Ask Your Question

GVannu's profile - activity

2018-01-28 09:33:22 -0600 received badge  Popular Question (source)
2016-06-20 02:09:49 -0600 received badge  Student (source)
2015-12-31 10:35:19 -0600 asked a question Use C++ openCV code into Windows Universal app in C#

Dear all, I am planning to do a Windows 10 Universal app. Into this app I want integrate part of my c++ OpenCV code. So I create a solution with a c# project and a windows c++ runtime component. So, now, I can call c++ code from c# app, this strategy work well, maybe is not the better, but work for my purpose. The c++ code into runtime component is very easy, just read frame from Webcam:

#include "Class1.h"
#include <core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/objdetect/objdetect.hpp"
#include <opencv2/imgproc.hpp>

using namespace WindowsRuntimeComponent1;
using namespace Platform;
using namespace cv;
using namespace std;

Mat cameraFrame;
Mat mGray;
Class1::Class1()
{
    VideoCapture stream1(0);
    Mat mGray;
    while (true) {
        stream1.read(cameraFrame);
        cvtColor(cameraFrame, mGray, CV_RGB2GRAY);
        //imshow("My Window", mGray);

        if (waitKey(10) >= 0)
            break;
    }
}

For now, imshow is commented, I think that I can't use into C# app.

Now, I want show mGray Mat into an Image object into my c# app, this is my XAML:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Image x:Name="imgCV" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Loaded="imgCV_Loaded"/>
    </Grid>

as you can see I also add a Loaded event, but for now I don't code this event. I am stop here and I am not able to proceed. Can you help me? How can I show my mGray Mat into XAML object Image?

Thank you all, and happy new year.

2015-12-28 14:43:20 -0600 commented question Detectmultiscale for face detection in opencv 3.1 C++ doesn't work properly

Yes!! I will try and I will tell you the results. Thank you

2015-12-28 14:17:23 -0600 commented question Detectmultiscale for face detection in opencv 3.1 C++ doesn't work properly

Hi sturkmen. No, I download the self-extract file from opencv website, I set environment variable and path. And finally set my visual studio project properties ( like linker input and additional include directories). I follow the tutorial provide from opencv. This worked for 3.0. I do the same procedure for 3.1 and I succesfully build and run my code. I have problem just with face detection

2015-12-28 11:26:51 -0600 asked a question Detectmultiscale for face detection in opencv 3.1 C++ doesn't work properly

Dear all, I recently develop an app for face detection using C++, Visual Studio 2015 and lbp cascades filter. Initially, my app, was developed with OpenCV 3.0 and face detection was very very good. The code is similar to others hundreds of Code on hundreds and hundreds of blogs:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/objdetect/objdetect.hpp"
#include <opencv2/imgproc.hpp>
#include "main.h"

using namespace cv;
using namespace std;
Mat cameraFrame;
CascadeClassifier face_cascade;
int main()
{
    VideoCapture stream1(0);
    Mat mGray;
    Mat eye;
    vector<Rect> faces;
face_cascade.load("C:\\MyFile\\Lavoro\\EyeTracking\\OpenCVwindows\\opencv\\build\\etc\\lbpcascades\\lbpcascade_frontalface.xml");
while (true) {
        stream1.read(cameraFrame);
        cvtColor(cameraFrame, mGray, CV_RGB2GRAY);
        equalizeHist(mGray, mGray);
        face_cascade.detectMultiScale(mGray, faces, 1.1, 2, CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_SCALE_IMAGE, Size(30, 30));
}
}
// ...other not usefull code for this questions

So, basically, I load an lbp filter and I apply this filter on GRAY image for detect faces. In OpenCV 3.0 all run very well, in opencv3.1 the results is that vector faces has a size of about 1.5 Millions. Watching this results I noticed that x and y coordinates are, in some case, wrong! For example into an image of 640x480 I have x and y of about 3000-4000.

Is this a bug of OpenCV 3.1? How can I resolve it?