GithubHelp home page GithubHelp logo

jimmyrperezpierola / dupimagelib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quickshot/dupimagelib

0.0 2.0 0.0 93 KB

.NET standard library offering several different perceptual hashing algorithms for detecting similar or duplicate images.

License: Apache License 2.0

C# 100.00%

dupimagelib's Introduction

DupImageLib

ImageDupLib is a .NET standard library offering several different perceptual hashing algorithms for detecting similar or duplicate images.

Downloads

DupImageLib is available as a Nuget package. You can laso donwload the Nuget packages from the releases page.

Features

DupImageLib implements the following perceptual hash algorithms:

  • Average

    • Calculates the hash based on the average value of scaled down image. More in-depth explanation of the algorithm can be found here. Extremely fast algorithm, but generates a lot of false positives. Can generate 64 or 256 bit hashes.
  • Median

    • Similar to average, but instead of average pixel value, median value is used. This should make the algorithm bit more resistant to non-linear changes in image. Slightly slower than average hash. Can generate 64 or 256 bit hashes
  • Difference

    • Constructs the hash by comparing the gradients of pixel values on each row of the scaled image. In-depth explanation found here. Performs faster than the average hash and provides better results. Produces 64 or 256 bit hashes.
  • DCT (pHash)

    • Discrete cosine transform based algorithm. Similar to the one implemented in pHash library. Detailed explanation of the algorithm can be found here. Slower than any of the previous algorithms, but has better tolerance to image modifications. Produces 64 bit hashes.

All algorithms accepts the image input as a stream or as a path to filesystem location.

DupImageLib also provides a function to compare hashes to return the similarity of the hashes.

DupImageLib uses Magick.NET for image processing needs. Users of DupImageLib can use their own image processing library by providing an implementation of IImageTransformer and passing that to the ImageHashes constructor.

Usage

Example

// Create new ImageHashes instance using ImageMackick as image manipulation library
var imageHasher = new ImageHashes(new ImageMagickTransformer());
// Calculate 64 bit hashes for the images using difference algorithm
var hash1 = imageHasher.CalculateDifferenceHash64(@"testimage1.png");
var hash2 = imageHasher.CalculateDifferenceHash64(@"testimage2.png");
// Calculate similarity between the hashes. Score of 1.0 indicates identical images.
var similarity = ImageHashes.CompareHashes(hash1, hash2);

License

This software is licensed under Apache 2.0 license. See LICENSE file for more information.

dupimagelib's People

Contributors

quickshot avatar

Watchers

 avatar  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.