2016-12-04 98 views
0

我需要一些關於如何將IplImage轉換爲java中的BufferedImage的幫助。如果有人知道,請回答我。給一些程序例子比較好。謝謝。將IplImage轉換爲javacv中的BufferedImage

+0

[轉換到的IplImage BufferedImage的集成]的可能的複製(http://stackoverflow.com/questions/23597104/converting-iplimage-to-bufferedimage-to-integrate) –

回答

0

請參閱此link。它建議使用OpenCVFrameConverter.IplImageJava2DFrameConverterhttp://bytedeco.org/news/2015/04/04/javacv-frame-converters/

另請參閱此question

public static BufferedImage toBufferedImage(IplImage src) { 
    OpenCVFrameConverter.ToIplImage iplConverter = new OpenCVFrameConverter.ToIplImage(); 
    Java2DFrameConverter bimConverter = new Java2DFrameConverter(); 
    Frame frame = iplConverter.convert(src); 
    BufferedImage img = bimConverter. convert(frame); 
    BufferedImage result = (BufferedImage)img.getScaledInstance(
     img.getWidth(), img.getHeight(), java.awt.Image.SCALE_DEFAULT); 
    img.flush(); 
    return result; 
}