Create a property for your app class to hold the image.
You appear to be using appdsigner. In appdesigner's code view, on the left panel look for "properties" and add a new one, call it Image (or b, but probably Image is better).
Remove your global declaration.
Your upload callback should look like
function UploadButtonPushed2(app, event)
[file,path] = uigetfile({'*.png';'*.jpg';'*.tiff';'*.jpeg'},...
'File Selector');
a=imread(file)
app.Image=imcrop(a,[145 58 370 370])
imshow(app.Image,'Parent',app.UIAxes)
title(sprintf('%s',file),'Parent',app.UIAxes)
end
and your deconv button callback should look like
function DeconvoluteButtonPushed(app, event)
PSF = fspecial('gaussian',[371 371],app.GaussianVarianceEditField.Value)
[J,psfr]=deconvblind(app.Image,PSF,app.IterationsEditField.Value)
figure
subplot(131)
imagesc(J)
colorbar
subplot(132)
imagesc(psfr)
colorbar
subplot(133)
imagesc(PSF)
colorbar
end
Best Answer