Ask Your Question
2

Create a mask with a roi

asked 2013-06-10 04:53:32 -0500

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-06-10 05:05:01 -0500

Vladislav Vinogradov gravatar image
Mat mask(image.size(), CV_8UC1, Scalar::all(0));
mask(ROI).setTo(Scalar::all(255));
edit flag offensive delete link more

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 ( 2013-06-10 07:02:37 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-06-10 04:53:32 -0500

Seen: 10,187 times

Last updated: Jun 10 '13