ceshi
% void CLASS cam_xyz_coeff (float rgb_cam[3][4], double cam_xyz[4][3])
% {
% double cam_rgb[4][3], inverse[4][3], num;
% int i, j, k;
%
% for (i=0; i < colors; i++) /* Multiply out XYZ colorspace /
% for (j=0; j < 3; j++)
% for (cam_rgb[i][j] = k=0; k < 3; k++)
% cam_rgb[i][j] += cam_xyz[i][k] xyz_rgb[k][j];
%
% for (i=0; i < colors; i++) { /* Normalize cam_rgb so that /
% for (num=j=0; j < 3; j++) / cam_rgb * (1,1,1) is (1,1,1,1) */
% num += cam_rgb[i][j];
% for (j=0; j < 3; j++)
% cam_rgb[i][j] /= num;
% pre_mul[i] = 1 / num;
% }
% pseudoinverse (cam_rgb, inverse, colors);
% for (i=0; i < 3; i++)
% for (j=0; j < colors; j++)
% rgb_cam[i][j] = inverse[j][i];
% }
% void CLASS pseudoinverse (double (in)[3], double (out)[3], int size)
% {
% double work[3][6], num;
% int i, j, k;
%
% for (i=0; i < 3; i++) {
% for (j=0; j < 6; j++)
% work[i][j] = j == i+3;
% for (j=0; j < 3; j++)
% for (k=0; k < size; k++)
% work[i][j] += in[k][i] * in[k][j];
% }
% for (i=0; i < 3; i++) {
% num = work[i][i];
% for (j=0; j < 6; j++)
% work[i][j] /= num;
% for (k=0; k < 3; k++) {
% if (k==i) continue;
% num = work[k][i];
% for (j=0; j < 6; j++)
% work[k][j] -= work[i][j] * num;
% }
% }
% for (i=0; i < size; i++)
% for (j=0; j < 3; j++)
% for (out[i][j]=k=0; k < 3; k++)
% out[i][j] += work[j][k+3] * in[i][k];
% }
% const double xyz_rgb[3][3] = { /* XYZ from RGB */
% { 0.412453, 0.357580, 0.180423 },
% { 0.212671, 0.715160, 0.072169 },
% { 0.019334, 0.119193, 0.950227 } };
clc
clear all
cmsrc0 = [1.895316, -0.688256,-0.20706;
-0.180953,1.625399,-0.444446;
-0.0000147,-0.524012,1.524159;
0,0,0]
cam_xyz = [0.617188, -0.140625, -0.0390625;
-0.460938, 1.19531, 0.226563;
-0.0859375, 0.1953113, 0.545875;
0,0,0
];
cam_rgb = zeros(4,3);
inverse = zeros(4,3);
xyz_rgb = [0.412453, 0.357580, 0.180423,0;
0.212671, 0.715160, 0.072169,0;
0.019334, 0.119193, 0.950227,0];
cam_rgb = cam_xyz * xyz_rgb;
for i =1:3
cam_rgb(i,:) = cam_rgb(i,:) / sum(cam_rgb(i,:));
end
cam_rgb = cam_rgb(:,1:3);
colors = 3;
x11 = cam_rgb(1,1);
x12 = cam_rgb(1,2);
x13 = cam_rgb(1,3);
x21 = cam_rgb(2,1);
x22 = cam_rgb(2,2);
x23 = cam_rgb(2,3);
x31 = cam_rgb(3,1);
x32 = cam_rgb(3,2);
x33 = cam_rgb(3,3);
work = zeros(3,6);
work(1,1) = x11 x11 + x21 x21 + x31 * x31;
work(1,2) = x11 x12 + x21 x22 + x31 * x32;
work(1,3) = x11 x13 + x21 x23 + x31 * x33;
work(2,1) = x11 x12 + x21 x22 + x31 * x32;
work(2,2) = x12 x12 + x22 x22 + x32 * x32;
work(2,3) = x12 x13 + x22 x23 + x32 * x33;
work(3,1) = x11 x13 + x21 x23 + x31 * x33;
work(3,2) = x12 x13 + x22 x23 + x32 * x33;
work(3,3) = x13 x13 + x23 x23 + x33 * x33;
work(:,4:6) = [1,0,0;0,1,0;0,0,1];
% i =1
num1 = work(1,1);
work(1,1) = work(1,1) / num1;
work(1,2) = work(1,2) / num1;
work(1,3) = work(1,3) / num1;
work(1,4) = work(1,4) / num1;
work(1,5) = work(1,5) / num1;
work(1,6) = work(1,6) / num1;
% k = 2
num2 = work(2,1);
work(2,1) = work(2,1) - num2 * work(1,1);
work(2,2) = work(2,2) - num2 * work(1,2);
work(2,3) = work(2,3) - num2 * work(1,3);
work(2,4) = work(2,4) - num2 * work(1,4);
work(2,5) = work(2,5) - num2 * work(1,5);
work(2,6) = work(2,6) - num2 * work(1,6);
% k = 3
num3 = work(3,1);
work(3,1) = work(3,1) - num3 * work(1,1);
work(3,2) = work(3,2) - num3 * work(1,2);
work(3,3) = work(3,3) - num3 * work(1,3);
work(3,4) = work(3,4) - num3 * work(1,4);
work(3,5) = work(3,5) - num3 * work(1,5);
work(3,6) = work(3,6) - num3 * work(1,6);
% i = 2
num1 = work(2,2);
work(2,1) = work(2,1) / num1;
work(2,2) = work(2,2) / num1;
work(2,3) = work(2,3) / num1;
work(2,4) = work(2,4) / num1;
work(2,5) = work(2,5) / num1;
work(2,6) = work(2,6) / num1;
num2 = work(1,2);
work(1,1) = work(1,1) - num2 * work(2,1);
work(1,2) = work(1,2) - num2 * work(2,2);
work(1,3) = work(1,3) - num2 * work(2,3);
work(1,4) = work(1,4) - num2 * work(2,4);
work(1,5) = work(1,5) - num2 * work(2,5);
work(1,6) = work(1,6) - num2 * work(2,6);
num3 = work(3,2);
work(3,1) = work(3,1) - num3 * work(2,1);
work(3,2) = work(3,2) - num3 * work(2,2);
work(3,3) = work(3,3) - num3 * work(2,3);
work(3,4) = work(3,4) - num3 * work(2,4);
work(3,5) = work(3,5) - num3 * work(2,5);
work(3,6) = work(3,6) - num3 * work(2,6);
% i = 3
num1 = work(3,3);
work(3,1) = work(3,1) / num1;
work(3,2) = work(3,2) / num1;
work(3,3) = work(3,3) / num1;
work(3,4) = work(3,4) / num1;
work(3,5) = work(3,5) / num1;
work(3,6) = work(3,6) / num1;
num2 = work(1,3);
work(1,1) = work(1,1) - num2 * work(3,1);
work(1,2) = work(1,2) - num2 * work(3,2);
work(1,3) = work(1,3) - num2 * work(3,3);
work(1,4) = work(1,4) - num2 * work(3,4);
work(1,5) = work(1,5) - num2 * work(3,5);
work(1,6) = work(1,6) - num2 * work(3,6);
num3 = work(2,3);
work(2,1) = work(2,1) - num3 * work(3,1);
work(2,2) = work(2,2) - num3 * work(3,2);
work(2,3) = work(2,3) - num3 * work(3,3);
work(2,4) = work(2,4) - num3 * work(3,4);
work(2,5) = work(2,5) - num3 * work(3,5);
work(2,6) = work(2,6) - num3 * work(3,6);
out = zeros(3,3);
out(1,1) = work(1,4) * cam_rgb(1,1) + work(1,5) * cam_rgb(1,2) + work(1,6) * cam_rgb(1,3);
out(1,2) = work(2,4) * cam_rgb(1,1) + work(2,5) * cam_rgb(1,2) + work(2,6) * cam_rgb(1,3);
out(1,3) = work(3,4) * cam_rgb(1,1) + work(3,5) * cam_rgb(1,2) + work(3,6) * cam_rgb(1,3);
out(2,1) = work(1,4) * cam_rgb(2,1) + work(1,5) * cam_rgb(2,2) + work(1,6) * cam_rgb(2,3);
out(2,2) = work(2,4) * cam_rgb(2,1) + work(2,5) * cam_rgb(2,2) + work(2,6) * cam_rgb(2,3);
out(2,3) = work(3,4) * cam_rgb(2,1) + work(3,5) * cam_rgb(2,2) + work(3,6) * cam_rgb(2,3);
out(3,1) = work(1,4) * cam_rgb(3,1) + work(1,5) * cam_rgb(3,2) + work(1,6) * cam_rgb(3,3);
out(3,2) = work(2,4) * cam_rgb(3,1) + work(2,5) * cam_rgb(3,2) + work(2,6) * cam_rgb(3,3);
out(3,3) = work(3,4) * cam_rgb(3,1) + work(3,5) * cam_rgb(3,2) + work(3,6) * cam_rgb(3,3);
out'
% work = zeros(3,6);
% for i =1:3
% for j = 1:6
% if j == i+3
% work(i,j) = 1;
% else
% work(i,j) = 0;
% end
% end
%
% for j = 1:3
% for k = 1:colors
% work(i,j) = work(i,j) + cam_rgb(k,i) * cam_rgb(k,j);
% end
% end
% end
%
% for i =1:3
% num = work(i,i);
% for j = 1:6
% work(i,j) = work(i,j) / num;
% end
% for k = 1:3
% if(k == i)
% continue;
% end
% num = work(k,i);
% for j = 1:6
% work(k,j) = work(k,j) - work(i,j) * num;
% end
% end
% end
% out = zeros(3,3);
% for i = 1:colors
% for j =1:3
% out(i,j) =0;
% for k = 1:3
% out(i,j) = out(i,j) + work(j,k+3) * cam_rgb(i,k);
% end
% end
% end
%
% out = out'
ceshi的更多相关文章
- http://www.spasvo.com/ceshi/open/kyxncsgj/Jmeter/
http://www.spasvo.com/ceshi/open/kyxncsgj/Jmeter/
- 解决Swap file ".ceshi.c.swp" already exists!问题
关于swp文件:使用vi,常常能够看到swp这个文件,那这个文件是怎么产生的呢.当你打开一个文件,vi就会生成这么一个.(filename)swp文件以备不測,假设你正常退出,那么这个.(filena ...
- Fatal error: Call to undefined function Think\C() in /var/www/html/ceshi.hzheee.com/think/ThinkPHP/Library/Think/Think.class.php on line 334 这个问题解决
当APP_DEBUG为true时,包含图中这个文件,文件中又引导包含这些库文件,可以看出安装thinkphp3.2.3时ThinkPHP/Common/下是functions.php,把它改成func ...
- laotech老师唠科mac 深入浅出MAC OS X ceshi ruguokeyi
laotech老师唠科mac 深入浅出MAC OS X http://study.163.com/plan/planLearn.htm?id=1637004#/learn/resVideo?lesso ...
- Jquery的点击事件,三句代码完成全选事件
先来看一下Js和Jquery的点击事件 举两个简单的例子 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...
- Jquery(1)
鼠标点击事件: <input type="button" value="测试" onclick="test()" /> < ...
- JQuery实现表格的增加行和删除行
利用JQuery实现datatables插件的增加和删除行操作 在学习过程中遇到了这个利用JQuery对表格行的增加和删除,特记录下来以供初学者参考. 下面是主要的代码: <meta http- ...
- Jquary入门(添加 修改 表单元素)+ JSON+弹框
字符串拼接 计算机语言 都是 对 数据的处理(获取/修改数据) 添加元素 除了 固定的方法添加 以外 都是 字符串拼接(拼接成固定格式即可执行). 1.表单添加元素 append() 方 ...
- Jquery事件
在JS里加事件 <input type="button" value="测试" onclick="test()"/>跟一个函数 ...
随机推荐
- php程序 注册机制
密码加密方式 1.直接md5加密 2.md5和随机数(也可以是固定参数,如(Rfd4WE784)) 3.md5(md5) 4. 参考 function sp_password($pw,$authcod ...
- webapi集成owin使用Oauth认证时能获取accee_token仍无法登录的解决办法
HttpConfiguration webapiConfig = new HttpConfiguration(); IIocBuilder iocBuilder = new OwinAutofacIo ...
- 关于.dll' could not be found 的问题以及解决方案
最近做项目遇到这个问题,搞了半天,也没有解决. 后台看看了生成的详细信息,提示引用的版本不统一,最后移除,再添加一个相同版本的Mysql.Data.Mysql.Data.Entity.EF6 就解决了 ...
- jQuery导入Eclipse后报错解决方法
使用Eclipse 3.7及以上版本时,工程中加入jquery.min.js文件,发现该文件出现错误提示(红×),但使用Eclipse 3.7以前的版本就不会出现这种提示.是因为Eclips ...
- webSphere内存溢出
有一个做了很长时间的项目,是用websphere做生产环境的,可是一旦加载的项目过多,webSphere就很傲娇的内存溢出,这是一个折腾了公司里某个前辈很久很久的问题,因为是测试版,所以各种官方文档说 ...
- python --> 递归 以及装饰器
一.递归知识 函数迭套执行,逐层执行之后,满足某个条件之后就会停止执行,将return值返回上层的函数,上层函数再逐层返回,最终返回给最初始函数. 递归在斐波那契数列的应用[斐波那契数列特点:前两个数 ...
- c++ 接口和抽象类
其实对抽象类与接口的区别一直是搞不太清楚,最近正在学习<设计模式>,期间用到了很多c++多态的知识.这是才恍然发现,是应该整理下这方面的知识了.但在翻阅书本.上网查阅资料之际,发现有篇文章 ...
- [Machine Learning] 梯度下降法的三种形式BGD、SGD以及MBGD
在应用机器学习算法时,我们通常采用梯度下降法来对采用的算法进行训练.其实,常用的梯度下降法还具体包含有三种不同的形式,它们也各自有着不同的优缺点. 下面我们以线性回归算法来对三种梯度下降法进行比较. ...
- 如何使用FileZilla上传和下载文件
一.使用FileZilla上传文件 1 打开 FileZilla 按照如下图所示,填写远程 Linux 的 IP ,用户名,密码,还有端口号(默认22) 2 选中左边需要上传的文件,然后拖到右边,等待 ...
- maven实战(03)_依赖
(一) 依赖配置声明 包含以下的一些元素: <project> ... <dependencies> <dependency> <groupId>... ...