フィルターのクリア

Randomizing an array or vector of images and displaying the image on an axis.

2 ビュー (過去 30 日間)
Hao Wei Low
Hao Wei Low 2015 年 4 月 23 日
コメント済み: Hao Wei Low 2015 年 4 月 23 日
So I want to randomize an array or vector of images and displaying the images on an axis. Below is the code I'm trying but its giving errors. Any help would be greatly appreciated.
image1=imread('imgae1.jpg')
image2=imread('image2.jpg')
sequence={image1 image2}
a=randperm(sequence)
axes(handles.axes1)
imshow(a(1))

採用された回答

Guillaume
Guillaume 2015 年 4 月 23 日
Nearly there. You can't use randperm on a cell array, but you can use it to get a random permutation of indices that you then use to reorder the cell array:
sequence = {image1 image2};
randidx = randperm(numel(sequence));
randsequence = sequence(randidx);
To display the first image in randsequence:
imshow(randsequence{1}); %note the curly brackets and not round brackets

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by