Skip to main content

Quickly find visually similar images

Project description

libpuzzle
=========


Implements libpuzzle_ for python.

It is designed to quickly find visually similar images (GIF, PNG, JPG), even
if they have been resized, recompressed, recolored or slightly modified.

Sample applications:

* finding duplicate images in photo libraries
* image classification
* image search services
* moderation (pictures sent by users on forums, wikis, blogs, etc). Pictures
similar to other pictures that were previously banned can be signaled to
moderators.

The library relies on the GD Library in order to load bitmap pictures.

Installation:

pip install libpuzzle


Usage::

from libpuzzle import Puzzle, SIMILARITY_THRESHOLD

puzzle = Puzzle()
sign1 = puzzle.from_filename('img1.jpg')
sign2 = puzzle.from_filename('img2.png')
distance = sign1.distance(sign2)
if distance <= SIMILARITY_THRESHOLD:
print('images are propably the same')

API:

.. py:data:: SIMILARITY_THRESHOLD
.. py:data:: SIMILARITY_HIGH_THRESHOLD
.. py:data:: SIMILARITY_LOW_THRESHOLD
.. py:data:: SIMILARITY_LOWER_THRESHOLD

.. py:class:: Puzzle

.. py:attribute:: max_width

.. py:attribute:: max_height

.. py:attribute:: lambdas

.. py:attribute:: noise_cutoff

.. py:attribute:: p_ratio

.. py:attribute:: contrast_barrier_for_cropping

.. py:attribute:: max_cropping_ratio

.. py:attribute:: autocrop

.. py:method:: from_filename(filename) -> Signature

.. py:method:: from_signature(sign) -> CompressedSignature

.. py:method:: from_signature(sign) -> Signature

.. py:method:: vector_normalized_distance(sign1, sign2) -> bool

.. py:class:: Signature

.. py:class:: CompressedSignature

.. py:exception:: PuzzleError

Raise when something went wrong

.. _libpuzzle: https://www.pureftpd.org/project/libpuzzle

Project details


Download files

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

Source Distribution

libpuzzle-1.0.0rc2.tar.gz (42.9 kB view details)

Uploaded Source

File details

Details for the file libpuzzle-1.0.0rc2.tar.gz.

File metadata

  • Download URL: libpuzzle-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for libpuzzle-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 e5118a88dd5b4e7ff5bd2b69ff45ca23322b9ba12fb9ffe0498f2b5849d97aaa
MD5 f4be2c225182b29d8aeaf7d84cbce7da
BLAKE2b-256 fd09f4bafb1b83219f4c35ad7ce72015134a5db953f3c23d3660f64815d3f15a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page