public static void showResult(Mat img) { Imgproc.resize(img, img, new Size(640, 480)); MatOfByte matOfByte = new MatOfByte(); Highgui.imencode(".jpg", img, matOfByte); byte[] byteArray = matOfByte.toArray(); BufferedImage bufImage = null; try { InputStream in = new ByteArrayInputStream(byteArray); bufImage = ImageIO.read(in); JFrame frame = new JFrame(); frame.getContentPane().add(new JLabel(new ImageIcon(bufImage))); frame.pack(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
Mat image_tmp = your image MatOfByte matOfByte = new MatOfByte(); Highgui.imencode(".jpg", image_tmp, matOfByte); byte[] byteArray = matOfByte.toArray(); BufferedImage bufImage = null; try { InputStream in = new ByteArrayInputStream(byteArray); bufImage = ImageIO.read(in); } catch (Exception e) { e.printStackTrace(); }
public static BufferedImage getBufferedImage(Mat mat, String type) { BufferedImage bImg = null; MatOfByte bytemat = new MatOfByte(); if (SX.isNull(mat)) { mat = getNewMat(); } Imgcodecs.imencode(type, mat, bytemat); byte[] bytes = bytemat.toArray(); InputStream in = new ByteArrayInputStream(bytes); try { bImg = ImageIO.read(in); } catch (IOException ex) { log.error("getBufferedImage: %s error(%s)", mat, ex.getMessage()); } return bImg; }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }
public List<Byte> toList() { byte[] a = toArray(); Byte ab[] = new Byte[a.length]; for(int i=0; i<a.length; i++) ab[i] = a[i]; return Arrays.asList(ab); } }