[pHash-support] Eclipse + MVP + Java
Sebastian Gallese
sebastiangallese at gmail.com
Fri Feb 12 11:13:35 PST 2010
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
More information about the pHash-support
mailing list