Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
Jeff

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 " <beachbumz123@yahoo.com> wrote in message <jqlcuq$l6c$1@newscl01ah.mathworks.com>...
> 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: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
>
> 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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.