fixed cascade detection on images of size equal to feature size (#1070)
This commit is contained in:
parent
883b87c04f
commit
eace415f57
@ -649,8 +649,8 @@ bool HaarEvaluator::setImage( const Mat &image, Size _origWinSize )
|
||||
bool HaarEvaluator::setWindow( Point pt )
|
||||
{
|
||||
if( pt.x < 0 || pt.y < 0 ||
|
||||
pt.x + origWinSize.width >= sum.cols-2 ||
|
||||
pt.y + origWinSize.height >= sum.rows-2 )
|
||||
pt.x + origWinSize.width >= sum.cols ||
|
||||
pt.y + origWinSize.height >= sum.rows )
|
||||
return false;
|
||||
|
||||
size_t pOffset = pt.y * (sum.step/sizeof(int)) + pt.x;
|
||||
@ -812,8 +812,8 @@ bool LBPEvaluator::setImage( const Mat& image, Size _origWinSize )
|
||||
bool LBPEvaluator::setWindow( Point pt )
|
||||
{
|
||||
if( pt.x < 0 || pt.y < 0 ||
|
||||
pt.x + origWinSize.width >= sum.cols-2 ||
|
||||
pt.y + origWinSize.height >= sum.rows-2 )
|
||||
pt.x + origWinSize.width >= sum.cols ||
|
||||
pt.y + origWinSize.height >= sum.rows )
|
||||
return false;
|
||||
offset = pt.y * ((int)sum.step/sizeof(int)) + pt.x;
|
||||
return true;
|
||||
@ -1203,7 +1203,7 @@ void CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& object
|
||||
|
||||
Size windowSize( cvRound(originalWindowSize.width*factor), cvRound(originalWindowSize.height*factor) );
|
||||
Size scaledImageSize( cvRound( grayImage.cols/factor ), cvRound( grayImage.rows/factor ) );
|
||||
Size processingRectSize( scaledImageSize.width - originalWindowSize.width, scaledImageSize.height - originalWindowSize.height );
|
||||
Size processingRectSize( scaledImageSize.width - originalWindowSize.width + 1, scaledImageSize.height - originalWindowSize.height + 1 );
|
||||
|
||||
if( processingRectSize.width <= 0 || processingRectSize.height <= 0 )
|
||||
break;
|
||||
|
@ -673,8 +673,8 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
|
||||
"Use cvSetImagesForHaarClassifierCascade" );
|
||||
|
||||
if( pt.x < 0 || pt.y < 0 ||
|
||||
pt.x + _cascade->real_window_size.width >= cascade->sum.width-2 ||
|
||||
pt.y + _cascade->real_window_size.height >= cascade->sum.height-2 )
|
||||
pt.x + _cascade->real_window_size.width >= cascade->sum.width ||
|
||||
pt.y + _cascade->real_window_size.height >= cascade->sum.height )
|
||||
return -1;
|
||||
|
||||
p_offset = pt.y * (cascade->sum.step/sizeof(sumtype)) + pt.x;
|
||||
@ -1095,7 +1095,7 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
|
||||
CvSize winSize = { cvRound(winSize0.width*factor),
|
||||
cvRound(winSize0.height*factor) };
|
||||
CvSize sz = { cvRound( img->cols/factor ), cvRound( img->rows/factor ) };
|
||||
CvSize sz1 = { sz.width - winSize0.width, sz.height - winSize0.height };
|
||||
CvSize sz1 = { sz.width - winSize0.width + 1, sz.height - winSize0.height + 1 };
|
||||
|
||||
CvRect equRect = { icv_object_win_border, icv_object_win_border,
|
||||
winSize0.width - icv_object_win_border*2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user