Questions tagged [phash]

pHash or perceptual hash is an algorithm for creating fingerprints of multimedia data (images, audio, etc).

What is a perceptual hash?

A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output, perceptual hashes are "close" to one another if the features are similar.

Relevance of Perceptual Hashing

Perceptual hashes must be robust enough to take into account transformations or "attacks" on a given input and yet be flexible enough to distinguish between dissimilar files. Such attacks can include rotation, skew, contrast adjustment and different compression/formats. All of these challenges make perceptual hashing an interesting field of study and at the forefront of computer science research.

What is pHash?

pHash is an open source software library released under the license that implements several perceptual hashing algorithms, and provides a -like API to use those functions in your own programs. pHash itself is written in . pHash was created by Evan Klinger.

Project URL: http://www.phash.org

76 questions
3
votes
1 answer

Create CImg from byte array?

I'm trying to modify a C++ library that has a function that creates a CImg instance from an image file, to use a byte array instead. Is this possible? I found one method that appears to allow it... CImg ( const t *const values, const…
Random
  • 1,896
  • 3
  • 21
  • 33
3
votes
2 answers

pHash (image-hash) in objective-c doesn't work

i used brew to create a compiled library from phash i have imported the CImg.h file and everything compiles but it doesn't work. i want to make a hash from an image but i always get the same output NSBundle *bundle = [NSBundle mainBundle]; NSString…
Andy Jacobs
  • 15,187
  • 13
  • 60
  • 91
3
votes
0 answers

Brew formula for pHash

After a couple of days of Googling and trying various suggestions, I am setting aside trying to build pHash for MacOS Sierra from source. Then one comment pointed to several issues with using Brew to build pHash. After going down several paths…
rick
  • 51
  • 6
3
votes
1 answer

Can't locate libraries installed with MacPorts

I've installed pHash libraries using MacPorts but when I try to compile the example source code I get this error: Fatal error: 'pHash.h' file not found #include "pHash.h" How can I tell the source code where to find the libraries? (from what I…
Hyperion
  • 2,515
  • 11
  • 37
  • 59
2
votes
1 answer

What type of phash Algorithm is this?

As i read about phash, there are four types: A discrete Cosine transform (DCT) based A Marr-Hildreth operator based A radial variance based and A block mean value based image hash function. in the below code you can see that, there is no DCT…
2
votes
0 answers

Difference between pHash nearest neighbor and color histogram nearest neighbor?

I'm looking to create an animated series of photos that are as similar as possible. While researching, I've come across two methods: Generate a pHash of the images and do a nearest neighbor using the Hamming distance of the hash. Create color…
evanlivingston
  • 322
  • 1
  • 7
  • 22
2
votes
0 answers

How to load Imagick convert and all dependencies into /dev/shm for performance?

I am trying to compare at least 40000 screenshots from videos with Imagick command "/dev/shm/convert s1 s2 -metric RMSE -format %[distortion] -compare info:". I have succeded to get an average speed of ~ 0.04 seconds. If I am using in 3 threads…
B.Petrus
  • 51
  • 1
  • 6
2
votes
2 answers

JS - How to check if 2 images (their hash) are similar

GOAL Finding a good way to check if 2 image are similar compairing their hash profiles. The hash is a simple array containing 0 and 1 values. INTRO I have 2 images. They are the same image but with some little differences: one has a different…
2
votes
0 answers

Calculating hamming distance with mongodb?

say i've got a large set of documents that contain perceptual hashes (around 35,000), what is the fastest way that I can (using mongodb) compare a given hash X to all the hashes in my database and find the ones with a distance less than N. I'm using…
davegri
  • 2,206
  • 2
  • 26
  • 45
2
votes
2 answers

Convert intptr to ulong array

I am calling a method from C# like this: [DllImport(@"pHash.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr ph_dct_videohash(string file, ref int length); And here is the method I am calling from the library ulong64*…
2
votes
2 answers

Error installing pHash on Ubuntu

So I was trying to install the pHash libraries on Ubuntu. I've installed all the required packages running this command: apt-get install libavformat-dev libmpg123-dev libsamplerate-dev libsndfile-dev cimg-dev libavcodec-dev ffmpeg…
Hyperion
  • 2,515
  • 11
  • 37
  • 59
2
votes
2 answers

Compile pHash on Ubuntu + PHP extension

I'm trying to compile the pHash extension. I found a great step-by-step explanation here, https://serverfault.com/questions/491730/compile-phash-on-centos-php-extension But I'm bumping into two problems : 1) When launching the ./configure script of…
joseph-l
  • 91
  • 1
  • 6
2
votes
1 answer

pHash yields weird results for some images

I have trouble understanding some pHash results. Two images that are really similar have only 75% in common according to pHash: & These other two images that should have nothing in common have a 78% similarity: & Is there something that I could…
Such
  • 910
  • 1
  • 9
  • 20
2
votes
1 answer

Java crash ! NTDLL.DLL when using jni and jpeg62.dll

Been trying to run pHash on java using jni and i have faced so many problems and solved them and now i am stuck at this place. i fixed all my dlls and my source code and everything is fine but when i try to run my java code using the dlls... JAVA…
2
votes
1 answer

Python equivalent of DCT image hash function used in pHash module

I have an existing python program that accepts an image URL and does manipulations on the image loaded. I tried passing the image data to the pHash module in C++ and then get the image hash. I've tried using python extension library to pass the…
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124