MATLAB Answers


How can I use uiimport to import an image and then store the data in common variables (from struct to other data structures)?

Asked by Thiago
on 25 Jan 2013

I'm studying image processing, and I built this function to perform piecewise linear transformation. I'd like to prompt the user to choose a file from the disk to be processed. Let's say I use: a = uiimport; and then I choose an image, let's say cameraman.tif. When I do so, a (the struct) has the data I need in a.cameraman (I don't get to choose the struct field name or whatever), which can in turn be stored as, for example, an uint8 variable: x = uint8(a.cameraman); My problem is, once the user is going to choose the image, and I want the function to work on supposedly any monochrome image, how can I write a command line that will have this content stored the way I want (and be accessible/worked on simply by assigning the content to a basic variable), regardless of the filename, and therefore regardless of the struct field name?



No products are associated with this question.

1 Answer

Answer by Image Analyst
on 25 Jan 2013

I've never seen that. Why don't you simply want to use imread()? Why make it hard on yourself?

grayImage = imread(fullFileName);


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!