title: How to detect skin color using ciexyz/cielab?
body: <p>I am new in opencv, i've been doing something skin detection using CIEXYZ. But i got propblem to convert RGB to CIE Lab to get skin-colored area, I did some calculations from RGB based on <a href="https://stackoverflow.com/questions/12968576/opencv-skin-detection">this</a>.</p>
  
  <p>Original images</p>
  
  <p><a href="https://i.stack.imgur.com/FftM8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FftM8.jpg" alt="enter image description here"></a></p>
  
  <p>The result is nothing nut black frame. Its from RGB to CIEXYZ
  <a href="https://i.stack.imgur.com/RHccy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHccy.jpg" alt="enter image description here"></a></p>
  
  <p>and this is binary image</p>
  
  <p><a href="https://i.stack.imgur.com/ui1qf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ui1qf.jpg" alt="enter image description here"></a></p>
  
  <p>but i want to display it like this</p>
  
  <p><a href="https://i.stack.imgur.com/rIx6a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rIx6a.png" alt="enter image description here"></a></p>
  
  <p>Here's my source code :</p>
  
  <pre><code>Mat img_color_space = new Mat();
  Mat mask = new Mat();
  
  Imgproc.cvtColor(src, img_color_space, colorBgr2hsv);
  Imgcodecs.imwrite(path+"CIELAB/hsv.jpg",img_color_space);
  Imgproc.blur(img_color_space, img_color_space, new Size(3,3));
  Mat canny_output = new Mat();
  
  Scalar minValues = new Scalar(0,10,60);
  Scalar maxValues = new Scalar(20,150,255);
  // show the current selected HSV range
  String valuesToPrint = "Hue range: " + minValues.val[0] + "-" + maxValues.val[0]
          + "\tSaturation range: " + minValues.val[1] + "-" + maxValues.val[1] + "\tValue range: "
          + minValues.val[2] + "-" + maxValues.val[2];
  //System.out.println("tresholding:"+valuesToPrint);
  
  Core.inRange(img_color_space, minValues, maxValues, mask);
  Imgcodecs.imwrite(path+"CIELAB/mask.jpg",mask);
  List&lt;MatOfPoint&gt; contours = new ArrayList&lt;&gt;();
  Mat hierarchy = new Mat();
  
  Imgproc.findContours(mask, contours, hierarchy, Imgproc.RETR_TREE, Imgproc.CHAIN_APPROX_SIMPLE,new Point(0,0));
  int s = findBiggestContour(contours);
  
  Mat drawing = Mat.zeros(mask.size(), CvType.CV_8UC3);
  Imgproc.drawContours(drawing, contours, s, new Scalar(255, 255, 255), -1,8,hierarchy,0,new Point(0,0));
  Imgproc.blur(drawing, drawing, new Size(3,3));
  Imgcodecs.imwrite(path+"CIELAB/biggest.jpg",drawing);
  </code></pre>
  
  <p>Is there something wrong in my code? Thanks in advance!</p>