title: Is there any way to paint my plate numbers to black using JavaCV?
body: <p>Hi I started using JavaCV two days ago,</p>
  
  <p>I m trying to make an <a href="https://github.com/MHTaleb/pfe_Nor" rel="nofollow noreferrer">ANPR Open Source System</a> at my git repository under Java SE and Maven.</p>
  
  <p>I have detected my plate rectangle and now I'm trying to prepare a good image for OCR reading.</p>
  
  <p>the original image : </p>
  
  <p><a href="https://i.stack.imgur.com/YllHs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YllHs.jpg" alt="enter image description here"></a></p>
  
  <p>Right now I have obtained this image :</p>
  
  <p><a href="https://i.stack.imgur.com/R29yn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R29yn.jpg" alt="current Image"></a> ,</p>
  
  <p>Is there any way to turn my plate numbers black using JavaCv ? I don't have the slightest idea how to do so using javacv functions .</p>
  
  <p>here I give you the methods that are producing this result :</p>
  
  <p>first I call this after a blur </p>
  
  <pre><code>public void toB_A_W(JLabel jLabel){
          Mat rgbImage = Imgcodecs.imread(original);
           Mat destination = new Mat(rgbImage.rows(), rgbImage.cols(), rgbImage.type());
          // l objectif et de corriger les erreur de la transformation en noire et blan
          int dilation_size = 2;
  
           // la matrice de la dilatation on cherche a dilater en forme de rectange ( Imgproc.MORPH_RECT )   
          Mat element1 = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(dilation_size + 1, dilation_size + 1));
          // on dilate l image
          Imgproc.dilate(rgbImage, destination, element1);
  
  
          Mat labImage = new Mat();
          cvtColor(destination, labImage, Imgproc.COLOR_BGR2GRAY);
          Imgcodecs.imwrite(ocrReadFrom, labImage);
          jLabel.setIcon(new ImageIcon(ocrReadFrom));
          JOptionPane.showConfirmDialog(null, "");
    }
  </code></pre>
  
  <p>then I call this :</p>
  
  <pre><code>public void toB_W(JLabel jLabelBlackAndWhiteImage) {
      // cella est l image de l ocr
      smouthedImage = opencv_imgcodecs.cvLoadImage(ocrReadFrom);
       blackAndWhiteImageOCR = opencv_core.IplImage.create(smouthedImage.width(),
              smouthedImage.height(), IPL_DEPTH_8U, 1);
       // la fonction qui va executé la transformation en noire et blan
      System.out.println("0");
      //cvAdaptiveThreshold(smouthedImage, smouthedImage, 255, CV_ADAPTIVE_THRESH_GAUSSIAN_C, opencv_imgproc.CV_THRESH_MASK, 15, -2);
       opencv_imgproc.cvSmooth(smouthedImage, smouthedImage);
      System.out.println("1");
      cvCvtColor(smouthedImage, blackAndWhiteImageOCR, CV_BGR2GRAY);
      System.out.println("2");
      cvAdaptiveThreshold(blackAndWhiteImageOCR, blackAndWhiteImageOCR, 255, CV_ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY_INV, 17, -4);
      System.out.println("3");
       opencv_imgproc.cvSmooth(blackAndWhiteImageOCR, blackAndWhiteImageOCR);
      // fin de la transformation 
      cvSaveImage(ocrReadFrom, blackAndWhiteImageOCR);
   ...}
  </code></pre>
  
  <p>Thanks  </p>