mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
added range check in the keypoint interpolation in SURF algorithm (ticket #497)
This commit is contained in:
parent
08e9d85582
commit
e20994d41c
@ -197,16 +197,16 @@ icvInterpolateKeypoint( float N9[3][9], int dx, int dy, int ds, CvSURFPoint *poi
|
||||
solve_ok = cvSolve( &matA, &_b, &_x );
|
||||
if( solve_ok )
|
||||
{
|
||||
point->pt.x += x[0]*dx;
|
||||
point->pt.y += x[1]*dy;
|
||||
// TBD quick fix to be reviewed
|
||||
if(x[2]*ds/point->size > 10)
|
||||
{
|
||||
//printf("Replacing point size %d with %f\n", point->size, x[2]*ds);
|
||||
|
||||
}
|
||||
if (x[0] > 1 || x[0] <-1 || x[1] > 1 || x[1] <-1 || x[2] > 1 || x[2] <-1 )
|
||||
solve_ok = 0;
|
||||
else
|
||||
{
|
||||
point->pt.x += x[0]*dx;
|
||||
point->pt.y += x[1]*dy;
|
||||
point->size = cvRound( point->size + x[2]*ds );
|
||||
|
||||
// TBD quick fix to be reviewed
|
||||
if(x[2]*ds/point->size <= 10)
|
||||
point->size = cvRound( point->size + x[2]*ds );
|
||||
}
|
||||
}
|
||||
@ -366,9 +366,7 @@ static CvSeq* icvFastHessianDetector( const CvMat* sum, const CvMat* mask_sum,
|
||||
int interp_ok = icvInterpolateKeypoint( N9, sampleStep, sampleStep, ds, &point );
|
||||
|
||||
/* Sometimes the interpolation step gives a negative size etc. */
|
||||
if( interp_ok && point.size >= 1 &&
|
||||
point.pt.x >= 0 && point.pt.x <= (sum->cols-1) &&
|
||||
point.pt.y >= 0 && point.pt.y <= (sum->rows-1) )
|
||||
if( interp_ok )
|
||||
{
|
||||
/*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/
|
||||
cvSeqPush( points, &point );
|
||||
|
Loading…
Reference in New Issue
Block a user