Matlab如何imwrite,Uint16的灰度图像???? 5

 我来答
仝俊民PL
2017-11-21
知道答主
回答量:13
采纳率:100%
帮助的人:3.1万
展开全部

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。如下图所示:

limuzi8801
2016-11-29
知道答主
回答量:10
采纳率:0%
帮助的人:5.2万
展开全部
clc;clear;
L2=rand(128,256);
str1='E\';
imwrite(L2,[str1,num2str(007),'.PNG'],'PNG','bitdepth',16);
imageName=[str1,num2str(007),'.PNG'];
II(:,:)=imread(imageName);%读图,把图像转化成数据
L1(:,:)=im2double(II(:,:));%读到的数据类型再转化成double型

a=abs(L1-L2);max(a(:))
max(a(:))>=(2^(-8))%如果结果是0,表示图片精度为8位或者8位以下
max(a(:))>=(2^(-16))%如果结果是0,表示图片精度为16位或者16位以下
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
英雄创业精神奇
2013-04-23 · TA获得超过1601个赞
知道小有建树答主
回答量:1454
采纳率:0%
帮助的人:1487万
展开全部
直接保存成tif文件
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式