Info

This question is closed. Reopen it to edit or answer.

I want to store "estimatedpsf" value of 100 images in excel file which contains table as "Images","​radius","e​strad"

3 views (last 30 days)
i made a code in which it estimates the radius of images which is working correctly but problem is that i have to do it for 100 images and store value of "EstimatedPSF" in a excel file which contains table as"Images","radius","estrad" 3 coloumn.
N=5; allResults=[]; images=cell(1,N);
%d=0;
for k=1:N
images{k}=(imread(sprintf('F:\\major\\dataset\\standard_dataset_blurred\\Defocus\\log_b%d.bmp',k)));
f=images{k};
%subplot(2,2,1);imshow(f);title('Original Image');
PSF = 3
blur=fspecial('disk',PSF); %PSF = radius of the blur
%subplot(2,2,2);imshow(blur);title('Blur');
degradedimage=imfilter(f,blur,'circular'); % Degrading the image
%subplot(2,2,2);imshow(degradedimage);title('Degraded image');
% Restoration using LUCY
lucyrestoredimage = deconvlucy(degradedimage,blur);
%subplot(2,2,3);imshow(lucyrestoredimage);title('Lucy Deconvolved image');
%----------------------------------------------------------------------- %Estimating the wider range of Radius of PSF -> here 10, 20, 30, 40
%----------------------------------------------------------------------
j=1;
for i1=3:10:40 % MAximum possible radius (PSF) that we are assuming here is till 40.
b1=fspecial('disk',i1);
estf=deconvlucy(degradedimage,b1); % Restoring the degraded image with PSF of different range
MSE(1,j) = MeanSquareError(f,estf); %Calculatinf MSE with each of the PSF values
[minMSE, minPSFcolumn] = min(MSE);
while MSE(1,j) == min(MSE)
widePSF = i1;
break
end
j=j+1;
end
% ---------------------------------------------------------------------------------- % Finding finer value of PSF by choosing the range inbetweem the wider estimated PSF %------------------------------------------------------------------------------------ j2=1;
p = widePSF - 5;
if p<0
p = 1;
else
p = widePSF - 5;
end
q = widePSF + 5;
for i2=p:1:q
b2=fspecial('disk',i2);
estf2=deconvlucy(degradedimage,b2); % Restoring the degraded image with finer PSF of different range
MSE2(1,j2) = MeanSquareError(f,estf2); %Calculatinf MSE with each of the PSF values
[minMSE2, minPSFcolumn2] = min(MSE2);
while MSE2(1,j2) == min(MSE2)
EstimatedPSF = i2; %Actual PSF
filename = 'results.xlsx';
% answerA=
%tableA(i,:)=[answerA EstimatedPSF];
xlswrite(filename, tableA);
break
end
j2=j2+1;
end end

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!