Ask Your Question

Vion's profile - activity

2019-04-05 01:27:29 -0500 received badge  Notable Question (source)
2018-05-25 08:15:30 -0500 received badge  Popular Question (source)
2017-12-06 06:10:36 -0500 received badge  Popular Question (source)
2014-07-25 04:50:22 -0500 received badge  Supporter (source)
2014-07-12 09:52:50 -0500 answered a question Opencv4Android sdk missing jar

What for a .jar file you mean? Android Libraries do not work as usual java libraries. So you can not just compile them to a .jar and add them as dependency. Instead you have to load the complete Project into your webspace and then reference the project as an Android Library (Android Library Project). You can find more informatio on that using this article (see point 5.7) click

2014-07-12 09:16:17 -0500 asked a question OpenCV: Find original coordinates of a rotated point

I have the following problem. I'm searching for eyes within an image using HaarClassifiers. Due to the rotation of the head I'm trying to find eyes within different angles. For that, I rotate the image by different angles. For rotating the frame, I use the code (written in C++):

Point2i rotCenter;
rotCenter.x = scaledFrame.cols / 2;
rotCenter.y = scaledFrame.rows / 2;

Mat rotationMatrix = getRotationMatrix2D(rotCenter, angle, 1);

warpAffine(scaledFrame, scaledFrame, rotationMatrix, Size(scaledFrame.cols, scaledFrame.rows));

This works fine and I am able to extract two ROI Rectangles for the eyes. So, I have the top/left coordinates of each ROI as well as their width and height. However, these coordinates are the coordinates in the rotated image. I don't know how I can backproject this rectangle onto the original frame.

Assuming I have the obtaind eye pair rois for the unscaled frame (full_image), but still roated.

eye0_roi and eye1_roi

How can I rotate them back, such that they map their correct position?

Best regards, Andre

2014-06-13 01:52:26 -0500 asked a question Process video frame by frame in OpenCV on Android

Hey all,

my goal is as follows: I have to read in a video that is stored on the sd card, process it frame for frame and then store it in a new file on the SD card again. The problem is that OpenCV4Android does not come with an video encoder/decoder as it does not include ffmpeg. Moreover, using JavaCV for processing the image is no option for me, as the code is already written in native OpenCV and I access them through the JNI. I did a lot of reading here on stackoverflow and the rest of google. But I did not find the solution.

1) JavaCV allows me to read a video frame by frame and also store it frame by frame. However, I am not able to convert the video to plain OpenCV Mat objects which can be processed by usual OpenCV4Android.

2) I read about JCodec as a library for encoding/decoding videos. Would JCodec allow me to fulfill my task? If yes, do you know any examples.

3) Compiling FFMPEG for Android would also be an option. However, I think it is a bit overkill to write FrameGrabber and FrameRecorder my self. I think that there must exist some solution besides the one of JavaCV.

4) Starting with API 18 there are the MediaCodec and the MediaMuxer in Android. Perhaps they can help me?

So lets come to my requirements. So I'm currently targeting Android API 19, so I have every function available which I need. The most important requirement for me is the following:

If I process a video of 10 seconds with 30 FPS, the result should also be a video of 10 seconds with 30 FPS. So I want an exact copy of the video but with some drawing added to each frame by OpenCV. Using OpenCV via Python for example can do this task by using the VideoWriter class and VideoInput class. I need the same functionality on Android.

I am wondering that no one had this problem so far (or I did not find it).

Hopefully, I explained everything.

Best regards, André

2014-04-17 23:50:34 -0500 received badge  Student (source)
2014-04-17 13:33:41 -0500 asked a question Android: Preview Size vs Frame Size

Hello everyone,

I'm new to OpenCV but I'm a very experienced Android Developer. Currently, I have the following goal: I want to process the live video stream of my camera using OpenCV. So far I have set up a JavaCameraView, set up the NDK methods for processing the image and get the result. This works fine.

But now I want the following: The user should not be distracted by the VideoStream that is captured of him (don't worry, the user knows that the stream is captured, but he should not see it while it is captured). So in general - I do not want a preview (however, I really need real-time tracking).

As you always need a Preview in Android to capture Videoframes, I implemented the standard workaround. I created a 1x1px surfaceview on which the preview is displayed.

And here, I have the problem. While reducing the surfaceview size, I discovered that the frame resolution of the camera for the preview frames was also reduced. This makes sense for the preview, but it does not make sense for the processing of the image.

Thus, I have the following question:

Is it possible to show a low resolution image on the surface view but process a high resoltution image? If yes, how?

Best regards, Vion