cdut007 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Sample 1: How to use SURF to extract features #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Because I believe that examples are the easiest way how to use JavaCV, I am 
sending a sample of running SIFT on images.

In the attached code I am sending en example how to use OpenCV surf to extract 
features from an image.

What steps will reproduce the problem?
1. Compile and run the code

What is the expected output? What do you see instead?
Obtaining information about point of interest.

It would be nice to extend the code so we can:
1) Extract points of interest. The code in C is the following:

CvSeqReader img_reader =  new CvSeqReader();
cvStartReadSeq( imageDescriptors, img_reader, 0 );
for (int i = 0; i < imageDescriptors.size(); i++) {
    float descriptor = (float) img_reader.ptr;
    CV_NEXT_SEQ_ELEM(img_reader.seq.elem_size, img_reader);
    memcpy(img_ptr, descriptor,
        length * com.sun.jna.Native.getNativeSize(Float.class));
        img_ptr += length;
}

2) make the whole example functional as in find_obj.cpp 
(https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/c/find_obj.cpp?re
v=2270).
The code to be fixed is commented at the moment.

What version of the product are you using? On what operating system?
This should work under all the version and operating systems

Original issue reported on code.google.com by burge...@gmail.com on 21 Jan 2011 at 9:21

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the samples! Although for SURF I had already done something named 
ObjectFinder:
http://code.google.com/p/javacv/source/browse/trunk/javacv/src/com/googlecode/ja
vacv/ObjectFinder.java

In any case, I'm thinking to start adding samples like those that people send 
me in a separate samples folder in future releases..

Original comment by samuel.a...@gmail.com on 29 Jan 2011 at 12:49

GoogleCodeExporter commented 9 years ago
Latest version includes some samples, but given that JavaCV already comes with 
a working ObjectFinder, I will leave this incomplete sample out of them.

Original comment by samuel.a...@gmail.com on 19 Feb 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Can you please explain whether this code example can use with new javacv 
package because when I try to execute it throws compile errors regarding the 
symbol can not find errors

for example
                CvSeq imageKeypoints = new CvSeq();
                CvSeq imageDescriptors = new CvSeq();
                CvSURFParams params = cvSURFParams(500, 1);

                cvExtractSURF(image, null, imageKeypoints.pointerByReference(),imageDescriptors.pointerByReference(), storage,params.byValue(), 0);

In this code line I can't get the pointerByReference(), .byValue() methods, 
could you please explain me the reason for that.
 can you please explain what is the reason for that ?

Original comment by lbnnir...@gmail.com on 20 Jun 2012 at 12:45

GoogleCodeExporter commented 9 years ago
I'm using opencv_2.4.2 and javaCV_0.2 but the SurfExample.java  file is not 
working. though I'm a newbie with javaCV here! Any help would be appreciated.

Original comment by ase...@gmail.com on 7 Mar 2013 at 6:57

GoogleCodeExporter commented 9 years ago
hello I have the same problem with the same mistakes, I am also newbie it seems 
SurfExample.java file is incomplete .. I need help .. could someone help me 
make it work?

Original comment by elpitbu...@gmail.com on 1 Jul 2013 at 5:07

GoogleCodeExporter commented 9 years ago
Please refer to ObjectFinder.java instead:
http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javac
v/ObjectFinder.java

Original comment by samuel.a...@gmail.com on 15 Jul 2013 at 1:36

GoogleCodeExporter commented 9 years ago

I am using the code of objectFinder.java at link provided in above comment. But 
the Following line is giving me error(in class settings). I am using the latest 
version of opencv, i.e 2.4.8 and also the latest version of javacv, i.e. 0.7.
CvSURFParams parameters=cvSURFParams(500,1);

Original comment by mehul18...@gmail.com on 27 Jan 2014 at 4:31