Image 哪种图像处理技术可以消除漩涡(典型的微光成像伪影)并创建清晰的图像?
我拍了这张照片Image 哪种图像处理技术可以消除漩涡(典型的微光成像伪影)并创建清晰的图像?,image,image-processing,Image,Image Processing,我拍了这张照片 哪种图像处理技术可以消除漩涡(典型的微光成像伪影)并创建清晰的图像?有不同的技术可以从图像中过滤出伪影。有些基于机器学习,有些使用模式识别 我发现这个方法>基于优化的图案伪影去除 这就是其工作原理总结>将输入图像“I”分解为潜在自然图像“L”和图案伪影图像“E”,其中I=L+E。图案伪影具有非自然的光谱峰,并且此类峰被分离为“E”。 这段代码不能处理复杂的模式 以下是函数的matlab代码> function [L, E] = imdecpattern( Y, lambda,
哪种图像处理技术可以消除漩涡(典型的微光成像伪影)并创建清晰的图像?有不同的技术可以从图像中过滤出伪影。有些基于机器学习,有些使用模式识别 我发现这个方法>基于优化的图案伪影去除 这就是其工作原理总结>将输入图像“I”分解为潜在自然图像“L”和图案伪影图像“E”,其中I=L+E。图案伪影具有非自然的光谱峰,并且此类峰被分离为“E”。 这段代码不能处理复杂的模式 以下是函数的matlab代码>
function [L, E] = imdecpattern( Y, lambda, tol, nite )
%IMDECPATTERN recovers a degraded image with a pattern artifact
% by decomposing the image into the latent image and the pattern image.
%
% [L, E] = IMDECPATTERN( Y )
% [L, E] = IMDECPATTERN( Y, lambda, tol, nite )
%
% arguments
% Y : input image
% L : latent image
% E : artifact image
% lambda : decomposition degree (default lambda=3)
% tol : the tolerance of a constraint Y = L + E (default tolerance=0)
% nite : the number of iterations to solve the problem.
%
%
%
% This program solves the following equation
%
% min_{l,e} |Dl|2,1 + lambda |Fe|c,1
% s.t. | y - (l+e) |2 <= tol, 1'l = 0
%
% where y is an observed image, l is the latent image, e is the artifact image,
% D is differential filtering and F is Fourier transformation.
%
%
% REFERENCE
%
% K. Shirai, S. Ono, and M. Okuda, ``Minimization of mixed norm for frequency
% spectrum of images and its application of pattern noise decomposition,''
% EUSIPCO, 5pages, 2017.
%
%
% parameters
%
if ~exist( 'lambda', 'var' ) || isempty( lambda )
lambda = 3; % mainly controls decomposition degree
end
if ~exist( 'tol', 'var' ) || isempty( tol )
tol = 0; % tolerance of the l2 ball related to noise reduction
end
% for ADMM
if ~exist( 'nite', 'var' ) || isempty( nite )
nite = 30; % number of iterations
end
rho = 1; % step size
%
% proximity operators
%
% mixed l2,1 norm
% is directly written in the ADMM algorithm
% mixed lc,1 norm
prox_lc1 = @(V,gamma) V.*(1 - gamma./max(gamma,abs(V)));
% l2 ball projection centered at V with the radius V-Y
prox_l2ball = @(V,V_Y,tol) V + V_Y * (tol/max(tol,norm(V_Y(:)))); % V_Y = V - Y
% which corresponds to ( norm(V_Y(:)) <= tol ) ? ( V ) : ( Y + V_Y*(tol/norm(V_Y(:)) );
[sy,sx,sc] = size( Y );
N = sy*sx; % number of pixels
% % unitary Fourier transform, but the following non-unitary version is faster.
% F = @(X) fft2(X)/sqrt(N); Ft = @(X) sqrt(N)*ifft2(X);
%
% non-unitary Fourier transform
lambda = sqrt(N) * lambda;
F = @(X) fft2(X); Ft = @(X) real(ifft2(X));
Zeros = zeros(sy,sx,sc);
Ones = ones(sy,sx,sc);
% initialization of variables
L = Y; E = Zeros;
% aux variables Z and Lagrangian-multiplier variables U
Zlh = Zeros; Ulh = Zeros;
Zlv = Zeros; Ulv = Zeros;
Ze = Zeros; Ue = Zeros;
Z = Zeros; U = Zeros;
% filters
% circular differential filters
Dh = [0,-1,1];
Dv = [0;-1;1];
% laplacian filter
DhDh_DvDv = [0,-1,0;-1,4,-1;0,-1,0];
% pre-computation of inverse filters
FA11 = 1 + repmat( psf2otf( DhDh_DvDv, [sy,sx] ), [1,1,sc] );
FA22 = 1 + Ones;
FA12 = Ones;
FA21 = Ones;
idetFA = 1./(FA11.*FA22 - FA12.*FA21); % determinant
iFA11 = FA22 .* idetFA; iFA12 = -FA12 .* idetFA;
iFA21 = -FA21 .* idetFA; iFA22 = FA11 .* idetFA;
% % weighted version
% sigma = 0.5;
% FW = Ones;
% FW = repmat( psf2otf( fspecial( 'gaussian', 2*ceil(3*sigma)+1, sigma ), [sy,sx] ), [1,1,sc] );
% FW = fftshift(FW);
for t = 1:nite
%
% solve l and e
%
IZU = (Z - U);
Fbl = fft2( IZU...
+ imfilter( Zlh - Ulh, Dh, 'corr','circular' )...
+ imfilter( Zlv - Ulv, Dv, 'corr','circular' ) );
Fbe = fft2( IZU + Ft( Ze - Ue ) );
L = real( ifft2( iFA11.*Fbl + iFA12.*Fbe ) );
E = real( ifft2( iFA21.*Fbl + iFA22.*Fbe ) );
%
% solve z_l and u_l
%
Vlh = imfilter( L, Dh, 'conv','circular' ) + Ulh;
Vlv = imfilter( L, Dv, 'conv','circular' ) + Ulv;
% prox of l2,1 norm
Vl_norm = sqrt(Vlh.*Vlh + Vlv.*Vlv);
Scale = 1 - (1/rho) ./ max(1/rho, Vl_norm);
Zlh = Vlh .* Scale;
Zlv = Vlv .* Scale;
Ulh = Vlh - Zlh; % update u_l
Ulv = Vlv - Zlv;
%
% solve z_e and u_e
%
Ve = F( E ) + Ue;
gamma = (lambda/rho);
% gamma = (lambda/rho) * FW; % weighted version
Ze = prox_lc1( Ve, gamma );
% the constraint coresponding to mean(e)=0
Ze(1,1,:) = 0;
Ue = Ve - Ze; % update u_e
%
% solve z and u
%
V = (L + E) + U;
dVY = V - Y;
for c = 1:sc
Z(:,:,c) = prox_l2ball( Y(:,:,c), dVY(:,:,c), tol );
% % Actually, this version is faster than the above
% dVYc = dVY(:,:,c);
% norm_dVY = norm( dVYc(:) );
% if ( norm_dVY <= tol )
% Z(:,:,c) = V(:,:,c);
% else
% Z(:,:,c) = Y(:,:,c) + dVY(:,:,c) * (tol/norm_dVY);
% end
end
U = V - Z; % update U
end
end
函数[L,E]=imdecpattern(Y,lambda,tol,nite)
%IMDECPATTERN恢复带有模式伪影的降级图像
%通过将图像分解为潜影图像和模式图像。
%
%[L,E]=IMDECPATTERN(Y)
%[L,E]=IMDECPATTERN(Y,λ,tol,nite)
%
%论据
%Y:输入图像
%L:潜影
%伪影图像
%lambda:分解程度(默认lambda=3)
%tol:约束的公差Y=L+E(默认公差=0)
%nite:解决问题的迭代次数。
%
%
%
%该程序求解以下方程
%
%min|l,e|Dl|2,1+lambda|Fe|c,1
%s.t.| y-(l+e)| 2有不同的技术用于从图像中滤除伪影。有些基于机器学习,有些使用模式识别
我发现这个方法>基于优化的图案伪影去除
这就是其工作原理总结>将输入图像“I”分解为潜在自然图像“L”和图案伪影图像“E”,其中I=L+E。图案伪影具有非自然的光谱峰,并且此类峰被分离为“E”。
这段代码不能处理复杂的模式
以下是函数的matlab代码>
function [L, E] = imdecpattern( Y, lambda, tol, nite )
%IMDECPATTERN recovers a degraded image with a pattern artifact
% by decomposing the image into the latent image and the pattern image.
%
% [L, E] = IMDECPATTERN( Y )
% [L, E] = IMDECPATTERN( Y, lambda, tol, nite )
%
% arguments
% Y : input image
% L : latent image
% E : artifact image
% lambda : decomposition degree (default lambda=3)
% tol : the tolerance of a constraint Y = L + E (default tolerance=0)
% nite : the number of iterations to solve the problem.
%
%
%
% This program solves the following equation
%
% min_{l,e} |Dl|2,1 + lambda |Fe|c,1
% s.t. | y - (l+e) |2 <= tol, 1'l = 0
%
% where y is an observed image, l is the latent image, e is the artifact image,
% D is differential filtering and F is Fourier transformation.
%
%
% REFERENCE
%
% K. Shirai, S. Ono, and M. Okuda, ``Minimization of mixed norm for frequency
% spectrum of images and its application of pattern noise decomposition,''
% EUSIPCO, 5pages, 2017.
%
%
% parameters
%
if ~exist( 'lambda', 'var' ) || isempty( lambda )
lambda = 3; % mainly controls decomposition degree
end
if ~exist( 'tol', 'var' ) || isempty( tol )
tol = 0; % tolerance of the l2 ball related to noise reduction
end
% for ADMM
if ~exist( 'nite', 'var' ) || isempty( nite )
nite = 30; % number of iterations
end
rho = 1; % step size
%
% proximity operators
%
% mixed l2,1 norm
% is directly written in the ADMM algorithm
% mixed lc,1 norm
prox_lc1 = @(V,gamma) V.*(1 - gamma./max(gamma,abs(V)));
% l2 ball projection centered at V with the radius V-Y
prox_l2ball = @(V,V_Y,tol) V + V_Y * (tol/max(tol,norm(V_Y(:)))); % V_Y = V - Y
% which corresponds to ( norm(V_Y(:)) <= tol ) ? ( V ) : ( Y + V_Y*(tol/norm(V_Y(:)) );
[sy,sx,sc] = size( Y );
N = sy*sx; % number of pixels
% % unitary Fourier transform, but the following non-unitary version is faster.
% F = @(X) fft2(X)/sqrt(N); Ft = @(X) sqrt(N)*ifft2(X);
%
% non-unitary Fourier transform
lambda = sqrt(N) * lambda;
F = @(X) fft2(X); Ft = @(X) real(ifft2(X));
Zeros = zeros(sy,sx,sc);
Ones = ones(sy,sx,sc);
% initialization of variables
L = Y; E = Zeros;
% aux variables Z and Lagrangian-multiplier variables U
Zlh = Zeros; Ulh = Zeros;
Zlv = Zeros; Ulv = Zeros;
Ze = Zeros; Ue = Zeros;
Z = Zeros; U = Zeros;
% filters
% circular differential filters
Dh = [0,-1,1];
Dv = [0;-1;1];
% laplacian filter
DhDh_DvDv = [0,-1,0;-1,4,-1;0,-1,0];
% pre-computation of inverse filters
FA11 = 1 + repmat( psf2otf( DhDh_DvDv, [sy,sx] ), [1,1,sc] );
FA22 = 1 + Ones;
FA12 = Ones;
FA21 = Ones;
idetFA = 1./(FA11.*FA22 - FA12.*FA21); % determinant
iFA11 = FA22 .* idetFA; iFA12 = -FA12 .* idetFA;
iFA21 = -FA21 .* idetFA; iFA22 = FA11 .* idetFA;
% % weighted version
% sigma = 0.5;
% FW = Ones;
% FW = repmat( psf2otf( fspecial( 'gaussian', 2*ceil(3*sigma)+1, sigma ), [sy,sx] ), [1,1,sc] );
% FW = fftshift(FW);
for t = 1:nite
%
% solve l and e
%
IZU = (Z - U);
Fbl = fft2( IZU...
+ imfilter( Zlh - Ulh, Dh, 'corr','circular' )...
+ imfilter( Zlv - Ulv, Dv, 'corr','circular' ) );
Fbe = fft2( IZU + Ft( Ze - Ue ) );
L = real( ifft2( iFA11.*Fbl + iFA12.*Fbe ) );
E = real( ifft2( iFA21.*Fbl + iFA22.*Fbe ) );
%
% solve z_l and u_l
%
Vlh = imfilter( L, Dh, 'conv','circular' ) + Ulh;
Vlv = imfilter( L, Dv, 'conv','circular' ) + Ulv;
% prox of l2,1 norm
Vl_norm = sqrt(Vlh.*Vlh + Vlv.*Vlv);
Scale = 1 - (1/rho) ./ max(1/rho, Vl_norm);
Zlh = Vlh .* Scale;
Zlv = Vlv .* Scale;
Ulh = Vlh - Zlh; % update u_l
Ulv = Vlv - Zlv;
%
% solve z_e and u_e
%
Ve = F( E ) + Ue;
gamma = (lambda/rho);
% gamma = (lambda/rho) * FW; % weighted version
Ze = prox_lc1( Ve, gamma );
% the constraint coresponding to mean(e)=0
Ze(1,1,:) = 0;
Ue = Ve - Ze; % update u_e
%
% solve z and u
%
V = (L + E) + U;
dVY = V - Y;
for c = 1:sc
Z(:,:,c) = prox_l2ball( Y(:,:,c), dVY(:,:,c), tol );
% % Actually, this version is faster than the above
% dVYc = dVY(:,:,c);
% norm_dVY = norm( dVYc(:) );
% if ( norm_dVY <= tol )
% Z(:,:,c) = V(:,:,c);
% else
% Z(:,:,c) = Y(:,:,c) + dVY(:,:,c) * (tol/norm_dVY);
% end
end
U = V - Z; % update U
end
end
函数[L,E]=imdecpattern(Y,lambda,tol,nite)
%IMDECPATTERN恢复带有模式伪影的降级图像
%通过将图像分解为潜影图像和模式图像。
%
%[L,E]=IMDECPATTERN(Y)
%[L,E]=IMDECPATTERN(Y,λ,tol,nite)
%
%论据
%Y:输入图像
%L:潜影
%伪影图像
%lambda:分解程度(默认lambda=3)
%tol:约束的公差Y=L+E(默认公差=0)
%nite:解决问题的迭代次数。
%
%
%
%该程序求解以下方程
%
%min|l,e|Dl|2,1+lambda|Fe|c,1
%s.t.| y-(l+e)| 2什么“漩涡”?我不知道我在看什么,但我看到了典型的微光成像伪影。有关您问题的更多信息会有所帮助。谢谢您的反馈,@Dai。你所说的“典型的微光成像伪影”就是我所说的“漩涡”(即某些图像处理程序中漩涡产生的效果)。如何将“典型的微光成像伪影”最小化?通常是微光摄影中出现的噪声。避免这种情况的最好方法是在三脚架上进行多次曝光,并将其平均。中值滤波器也很有用。如果你只需要从这一点开始,没有什么能创造出清晰的图像。信噪比太低了。你能做的最好的方法是涂抹噪声,但这也会涂抹图像特征。在你的相机上使用不同的(较低的)ISO设置…什么“漩涡”?我不知道我在看什么,但我看到了典型的微光成像伪影。有关您问题的更多信息会有所帮助。谢谢您的反馈,@Dai。你所说的“典型的微光成像伪影”就是我所说的“漩涡”(即某些图像处理程序中漩涡产生的效果)。如何将“典型的微光成像伪影”最小化?通常是微光摄影中出现的噪声。避免这种情况的最好方法是在三脚架上进行多次曝光,并将其平均。中值滤波器也很有用。如果你只需要从这一点开始,没有什么能创造出清晰的图像。信噪比太低了。你能做的最好的方法是涂抹噪声,但这也会涂抹图像特征。在你的相机上使用不同的(较低的)ISO设置。。。