相机响应曲线计算(Debeve and Malik) |
您所在的位置:网站首页 › 相机的s值 › 相机响应曲线计算(Debeve and Malik) |
1.背景
相机的灰度值与实际辐照度值的关系不成线性关系,因此需要进行预标定。
通过上述公式,可以知道要想总曲线达到最佳重合,可以列出公式 相关求解代码如下 function [g,lE]=gsolve(Z,B,l) % Given a set of pixel values observed for several pixels in several % images with different exposure times, this function returns the % imaging system誷 response function g as well as the log film irradiance % values for the observed pixels. % % Assumes: % % Zmin = 0 % Zmax = 255 % % Arguments: % % Z(i,j) is the pixel values of pixel location number i in image j % B(j) is the log delta t, or log shutter speed, for image j % l is lamdba, the constant that determines the amount of smoothness % % Returns: % % g(z) is the log exposure corresponding to pixel value z ,g=log(E)+log(t) % lE(i) is the log film irradiance at pixel location i % w(z) is the weighting function value for pixel value z % here we set w(z) to a constant n = 256; m = size(Z,1); p = size(Z,2); w = ones(n,1)/n; % 创建稀疏零矩阵 A = sparse([], [], [], m*p+n+1,n+m, m*p*2 + n*3);% 前面两个变量为 b = zeros(size(A,1),1); k = 1; %% Include the data-fitting equations for i=1:m for j=1:p wij = w(Z(i,j)+1); A(k,Z(i,j)+1) = wij; A(k,n+i) = -wij; b(k,1) = wij * B(j); k=k+1; end end A(k,129) = 1; %% Fix the curve by setting its middle value to 0 k=k+1; % 计算g(Z_ij)前后的梯度 for i=1:n-2 %% Include the smoothness equations A(k,i)=l*w(i+1); A(k,i+1)=-2*l*w(i+1); A(k,i+2)=l*w(i+1); k=k+1; end % 相当于Ax=b,其中x前256为为g(i,j),后面为E_i,即对应像素的辐照度。 % A前面 m*p行每行有两个元素,分别是wij和-wij, % 后面1行是129列处值为1,最后的255行为三个数w,-2w,w,表示梯度计算 % % b 为wij * B(j) x = A\b; %% Solve the system using SVD g = x(1:n); lE = x(n+1:size(x,1)); |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |