子地块中的电影比率-Matlab
在下面的代码中,我有四个子图:视频、一个裁剪视频和两个正弦曲线图。我遇到的问题是,播放的电影失去了原来的比例。如何在子批次中设置正确的比率 代码:子地块中的电影比率-Matlab,matlab,Matlab,在下面的代码中,我有四个子图:视频、一个裁剪视频和两个正弦曲线图。我遇到的问题是,播放的电影失去了原来的比例。如何在子批次中设置正确的比率 代码: 根据我的理解,解决方案已经在您的问题中,请使用imshow,就像您对裁剪的小节所做的那样。从文档“imshow使用图像数据类型的默认显示范围,并优化图像显示的图形、轴和图像对象属性。”您的意思是校正纵横比吗?丹尼尔给了你答案:替换图像(thisFrame)带有imshow(此帧) clc; close all; imtool clos
根据我的理解,解决方案已经在您的问题中,请使用
imshow
,就像您对裁剪的小节所做的那样。从文档“imshow使用图像数据类型的默认显示范围,并优化图像显示的图形、轴和图像对象属性。”您的意思是校正纵横比吗?丹尼尔给了你答案:替换图像(thisFrame)代码>带有imshow(此帧)代码>
clc;
close all;
imtool close all;
clear;
fontSize = 10;
folder = fullfile( 'D:\Program Files\MATLAB\R2019b\toolbox\images\imdata');
movieFullFileName = fullfile(folder, 'rhinos.avi');
firstFrame = VideoReader(movieFullFileName);
frame = read(firstFrame,1);
videoObject = VideoReader(movieFullFileName)
numberOfFrames = videoObject.NumberOfFrames;
vidHeight = videoObject.Height;
vidWidth = videoObject.Width;
figure;
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
close(gcf)
for frame = 1 : numberOfFrames
thisFrame = read(videoObject, frame);
hImage = subplot(4, 2, 1);
image(thisFrame);
caption = sprintf('Frame %4d of %d.', frame, numberOfFrames);
title(caption, 'FontSize', fontSize);
hPlot = subplot(4, 2, 2);
thisFrameCrop = imcrop(thisFrame,[150 40 30 50]);
imshow(thisFrameCrop);
caption = sprintf('Region of interest - Frame %4d of %d.', frame, numberOfFrames);
title(caption, 'FontSize', fontSize);
drawnow;
subplot(4, 2, 3);
x = linspace(0,10);
y1 = sin(x);
plot(x,y1)
subplot(4, 2, 4);
y2 = sin(5*x);
plot(x,y2)
end