doubt about ROIs in android

asked 2014-08-21 13:32:37 -0600

borjaevo gravatar image

HI,

I have a doubt about how ROIs work on java. My way to create a ROI of an image is this:

Rect r1 = new Rect(x,y,sizex,sizey);
Mat roi1 = new Mat(A,r1);

where A is the source image. If i modify roi1 i also modify A? I want to do this to modify a concrete area of A but i do not get. What i'm doing wrong?

edit retag flag offensive close merge delete

Comments

yes, you modify the original image. a ROI does not make a copy of the pixels in opencv (no matter what language)

try: Mat roi_copy = new Mat(A,r1).clone(); , again, i'm not sure, what you wanted, please report back.

berak gravatar imageberak ( 2014-08-21 14:40:09 -0600 )edit

And this is a good way to create a ROI or is necessary to use submat?

borjaevo gravatar imageborjaevo ( 2014-08-21 14:42:51 -0600 )edit

both are equivalent. same output, same problem.

berak gravatar imageberak ( 2014-08-21 14:47:44 -0600 )edit

Thank you!

borjaevo gravatar imageborjaevo ( 2014-08-21 16:27:34 -0600 )edit