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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for libpuzzle-1.0.0rc4.tar.gz
Algorithm Hash digest
SHA256 016be380b91d9655ccf8620791ac204fc1caab7343e0be6157a3bc042f44f6af
MD5 d6a86ede71942025b0dc07136034aa3e
BLAKE2b-256 3fd8b32082fa9dbaf26d923817b1a148af1a67ab96c638014225641a6d0ddbe7

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