MATLAB 中几个颜色空间的坐标范围
在一些图象处理的程序中,我们经常要在不同的颜色空间操作,而且经常要把各颜色空间的坐标转化到 [0,1] 之间,这就需要知道一些常用颜色空间的坐标范围。
虽然可以通过颜色空间转化的公式推导这些范围,但是不同的颜色空间转换的程序之间总是有细微的差别。
本文记录了 MATLAB 2011b 中用 makecform, applycform 进行转换得到 LAB, LUV, xyY 空间的坐标范围。
代码如下:
R = :;
cxyz = makecform('srgb2xyz');
cs = {'lab', 'uvl', 'xyl'};
c = {makecform('xyz2lab'), makecform('xyz2uvl'), makecform('xyz2xyl')};
max1 = ones(,)*(-Inf); min1 = ones(,)*Inf;
for i = :length(c)
fprintf('%s ...\n', cs{i});
for r = R
if mod(r, ) == , fprintf('r=%d...\n',r);end
[g b] = meshgrid(R,R);
rgb = ([r*ones(^,) g(:) b(:)])/;
xyz = applycform(rgb, cxyz);
dest = applycform(xyz, c{i});
tmpmax = max(dest); tmpmin = min(dest);
max1(i,:) = max(max1(i,:), tmpmax);
min1(i,:) = min(min1(i,:), tmpmin);
end
end
for i = :length(cs)
fprintf('\n%s:\n', cs{i});
for j = :
fprintf('%d: [%.2f, %.2f]\n', j,min1(i,j), max1(i,j));
end
end
打印结果如下:
lab:
1: [0.00, 100.00]
2: [-79.25, 93.55]
3: [-112.04, 93.40]
uvl:
1: [0.00, 0.46]
2: [0.00, 0.38]
3: [0.00, 1.00]
xyl:
1: [0.00, 0.65]
2: [0.00, 0.60]
3: [0.00, 1.00]
MATLAB 中几个颜色空间的坐标范围的更多相关文章
- 在matlab中进行地理坐标和像素坐标的相互转换
clc;close all;clear; %地理坐标和像素坐标的相互转换 [pic,R]=geotiffread('boston.tif'); %读取带地理坐标信息的tif影像 [m,n,~]=siz ...
- MATLAB中求矩阵非零元的坐标
MATLAB中求矩阵非零元的坐标: 方法1: index=find(a); [i,j]=ind2sub(size(a),index); disp([i,j]) 方法2: [i,j]=find(a> ...
- matlab中subplot 在平铺位置创建坐标区
来源:https://ww2.mathworks.cn/help/matlab/ref/subplot.html?searchHighlight=subplot&s_tid=doc_srcht ...
- matlab中imread 从图形文件读取图像
来源:https://ww2.mathworks.cn/help/matlab/ref/imread.html?searchHighlight=imread&s_tid=doc_srchtit ...
- matlab中patch函数的用法
http://blog.sina.com.cn/s/blog_707b64550100z1nz.html matlab中patch函数的用法——emily (2011-11-18 17:20:33) ...
- MATLAB中plot()画图的颜色线型和希腊字母参数设置
y 黄色 · 点线 m 粉红 ○ 圈线 c ...
- 在matlab中进行遥感影像地理坐标的相互转换
在matlab中进行图像处理,一般使用的都是图像本地坐标,以左上角(1,1)开始.处理完成后,如果要将结果在带地理坐标的遥感影像中显示,或者需要输出成shp文件,就需要涉及到本地坐标和地理坐标的转换, ...
- Matlab中plot函数参数解析
功能 二维曲线绘图 语法 plot(Y) plot(X1,Y1,...) plot(X1,Y1,LineSpec,...) plot(...,'PropertyName',PropertyValue, ...
- matlab中disp函数的使用
disp函数直接将内容输出在Matlab命令窗口中, 关键是看disp函数怎么把字符和数字在一起进行显示. matlab中disp()就是屏幕输出函数,类似于c语言中的printf()函数 %%以下是 ...
随机推荐
- Codeforces Round #410 (Div. 2)B. Mike and strings(暴力)
传送门 Description Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In ...
- 23.协程的使用场景,高I/O密集型程序
import time def one_hundred_millionA(): start_time = time.time() i = 0 for _ in range(100000000): i ...
- Django+python报错与解决方法
编码信息导致修改django文件下的debug.py文件331行的编码格式 with Path(CURRENT_DIR, 'templates', 'technical_500.html').open ...
- Uncaught TypeError: Cannot set property onclick' of null
如果出现以上问题,只需要把<script src="xxx.js"></script> 移动到最后,</body>的前面;
- [暑假集训Day2T1]种树
标算是贪心,我写了个差分约束????? 设dist[i]表示1-i号土地种的树的总棵数,考虑以下几种约束条件: 1)dist[y]>=dist[x]+z,即x号土地至y号土地间至少种了z棵树 2 ...
- 初学Java 求最大公约数
import java.util.Scanner; public class GreatesCommonDivisor { public static void main(String[] args) ...
- python常用函数 S
slice(int,int) 切片,可以为切片命名增加可读性. 例子: sorted(iterable, key) 排序,支持传入参数,例如通过itemgetter传入参数(itemgetter可以传 ...
- 【LeetCode】树(共94题)
[94]Binary Tree Inorder Traversal [95]Unique Binary Search Trees II (2018年11月14日,算法群) 给了一个 n,返回结点是 1 ...
- Vue:替换/合并现有的特性
假设这是 bs-date-input 的模板: <input type="date" class="form-control"> 为了给该日期选择器 ...
- 学会如何使用shiro
摘:https://www.cnblogs.com/learnhow/p/5694876.html 一.架构 要学习如何使用Shiro必须先从它的架构谈起,作为一款安全框架Shiro的设计相当精妙.S ...