contrib/mul/mipa/mipa_sample_histo_boxes.h
Go to the documentation of this file.
00001 #ifndef mipa_sample_histo_boxes_h_
00002 #define mipa_sample_histo_boxes_h_
00003 
00004 //:
00005 // \file
00006 // \brief Functions to sample blocks of histograms
00007 // \author Tim Cootes
00008 
00009 #include <vil/vil_image_view.h>
00010 #include <vnl/vnl_vector.h>
00011 
00012 //: Extract data from an image of histograms over nested boxes
00013 //  Assume h_im(i,j,A) gives frequency stored in angle bin A
00014 //  for (i,j)th histogram, organised so that h_im.planestep()=1
00015 //  This copies the individual histograms from a rectangular
00016 //  region of the image with corner (i0,j0).
00017 //
00018 //  It samples a grid of 2ni x 2nj histos, 
00019 //  ie h_im([i0,i0+2ni),[j0,j0+2nj)).
00020 //
00021 //  The first 4*nA*ni*nj elements of v are copies of the
00022 //  histograms.  The next nA*ni*nj elements are a set of
00023 //  pooled histograms, adding the 4 histos in each 2 x 2 block.
00024 //  The final nA elements give a total histogram, adding 
00025 //  all the histograms in the region together.
00026 template<class srcT, class vT>
00027 void mipa_sample_histo_boxes_3L(const vil_image_view<srcT>& h_im,
00028                              unsigned i0, unsigned j0,
00029                              vnl_vector<vT>& vec,
00030                              unsigned ni, unsigned nj);
00031 
00032 //: Performs inverse transform mapping from the sample vector back to a hist image
00033 // Note only the first 4*nA*ni*nj elements of v are accessed
00034 template<class srcT, class vT>
00035 void mipa_sample_histo_boxes_3L_inv(vil_image_view<srcT>& h_im,
00036                                     unsigned i0, unsigned j0,
00037                                     const vnl_vector<vT>& vec,
00038                                     unsigned ni, unsigned nj);
00039 
00040 #endif // mipa_sample_histo_boxes_h_