本篇博客介绍如何在Java中使用Opencv实现对图片的读取和显示。
首先是显示部分:
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
public class ShowImage {
private JFrame frame;
/**
* Create the application.
*/
public ShowImage(Mat mat) {
initialize(mat);
}
public JFrame getFrame() {
return frame;
}
/**
* Initialize the contents of the frame.
*/
private void initialize(Mat mat) {
frame = new JF

这篇博客详细阐述了如何在Java环境中利用Opencv库进行图片的读取和显示操作,通过将Mat类型的图片转换为BufferedImage,实现在Java应用中展示图片。
订阅专栏 解锁全文
597

被折叠的 条评论
为什么被折叠?



