mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
made MaskPredicate safer (#419)
This commit is contained in:
parent
dfe4af9e1d
commit
354be115f2
@ -48,17 +48,16 @@ namespace cv
|
|||||||
/*
|
/*
|
||||||
* FeatureDetector
|
* FeatureDetector
|
||||||
*/
|
*/
|
||||||
struct MaskPredicate
|
class MaskPredicate
|
||||||
{
|
{
|
||||||
MaskPredicate( const Mat& _mask ) : mask(_mask)
|
public:
|
||||||
{}
|
MaskPredicate( const Mat& _mask ) : mask(_mask) {}
|
||||||
MaskPredicate& operator=(const MaskPredicate&) { return *this; }
|
|
||||||
bool operator() (const KeyPoint& key_pt) const
|
bool operator() (const KeyPoint& key_pt) const
|
||||||
{
|
{
|
||||||
return mask.at<uchar>( (int)(key_pt.pt.y + 0.5f), (int)(key_pt.pt.x + 0.5f) ) == 0;
|
return mask.at<uchar>( (int)(key_pt.pt.y + 0.5f), (int)(key_pt.pt.x + 0.5f) ) == 0;
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
const Mat& mask;
|
const Mat mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
FeatureDetector::~FeatureDetector()
|
FeatureDetector::~FeatureDetector()
|
||||||
|
Loading…
Reference in New Issue
Block a user