Search code examples
androidopencvcamera

How to take picture with openCV in android?


While searching on the internet, I found that proper way of doing this is using takePicture method of CameraBridgeViewBase . But that doesn't work, because CameraBridgeViewBase doesn't have takePicture method. So, what should I do?

P.S. This question has been asked before about 6 years ago (here). But there are problems in code and I don't feel like it is the correct way of doing this


Solution

  • with the latest (v.4.5.0) version the approach of extending org.opencv.android.JavaCameraView is still valid.

    OpenCV is not built to take pictures, this whole process is a workaround. It does not take a picture with OpenCV, it takes a picture side by side with OpenCV, without breaking it. There has been some discussion about switching from the old deprecated Camera API to the new camera2 API, but this seems to be irrelevant now: soon, a new, easier CameraX API will become production grade, and, hopefully, OpenCV will switch to this new API. Then, we will need a new way to take pictures without breaking OpenCV.