Reading image using uiget file output

How to save the image in a variable (say I) obtained with the command uigetfile()? For example, I selected an image through

[FileName PathName] = uigetfile('E:\*.jpg','Select an image');

Now I want to save the selected image in variable I.

+5
source share
2 answers

The code below will work for you: -

[FileName,PathName] = uigetfile('*.jpg','Select an image');
image=imread(strcat(PathName,FileName));
+5
source

Use command imread

  if ~isequal(FileName,0)
      I = imread(fullfile(PathName,FileName));
  end

isequal - This is a user click click verification.

+2
source

All Articles