Comparing Two Images with JavaCV SURF

1,484 views
Skip to first unread message

Joe

unread,
Apr 7, 2011, 12:23:00 AM4/7/11
to javacv
HI there,

With reference to this topic (https://groups.google.com/group/javacv/
browse_thread/thread/56c0b7a9b53262c8/b0aa7440442bf6e6?
hl=en&lnk=gst&q=how+to+compare#b0aa7440442bf6e6), I'm basically
trying to do exactly what the original poster was trying to do. I'm
working on a small image comparison project. Looking to use SURF to
compare two images together to see how similar they are in terms of %.

My knowledge of Java and SURF is not "extensive", so to speak, but
from my understanding, SURF does not return a similarity %, but
identifies keypoints in an image so obviously some work on quantifying
the end results would need to be done (perhaps the % can be based on
the number of geometrically valid feature points they have in common
as Samuel mentioned).

Here's the basic outline of my app:

1. User loads two images via a JFileChooser
- One source image
- One reference image

2. Both images displayed on JLabels

3. "Check Similarity" button becomes enabled and when the user clicks
it I would like SURF to be used to calculate the similarity between
the two images in terms of a percentage %, which is then displayed in
another JLabel 'Result'.

Again, my Java knowledge is limited but I'm quite eager to implement
this. However, I'm not exactly sure how to implement it. Right now I'm
stuck with having ObjectFinder.java and BaseChildSettings.java in my
<default package> (using NetBeans). And also I obviously have the JAR
files in my Libraries. I've tried searching but I really can't find an
example/clear-cut guide on how to use ObjectFinder. Forgive me if
there is indeed an example lying around somewhere.

I'd really appreciate some help on this. Much thanks in advance. If
you need any more information about how I want my program to be please
ask :)

Samuel Audet

unread,
Apr 8, 2011, 2:46:17 AM4/8/11
to jav...@googlegroups.com
Hello,

I use ObjectFinder in my code here:
http://code.google.com/p/javacv/source/browse/trunk/procamtracker/src/com/googlecode/javacv/procamtracker/RealityAugmentor.java#499

I don't make the number of matches available from outside the object,
but one can easily modify ObjectFinder to do that. Search for
"logger.info" in the code, and that will indicate to you the variables
you should try to use.. If your objects are mostly planar, you could
also analyze the "mask" matrix after the call to cvFindHomography()

Samuel

Joe

unread,
Apr 8, 2011, 8:15:00 AM4/8/11
to javacv
Hey,

Appreciate the response, but I'm still not entirely sure what I should
do. So far I've basically made a method called imagesurf() which
accepts a String parameter.

This string is the filepath to the image I'm trying to implement SURF
on. The next line is simply:

ObjectFinder inFile = new ObjectFinder(inputFile, ?, ?, ?);

But obviously there are things missing which I'm not sure of.

On Apr 8, 2:46 pm, Samuel Audet <samuel.au...@gmail.com> wrote:
> Hello,
>
> I use ObjectFinder in my code here:http://code.google.com/p/javacv/source/browse/trunk/procamtracker/src...

Samuel Audet

unread,
Apr 8, 2011, 9:36:50 AM4/8/11
to jav...@googlegroups.com
Starting from a sample like this one:
http://code.google.com/p/javacv/source/browse/trunk/javacv/samples/HoughLines.java
Would be a good start..

ROUSSI Abdelghani

unread,
Oct 28, 2014, 7:15:15 PM10/28/14
to jav...@googlegroups.com, gri...@gmail.com
Did you find an example of doing that because URLs bellow doesn't work

Samuel Audet

unread,
Nov 3, 2014, 6:53:19 AM11/3/14
to jav...@googlegroups.com
On 10/29/2014 08:15 AM, ROUSSI Abdelghani wrote:
> Did you find an example of doing that because URLs bellow doesn't work

The thread is still available here:
https://groups.google.com/forum/?hl=en#!topic/javacv/VsC3qbUyYsg

And the example here:
https://github.com/bytedeco/procamtracker/blob/master/src/main/java/org/bytedeco/procamtracker/RealityAugmentor.java#L575

Samuel
Reply all
Reply to author
Forward
0 new messages