Loading MatLab .fig file as an Image
1 view (last 30 days)
I have recently cropped an image and saved is at a .fig MatLab file so that I can plot out and edit its histogram in the future. Currently I am unsure of how to load the image such that I can do my histogram.
I read online about hgload, but when I load it and plot, it only shows 1 point in the histogram.
Can anyone guide me?
Regards Guan Zhao
Image Analyst on 22 Sep 2012
That's inefficient and confusing. Just take the histogram again when you want it later, or if you want to save the histogram itself, just save the histogram with save(). Don't save a displayed figure, with all its background, axes tick marks, etc. and then try to get back to the original image from a figure - it just doesn't make sense.
% Save the cropped image
imwrite( croppedImageArray, fullFileName);
% or save the histogram
[pixelCounts grayLevels] = imhist(croppedImageArray);
save(fullMATFileName, 'pixelCounts', 'grayLevels');