Why I can't do threshold opencv for skin segmentation provementin my android project ?

asked 2015-05-07 00:11:06 -0500

ichaka gravatar image

updated 2015-05-07 00:17:14 -0500

I am doing final project about hand gesture recognition real time using android and opencv. I'm doing skin segmentation on it, by convert picture from camera frame (RGB) to YCrCb color and get the Cr and Cb value (range) from rectangle that is directed to skin color (seems like color picker). Now, i want to prove it (skin segmentation) by using thresholding function through option menu button on my android phone. But, it's not work, no effect. What should I do ? This is my threshold code :

   case MainActivity.VIEW_MODE_THRES:
        mask = rgba.clone();
        rgbaInnerWindow = rgba.submat(top, top + height, left, left + width);

        Imgproc.cvtColor(rgbaInnerWindow, rgbaInnerWindow, Imgproc.COLOR_BGR2YCrCb);
        Imgproc.cvtColor(mask, mask, Imgproc.COLOR_BGR2GRAY);

        Core.inRange(rgbaInnerWindow, new Scalar(0, Cr_low, Cb_low), new Scalar (255, Cr_high, Cb_high), mask);

        image = mask.clone(); //save the image segmentation output
        Imgproc.blur(mask, mask, new Size(5,5));

        Imgproc.threshold(mask, mask, 13, 255, Imgproc.THRESH_OTSU);
        Core.inRange(mask, new Scalar(30), new Scalar(255), mask); rgbaInnerWindow.release();
edit retag flag offensive close merge delete