Ask Your Question

Freeze camera image, zoom into image, and move image around

asked 2013-01-06 05:10:11 -0500

jjbluesky gravatar image


I have an application built on the basis of the sample4mixed example from OpenCV4Android. What I want to do is: I want to "freeze" the camera input in the onCameraFrame() method. Then I want to zoom into the frozen picture (e.g. 4x) and drag the zoomed part around on the entire frozen picture.

But I have no idea so far how to do that. I don't know how to "freeze" the camera input. I know how to zoom into a video, so maybe that's the same with the picture then...but I have not a clue how to drag the picture around...if that makes sense. If not let me know and I try to explain it a little bit more.

P.S. The image should not be saved on SD card or anything.

Thanks :)!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-01-06 07:33:49 -0500

  1. What version of OpenCV4Android do you use? Different versions of samples in SDK uses different classes. Both of them allows you to stop preview from camera. For OpenCV 2.4.3 and newer use disableView()/enableView methods of NativeCameraView or JavaCameraView classes.

  2. There are warpAffine and warpPerspective functions, that makes image transformations, including rotation.

edit flag offensive delete link more


I'm using version 2.4.3. I don't know how to process the stopped camera image....if that's possible.

jjbluesky gravatar imagejjbluesky ( 2013-01-07 04:45:01 -0500 )edit

You can save Mat object from camera or copy Mat object data to other Mat using Mat.copyTo() method. After stopping camera view you need to show the result manually. Use Utils.matToBitmap function to convert OpenCV Mat object to Android bitmap, that can be drown on canvas by standard Android API. See deliverAndDrawFrame method of CameraBridgeViewBase class as an example of frame output on screen.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-01-08 05:44:08 -0500 )edit

Thanks, you gave me the push in the right direction :).

jjbluesky gravatar imagejjbluesky ( 2013-01-11 06:38:19 -0500 )edit

how do you zoom?please let me know. even i am making an app which requires zooming.please help

gj gravatar imagegj ( 2014-11-14 11:54:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-01-06 05:10:11 -0500

Seen: 1,427 times

Last updated: Jan 06 '13