Ask Your Question
0

Reduce frame resolution

asked 2020-11-27 12:00:05 -0600

Handa gravatar image

I have android studio app and I need to access the camera and do some real-time processing to the video frames. I have tried to use onCameraFrame() method, the problem is that the process I do to the frames is heavy, so I want to reduce the frame size to save some time. How can I do this inside the onCameraFrame() method? Or if anyone knows another solution that helps?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-11-27 12:25:17 -0600

berak gravatar image

what about this:

   Mat frame = ... // from onCameraFrame()
   Mat reduced = new Mat();
   Imgproc.resize(frame, reduced, new Size(320,240), 0, 0);
   // ... use "reduced" Mat for further processing
edit flag offensive delete link more

Comments

1

tips: use INTER_AREA for good results of severe downsampling. pyrDown(), is also an easy option.

crackwitz gravatar imagecrackwitz ( 2020-11-27 13:01:00 -0600 )edit

Is it supported in OpenCV 2.4.11?

Handa gravatar imageHanda ( 2020-11-27 14:30:22 -0600 )edit

DO NOT USE 2.xx, we're at 4.5 now.

(but yes, it is..)

berak gravatar imageberak ( 2020-11-27 15:18:26 -0600 )edit

Unfortunately that the functionality that I need exist in this old version. So I need to resize the frame within this version.

Handa gravatar imageHanda ( 2020-11-27 15:56:08 -0600 )edit

don't excpect any sympathy or help, as long as you try to use 2.x

berak gravatar imageberak ( 2020-11-27 16:15:11 -0600 )edit

yes image resizing exists in 2.4. you could check the docs for v2.4 if you are unsure. they are still on the web.

crackwitz gravatar imagecrackwitz ( 2020-11-27 21:19:25 -0600 )edit

or you could instead request a lower resolution picture from the system (android API)...

crackwitz gravatar imagecrackwitz ( 2020-11-27 21:20:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-27 12:00:05 -0600

Seen: 942 times

Last updated: Nov 27 '20