Ask Your Question

devdroid6's profile - activity

2016-10-14 02:13:56 -0600 commented question How to use detectMultiScale detector for ROI in Face detection. Please help me in this code.

//Mouth Detection Mat cropped_Mouth = new Mat();
cropped_Mouth = mGray.submat(roi_Mouth); CascadeClassifier classifier = mMouthDetector; //haarcascade_mcs_mouth.xml

            if (classifier != null) {
                classifier.detectMultiScale(cropped_Mouth, mouth, 1.1, 0, 1, new Size(mAbsoluteFaceSize, mAbsoluteFaceSize), new Size());
            }
            else {
                Log.i("Fdvuew", "classifier mouth is NULL");
            }                   
            mouthArray = mouth.toArray();
            for (int i = 0; i < mouthArray.length; i++) {
                Imgproc.rectangle(mRgba, mouthArray[i].tl(), mouthArray[i].br(), MOUTH_RECT_COLOR, 6);
            }
2016-10-14 02:12:23 -0600 commented question How to use detectMultiScale detector for ROI in Face detection. Please help me in this code.

//Face Detection Rect[] facesArray = faces.toArray(); for (int i = 0; i < facesArray.length; i++) { Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR, 3);

    if (facesArray.length > 0) {
        Rect roi = new Rect((int) facesArray[0].tl().x,
                (int) (facesArray[0].tl().y), facesArray[0].width,
                (int) (facesArray[0].height));//

        if (roi.x >= 0 && roi.width >= 0 && roi.y >= 0 && roi.height >= 0) {
            Rect roi_Mouth = new Rect((int) facesArray[0].tl().x, (int) (facesArray[0].tl().y), facesArray[0].width, (int) (facesArray[0].height));

}

2016-10-14 02:07:47 -0600 answered a question How to use detectMultiScale detector for ROI in Face detection. Please help me in this code.
     public Mat onCameraFrame(CvCameraViewFrame inputFrame) {

    mRgba = inputFrame.rgba();
    mGray = inputFrame.gray();


    if (mAbsoluteFaceSize == 0) {
        int height = mGray.rows();
        if (Math.round(height * mRelativeFaceSize) > 0) {
            mAbsoluteFaceSize = Math.round(height * mRelativeFaceSize);
        }
        mNativeDetector.setMinFaceSize(mAbsoluteFaceSize);
    }

    MatOfRect faces = new MatOfRect();
    MatOfRect mouth = new MatOfRect();

    if (mDetectorType == JAVA_DETECTOR) {
        if (mJavaDetector != null)
            mJavaDetector.detectMultiScale(mRgba, faces, 1.1, 2, 2, // TODO: objdetect.CV_HAAR_SCALE_IMAGE
                    new Size(mAbsoluteFaceSize, mAbsoluteFaceSize), new Size());
    }

    else {
        Log.e(TAG, "Detection method is not selected!");
    }

    //Face Detection
    Rect[] facesArray = faces.toArray();
    for (int i = 0; i < facesArray.length; i++) {
        Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR, 3);

    if (facesArray.length > 0) {
        Rect roi = new Rect((int) facesArray[0].tl().x,
                (int) (facesArray[0].tl().y), facesArray[0].width,
                (int) (facesArray[0].height));//

        if (roi.x >= 0 && roi.width >= 0 && roi.y >= 0 && roi.height >= 0) {
            Rect roi_Mouth = new Rect((int) facesArray[0].tl().x,
                    (int) (facesArray[0].tl().y)/*
                                                     * +facesArray[0].height*
                                                     * 2/3
                                                     */,
                    facesArray[0].width, (int) (facesArray[0].height)/**
             *
             * 2/5
             */
            );//


            //Mouth Detection
            Mat cropped_Mouth = new Mat();                
            cropped_Mouth = mGray.submat(roi_Mouth);


            CascadeClassifier classifier = mMouthDetector; //haarcascade_mcs_mouth.xml       

            if (classifier != null) {
                classifier.detectMultiScale(cropped_Mouth, mouth, 1.1,
                        0, 1, new Size(mAbsoluteFaceSize,
                                mAbsoluteFaceSize), new Size());


            }
            else {
                Log.i("Fdvuew", "classifier mouth is NULL");
            }

            mouthArray = mouth.toArray();
            for (int i = 0; i < mouthArray.length; i++) {
                Imgproc.rectangle(mRgba, mouthArray[i].tl(), mouthArray[i].br(), MOUTH_RECT_COLOR, 6);
            }
        }
    }
}

faces.release();
mouth.release();

return mRgba;

}

2016-10-13 08:21:43 -0600 commented question How to use detectMultiScale detector for ROI in Face detection. Please help me in this code.

Hi guys any progress on this?, as i am also stuck on the same issue

2016-10-13 05:30:16 -0600 received badge  Critic (source)
2016-10-13 05:07:12 -0600 commented answer Face detection: how to stop detecting multiple mouths in real time OpenCV Java

This still shows the red rectangle on the top of the eyebrow for mouth

2016-10-10 03:53:07 -0600 received badge  Supporter (source)