在matlab中更改电影尺寸

我正在尝试在执行2x合并后使用“电影”功能从外部摄像头显示实时视频.我原来的视频尺寸是768×576.但是,当我对像素进行分割时,我会得到一张384×288的图像,当它显示时,它看起来只有原始视频的一半.有什么方法可以增加电影的显示尺寸,使其看起来与原始尺寸相同吗?换句话说,我的像素看起来是两倍大小.

我尝试过使用set(gca,’Position’…),但它不会改变我的电影大小.

有什么建议吗?

最佳答案 我将使用
the documentation上的示例电影.

假设你有一堆帧:

figure('Renderer','zbuffer')
Z = peaks;
surf(Z); 
axis tight
set(gca,'NextPlot','replaceChildren');
% Preallocate the struct array for the struct returned by getframe
F(20) = struct('cdata',[],'colormap',[]);
% Record the movie
for j = 1:20 
    surf(.01+sin(2*pi*j/20)*Z,Z)
    F(j) = getframe;
end

在帮助电影结束时,它说:

MOVIE(H,M,N,FPS,LOC) specifies the location to play the movie
at, relative to the lower-left corner of object H and in
pixels, regardless of the value of the object’s Units property.
LOC = [X Y unused unused]. LOC is a 4-element position
vector, of which only the X and Y coordinates are used (the
movie plays back using the width and height in which it was
recorded).

因此,无法以比录制的更大的尺寸显示电影.你必须炸掉像素才能以更大的尺寸显示:

% blow up the pixels
newCdata = cellfun(@(x) x(...
    repmat(1:size(x,1),N,1), ...         % like kron, but then
    repmat(1:size(x,2), N,1), :), ...    % a bit faster, and suited 
    {F.cdata}, 'UniformOutput', false);  % for 3D arrays

% assign all new data back to the movie
[F.cdata] = newCdata{:};

% and play the resized movie
movie(F,10)

请注意,这不会因为可读性而赢得任何奖品,因此如果您打算使用此奖项,请附上描述其功能的评论.

点赞