Ask Your Question

carlos123alberto's profile - activity

2020-03-24 10:15:32 -0600 received badge  Popular Question (source)
2016-09-26 07:24:44 -0600 received badge  Supporter (source)
2016-08-17 06:13:56 -0600 received badge  Enthusiast
2016-08-10 11:12:52 -0600 commented question OpenCV multi-threading frames on Android

Yes. Reducing the resolution does help a lot, but I am already doing it, I am working with 640x360. But it is some heavy processing and I only have like 6fps and I should have at least 20fps for it to work great

2016-08-10 05:01:46 -0600 commented question OpenCV multi-threading frames on Android

Hi. Sorry but I didn't really understand what you meant by it.

2016-08-10 04:56:32 -0600 commented answer OpenCV multi-threading frames on Android

Is parallel for compatible with all architecture? I had the impression that it was compatible only with Intel processors, but I think I might be wrong. I need compatibility in the application. But anyway, my frame processing wouldn't be compatible with multiple threads in the same frame as it stores points of the frame and compares them in the loop.

I am currently think about editing Opencv functions to be compatible with multi threading, I am studying DeliverAndDrawFrame, it receives the frame from a thread, calls OnCameraFrame that is our natural callback to edit the frame and draws the frame, I am thinking of segmenting it in just deliver frame in a queue for multiple threads to catch it when ready and then a draw frame for when there is a processed frame do be draw

2016-08-06 21:41:27 -0600 asked a question OpenCV multi-threading frames on Android

I am doing some work with OpenCV on Android. My code was all on the Java interface and its performance was very bad, so I implemented almost all the image processing with JNI. So on Java I have:

@Override
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame)
{
    _imgBgrTemp = inputFrame.rgba();
    jniFrame(_imgBgrTemp.nativeObj);
    return _imgBgrTemp;
}

So jniFrame() function takes care of all the image processing in C++, and with this there was a good improvement in performance. But it is still around 8fps and my camera can do 30fps without any processing on the image.

Looking more close I saw that even while processing the code, it uses only 25% CPU of my Android, witch is a Zenfone 2 with a quad-core processor.

I am thinking about having it running in 4 threads so I would have o FIFO pool to receive frames, process, and display it in the received order.

I am thinking in use this: Creating a Manager for Multiple Threads

So my questions are:

I am going the right way ?

Do you have any tips ?

What should I consider (As I am working with JNI) ?

I didn't post the jniFrame() here because I don't think it is very relevant as it is a Work in progress code, very big. But it is about recognizing a rubik cube and getting its colors. if you also can give me any tips on that... but I may create another question only about this part later.

An update: I as just searching about using OpenCL, but it seeams even more complicated then multi-threading and I am not sure if the improvement would be good. would it be better then multi-threading ?