~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to extern/libmv/libmv/tracking/brute_region_tracker.cc

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-04-28 12:11:12 UTC
  • mto: (14.1.6 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20120428121112-2zi0vp8b6vejda8i
Tags: upstream-2.63
ImportĀ upstreamĀ versionĀ 2.63

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
#include "libmv/image/image.h"
46
46
#include "libmv/image/convolve.h"
 
47
#include "libmv/image/correlation.h"
47
48
#include "libmv/image/sample.h"
48
49
#include "libmv/logging/logging.h"
49
50
 
332
333
  if (best_sad != INT_MAX) {
333
334
    *x2 = best_j + half_window_size;
334
335
    *y2 = best_i + half_window_size;
 
336
 
 
337
    if (minimum_correlation > 0) {
 
338
      Array3Df image_and_gradient1_sampled, image_and_gradient2_sampled;
 
339
 
 
340
      SamplePattern(image_and_gradient1, x1, y1, half_window_size, 3,
 
341
                    &image_and_gradient1_sampled);
 
342
      SamplePattern(image_and_gradient2, *x2, *y2, half_window_size, 3,
 
343
                    &image_and_gradient2_sampled);
 
344
 
 
345
      // Compute the Pearson product-moment correlation coefficient to check
 
346
      // for sanity.
 
347
      double correlation = PearsonProductMomentCorrelation(image_and_gradient1_sampled,
 
348
                                                           image_and_gradient2_sampled,
 
349
                                                           pattern_width);
 
350
      LG << "Final correlation: " << correlation;
 
351
 
 
352
      if (correlation < minimum_correlation) {
 
353
        LG << "Correlation " << correlation << " greater than "
 
354
           << minimum_correlation << "; bailing.";
 
355
        return false;
 
356
      }
 
357
    }
 
358
 
335
359
    return true;
336
360
  }
337
361
  return false;