Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Phash Algorithm in img_hash

I want to get the phash with opencv on Android then compare to a database of image phashes on a server.

1.Is the phash algorithm in opencv img_hash the same as one from phash.org at all?

  1. I see img_hash.phash has compute function which just converts a mat to an output mat. How do I get the string representation of this output mat to then run against my phash database? This is what I have but I am getting some unrecognizable characters.

:

Mat outMat = new Mat();
phash.compute(inMat, outMat);
byte[] data = new byte[outMat.rows() * outMat.cols()];
outMat.get(0, 0, data);
String hashString = new String(data, StandardCharsets.UTF_8);

Phash Algorithm in img_hash

I want to get the phash with opencv on Android then compare to a database of image phashes on a server.

  1. 1.Is Is the phash algorithm in opencv img_hash the same as one from phash.org at all?

    1. I see img_hash.phash has compute function which just converts a mat to an output mat. How do I get the string representation of this output mat to then run against my phash database? This is what I have but I am getting some unrecognizable characters.

    :

    Mat outMat = new Mat();
    phash.compute(inMat, outMat);
    byte[] data = new byte[outMat.rows() * outMat.cols()];
    outMat.get(0, 0, data);
    String hashString = new String(data, StandardCharsets.UTF_8);