خرید بک لینک

Vote count: 0

I am trying to convert C++ Opencv Interface code to C Opencv Interface code because my last project which i did years ago of face detection coded in C interface, for normal testing and algorithm checking i am trying to add this code snippet in it. I have done with detecting face, now i want to detect smile on face for which i am using code below but i want to convert the below code in C interface

                Mat frame_gray;
                for (size_t i = 0; i < frame.size(); i++)
                {
                    Point center(frame[i].x + frame[i].width*0.5, frame[i].y + frame[i].height*0.5);
                    ellipse(frame_2, center, Size(frame[i].width*0.5, frame[i].height*0.5), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);
                    Mat faceROI = frame_gray(frame[i]);
                    std::vector<Rect> eyes;
                    //-- In each face, detect eyes
                    eyes_cascade.detectMultiScale(faceROI, eyes, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
                    for (size_t j = 0; j < eyes.size(); j++)
                    {
                        Point center(frame[i].x + eyes[j].x + eyes[j].width*0.5, frame[i].y + eyes[j].y + eyes[j].height*0.5);
                        int radius = cvRound((eyes[j].width + eyes[j].height)*0.25);
                        circle(frame_2, center, radius, Scalar(255, 0, 0), 4, 8, 0);
                    }
                } 

What i tried is converting Mat frame_gray into

IplImage *frame_gray = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 1);

where frame is the image where i detect the face

if (draw)
        for (i = 0; i < ndetections; ++i)
            if (qs[i] >= qthreshold) // check the confidence threshold
                cvCircle(frame, cvPoint(cs[i], rs[i]), ss[i] / 2, CV_RGB(255, 0, 0), 4, 8, 0); // we draw circles here since height-to-width ratio of the detected face regions is 1.0f

asked 51 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 31 خرداد 1395 ساعت: 1:10

صفحه بندی