[pHash-support] Eclipse + MVP + Java

Evan Klinger eklinger at phash.org
Fri Feb 12 12:00:35 PST 2010

It looks like you are almost there.
First, you are trying to print the MHImageHash object and not the
actual hash, the hash field would be hashes[0].hash.
The MVP tree must be created with at least leaf capacity + 3 images,
which by default is 28 I believe. Try placing 30 images in your
directory and then create the MVP tree.
Please keep us posted on your progress.

On Fri, Feb 12, 2010 at 11:13 AM, Sebastian Gallese
<sebastiangallese at gmail.com> wrote:
> Hello,
> Getting pHash to work in Java in Eclipse has been pretty cool.  I did
> the following steps and doing a simple image distance calculation is
> easy:
>    *  Copy all .java files in pHash-0.8.1/bindings/java to your Eclipse project
>    * Make sure you are not working in a package (put all your files
> in default package)
>    * Go to run → run configurations, make a new configuration, add
> pHash to your main class
>    * In the Arguments tab, put -Djava.library.path=/usr/local/lib in
> VM arguments
>    * If you want to use the program arguments, you can put something
> like -mh /home/Pictures/cc.jpg /home/Pictures/c1.jpg (just make sure
> you use the full path name)
> However, when trying to build an MPV tree, I'm running into some difficulty.
> Right now, I have two jpgs in the folder /home/kdge/Pictures that I
> want to add to the tree.  So I'm using the following code:
> MVPTree mvp = new MVPTree("mvp");
> MHImageHash[] hashes = getMHImageHashes("/home/kdge/Pictures");
> System.out.println("Hash 1 is :" + hashes[0]);
> boolean result = mvp.create(hashes);
> System.out.println("MVP creation result is:" + result);
> But I get the following output:
> Hash 1 is :MHImageHash at 6eb38a
> MVP creation result is:false
> Why is mvp.create(hashes); returning false when I'm supplying it with
> a valid array of hashes?
> Even running "java -Djava.library.path=/usr/local/lib pHash -mvp
> /home/kdge/Pictures/" from the command line returns no information.
> Full code is here: http://gist.github.com/302871 (it's just a modified
> pHash.java)
> Thanks,
> Seb
> _______________________________________________
> pHash-support mailing list
> pHash-support at lists.phash.org
> http://lists.phash.org/listinfo.cgi/phash-support-phash.org

More information about the pHash-support mailing list