First time here? Check out the FAQ!

Ask Your Question
3

Create a mask with a roi

asked Jun 10 '13

yes123 gravatar image

I have an image

Mat image; //(size: 300x300)

And I have a roi:

Rect ROI(50,50,100,100);  //(start from 50,50 and has size 100x100)

I would like to create a mask so keypoints inside of this roi don't get extracted.

//> create mask with 0s inside the ROI and 1s outside
OrbFeatureDetector.detect(image,kps,mask);

Which would be a good way to create this mask?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
4

answered Jun 10 '13

Vladislav Vinogradov gravatar image
Mat mask(image.size(), CV_8UC1, Scalar::all(0));
mask(ROI).setTo(Scalar::all(255));
Preview: (hide)

Comments

thanks! i was getting confused because i was trying to adapt what gridadapted does with Range. but clearly in this case your solution is much better

yes123 gravatar imageyes123 (Jun 10 '13)edit

Question Tools

Stats

Asked: Jun 10 '13

Seen: 13,945 times

Last updated: Jun 10 '13