I'm approaching a task of Bio Informatics, and need to extract some features from some cell images.
I used SIFT algorithm to extract Key Points inside of the image, as you can see in the picture.
As you can also see in the picture (circled in red), some key points are outliers and I don't want to calculate any feature on them.
I obtained the cv::KeyPoint
vector with the following code:
const cv::Mat input = cv::imread("/tmp/image.jpg", 0); //Load as grayscale
cv::SiftFeatureDetector detector;
std::vector<cv::KeyPoint> keypoints;
detector.detect(input, keypoints);
but I would like to discard from the vector
all those key points that, say for example, have less than 3 key points inside of a certain region of interest (ROI) centred on them in the image.
Therefore I need to implement a function returning the number of key points inside of a certain ROI given as input:
int function_returning_number_of_key_points_in_ROI( cv::KeyPoint, ROI );
//I have not specified ROI on purpose...check question 3
I have three questions:
- Is there any existing function doing something similar?
- If not can you give me some help in understanding how to implement it by myself?
- Would you use a circular, or rectangular ROI for this task?And how would you specify it in input?
Note:
I forgot to specify that I would like an efficient implementation for the function, i.e. checking for each key point the relative position of all others with respect to it would not be a good solution (if there exists another way of doing).