]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed possible crash in goodFeaturesToTrack (ticket #171). Thanks to bwieloch for...
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 15 Mar 2010 12:14:50 +0000 (12:14 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 15 Mar 2010 12:14:50 +0000 (12:14 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2814 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/src/cv/cvfeatureselect.cpp

index e1da99259e134fb216441a4672a7feb25fe33744..90d540c7bd3d3ec6d8fad0064ff70d35f3b06993 100644 (file)
@@ -101,10 +101,10 @@ void goodFeaturesToTrack( const Mat& image, vector<Point2f>& corners,
         int h = image.rows;
 
         const int cell_size = cvRound(minDistance);
-        const int grid_width = cvRound(w / cell_size); // round up
-        const int grid_height = cvRound(h / cell_size); // round up
+        const int grid_width = (w + cell_size - 1) / cell_size;
+        const int grid_height = (h + cell_size - 1) / cell_size;
 
-        std::vector <  std::vector <Point2f> > grid(grid_width*grid_height);
+        std::vector<std::vector<Point2f> > grid(grid_width*grid_height);
 
         minDistance *= minDistance;