matlab中imwrite函数如何使用,matlab中imwrite函数详解(imwri。。。

matlab中imwrite函数如何使⽤,matlab中imwrite函数详解
骆家辉 李蒙(imwri。。。jnk
参考资料:
你可能觉得imread函数很简单,但是还是有⼀些细节要注意。⽐如我就对imwrite函数输出的图⽚格式有⼀些疑问,下⾯对imwrite函数的⽤法进⾏解释,先放⼀下官⽅⽂档:
imwrite(A,filename) writes image data A to the file specified by filename, inferring the file format from the
extension. imwrite creates the new file in your current folder. The bit depth of the output image depends on the data type
of A and the file format. For most formats:
If A is of data type uint8, then imwrite outputs 8-bit values.
If A is of data type uint16 and the output file format supports 16-bit data (JPEG, PNG, and TIFF), then i
学习经验总结2009我的梦想>第29次中国互联网络发展状况统计报告mwrite outputs 16-bit values. If the output file format does not support 16-bit data, then imwrite returns an error.
If A is a grayscale or RGB color image of data type double or single, then imwrite assumes that the dynamic range is [0,1] and automatically scales the data by 255 before writing it to the file as 8-bit values. If the data in A is single,
convert A to double before writing to a GIF or TIFF file.
整形归来If A is of data type logical, then imwrite assumes that the data is a binary image and writes it to the file with a bit depth of 1, if the format allows it. BMP, PNG, or TIFF formats accept binary images as input arrays.
If A contains indexed image data, you should additionally specify the map input argument.
imwrite的⽤法本⾝也很简单,A是⼀个图像矩阵,从上述说明中可以看出,A的数据类型可以是uint8,uint16,logical等,还可以是indexed image data即索引图。filename是⼀个字符串,将输出图像的路径和⽂件名传给filename即可。更进⼀步从描述中可看出,输出图⽚⽂件的格式由后缀名(extension)决定,uint8基本都⽀持,uint16则仅有部分图⽚格式⽀持。此时我们就要specific⽂件名的后缀,防⽌出现error。
看⽂档⼜好奇这个indexed image即索引图是什么,在⽹上了⼀张图:
简单来说就是给⼀幅图像出现的所有RGB值编⼀个映射表,然后有⼀个和图像形状⼀样的索引矩阵,查表即可得到RGB图。

本文发布于:2024-09-21 13:40:49,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/155458.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:图像   输出   格式   看出   函数   矩阵   出现   决定
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议