changed border type to float

This commit is contained in:
Maria Dimashova 2011-01-31 16:45:12 +00:00
parent fd1f644e39
commit c562d79121

View File

@ -54,14 +54,16 @@ namespace cv
*/
struct RoiPredicate
{
RoiPredicate(float _minX, float _minY, float _maxX, float _maxY)
RoiPredicate( float _minX, float _minY, float _maxX, float _maxY )
: minX(_minX), minY(_minY), maxX(_maxX), maxY(_maxY)
{}
bool operator()( const KeyPoint& keyPt) const
bool operator()( const KeyPoint& keyPt ) const
{
Point2f pt = keyPt.pt;
return (pt.x < minX) || (pt.x >= maxX) || (pt.y < minY) || (pt.y >= maxY);
float eps = std::numeric_limits<float>::epsilon();
return (pt.x < minX + eps) || (pt.x >= maxX - eps) ||
(pt.y < minY + eps) || (pt.y >= maxY - eps);
}
float minX, minY, maxX, maxY;
@ -102,14 +104,14 @@ bool DescriptorExtractor::empty() const
}
void DescriptorExtractor::removeBorderKeypoints( vector<KeyPoint>& keypoints,
Size imageSize, int borderSize )
Size imageSize, float borderSize )
{
if( borderSize > 0)
{
keypoints.erase( remove_if(keypoints.begin(), keypoints.end(),
RoiPredicate((float)borderSize, (float)borderSize,
(float)(imageSize.width - borderSize),
(float)(imageSize.height - borderSize))),
RoiPredicate(borderSize, borderSize,
(float)imageSize.width - borderSize,
(float)imageSize.height - borderSize)),
keypoints.end() );
}
}