how to browse an image?

15 次查看(过去 30 天)
bharath raavudi
bharath raavudi 2013-5-14
i need to browse an image and give the same image as input in a file to process it. i am new in matlab and dont know much about matlab. can anyone here help me?

回答(3 个)

Image Analyst
Image Analyst 2013-5-14
I'm not sure what browse an image means to you. Maybe it means to select an image file from a folder on your computer (browse for an image), in which case you'd do
[baseFileName, folder] = uigetfile({'*.png';'*.jpg';'*.JPG';'*.bmp';'*.tif'})
fullFileName = fullfile(folder, baseFileName)
or perhaps you want to inspect an image's color values:
imtool(rgbImage); % Can also use a gray image.
If you mean something other than one of those two, then please explain in more detail what "browse an image" means.
  2 个评论
Shashank Rao
Shashank Rao 2013-5-17
Hi, I think Mr. Bharath and me are facing same problem. Here Bharath want to say that in some folder or directory he have some image. He want to access it using matlab coading so that he can do some changes to it. Am i right Mr. Bharath?
Image Analyst
Image Analyst 2013-5-17
But I don't know where your difficulty lies. So what's the problem? Just construct the filename, call imread() to bring it from disk into a variable in your program, and start doing something with it.
rgbImage = imread(fullFileName); % or call it grayImage if it's monochrome.

请先登录,再进行评论。


David Sanchez
David Sanchez 2013-5-14
To get a image from any location, try this:
MY_IMAGE = uigetfile({'*.jpg','*.JPG','*.bmp','*.tif'}) % add any extension you need
MY_IMAGE will be a string with your file name, later, you can read it, load it or do whatever you need to do.
For files in a directory other than the working one:
[MY_IMAGE MY_PATH] = uigetfile({'*.jpg','*.JPG','*.bmp','*.tif'})
my_file = fullfile(MY_PATH.MY_IMAGE) % full directory of your file

Jaliya Samarakkody
Jaliya Samarakkody 2020-8-27
When I am trying to read image from my desktop following error appears
Error using imread > get_full_filename(line567)
File 'C:\Users\Pehelinie\Desktop\digital-images-week2_quizzes-lena.gif' does not exist
Error in imread (line 374)
fullname = get_full_filename(filename);
  2 个评论
Image Analyst
Image Analyst 2020-8-28
OK, so make sure that file exists. Then the problem will go away.
Jaliya Samarakkody
Jaliya Samarakkody 2020-8-28
Thanks.! I have already drop the file into the folder

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by