主要内容

一起工作MATLAB图像数据

更全面的例子

本节包含一些代码片段,用于演示与处理图形和图像数据相关的特定功能。

处理图像

从组件中的图像获取编码图像字节

public byte[] getByteArrayFromDeployedComponent() {Object[] byteImageOutput = null;MWNumericArray numericImageByteArray = null;try {byteImageOutput =部署。getImageDataOrientation(1, // output Number 500, //Height 500, //Width 30, //Elevation 30, //Rotation "png" //图像格式);numericImageByteArray = (MWNumericArray) byteImageOutput [0];返回numericImageByteArray.getByteData ();} finally {MWArray.disposeArray(byteImageOutput);}}

在组件中获取缓冲图像

public byte[] getByteArrayFromDeployedComponent() {Object[] byteImageOutput = null;MWNumericArray numericImageByteArray = null;try {byteImageOutput =部署。getImageDataOrientation(1, // output Number 500, //Height 500, //Width 30, //Elevation 30, //Rotation "png" //图像格式);numericImageByteArray = (MWNumericArray) byteImageOutput [0];返回numericImageByteArray.getByteData ();} finally {MWArray.disposeArray(byteImageOutput);}} public BufferedImage getBufferedImageFromDeployedComponent() {try {byte[] imageByteArray = getByteArrayFromDeployedComponent()返回ImageIO。读(新ByteArrayInputStream (imageByteArray));} catch(IOException io_ex) {io_ex. printstacktrace ();}}