Katna is a tool that automates video key/best frames extraction.
Project description
Katna: Tool for automating common video keyframe extraction and Image Autocrop tasks
Resources
- Homepage and Reference: https://keplervaani.com/katna/
Description
Katna automates the boring, error prone task of videos key/best frames extraction and manual time consuming task of image cropping.
Katna is divided into two modules namely video and image.
Video Module:
This module handles the task(s) related to key frame extraction.
Key-frames are defined as the representative frames of a video stream, the frames that provide the most accurate and compact summary of the video content.
Frame extraction and selection criteria
- Frame that are sufficiently different from previous ones using absolute differences in LUV colorspace
- Brightness score filtering of extracted frames
- Entropy/contrast score filtering of extracted frames
- K-Means Clustering of frames using image histogram
- Selection of best frame from clusters based on and variance of laplacian (image blur detection)
Image Module:
This module handles the task(s) related to smart cropping.
The Smart image cropping is happening in way that the module identifies the best part or the area where someone focus more and interprets this information while cropping the image.
Crop extraction and selection criteria
- Edge, saliency and Face detection features are detected in the input image
- All the crops with specified dimensions are extracted with calculation of score for each crop wrt to extracted features
- The crops will be passes through filters specified which will remove the crops which filter rejects
Supported Video and image file formats ##########################################
All the major video formats like .mp4,.mov,.avi etc and image formats like .jpg, .png, .jpeg etc are supported.
More selection features are in developement pipeline
How to install
Using pypi
- Install Python 3
- pip install katna
Install from source
-
Install git
-
Install Anaconda or Miniconda Python
-
Open terminal
-
Clone repo from here https://github.com/keplerlab/Katna.git
-
Change the directory to the directory where you have cloned your repo
$cd path_to_the_folder_repo_cloned
-
Create a new anaconda environment if you are using anaconda python distribution
conda create --name katna python=3 source activate katna
-
Run the setup:
python setup.py install
Error handling and tips
-
If you see "AttributeError: module 'cv2.cv2' has no attribute 'saliency'" error. Uninstall opencv-contrib by running command "python -m pip uninstall opencv-contrib-python" and then again install it by running command "python -m pip install opencv-contrib-python"
-
If you see "FileNotFoundError: frozen_east_text_detection.pb file not found". Open python shell and follow below commands. a) from Katna.image_filters.text_detector import TextDetector b) td = TextDetector() c) td.download()
How to use Library
- Refer to quickstart section in Katna Reference from https://keplervaani.com/katna/tutorials.html
Attributions
- We have used the SAD (Sum of absolute difference) code from https://github.com/amanwalia92/KeyFramesExtraction
- Smart crop feature in Katna Image module is inspired and enhanced from Smartcrop.js by Jonas Wagner https://github.com/jwagner/smartcrop.js/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file katna-0.3.0.0.tar.gz
.
File metadata
- Download URL: katna-0.3.0.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1ef9387b052784d663153e881815f95bd3531f37478748cf4ea29d90489f1c |
|
MD5 | bfb1c12966265a3bbb1818ea6c9e4735 |
|
BLAKE2b-256 | e92e2abf8d309d055086a1ad8f0b4fea42d8173565e5d21c75a7c9b81d9f3321 |
File details
Details for the file katna-0.3.0.0-py3-none-any.whl
.
File metadata
- Download URL: katna-0.3.0.0-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae2ebb7d4dcc98f82306ef37573fae04b7b76160509099f623724650cc5d18af |
|
MD5 | f31a8788933d4803b1815e9a2941eb76 |
|
BLAKE2b-256 | f7231fc4794c505bb99760af2718ddc781290975f34fd7a2a9569aef7f3bfd43 |