str2num for looping through images
1 次查看(过去 30 天)
显示 更早的评论
Hi Everyone! I'm trying to have a for loop that will cycle through multiple images. Take my trainer pic for example. There are 3 pictures. Instead of reading the file 3 times, can someone help?
Keep in mind the following
- trainer1.png,trainer2.png, and trainer3.png are 3 different pictures
- trainerPic is the axes in which it will be displayed
Here's what I have:
[handles.v1,handles.b,handles.a1] = imread('trainer1.png');
[handles.v2,handles.b,handles.a2] = imread('trainer2.png');
[handles.v3,handles.b,handles.a3] = imread('trainer3.png');
i=true
while(i==true)
% trainer sequence
axes(handles.trainerPic)
handles.V = imshow(handles.v1)
set(handles.V,'AlphaData',handles.a1)
pause(0.3)
handles.V = imshow(handles.v2)
set(handles.V,'AlphaData',handles.a2)
pause(0.3)
handles.V = imshow(handles.v3)
set(handles.V,'AlphaData',handles.a3)
end
0 个评论
回答(1 个)
Image Analyst
2014-8-22
What is handles.a1, a2, and a3? Where did you see that imread() returns 3 outputs? What do you think the third output is supposed to be? I've never used more than 2 outputs and don't see anything in the help about 3 outputs.
2 个评论
Image Analyst
2014-8-22
I'm really not sure what you want to do and why you have a loop. Do you want to show images #2 and 3 in the overlay (alpha channel) above image #1? Or maybe you want to process a sequence of images, like the FAQ shows you http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F Let us know if we can help further (after you explain better).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!