Sign in to follow this  
Uzumakis

Shot Boundry Detection(Computer Vision)

Recommended Posts

Uzumakis    130

I am new to Computer vision i am implementing Shot boundry detection algorithm based on histogram difference for key frame extraction the paper i am consulting for algorithm is paper on page # 4 it gives algorithm for detection shot boundry detection using it i am try to get results but no success so far it gives me all the frames becasue their value is less then that of the threshold any help will be appreciated..... My code in matlab...

data=VideoReader('C:\Users\Senuch Uzair Tariq\Downloads\Video\house_tour.mpg');
length=data.numberofframes;
increment=0;
for i=1:1:50
    frame1=read(data,i);
    frame2=read(data,i+1);
    frame1=rgb2gray(imresize(frame1,[256 256]));
    frame2=rgb2gray(imresize(frame2,[256 256]));
    %frame 1 blocks
    b11=frame1(1:128, 1:128);
    w11=sum(b11(:))/16384;
    b12=frame1(129:256, 1:128);
    w12=sum(b12(:))/16384;
    b13=frame1(1:128, 129:256);
    w13=sum(b13(:))/16384;
    b14=frame1(129:256, 129:256);
    w14=sum(b14(:))/16384;
    %frame 2 blocks
    b21=frame2(1:128, 1:128);
    b22=frame2(129:256, 1:128);
    b23=frame2(1:128, 129:256);
    b24=frame2(129:256, 129:256);
    %first elements
    b11h=imhist(b11);
    b12h=imhist(b12);
    b13h=imhist(b13);
    b14h=imhist(b14);
    %second elements
    b21h=imhist(b21);
    b22h=imhist(b22);
    b23h=imhist(b23);
    b24h=imhist(b24);
    %1st blocks difference
    db1=b11h-b21h;
    db1=db1.^2;
    db1=sum(db1)/sum(b11h);
    %2nd blocks difference
    db2=b12h-b22h;
    db2=db2.^2;
    db2=sum(db2)/sum(b12h);
    %3rd blocks difference
    db3=b13h-b23h;
    db3=db3.^2;
    db3=sum(db3)/sum(b13h);
    %4th blocks difference
    db4=b14h-b24h;
    db4=db4.^2;
    db4=sum(db4)/sum(b14h);
    %difference block sum*weight 1
    db1=db1*w11;
    %difference block sum*weight 2
    db2=db2*w12;
    %difference block sum*weight 3
    db3=db3*w13;
    %difference block sum*weight 4
    db4=db4*w14;
    total=db1+db2+db3+db4;
    MD=total/length-1;
    STD=total-MD;
    STD=STD^2;
    STD=STD/length-1;
    STD=sqrt(STD);
    threshold=MD+1*STD;
    if(total>=threshold)
        increment=increment+1;
        boundry(increment)=i;
    end
end

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this