Cody

# Problem 682. Image Processing 002 : Fix Vignetting in a Visible Sensor

Solution 569743

Submitted on 29 Jan 2015 by Jean-Marie Sainthillier
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### Test Suite

Test Status Code Input and Output
1   Pass
%% %Typical Vignette load penny.mat; Timg=double(P); Timg=Timg+250; [nr nc]=size(Timg); obscuration=zeros(1,nc); widthL=24; widthR=16; maxobsL=.16; maxobsR=.20; % ObscurationLinear obscuration(1:1+widthL)=maxobsL*(widthL-(0:widthL))/widthL; obscuration(end:-1:end-widthR)=maxobsR*(widthR-(0:widthR))/widthR; Vimg=bsxfun(@times,Timg,1-obscuration); % Processing Fimg=Vignette_fix(Vimg,obscuration); % % Verification tolerance=[0.01 1]; Pass=1; % Hi check tcheck=(Timg*(1+tolerance(1))+tolerance(2))-Fimg; if min(tcheck(:))<0,Pass=0;end % Lo check tcheck=Fimg-(Timg*(1-tolerance(1))-tolerance(2)); if min(tcheck(:))<0,Pass=0;end assert(isequal(Pass,1))

[Warning: Matrix is singular to working precision.] [> In Vignette_fix at 4 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

2   Pass
%% % Low Image Signal load penny.mat; Timg=double(P); Timg=Timg+50; [nr nc]=size(Timg); obscuration=zeros(1,nc); widthL=16; widthR=12; maxobsL=.08; maxobsR=.12; % ObscurationLinear obscuration(1:1+widthL)=maxobsL*(widthL-(0:widthL))/widthL; obscuration(end:-1:end-widthR)=maxobsR*(widthR-(0:widthR))/widthR; Vimg=bsxfun(@times,Timg,1-obscuration); % Processing Fimg=Vignette_fix(Vimg,obscuration); % % Verification tolerance=[0.01 1]; Pass=1; % Hi check tcheck=(Timg*(1+tolerance(1))+tolerance(2))-Fimg; if min(tcheck(:))<0,Pass=0;end % Lo check tcheck=Fimg-(Timg*(1-tolerance(1))-tolerance(2)); if min(tcheck(:))<0,Pass=0;end assert(isequal(Pass,1))

[Warning: Matrix is singular to working precision.] [> In Vignette_fix at 4 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!