how to open the filename in thisstatement "filename = 'output.bmp'"
1 次查看(过去 30 天)
显示 更早的评论
filename = 'output.bmp'
1 个评论
Image Analyst
2012-10-1
This is really basic stuff. If you want a tutorial of other basic stuff you'll need to do image processing, see my image segmentation tutorial "BlobsDemo": http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 It does basic blob detection and measurement.
回答(2 个)
Wayne King
2012-10-1
编辑:Wayne King
2012-10-1
With imread?
im = imread(filename);
The folder containing output.bmp has to be on the MATLAB path.
1 个评论
Image Analyst
2012-10-1
Vinayak, it's good practice to use exist and fullfile
fullFileName = fullfile(folder, 'output.bmp');
if exist(fullFileName, 'file')
% File exists, read it in.
imageArray = imread(fullFileName);
else
% Not there - alert the user.
warningMessage = sprintf('Image file not found:\n%s', fullFileName);
uiwait(warndlg(warningMessage));
imageArray = []; % Create a null array (avoids certain other errors).
end
folder obviously holds a string that is the folder name where your image file lives.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!