Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Use OpenCV to extract image crops using homography and feature matching

Project Description

Image extraction using a template. Uses homography and feature matching, storing results in a SQLite database in the user’s home directory for faster reprocessing.


from image_extract.extract import Extracter
ex = Extracter()
ex.crop_images(image_directory, crop_template, file_extension[, match_points])

Successful crops are extracted to a directory called successful_crops, directly underneath image_directory. Each template used creates a subdirectory, named after its md5 hash:

    - img1.jpg
    - …
    - imgn.jpg
    - successful_crops
        - 2a1bdab44c5e81af34f47f3395a3da7e
            - img1_cropped.jpg

The optional match_points argument controls the number of matching points which must be detected in order for a template match to be deemed successful. It’s set to 30 by default.


Call ex.summary(path) to see information on extracted crops for a given directory.

Deleting Extracted Crops

Call ex.delete(path[, template_md5]) to delete extracted crops for a given template. If no template md5 value is given, all extracted crops in that directory are removed.


For best results, the template image should be of the same (or similar) resolution as the image from which the crop is to be extracted.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(9.6 kB) Copy SHA256 Hash SHA256
py2 Wheel Feb 16, 2018

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting