|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message
<764de644-a7f3-4bbe-b830-
7b392401ef3d@f63g2000hsf.googlegroups.com>...
> On Jun 6, 12:12=A0am, rober...@ibd.nrc-cnrc.gc.ca (Walter
Roberson)
> wrote:
> > In article <g2a8it$im...@fred.mathworks.com>,
> >
> > Jessica =A0<jyorzin...@ucdavis.edu> wrote:
> > >I have a list of images, such as:
> > >I would like to create a loop in which I can display
these
> > >images in a randomized order without replacement
> >
> > randperm()
> > --
> > =A0 "MAMA: Oh--So now it's life. Money is life. Once
upon a time freedom
> > =A0 =A0used to be life--now it's money. I guess the
world really do change=
> .
> > =A0 =A0WALTER: No--it was always money, Mama. We just
didn't know about it=
> ."
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0 =A0 =A0 =A0 =
> =A0 =A0 =A0 =A0 =A0 -- Lorraine Hansberry
>
> ------------------------------------
> Jessica:
> Like Walter said, you can use randperm. Then you just
need to figure
> out which array to display. You could stick the images
into a higher
> order array and then just get them out of that using the
randperm
> value as an index. For example, load all the 2D
monochrome images
> into one big 3D array, or all the 3D color images into
one big 4
> dimensional array. This is good if you have a lot of
memory - enough
> to read in ALL of the images you intend to display. This
also works
> if you have a variable number of images, like if people
selected some
> variable number of filenames from a listbox. The other
option would
> be to put the randperm value into a big switch/case
statement and read
> it in from disk each time. This takes less memory but
could be slower
> because of having to do disk access each time. The same
method would
> also work if you just kept a bunch of separate images as
variables in
> memory. This method works only for a known number of
images because
> you have to put in a case statement for each one.
> Regards,
> ImageAnalsyt
> -----------------------------------------------------
Thanks for these suggestions. Based on what was advised, I
came up with:
x = str2mat
('C:\Users\Desktop\Sample\a.bmp','C:\Users\Desktop\Sample\b.
bmp','C:\Users\Desktop\Sample\c.bmp');
NumberofPictures=3;
RandomNumber=randperm(3);
imread('C:\Users\Desktop\Sample\a.bmp');
imread('C:\Users\Desktop\Sample\b.bmp');
imread('C:\Users\Desktop\Sample\c.bmp');
for S=1:NumberofPictures
T=RandomNumber(1,S);
ImageUp =x(T,:);
imshow(ImageUp);
end;
I am much closer to what I need to do but still am
uncertain about some things. Is there something that I can
write to indicate how long each picture will remain on the
screen? Is there a way to make it so the picture fills up
the entire screen without saying "Figure 1," "File," etc.
(i.e., so the loop is like a slideshow presentation)?
|