Filter löschen
Filter löschen

how to open the filename in thisstatement "filename = 'output.bmp'"

1 Ansicht (letzte 30 Tage)
Vinayak
Vinayak am 1 Okt. 2012
filename = 'output.bmp'
  1 Kommentar
Image Analyst
Image Analyst am 1 Okt. 2012
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Wayne King
Wayne King am 1 Okt. 2012
Bearbeitet: Wayne King am 1 Okt. 2012
With imread?
im = imread(filename);
The folder containing output.bmp has to be on the MATLAB path.
  1 Kommentar
Image Analyst
Image Analyst am 1 Okt. 2012
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.

Melden Sie sich an, um zu kommentieren.


Thomas
Thomas am 1 Okt. 2012
Bearbeitet: Thomas am 1 Okt. 2012
Do you want to read it or display it..
to read it put it into a variable, (make sure output.bmp is on the path or in current directory)
filename = 'output.bmp'
ii=imread(filename);
%to display after being read
imshow(ii)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by