Skin Color Detection Problem [opencv4android]
i want to make a skin color detection, then i search a simple example to do skin color detection, but i don't know why my code is cannot run properly : this example basic skin color detection :
int main(){
Mat src = imread("qq.jpg");
if (src.empty())
return -1;
blur( src, src, Size(3,3) );
Mat hsv;
cvtColor(src, hsv, CV_BGR2HSV);
Mat bw;
inRange(hsv, Scalar(0, 10, 60), Scalar(20, 150, 255), bw);
imshow("src", src);
imshow("dst", bw);
waitKey(0);
return 0;}
then this my android java code :
for (Rect r : hand){
Core.rectangle(mRgba, r.tl(), r.br(), new Scalar(255, 255, 255, 255), 3);
Mat roi = mRgba.submat(r);
Imgproc.cvtColor(roi, roi, Imgproc.COLOR_BGR2HSV, 4);
Imgproc.cvtColor(roi, roi, Imgproc.COLOR_RGB2RGBA, 4);
Core.inRange(roi, new Scalar(0, 10, 60), new Scalar(20, 150, 255), roi);
Mat rect_area = mRgba.rowRange(r.y, r.y+r.height).colRange(r.x, r.x+r.width);
roi.copyTo(rect_area);
}
any body help me... i need this for my final project, thanks