matlab中imwrite函数详解(imwrite的输出格式)
参考资料:
https://www.mathworks.com/help/matlab/ref/imwrite.html?s_tid=srchtitle
你可能觉得imread函数很简单,但是还是有一些细节要注意。比如我就对imwrite函数输出的图片格式有一些疑问,下面对imwrite函数的用法进行解释,先放一下官方文档:
imwrite(
writes image data A
,filename
)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 typeuint8
, thenimwrite
outputs 8-bit values.If
A
is of data typeuint16
and the output file format supports 16-bit data (JPEG, PNG, and TIFF), thenimwrite
outputs 16-bit values. If the output file format does not support 16-bit data, thenimwrite
returns an error.If
A
is a grayscale or RGB color image of data typedouble
orsingle
, thenimwrite
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 inA
issingle
, convertA
todouble
before writing to a GIF or TIFF file.If
A
is of data typelogical
, thenimwrite
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图。
matlab中imwrite函数详解(imwrite的输出格式)的更多相关文章
- JavaScript正则表达式详解(二)JavaScript中正则表达式函数详解
二.JavaScript中正则表达式函数详解(exec, test, match, replace, search, split) 1.使用正则表达式的方法去匹配查找字符串 1.1. exec方法详解 ...
- 【转】linux 中fork()函数详解
在看多线程的时候看到了这个函数,于是学习了下,下面文章写的通俗易懂,于是就开心的看完了,最后还是很愉快的算出了他最后一个问题. linux 中fork()函数详解 一.fork入门知识 一个进程,包括 ...
- Linux中fork()函数详解(转载)
linux中fork()函数详解 一.fork入门知识 一个进程,包括代码.数据和分配给进程的资源.fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程,也就是两个进程可以做完全相同的事, ...
- C++中重载函数详解
函数的重载详解 什么时函数重载: 函数重载是指在同一作用域内,可以有一组具有相同函数名,不同参数列表的函数,这组函数被称为重载函数.重载函数通常用来命名一组功能相似的函数,这样做减少了函数名的数量,避 ...
- php中magic_quotes_gpc函数详解
magic_quotes_gpc函数在php中的作用是判断解析用户提示的数据,如包括有:post.get.cookie过来的数据增加转义字符“\”,以确保这些数据不会引起程序,特别是数据库语句因为特殊 ...
- python unittest框架中addCleanup函数详解
接上一篇doCleanups说明,这次介绍下另一个很好用的函数:addCleanup 还是老规矩,看官方文档说明: addCleanup(function, *args, **kwargs)¶ Add ...
- JavaScript基础内容中的函数详解
函数 函数:即方法 函数就是一段预先设置的功能代码块,可以反复调用,根据输入参数的不同,返回不同的值. 为什么使用函数: 1.方便调用 2.代码重用,利于维护 3.便于修改,便于重构 4.简化逻辑,利 ...
- python中groupby函数详解(非常容易懂)
一.groupby 能做什么? python中groupby函数主要的作用是进行数据的分组以及分组后地组内运算! 对于数据的分组和分组运算主要是指groupby函数的应用,具体函数的规则如下: df[ ...
- matlab的pdist函数详解
Pairwise distance between pairs of object(Pdist函数用于各种距离的生成) 语法: D=pdist(x) D=pdist(x,distance) 解释: D ...
随机推荐
- python list 与 String 互相转换
str0 = '127.0.0.1' list0 = str0.split('.') print(list0) #['127', '0', '0', '1'] str1 = '#'.join(list ...
- python-基站位置查询
本文采用的接口是聚合数据提供的 python2.7环境,3.x环境试了下好像不支持,获取位置信息为空 如下为运用代码: #coding=utf-8 ''' Created on 2019年9月18日 ...
- Java——读取和写入txt文件
package com.java.test.a; import java.io.BufferedReader; import java.io.BufferedWriter; import java.i ...
- 使用EditPlus根据指定字符批量换行,快速填充Postman请求参数键值对
1.当某个.ext格式的文件中的重复格式内容太多时,而又想要根据某个字符进行批量换行时,那么可以使用EditPlus进行批量换行. 在开发过程中就会经常遇到这种问题,比如把Url的请求参数,快速的填写 ...
- Centos7无界面化启动
Centos7无界面启动: 为了减少系统开销,有时候我们需要无图形界面启动linux(centos7) systemctl set-default multi-user.target (关闭图形界面) ...
- C#基础之方法的重载
在C#语言中,方法的重载作用非常大,但是使用重载需要注意方法的签名,必须有一种要不一样,具体指的是: 1.方法的返回值类型 2.方法的形参类型 3.形参类型的顺序 4.形参的个数 4.泛型的类型< ...
- [Python基础]007.字符串
字符串 内建操作 字符串长度 大小写变换 去空格或其他 连接字符串 查找替换 分割 判断 内建操作 字符串长度 len 代码 s = 'abcd' print len(s) 大小写变换 lower 小 ...
- 安卓全屏或沉浸式状态栏下输入框(EditText)被键盘遮挡解决方法
沉浸式状态栏用了一段时间了,一直没发现安卓在这方面的坑.最近在集成环信自定义UI的过程中,发现将环信界面设置为沉浸式之后最底部的消息输入框不随键盘弹起而变化了,一直显示在屏幕最下方,体验非常差. 后来 ...
- pandas读写csv,并增加一列
为读取csv,并DataFrame增加一列,再自由组合列并保存到csv文件: import pandas as pd sourceFile='d:\person.csv' #person.csv包括i ...
- Rocket - interrupts - Xbar
https://mp.weixin.qq.com/s/icPGf4KdSOudwuNpLxdo7w 简单介绍Xbar的实现. 1. 简单介绍 IntXbar主要用于把上游多个中断源的中断组合在一起,然 ...