How to convert detected mouth region in gray-scale and binary in android ? [closed]

asked 2015-12-15 23:58:25 -0600

opencvlover gravatar image

updated 2015-12-16 11:22:37 -0600

Here is my code, i am not able to covert the mouth region into grayscale please help me...i have tried everything available on internet

        Mat innerWindow = mRgba.submat(moutharea);
Imgproc.cvtColor(innerWindow, innerWindow,Imgproc.COLOR_RGB2GRAY);      
Imgproc.threshold( innerWindow,  innerWindow,70, 255,Imgproc.THRESH_BINARY);
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by opencvlover
close date 2015-12-16 11:21:32.659287

Comments

please post whole code

sturkmen gravatar imagesturkmen ( 2015-12-16 03:18:15 -0600 )edit

could you try ( sorry i can't try java code )

Mat innerWindow = mRgba.submat(moutharea);
Mat innerWindowGray;
Imgproc.cvtColor(innerWindow, innerWindowGray,Imgproc.COLOR_RGB2GRAY);
Imgproc.threshold( innerWindowGray,  innerWindowGray,70, 255,Imgproc.THRESH_BINARY);
Imgproc.cvtColor(innerWindowGray, innerWindowGray,Imgproc.COLOR_GRAY2RGB);
innerWindowGray.copyTo( innerWindow );
sturkmen gravatar imagesturkmen ( 2015-12-16 04:12:33 -0600 )edit

let me try

opencvlover gravatar imageopencvlover ( 2015-12-16 04:27:50 -0600 )edit

One year ago I wouldn't expect someone to be able to perform face/mouth detection but not able to perform image thresholding.

Pedro Batista gravatar imagePedro Batista ( 2015-12-16 04:39:04 -0600 )edit

I have tried this and it gives no grayscale area :(

 Mat innerWindow = mRgba.submat(moutharea);
        Mat innerWindowGray = innerWindow;
        Imgproc.cvtColor(innerWindow, innerWindowGray,Imgproc.COLOR_RGB2GRAY);
        Imgproc.threshold( innerWindowGray,  innerWindowGray,70, 
                   255,Imgproc.THRESH_BINARY);
        Imgproc.cvtColor(innerWindowGray, innerWindowGray,Imgproc.COLOR_GRAY2RGB);
        innerWindowGray.copyTo( innerWindow );
opencvlover gravatar imageopencvlover ( 2015-12-16 04:40:01 -0600 )edit

@Pedro Batista i have spent 2 days but nothing works :( i want only a region to be in grayscale for further processing... i have seen opencv4android mixed processing project sample but there is no code for showing a ROI in grayscale

opencvlover gravatar imageopencvlover ( 2015-12-16 04:42:31 -0600 )edit

You have to go step by step. Try to visualize the image in every step and then tell us where it is going wrong.

Does Imgproc.cvtColor(innerWindow, innerWindowGray,Imgproc.COLOR_RGB2GRAY); work? Visualize the image after this step tell us if you see a grayscale ROI.

Pedro Batista gravatar imagePedro Batista ( 2015-12-16 04:54:59 -0600 )edit

No it doesnot show grayscale region... but when i tried this it show me region in blue.. it means only grayscale is not working

Imgproc.cvtColor(innerWindow, innerWindowGray,Imgproc.COLOR_RGB2BGRA);
opencvlover gravatar imageopencvlover ( 2015-12-16 05:02:27 -0600 )edit

And before? Try to visualize mouthArea and tell us if you see a normal mouth ROI.

Pedro Batista gravatar imagePedro Batista ( 2015-12-16 05:05:14 -0600 )edit

yes i can see the normal mouth ROI i draw a rectangle around the mouth area

opencvlover gravatar imageopencvlover ( 2015-12-16 05:11:29 -0600 )edit