Ask Your Question

Oscanto's profile - activity

2020-10-28 01:25:54 -0500 received badge  Nice Question (source)
2016-04-07 05:52:36 -0500 received badge  Famous Question (source)
2015-09-19 12:22:16 -0500 received badge  Famous Question (source)
2015-06-09 15:00:29 -0500 received badge  Notable Question (source)
2015-05-05 13:43:59 -0500 received badge  Nice Question (source)
2015-04-01 15:25:21 -0500 received badge  Popular Question (source)
2015-03-25 03:50:00 -0500 received badge  Taxonomist
2015-01-18 14:53:35 -0500 received badge  Notable Question (source)
2014-09-04 04:32:30 -0500 received badge  Teacher (source)
2014-09-02 15:49:59 -0500 commented answer Include multiple objects in one contour

Can't you just use contour instead of Mat(contour) in convexHull ? i.e. convexHull(contour, hull, false) Can you also check that the error is not coming from the instruction "Mat(contour)"

2014-09-02 15:34:44 -0500 commented answer Include multiple objects in one contour

Can you provide more information ? When exactly are you issuing this error? When calling the push_back() function ?

2014-09-02 15:25:09 -0500 commented question OpenCV troubles with convexHull

But convex hull shouldn't need a valid contour, just a point set.

2014-09-02 13:45:23 -0500 commented answer Include multiple objects in one contour

Just insert every points of one contour into the other one.

2014-09-02 02:30:15 -0500 answered a question Include multiple objects in one contour

Did you try using convexHull()?

It finds the convex hull of a point set, I guess if you can "union" the contours (which are vector of points) that are close enough, and then apply this function, it can do the job.

2014-08-30 03:52:19 -0500 answered a question Is it possible to use OpenCV in Android- and IPhone-App without rooting/jailbreaking the device?

You can use OpenCV in android without any rooting. I don't know about Iphone though, but I guess you don't need to jailbreak it neither....

2014-08-29 08:06:13 -0500 commented question Weird bug with VideoCapture

Thanks for your answer, for the first point, I only have 2 ids for this simple example, but I may have a lot more cameras in my real program. The second point solved my problem, I don't know why, but I was creating a new object each time I was changing the source device, but using the function "open()" solved my problem (as it calls release)

Thank you!

2014-08-29 07:15:49 -0500 asked a question Weird bug with VideoCapture

Hello everybody,

I'm facing a very weird bug when using VideoCapture.

I have two webcams, and I want to switch between them.

When the program is started, it opens device 0. When the user presses 'd', he gets connected to 'current_device+1'. When he presses 'q', he gets connected to 'current_device-1'

I can switch between 0 and 1 very well, and multiple times without any problem, however, when I try to connect to device 2, it detects a problem (I only have 2 cams), and then connects back to 1. No problem until here, however, when I press 'q', it tries to connect to device 0, and here is the problem, it can connect, but the operator "<<" is very slow (1 second I think), and it always returns empty Mat....

Here is the code (very simple reproduction of the problem (most of the lines are just to print stuff on the console)):

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, char** argv ) {
    VideoCapture vc(0);

    int i = 0;
    char key('0');
    Mat frame;

    while (key != 'a') {
        key = waitKey(10);
        vc >> frame;

        if (frame.empty()) {
            std::cerr << "WTF, frame is empty." << std::endl;
        } else {
            imshow("TestW", frame);

        if (key == 'd') {
            std::cerr << "Trying to open " << i << "...";
            vc = VideoCapture(i);
            if (vc.isOpened()) {
                std::cerr << " done." << std::endl << std::endl;
            } else {
                std::cerr << "But is not working, trying to open " << i << "...";
                vc = VideoCapture(i);
                if (vc.isOpened()) {
                    std::cerr << "And is working" << std::endl << std::endl;
                } else {
                    std::cerr << "Let's stop here." << std::endl;

        } else if (key == 'q') {
            std::cerr << "Trying to open " << i << "..." << std::endl;
            vc = VideoCapture(i);
            if (vc.isOpened()) {
                std::cerr << "done" << std::endl << std::endl;
            } else {
                std::cerr << "Let's stop here." << std::endl;

And here is an output with this code:

At the beginning, I just switch between 0 and 1:

Trying to open 1... done.

Trying to open 0...


Trying to open 1... done.

Trying to open 0...


Trying to open 1... done.

I then press 'd' when I'm connected to device 1 (so it connects to device 2, and goes back to device 1):

Trying to open 2...But is not working, trying to open 1...And is working

And 'q' when I'm connected to device 1, the connection seems okay, but it's very slow and the frames are empty:

Trying to open 0... done WTF, frame is empty. WTF, frame is empty. WTF, frame is empty. WTF, frame is empty. WTF, frame is empty.

However I can still go back to device 1 without any problem! But device 0 seems to be broken after having connected to device 2....

Do you have any suggestion? I'm working on Windows 7 64 bits

2014-08-23 06:20:36 -0500 asked a question Cannot compile OpenCV 3.0


I downloaded OpenCV 3.0 from this website, and after the cmake step, I obtain an an error during the make step, here it is:

Linking CXX shared library ....\bin\libopencv_core300.dll c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lRunTmChk collect2.exe: error: ld returned 1 exit status modules\core\CMakeFiles\opencv_core.dir\build.make:1257: recipe for target 'bin/libopencv_core300.dll' failed mingw32-make[2]: * [bin/libopencv_core300.dll] Error 1 CMakeFiles\Makefile2:1325: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed mingw32-make[1]: [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 Makefile:136: recipe for target 'all' failed mingw32-make: ** [all] Error 2

I'm under Windows7 64bits, and using mingw32 4.8.1

I have no idea of what is -lRunTmChk, so any help would be greatful...

Also, I have to add that I can compile OpenCV 2.4.9 without any problem.

Any suggestion?

2014-08-01 09:20:32 -0500 asked a question HIGHGUI ERROR when opening webcam

Hello, I have a problem opening my webcam with openCV

This line of code cv::VideoCapture _capture = cv::VideoCapture(0);

Create an error in the console: HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP

Do you have any suggestion?

I'm using Xubuntu 32b, I also compiled opencv myself.

Thank you!

2014-07-22 03:08:31 -0500 commented question opencv and qt

Ok thank you, but even though there is a particular path to FFMPEG in the pro file, I don't have to download and compile it? Thanks for your help, I will try that

2014-07-22 02:42:05 -0500 asked a question opencv and qt

Hello, I'm having trouble compiling opencv with mingw32. I have a project which needs opencv, qt, and ffmpeg.

In the .pro file, I have these lines:

win32 {
        "C:\opencv\include" \
    LIBS += \
        -L"C:\opencv\lib" \

I will work on qtcreator, and to compile opencv, I use CMAKE and mingw32.

My question is, do I need to tick WITH_QT and WITH_FFMPEG? QT is already installed, and will be found by qtcreator, so I don't need it with opencv, am I right?

And same question for FFMPEG, as there is a different path for FFMPEG, I will download FFMPEG, and compile it myself, so I think I don't need to tick WITH_FFMPEG....

I'm new to this kind of stuff, and I have to admit that I'm a bit lost....

Thanks for your help, Florian

2014-03-04 10:33:31 -0500 received badge  Popular Question (source)
2012-11-14 03:26:41 -0500 commented answer How to get the best detection for an object

Thanks, it could work of course, but performance will be a pain... I've simplified my problem, but i'm building a real-time application on Android, so it's not really possible to do that... I'm going to look around the grouping function, because I can get every rectangle by setting minNeighbors to 0, and maybe I can make my own grouping function, remembering how many rectangles were merged to build a rectangle...

2012-11-14 02:17:50 -0500 commented question Error: Cannot run program "\ndk-build.cmd"

Have you tried to remove the ".cmd" at the end of the command inside eclipse ?

2012-11-13 14:02:45 -0500 asked a question How to get the best detection for an object

Sorry if the title is not clear enough, I will try to explain it better. I have a picture and I know there is only one face inside, i would like to know the best way to find that face. For the moment, I'm doing this :

faceClassifier.detectMultiScale(img, faces, 1.2, 1, Objdetect.CASCADE_FIND_BIGGEST_OBJECT | Objdetect.CASCADE_DO_ROUGH_SEARCH, new Size(img.rows()/5, img.cols()/5), new Size(img.rows(), img.cols()));

But with this, I'm not getting the "best" face, but the bigger one, and I think it could result in an oversized rectangle around the face.
I could set minNeighbors to a high value, but sometimes, the face won't be good enough to be well detected, so i should not discard any candidate, because I should always find one !

Thanks for your help,

2012-10-05 07:10:29 -0500 marked best answer findContours gives me the border of the image

Hello, I'm working with OpenCv on Android and have a problem with the findContours function because it gives me the border of the image.

Here is an example (source image will always be a thresholded image) :

pic1 pic2

As you can see, I do have the contour of the blob, but I don't want to get the contour of the picture...

Actually, I need to find the biggest blob, so what I do is to find every contour, and then find the one with the biggest area, but to do this, I have to save the biggest area (which will be the contour of the image) and the second biggest (which will be the true biggest blob)... I think it's pretty ugly and a waste...

Is it a normal behaviour ? And Is there a way of getting rid of this ?

EDIT : here is the code i'm using

Mat eyeMat = faceMat.submat(eyesArray[j]); //This is a gray image    
Imgproc.GaussianBlur(eyeMat, eyeMat, new Size(9, 9), 2, 2);    
Imgproc.threshold(eyeMat, eyeMat, 30, 255, Imgproc.THRESH_BINARY);    
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(eyeMat, contours, hierarchy, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_NONE);
2012-10-05 07:00:11 -0500 received badge  Critic (source)
2012-10-05 07:00:08 -0500 received badge  Supporter (source)
2012-10-05 06:59:43 -0500 received badge  Scholar (source)