degate  0.1.2
Functions
ViaMatching.cc File Reference
#include <ViaMatching.h>
#include <BoundingBox.h>
#include <MedianFilter.h>
#include <EdgeDetection.h>
#include <LogicModelHelper.h>
#include <boost/foreach.hpp>

Go to the source code of this file.

Functions

template<class BGImageType , class TemplateImageType >
double calc_xcorr (unsigned int start_x, unsigned int start_y, std::shared_ptr< BGImageType > bg_img, double f_avg, double sigma_f, std::shared_ptr< TemplateImageType > tmpl_img, double t_avg, double sigma_t)
bool compare_correlation (ViaMatching::match_found const &lhs, ViaMatching::match_found const &rhs)

Function Documentation

template<class BGImageType , class TemplateImageType >
double calc_xcorr ( unsigned int  start_x,
unsigned int  start_y,
std::shared_ptr< BGImageType >  bg_img,
double  f_avg,
double  sigma_f,
std::shared_ptr< TemplateImageType >  tmpl_img,
double  t_avg,
double  sigma_t 
)

Definition at line 173 of file ViaMatching.cc.

Referenced by degate::ViaMatching::scan().

                                                                                           {

  double sum = 0;
  double n = tmpl_img->get_width() * tmpl_img->get_height();

  for(unsigned int y = 0; y < tmpl_img->get_height(); y++) {
    for(unsigned int x = 0; x < tmpl_img->get_width(); x++) {
      double f_xy = bg_img->template get_pixel_as<double>(start_x + x, start_y + y);
      double t_xy = tmpl_img->template get_pixel_as<double>(x, y);
      
      sum += (f_xy - f_avg) * (t_xy - t_avg) / (sigma_f * sigma_t); // extract commons
    }
  }

  sum *= 1/(n - 1);


  return sum;
}

Here is the caller graph for this function:

Definition at line 196 of file ViaMatching.cc.

References degate::ViaMatching::match_found::correlation.

                                                            {
  return lhs.correlation > rhs.correlation;
}