码迷,mamicode.com
首页 > 其他好文 > 详细

Matlab下imwrite,Uint16的深度图像

时间:2018-04-10 16:06:31      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:执行命令   write   sum   ati   mat   ram   info   form   atl   

Matlab下imwrite,Uint16的深度图像

1. 在Matlab命令窗口输入命令:

help imwrite

会有如下解释:

  • If the input array is of class uint16 and the format supports 16-bit data (JPEG, PNG, and TIFF), imwrite outputs the data as 16-bit values. If the format does not support 16-bit values, imwrite issues an error. Several formats, such as JPEG and PNG, support a parameter that lets you specify the bitdepth of the output data.

  • If the input array is of class double, and the image is a grayscale or RGB color image, imwrite assumes the dynamic range is [0,1] and automatically scales the data by 255 before writing it to the file as 8-bit values.

2. 如果你要保存成uint16的图像的矩阵数据是非uint16的类型:

技术分享图片

则必须先将double类型转换为uint16的类型,执行命令:

data11=uint16(data1);

结果如下:

技术分享图片

3. 然后执行命令:

imwrite(data11,image.png,png,bitdepth,16);

最终得到uint16的灰度图像image.png。如下图所示:

技术分享图片

 

Matlab下imwrite,Uint16的深度图像

标签:执行命令   write   sum   ati   mat   ram   info   form   atl   

原文地址:https://www.cnblogs.com/yuanlibin/p/8779658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!