Ask Your Question

Rivale's profile - activity

2016-12-18 14:58:18 -0600 answered a question BebopVideoView to Mat

Hi, where you able to convert the frame to mat?

2016-12-18 14:56:09 -0600 asked a question Analyse image from a video/avc (h264) Android

Hi I want to analyse the frames from a streaming which is using a h264 encoding format.

this is the code I have to show each frame in a surfaceview inside the frame I have an array of byte which has the information of the next frame.

public void displayFrame(ARFrame frame) {
        mReadyLock.lock();



     if ((mMediaCodec != null)) {
            if (mIsCodecConfigured) {
                // Here we have either a good PFrame, or an IFrame
                int index = -1;

                try {
                    index = mMediaCodec.dequeueInputBuffer(VIDEO_DEQUEUE_TIMEOUT);
                } catch (IllegalStateException e) {
                    Log.e(TAG, "Error while dequeue input buffer");
                }
                if (index >= 0) {
                    ByteBuffer b;
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                        b = mMediaCodec.getInputBuffer(index);
                    } else {
                        b = mBuffers[index];
                        b.clear();
                    }

                    if (b != null) {

                        b.put(frame.getByteData(), 0, frame.getDataSize());
                    }

                    try {
                        mMediaCodec.queueInputBuffer(index, 0, frame.getDataSize(), 0, 0);
                    } catch (IllegalStateException e) {
                        Log.e(TAG, "Error while queue input buffer");
                    }
                }
            }

            // Try to display previous frame
            MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
            int outIndex;
            try {
                outIndex = mMediaCodec.dequeueOutputBuffer(info, 0);

                while (outIndex >= 0) {
                    mMediaCodec.releaseOutputBuffer(outIndex, true);
                    outIndex = mMediaCodec.dequeueOutputBuffer(info, 0);
                }
            } catch (IllegalStateException e) {
                Log.e(TAG, "Error while dequeue input buffer (outIndex)");
            }
        }


        mReadyLock.unlock();
    }

My doubt is, in which part of this code can I extract the image to make it compatible with openCV and create a Mat variable so I can analyse the image

Thanks in advance

2016-12-13 18:34:40 -0600 asked a question error in CascadeClassifier and HOGDescriptor

I am creating an application in android, and I am trying to do a face recognition using either CascadeClassifier or HOGDescriptor, but when I try to use the constructors of any of these classes, my app crashes

CascadeClassifier ccfs=new CascadeClassifier();
HOGDescriptor hog = new HOGDescriptor();

I get the following error:

12-13 23:55:43.029 31344-31344/com.i3rivale.droneapp E/OCVSample::Activity: Internal OpenCV library not found. Using OpenCV Manager for initialization
12-13 23:55:43.820 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]     from long org.opencv.objdetect.CascadeClassifier.CascadeClassifier_1()
12-13 23:55:43.821 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   native: #09 pc 000ba7e9  /data/app/org.opencv.engine-1/lib/arm/libopencv_java3.so (Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11+24)
12-13 23:55:43.821 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   native: #10 pc 00014f29  /data/data/com.i3rivale.droneapp/cache/slice-slice_1-classes.dex (Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11__+80)
12-13 23:55:43.821 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   at org.opencv.objdetect.CascadeClassifier.CascadeClassifier_1(Native method)
12-13 23:55:43.822 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   at org.opencv.objdetect.CascadeClassifier.<init>(CascadeClassifier.java:45)
12-13 23:55:43.822 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   at com.i3rivale.droneapp.OpenCVLib.onCameraFrame(OpenCVLib.java:129)
12-13 23:55:43.822 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:391)
12-13 23:55:43.822 31344-31492/com.i3rivale.droneapp A/art: art/runtime/check_jni.cc:65]   at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:350)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   native: #13 pc 000ba7e9  /data/app/org.opencv.engine-1/lib/arm/libopencv_java3.so (Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11+24)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   native: #14 pc 00014f29  /data/data/com.i3rivale.droneapp/cache/slice-slice_1-classes.dex (Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11__+80)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   at org.opencv.objdetect.CascadeClassifier.CascadeClassifier_1(Native method)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   at org.opencv.objdetect.CascadeClassifier.<init>(CascadeClassifier.java:45)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   at com.i3rivale.droneapp.OpenCVLib.onCameraFrame(OpenCVLib.java:129)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:391)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:350)
12-13 23:55:44.149 31344-31492/com.i3rivale.droneapp A/art: art/runtime/runtime.cc:284]   native: #02 pc 0013790b  /system/lib/libart.so (art::gc::Heap::DoPendingTransitionOrTrim()+686)
12-13 23:55:44 ...
(more)