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.0rc3.tar.gz (44.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for libpuzzle-1.0.0rc3.tar.gz
Algorithm Hash digest
SHA256 86ca02e696e9d24ff73cae4ed34b3dd3fb8e8eab5c6cfdd6eaa1ab1725004718
MD5 bbf1dac625844134d4fd2c8eab805a7a
BLAKE2b-256 8132ecfdd2f8acd477c6dc9323c091703cc1ff2bd3b307420defff047a266d54

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