简体   繁体   中英

Access Android Camera Frames with no Preview

I want to do image processing on frames from Android Camera in real time with OpenCv, but all the OpenCv Android examples provide a preview of the image being captured. I really don't need previews of the frames , is there any way to get the frames without actually showing the preview ?

一种快速/幼稚的方法是使onCameraFrame方法返回null并将您的CameraBridgeViewBase可见性设置为SurfaceView.INVISIBLESurfaceView.GONE

I still would like to know if it worked for you, but meanwhile I found the solution that worked for me. As I feel grateful for the guy who wrote it, I'm sharing this (scroll down to answers section) with anyone who will have same problem in future.

In case the link vanished, here's his/her pro-tip:

You can set your preview (in this case a CameraBridgeViewBase ) transparent by setting the alpha value of the view, with 0 being completely invisible.

mOpenCvCameraView.setAlpha(0);

This should make your preview "disappear".


I wonder how your solution works, because as you can read in the docs :

This method is invoked when delivery of the frame needs to be done. The returned values - is a modified frame which needs to be displayed on the screen.

Indeed, in my case it doesn't work but I desperately need such a functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM