Git Product home page Git Product logo

keyframesextraction's Introduction

Key Frames Extraction

This project implements implements python script to read a video and extract key frames based on sum of absolute differences in LUV colorspace.

Getting Started

Download or clone this repository to your local system.

Prerequisites

You need to have OpenCV and Python installed on your machine.For OpenCV look for another one of my repsitory.

How to Run...

Download this project to your machine. Move to the folder using

cd KeyFramesExtraction
python scene_div.py <videopath> <extract frames to this path> <Paremeter to select how many frames you want>

Authors

  • Amanpreet Walia

License

This project is licensed under the MIT License - see the LICENSE.md file for details

keyframesextraction's People

Contributors

amanwalia123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

keyframesextraction's Issues

how to select parameter window_len?

hello, nice project ! Its very useful.
But I have a question : Since 'window_len' parameters have a great influence on the experimental results, how to choose the right window_len. Can you give some advice? Thank you very much.

Something about the various

Thanks for your help! I've tried your code using the command(I set the window size to 20) mentioned in your README, but frames saved by the script seems like the "every frame" not the key frames. Where could I find the extracted keyframes? Best wishes:)

how to run this program

I run it by: python scene_div.py 1.mp4 ./data/ 10
But the program reported an error:
File "scene_div.py", line 63
raise ValueError, "smooth only accepts 1 dimension arrays."
^
SyntaxError: invalid syntax
Please tell me the correct command to run,thank you.

Name of the smoothing method

What is the name of the smoothing method you are using in the smooth function?

def smooth(x, window_len=13, window='hanning'):
    """smooth the data using a window with requested size.
    
    This method is based on the convolution of a scaled window with the signal.
    The signal is prepared by introducing reflected copies of the signal 
    (with the window size) in both ends so that transient parts are minimized
    in the begining and end part of the output signal.
    
    input:
        x: the input signal 
        window_len: the dimension of the smoothing window
        window: the type of window from 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'
            flat window will produce a moving average smoothing.
    output:
        the smoothed signal
        
    example:
    import numpy as np    
    t = np.linspace(-2,2,0.1)
    x = np.sin(t)+np.random.randn(len(t))*0.1
    y = smooth(x)
    
    see also: 
    
    numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve
    scipy.signal.lfilter
 
    TODO: the window parameter could be the window itself if an array instead of a string   
    """
    print(len(x), window_len)
    if x.ndim != 1:
        raise ValueError, "smooth only accepts 1 dimension arrays."

    if x.size < window_len:
        raise ValueError, "Input vector needs to be bigger than window size."

    if window_len < 3:
        return x

    if not window in ['flat', 'hanning', 'hamming', 'bartlett', 'blackman']:
        raise ValueError, "Window is on of 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'"

    s = np.r_[2 * x[0] - x[window_len:1:-1],
              x, 2 * x[-1] - x[-1:-window_len:-1]]
    #print(len(s))

    if window == 'flat':  # moving average
        w = np.ones(window_len, 'd')
    else:
        w = getattr(np, window)(window_len)
    y = np.convolve(w / w.sum(), s, mode='same')
    return y[window_len - 1:-window_len + 1]

"smooth only accepts 1 dimension arrays."

Hi there,

I was trying to use your code to do keyframe extraction, but I got "smooth only accepts 1 dimension arrays." Do you know is there anything I did wrong?

File "scene_div.py", line 63
raise ValueError, "smooth only accepts 1 dimension arrays."
^
SyntaxError: invalid syntax

how to get the number of key frames?

Thanks for your good job!I have already successfully run this file.But I still have some questions.Different videos may have different numbers of the key frames.How to get the number of keyframes of different videos?And what is the function of the sliding window?Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.