The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Indexing Images from For Loop Import
Replies: 4   Last Post: Jun 6, 2012 2:48 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 107
Registered: 2/27/10
Re: Indexing Images from For Loop Import
Posted: Jun 5, 2012 3:12 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Zachary " <> wrote in message <jqlcuq$l6c$>...
> Hi
> I am struggling with a simple code where I want to index all of the images I am importing from the directory so that I can manipulate each image individually. I read that MATLAB imread stores the image in an array; however, I am struggling with accessing the images. I have tried using both cat() and cell() with no luck. I am using the same code as in the FAQ to bring the pictures into MATLAB. How can I access each image from imageArray? Note: I have tried using imshow(imageArray(2)), but it gives me the same image as imshow(imageArray(1))
> Link to FAQ:
> Thanks
> Z

In that FAQ, the images are being read in one at a time, and not stored as a multidimensional array. imageArray is overwritten every time the loop is run. To access a specific image you need to run all the code in that loop, including setting jpegFiles(k).name, where k = the index of the image you want to access.

If you want to store all the images, you will probably want to use a structure (i.e. images(k).image = imread(fullFileName); ). If you can guarantee all the images have the same dimensions, then an array would work also.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.