Camera preview freezed after switching camera

asked 2013-07-11 12:58:45 -0600

bllmica gravatar image

I am developing an Android application, and I use opencv libraries, in 2.4.5 version, for this purpose. I am basing my application on this tutorial, taken from the set of tutorials contained in the OpenCV4Android package.

In onCameraFrame, I take a mat obtained from a background processing, and I copy it on mRgba, before it is send to deliverAndDrawFrame, in this way:

return mRgba;

I have also implemented a method (called if a button is pressed) to switch camera. The method simply does:


The application works properly if I don't switch camera. Instead, if I press button to switch it, sometimes (not always) preview blocks, and it seems as freezed. This effect stops, if I remove the instruction of copy on mRgba from onCameraFrame.

It's really important for me that copy, so I cannot remove it.

How can I solve this problem, to switch every time camera without problems?

Any help would be really appreciated.

edit retag flag offensive close merge delete