MizanCSEJU / javacv

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

drawKeyoints() not working #439

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.call drawKeypoints() function
2.
3.

What is the expected output? What do you see instead?
error cannot find symbol : drawKeypoints()

What version of the product are you using? On what operating system?
javacv 0.7 , opencv 2.4.8 , windows 7 64 bit

Please provide any additional information below.

i have imported "com.googlecode.javacv.cpp.opencv_features2d.*;" but can't call 
drawKeypoints() function, also SiftFeatureDetector() and 
SiftDescriptorExtractor().

Original issue reported on code.google.com by jimm.ast...@gmail.com on 1 Mar 2014 at 9:04

GoogleCodeExporter commented 9 years ago
Could you please copy/paste the import like that you are using?

Original comment by samuel.a...@gmail.com on 1 Mar 2014 at 10:53

GoogleCodeExporter commented 9 years ago
here is my imports :

import static com.googlecode.javacv.cpp.opencv_highgui.*; 
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_features2d.*;
import static com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_flann.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_legacy.*;
import static com.googlecode.javacv.cpp.opencv_nonfree.*;

I couldn't find class 
com.googlecode.javacv.cpp.opencv_features2d.SiftFeatureDetector and can't call 
method drawKeypoints() as stated error cannot find symbol in netbeans IDE 7.

here is my code in main function :

        CvMat image = cvLoadImageM("C:\\images\\s2.jpg");
        KeyPoint keypoint1 = new KeyPoint();
        SIFT sift = new SIFT(0, 3, 0.03, 10, 1.6);
        //can't find SiftFeatureDetector() method
        sift.detect(image, null, keypoint1);

        CvMat desc1 = new CvMat();
        sift.compute( image, keypoint1, desc1);
        //can't find SiftDescriptorExtractor().

        System.out.println("Keypoints found: "+ keypoint1.capacity());

        IplImage featureImage = IplImage.create(cvGetSize(image), image.depth(), 3);
        drawKeypoints(image, keypoint1, featureImage, CvScalar.WHITE, DrawMatchesFlags.DRAW_RICH_KEYPOINTS); --> error
        cvShowImage("Keypoints", featureImage);
        cvWaitKey(0);

these codes can't be compiled because error of method drawKeypoints (cannot 
find symbol).

Original comment by jimm.ast...@gmail.com on 2 Mar 2014 at 4:04

GoogleCodeExporter commented 9 years ago
OpenCV contains no class or function named `SiftFeatureDetector`, so it's 
pretty normal that is doesn't work...

Original comment by samuel.a...@gmail.com on 2 Mar 2014 at 4:11

GoogleCodeExporter commented 9 years ago
This code compiles just fine here with `javac`. The Eclipse compiler is known 
to be buggy, so please try again with `javac`, thank you.

Original comment by samuel.a...@gmail.com on 2 Mar 2014 at 4:20

GoogleCodeExporter commented 9 years ago
how to compile netbeans project using javac? can it be builded after compiled 
using javacv?

Original comment by jimm.ast...@gmail.com on 2 Mar 2014 at 5:11

GoogleCodeExporter commented 9 years ago
You're using NetBeans, sorry. NetBeans also have an incremental compiler that 
doesn't always work properly. We can disable it and use javac instead as 
explained here:
http://wiki.netbeans.org/FaqCompileOnSave#How_to_turn_it_on.2Foff

Original comment by samuel.a...@gmail.com on 2 Mar 2014 at 5:14

GoogleCodeExporter commented 9 years ago
i have disabled compile on save and it keep threw an error while compiling it.
here is the error :

Compiling 1 source file to D:\TestJavaCV\build\classes
D:\TestJavaCV\src\testjavacv\TestJavaCV.java:42: error: cannot find symbol
        drawKeypoints(image, keypoint1, featureImage, CvScalar.WHITE, DrawMatchesFlags.DRAW_RICH_KEYPOINTS);
  symbol:   method drawKeypoints(CvMat,KeyPoint,IplImage,CvScalar,int)
  location: class TestJavaCV
1 error
D:\TestJavaCV\nbproject\build-impl.xml:959: The following error occurred while 
executing this line:
D:\TestJavaCV\nbproject\build-impl.xml:296: Compile failed; see the compiler 
error output for details.
BUILD FAILED (total time: 1 second)

how to use javac in netbeans?

Original comment by jimm.ast...@gmail.com on 2 Mar 2014 at 5:24

GoogleCodeExporter commented 9 years ago
javac is used when you disable compile as save.

Well, `drawKeypoints()` is clearly defined here:
http://code.google.com/p/javacv/source/browse/src/main/java/com/googlecode/javac
v/cpp/opencv_features2d.java#1135
So, something else is wrong with your project files. It works fine here. If you 
ever figure it out what, please post the details here, thanks!

Original comment by samuel.a...@gmail.com on 2 Mar 2014 at 5:33

GoogleCodeExporter commented 9 years ago
i have figured it out...after i disabled compile on save, i forgot to add 
"static" on import com.googlecode.javacv.cpp.opencv_features2d.*;
so no wonder if method drawKeypoints() cannot be found. After add "static" 
(import static com.googlecode.javacv.cpp.opencv_features2d.*;) the code works 
well. that's my silly failure anyway. Thanks Sam !

Btw, is there alternative method/function of SiftDescriptorExtractor() in 
javacv ? for SiftFeatureDetector(), i can use these alternative :
        SIFT sift = new SIFT(0, 3, 0.03, 10, 1.6);
        sift.detect(image, null, keypoint1);

Original comment by jimm.ast...@gmail.com on 2 Mar 2014 at 5:49

GoogleCodeExporter commented 9 years ago
Ok, it would help to diagnose problems if you could copy/paste the code that 
you are actually using.

There is no SiftDescriptorExtractor or SiftFeatureDetector in OpenCV 2.4.8. 
They were renamed to SIFT.

In any case, this isn't an issue with JavaCV, so please post your questions on 
the mailing list next time if possible, thank you!

Original comment by samuel.a...@gmail.com on 2 Mar 2014 at 5:57