How can I use the second argument of sift.detectAndCompute() ?

asked 2016-02-23 04:01:09 -0600

gafoor gravatar image

Hi, I'm using SIFT algorithm for comparing the features between two images. I'm curious to know about the second argument of sift.detectAndCompute() method. I'm using none in my script. I know the method's syntax cv2.SIFT.detectAndCompute(image, mask[, descriptors[, useProvidedKeypoints]]) → keypoints, descriptors¶ But I couldnot understand how can I use this "mask"?

A brief Explanation with an example is very helpful for me

edit retag flag offensive close merge delete

Comments

In orb ( and C++) you can use mask like this

Rect r(200,200,100,100);
Mat mask=Mat::zeros(512,512,CV_8UC1);
mask(r)=255;

and then you can call your detector with mask and it will give you sift only inside rect (not in all image) It works with ORB I don't know with SIFT

LBerger gravatar imageLBerger ( 2016-02-23 07:04:41 -0600 )edit