フィルターのクリア

how get the information of the image instead of using imfinfo?

2 ビュー (過去 30 日間)
Manoj Kumar
Manoj Kumar 2014 年 6 月 19 日
コメント済み: Manoj Kumar 2014 年 6 月 20 日
Hi,
I used imfinfo to get the details of width, height, colortype and bitspersample for the selected image with the following code:
[baseFileName,folder]=uigetfile('*'); % read the input image
ImageOriginal=imread([folder,baseFileName]);
info=imfinfo(baseFileName);
% To pull out the BitsPerSample since few images don't have that info
hasField = isfield(info, 'BitsPerSample');
if hasField % We can print it.
details= sprintf(' \n \n \n \n Width= %d \n Height=%d \n ColorType=%s \n BitsPerSample= %d %d %d \n', info.Width, info.Height,info.ColorType, info.BitsPerSample);
else % we can't print it.
details= sprintf(' \n \n \n \n Width= %d \n Height=%d \n ColorType=%s \n', info.Width, info.Height,info.ColorType);
end
But the problem is, to use imfinfo the file must be in the currentfolder or in a folder on the MATLAB path.
But when I try to pick an image in another folder, I am facing an error. How can I get the details of the image even if it is not in the current folder or current directory? Is there any other function to get those details?
Thank you...

採用された回答

Sean de Wolski
Sean de Wolski 2014 年 6 月 19 日
編集済み: Sean de Wolski 2014 年 6 月 19 日
How are you getting the image? Most of the interactive tools, such as uigetfile return the full path as the second output. You can then use fullfile to build the full path.
For example:
[filename,filepath] = uigetfile('*.png')
fullpath = fullfile(filepath,filename)
imfinfo(fullpath)
  1 件のコメント
Manoj Kumar
Manoj Kumar 2014 年 6 月 20 日
It is working , thanks for your help....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by