本节包含一些代码片段,用于演示与使用图形和图像数据相关的特定功能。
public byte[] getByteArrayFromDeployedComponent() {Object[] byteImageOutput = null;MWNumericArray numericImageByteArray = null;try {byteImageOutput =部署。getImageDataOrientation(1, //Number Of Outputs 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, //Number Of Outputs 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 ();}}
使用renderArrayData
方法:
在给定的MATLAB中创建一个缓冲图像®数组中。
验证阵列是三维的(高度、宽度和颜色组件)。
验证颜色组件顺序为红色、绿色和蓝色。
看到renderArrayData
在Java®有关输入参数、返回值、抛出的异常和示例的API文档。