Ask Your Question

insert a frame to mat , instead of coloring the whole Mat

asked 2015-11-06 18:34:10 -0500

215 gravatar image

I know that to retrieve a ROI from the image you would usually do something like

Mat image(Rect(x,y,sx,sy))

And to color at the rectangle you would just

Mat image(Rect(x,y,sx,sy)) = 255

But if only want to create a frame with that pixelvalue such that some of the center elements isn't touched.. what shall i do?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-07 02:16:09 -0500

LBerger gravatar image

May be like this using mask and function setTo :

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

imshow("mask ",im);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-11-06 18:34:10 -0500

Seen: 599 times

Last updated: Nov 07 '15