所以基本上我试图计算在一个视频中改变的镜头数目前,im对淡入淡出算法不感兴趣,只关心场景总数的变化。
我已经提出了以下算法,但还是坚持从相似度矩阵中获取标量值:
videoPlayer = vision.VideoPlayer;
Frame1 = step(videoFReader);
for i=1:n - 1
step(videoPlayer, Frame1);
Frame2 = step(videoFReader);
hist1 = imhist(Frame1);
hist2 = imhist(Frame2);
D = pdist2(hist2, hist1,'euclidean'); % D is a matrix
histNorm = norm(D); % histNorm is a very small value which
% doesn't change its value drasticly during
% an actual scence change
Frame1 = Frame2;
%location = strcat('c:\1\', int2str(i), 'pic.jpg');
%imwrite(d, location, 'Quality', 100);
audios=audio( (i-1)*op + 1 : i*op , : );
end
最佳答案
我认为在这里使用pdist2
没有意义pdist2
给出两组向量之间的所有成对距离这里只有两个向量,它们是你的直方图。您可以简单地计算两个直方图之间的欧几里德距离:
d = sqrt(sum((hist1 - hist2).^2));