在Matlab的滑块中同时显示/连接两个图像? [英] To show/join Two Images Simultaneously in Matlab's slider?
问题描述
我无法制作太大的文件(例如尝试
每个图像后滑块中断。
图片只是两张图片的截图:滑块的开头和结尾。蓝色区域只是OS X GUI,但仍然表明开始和结束之间存在间隙和中断。
如何在Matlab的滑块中同时显示/加入两个图像?
为了在这个滚动窗口中并排显示多个图像,我认为最简单的方法是将所有图像预先加载到<$ c $的数组中c> [nRows x(nColumns * nImages)x 3] 然后只需使用原始代码滚动浏览此内容。
hFig = figure('菜单栏','无','号码标题','关闭','颜色','k');
signal = [];
%将所有图像加载到一个长图像中
表示k = 1:7
filename = fullfile(homedir,sprintf('%d.png',k) );
img = imread(filename);
signal = cat(2,signal,img);
end
%% //创建滑动窗口视频
windowWidth = 320; %宽度(以像素为单位)
hImg = imshow(信号(:,1:1 + windowWidth,:),...
'InitialMagnification',100,'Border','tight');
vid = VideoWriter('signal.avi');
vid.Quality = 100;
vid.FrameRate = 60;
open(vid);
M =大小(信号,2);
表示k = 1:(M - windowWidth)
set(hImg,'CData',signal(:,k:k + windowWidth,:))
writeVideo(vid,getframe() );
结束
结束(vid);
I cannot make too big file (like tried here) so I need to show only portions at a time. However, I cannot make the transfer from one file to another smooth in Matlab. I am trying to expand the solution of the thread To refresh imshow in Matlab? for two images. The problem is the ending of image A and start of the image B. Now, I have an interruption in the flow, which I do not like because I cannot show two images at the same time without an interruption.
In the example here, it is not needed to filter the axes. Code
iterationCounter=1;
hFig=figure('Menubar','none', 'NumberTitle','off', 'Color','k');
while(iterationCounter < 7)
filenamePng=fullfile(homedir, '/Images/Raw/', iterationCounter, '.png');
imgRGB=imread(filenamePng);
% https://stackoverflow.com/a/29952648/54964
%%// create sliding-window video
len = 40*2^3;
signal = imgRGB(:,1:end,:);
hImg = imshow(signal(:,1:1+len,:), ...
'InitialMagnification',100, 'Border','tight');
vid = VideoWriter('signal.avi');
vid.Quality = 100;
vid.FrameRate = 60;
open(vid);
M = size(signal,2);
for k=1:M-len
set(hImg, 'CData',signal(:,k:k+len,:))
writeVideo(vid, getframe());
end
iterationCounter=iterationCounter+1;
end
close(vid);
Output for Image A and Image B
where there is an interruption in the slider after each image. The picture is just a screenshot of two images: beginning and ending of the slider. The blue area is just OS X GUI but still indicates that there is a gap and interruption between the start and end.
How can show/join two images simultaneously in Matlab's slider?
In order to display multiple images side by side in this scrolling window, I think the easiest approach is to actually load all of the images upfront into an array that is [nRows x (nColumns * nImages) x 3]
and then just use the original code to scroll through this.
hFig=figure('Menubar','none', 'NumberTitle','off', 'Color','k');
signal = [];
% Load all the images into one "long" image
for k = 1:7
filename = fullfile(homedir, sprintf('%d.png', k));
img = imread(filename);
signal = cat(2, signal, img);
end
%%// create sliding-window video
windowWidth = 320; % Width in pixels
hImg = imshow(signal(:,1:1 + windowWidth,:), ...
'InitialMagnification',100, 'Border','tight');
vid = VideoWriter('signal.avi');
vid.Quality = 100;
vid.FrameRate = 60;
open(vid);
M = size(signal,2);
for k = 1:(M - windowWidth)
set(hImg, 'CData',signal(:,k:k + windowWidth,:))
writeVideo(vid, getframe());
end
close(vid);
这篇关于在Matlab的滑块中同时显示/连接两个图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!