Using OpenCV in Service on Android OS

Question:

Good afternoon.

When developing a Service in Android OS using the OpenCV4Android library, it is required to process frames from the camera in background mode using the methods. Of all the advice, I found both about SurfaceView and about creating separate services, but I still did not understand how to adapt this business – I didn’t understand the devil.

And actually the questions:

  1. How to handle camera frames in the created Service?
  2. How to adapt it all for using OpenCV4Android.

PS I found answers to these questions here https://stackoverflow.com/questions/18811303/android-opencv-process-camera-frames-in-a-service

But I did not understand how this can be used, if anyone can explain, I will be grateful.

UPDATE I figured it out in the end, if someone has questions – write. It is enough to integrate the HardwareCamera class from the link into your service. While removing some unused methods and editing the code, it works well in the service and allows you to handle camera frames using OpenCV.

PS So I was able to get the camera to detect faces using a few examples from the internet.

Answer:

taken from the update of the question:

I figured it out in the end, if someone has questions – write. It is enough to integrate the HardwareCamera class from the link into your service. While removing some unused methods and editing the code, it works well in the service and allows you to handle camera frames using OpenCV .

PS So I was able to get the camera to detect faces using a few examples from the internet.

Scroll to Top