1

So basically im trying to count number of shots change during a single video. Currently im not interested in fading in / out algorithms, but simply number of total scenes change.

i've came up with the following algoirthm, but kinda stuck with getting a scalar value from the similarity matrix:

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
aurelius
  • 3,946
  • 7
  • 40
  • 73
igal k
  • 1,883
  • 2
  • 28
  • 57
  • 1
    related: http://stackoverflow.com/questions/3273196/python-scene-change-detection, possibly helpful: https://github.com/johmathe/Shotdetect – A. Donda Feb 04 '15 at 18:24

1 Answers1

0

I don't think using pdist2 makes sense here. pdist2 gives you all pairwise distances between two sets of vectors. You only have two vectors here, which are your histograms. You can simply compute the Euclidean distance between the two histograms:

d = sqrt(sum((hist1 - hist2).^2));
Dima
  • 38,860
  • 14
  • 75
  • 115
  • Thanks for the answer, the following equation gives me a vector, how do i utilize it into a threshold purposes? eventually i'd need to compare it against an integer. thanks! – igal k Feb 13 '15 at 11:10