Effacer les filtres
Effacer les filtres

how to browse an image?

11 vues (au cours des 30 derniers jours)
bharath raavudi
bharath raavudi le 14 Mai 2013
Commenté : Jaliya Samarakkody le 28 Août 2020
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?

Réponses (3)

Image Analyst
Image Analyst le 14 Mai 2013
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 commentaires
Shashank Rao
Shashank Rao le 17 Mai 2013
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 le 17 Mai 2013
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.

Connectez-vous pour commenter.


David Sanchez
David Sanchez le 14 Mai 2013
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 le 27 Août 2020
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 commentaires
Image Analyst
Image Analyst le 28 Août 2020
OK, so make sure that file exists. Then the problem will go away.
Jaliya Samarakkody
Jaliya Samarakkody le 28 Août 2020
Thanks.! I have already drop the file into the folder

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by