Save image into Mat using Java?
<p>Some bmp and tif image files cannot be read using the following method, except for the jpeg files. And I want to save it in opencv's Mat structure. What should I do? And I want to convert it into BufferedImage for further processing.</p>

<pre><code>File input = new File("C:\\File\\1.tif");
BufferedImage image = ImageIO.read(input);         
byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();            
Mat img = new Mat(image.getHeight(),image.getWidth(), CvType.CV_8UC3);
img.put(0, 0, data);            
Imgcodecs.imwrite("C:\\File\\input.jpg", img);
</code></pre>