Commit 948d9664 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

change at<double> => at<float>, since the histogram is cv_32f, not cv_64f

parent 25919884
...@@ -62,7 +62,7 @@ void drawCircles(Mat& img, const vector<Point2f>& corners, const vector<float>& ...@@ -62,7 +62,7 @@ void drawCircles(Mat& img, const vector<Point2f>& corners, const vector<float>&
} }
} }
int histQuantile(const MatND& hist, float quantile) int histQuantile(const Mat& hist, float quantile)
{ {
if(hist.dims > 1) return -1; // works for 1D histograms only if(hist.dims > 1) return -1; // works for 1D histograms only
...@@ -71,7 +71,7 @@ int histQuantile(const MatND& hist, float quantile) ...@@ -71,7 +71,7 @@ int histQuantile(const MatND& hist, float quantile)
float quantile_sum = total_sum*quantile; float quantile_sum = total_sum*quantile;
for(int j = 0; j < hist.size[0]; j++) for(int j = 0; j < hist.size[0]; j++)
{ {
cur_sum += (float)hist.at<double>(j); cur_sum += (float)hist.at<float>(j);
if(cur_sum > quantile_sum) if(cur_sum > quantile_sum)
{ {
return j; return j;
...@@ -173,7 +173,7 @@ void findCorner(const vector<Point2f>& contour, Point2f point, Point2f& corner) ...@@ -173,7 +173,7 @@ void findCorner(const vector<Point2f>& contour, Point2f point, Point2f& corner)
return; return;
} }
int segment_hist_max(const MatND& hist, int& low_thresh, int& high_thresh) int segment_hist_max(const Mat& hist, int& low_thresh, int& high_thresh)
{ {
Mat bw; Mat bw;
//const double max_bell_width = 20; // we expect two bells with width bounded above //const double max_bell_width = 20; // we expect two bells with width bounded above
...@@ -194,7 +194,7 @@ int segment_hist_max(const MatND& hist, int& low_thresh, int& high_thresh) ...@@ -194,7 +194,7 @@ int segment_hist_max(const MatND& hist, int& low_thresh, int& high_thresh)
const double out_of_bells_fraction = 0.1; const double out_of_bells_fraction = 0.1;
for(int x = 0; x < hist.size[0]; x++) for(int x = 0; x < hist.size[0]; x++)
{ {
quantile_sum += hist.at<double>(x); quantile_sum += hist.at<float>(x);
if(quantile_sum < 0.2*total_sum) continue; if(quantile_sum < 0.2*total_sum) continue;
if(quantile_sum - low_sum > out_of_bells_fraction*total_sum) if(quantile_sum - low_sum > out_of_bells_fraction*total_sum)
...@@ -228,7 +228,7 @@ bool find4QuadCornerSubpix(const Mat& img, std::vector<Point2f>& corners, Size r ...@@ -228,7 +228,7 @@ bool find4QuadCornerSubpix(const Mat& img, std::vector<Point2f>& corners, Size r
const int nbins = 256; const int nbins = 256;
float ranges[] = {0, 256}; float ranges[] = {0, 256};
const float* _ranges = ranges; const float* _ranges = ranges;
MatND hist; Mat hist;
#if defined(_SUBPIX_VERBOSE) #if defined(_SUBPIX_VERBOSE)
vector<float> radius; vector<float> radius;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment