Ask Your Question

tralladas's profile - activity

2017-08-10 02:53:12 -0600 answered a question LBPHFaceRecognizer train length error

Hi,

I could resolve it the same way my other post: Creating new project and linking opencv libraries again. I supose it was wrongly linked.

Thanks for all replies.

2017-08-09 01:50:49 -0600 commented question detectMultiScale returns incorrect face values

Hi,

Finally It works. I created empty project again and linked opencv againg and It worked. So as you said berak, the problem could be linkage. What I see now is that I receive a lot of false positives (it detect faces where it shouldn't, for example if there is two lights more or less aligned.

Thanks, for you responses.

2017-08-08 09:40:29 -0600 commented question detectMultiScale returns incorrect face values

I'm using it in a 64 bits system, Windows 10 Enterprise 64 bits. OpenCV and my solution are compiled with Visual Studio 2015 x86 (Win32). The thing in this case is that It doesn't throw any error. It throws one when I try to create Rectangle with negative coordenates.

2017-08-08 08:31:52 -0600 commented question LBPHFaceRecognizer train length error

Sorry, actually opencv 3.1.0 is used in several projects in Production environment and I can't migrate to 3.3.0 version.

2017-08-08 08:21:47 -0600 asked a question detectMultiScale returns incorrect face values

Hi,

I am trying to detect faces from one image usinf face_cascade.detectMultiScale, but it returns a faces vector with 258235440 size. I'm using opencv 3.1.0 x86 version. Exploring the vector I can see that some values have x and y coordinates with negative values. The image actually does not conatins faces. The image is 1920x1080 24 bits rgb. The xml used is haarcascade_frontalface_alt.xml contained in data folder in opencv3.1.0 code.

This is my code:

    bool Util_Faces::detectFace(const cv::Mat &img, cv::Rect &rect)
{
    try
    {

        std::vector<cv::Rect> faces;
        float ratio = 5.0;
        float invertRatio = 1 / ratio;


        int newCols = (int)(img.cols*invertRatio);
        int newRows = (int)(img.rows*invertRatio);

        //Scale image to 1/5 factor. (Image is 1920x1080 24rgb
        cv::Mat imgGray;
        cv::resize(img, imgGray, cv::Size(newCols, newRows));

        cv::cvtColor(imgGray, imgGray, cv::COLOR_BGR2GRAY);

        //-- Detect faces
        Util_Faces::face_cascade.detectMultiScale(imgGray, faces, 1.1, 2, 0 | cv::CASCADE_SCALE_IMAGE);

        if (faces.size() == 0)
            return false;

        cv::Rect ajustRect = faces[0];
        rect = cv::Rect(ajustRect.x*ratio, ajustRect.y*ratio, ajustRect.width*ratio, ajustRect.height*ratio);

        return true;
    }
    catch (std::exception  ex)
    {
        int a = 0;
        return false;
    }


}

Anyone knows why am I receiving this values?

Thanks.

2017-08-04 06:29:35 -0600 commented question LBPHFaceRecognizer train length error

Hi, Libraries are correct because same libraries are used in other proyect (receiving an image from camera) and train works correctly. The problem is when image is loaded from file. I have already tried IMREAD_GRAYSCALE also, and the error persists.

2017-08-04 04:00:43 -0600 commented question LBPHFaceRecognizer train length error

Yes, I have only one image and one label. The error in output is "std::length_error. Debugging I obtain "Exception thrown at 0x52BCE39D (opencv_core310.dll). Access violation writing location 0x80000640.

2017-08-04 02:44:53 -0600 asked a question LBPHFaceRecognizer train length error

Hi,

I am trying to extract histograms from a grayscale face image, but I am getting a std::length_error. I am using opencv 3.1.0

This is my code:

 int GetHistograms(cv::Mat &features)
{   
    cv::Mat img;
    img = cv::imread("face_grayscale.bmp",CV_LOAD_IMAGE_UNCHANGED);
    std::vector<cv::Mat> images;
    std::vector<int> labels;
    images.push_back(img); labels.push_back(0);

    cv::Ptr<cv::face::LBPHFaceRecognizer> model2 = cv::face::createLBPHFaceRecognizer();
    model2->train(images, labels);
    std::vector<cv::Mat> histogramsS = model2->getHistograms();
    features =  histogramsS[0];

    return histogramsS[0].cols;
}

The code fails on train(images, labels). Going into details, I could see that the exception is through in lbph_faces.cpp in _in_src.getMatVector(src)

I have checked the loaded image is really loaded, has format CV_8U (grayscale), size 100x100 and no stride (isContinuos = true).

Any suggestions?

Thanks.

2017-08-02 09:27:40 -0600 asked a question EmguCv 3.1 y OpenCv 3.2

Due to project requirements, I need to use EmguCv v3.1 (C# project) and OpenCv (SVM in C++ Project) 3.2 into the same solution. The problem is that Emgu Constructor fails because it's trying to load 3.2 libraries.

¿There is a way to use both versions in same Project/Solution?