필터 지우기
필터 지우기

how to browse an image?

조회 수: 11 (최근 30일)
bharath raavudi
bharath raavudi 2013년 5월 14일
댓글: Jaliya Samarakkody 2020년 8월 28일
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에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by