1

I have already detected and computed SIFT keypoints and descriptors in an image (which I need for a different purpose) with OpenCV (4.3.0-dev).

Mat descriptors;
vector<KeyPoint> keypoints;
sift->detectAndCompute(image, Mat(), keypoints, descriptors);

Now I want to get keypoints and descriptors for a rectangular patch of this same image (from the previously extracted keypoints and descriptors) and do so without having to run the costly detectAndCompute() again. The only solutions I can come up with are masking and region of interest extraction, both of which require detectAndCompute() to be run again. How can this be done?

muscleman
  • 11
  • 2
  • so from your already computed keypoints you want to identify all which are in some roi? Or do you want different keypoints (e.g. different sift parameters)? – Micka May 16 '20 at 15:43
  • @Micka the former. I was hoping this would be evident enough from my question. – muscleman May 16 '20 at 15:48
  • https://stackoverflow.com/questions/33065834/how-to-detect-if-a-point-is-contained-within-a-bounding-rect-opecv-python – Micka May 16 '20 at 21:40
  • @Micka I do have an idea of how I could get the relevant key points. But then I need to `compute()` the descriptors which is quite costly as well. I was hoping that there is a way to take a part of the already computed descriptors but how to do that is not apparent to me. – muscleman May 17 '20 at 09:37
  • you do have a list with all already computed keypoints and descriptors. Just add the wanted ones to a new empty list. – Micka May 17 '20 at 10:27

0 Answers0