Git Product home page Git Product logo

pypuzzle's Introduction

PyPuzzle

PyPuzzle provides python bindings for libpuzzle. Libpuzzle is designed to quickly find visually similar images (gif, png, jpg), even if they have been resized, recompressed, recolored or slightly modified. Since libpuzzle is a C library, PyPuzzle connects it to python.

For more information about libpuzzle, consult its home page.

Installation

At present, PyPuzzle has only been tested under Linux.

Before compiling, make sure you have header files of libpuzzle and libgd2 installed. See 'COMPILATION' section in the doc of libpuzzle.

For Ubuntu users, you can just install them from source:

apt-get install libgd2-xpm-dev
apt-get install libpuzzle-dev

You can install PyPuzzle with pip:

$ pip install pypuzzle

or easy_install:

$ esay_install pypuzzle

In addition, you can compile it from source:

$ python setup.py install

Usage

import pypuzzle

puzzle = pypuzzle.Puzzle()

# Get distance between two image files
distance = puzzle.get_distance_from_file("file_1.jpg", "file_2.jpg")

# Get vector from image file
vec_1 = puzzle.get_cvec_from_file("file_1.jpg")
vec_2 = puzzle.get_cvec_from_file("file_2.jpg")

# Get distance between two vectors
distance = puzzle.get_distance_from_cvec(vec_1, vec_2)

# Compress vector
cmp_vec_1 = puzzle.compress_cvec(vec_1)

# Uncompress vector
uncmp_vec_1 = puzzle.uncompress_cvec(cmp_vec_1)

PyPuzzle allows you to change related parameters of the algorithm with set_*() methods:

Puzzle.set_max_width(max_width)
Puzzle.set_max_height(max_height)
Puzzle.set_lambdas(lambdas)
Puzzle.set_p_ratio(p_ratio)
Puzzle.set_noise_cutoff(noise_cutoff)
Puzzle.set_contrast_barrier_for_cropping(barrier)
Puzzle.set_max_cropping_ratio(ratio)
Puzzle.set_autocrop(enable)

Consult original page of libpuzzle for more details.

pypuzzle's People

Contributors

archangelsdy avatar

Watchers

Adam DePrince avatar Evan Hensleigh avatar Marine Boudeau avatar James Cloos avatar Rushaine McBean avatar Karthik Ravindra avatar  avatar Elizabeth Zagroba avatar  avatar  avatar Brad Kammin avatar Kio Stark avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.