Ask Your Question

MatOfPoint image transportation

asked 2017-03-16 04:18:35 -0500

khrizt gravatar image


I'm developing a document scanner using OpenCV and I succesfully detected and drawed the contour on the preview of the JavaCameraView, now I want to take a picture and use the detected points to extract that part of the image from the newly taken image. That image taken by the camera is bigger than the preview, is there a way to use the same MatOfPoint in the new image "transporting" (I don't know if it's the right word) the points?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-16 08:36:19 -0500

berak gravatar image

updated 2017-03-16 08:36:59 -0500

"scaling" or "transforming" might be the better word ..

no java here, so no idea if it will work, but , ifyour new image is by 1.2 larger in x, and by 1.4 in y direction, you could try:

MatOfPoints contour = ... //(from findContours, i guess)
MatOfPoints scaled = new MatOfPoints();
Core.multiply( contour, new Scalar(1.2, 1.4), scaled );
edit flag offensive delete link more


Wow, I didn't know this method. Yep, that works, thanks a lot!!

khrizt gravatar imagekhrizt ( 2017-03-16 12:09:47 -0500 )edit

Question Tools

1 follower


Asked: 2017-03-16 04:18:35 -0500

Seen: 240 times

Last updated: Mar 16 '17