title: Converting BufferedImage to OpenCv Mat
body: <p>I'm trying to convert a BufferedImage to a Mat, used in OpenCV. </p>
  
  <p>The code I found for this ( on many different sites, including stackoverflow ) is: </p>
  
  <pre><code>public Mat bufferedImageToMat(BufferedImage bi) {
        Mat mat = new Mat(bi.getHeight(), bi.getWidth(), CvType.CV_8UC3);
        byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
        mat.put(0, 0, data);
        return mat;
      }
  </code></pre>
  
  <p>Eclipse gives me the following error: </p>
  
  <p>DataBufferType cannot be resolved to a type. </p>
  
  <p>I have imported java.awt.image.BufferedImage; so this cant be the problem. </p>
  
  <p>Any ideas? 
  Or maybe another way to do this conversion? </p>