ChitraPathak / javacv

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

SURF Detect "bad allocation" Error #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to use the SURF Feature Detector in features2d. Essentially I'm 
doing this tutorial: 
http://opencv.itseez.com/doc/tutorials/features2d/feature_flann_matcher/feature_
flann_matcher.html
but in java, using javacv.

I found the scala SURF example in javacv-examples that is essentially identical 
to the first part of the tutorial.

However whenever I call the .detect() method (in scala or in java) I get a "bad 
allocation" error (stack trace below).

What steps will reproduce the problem?
1. Create a SurfFeatureDetector.
2. Call the .detect() method.

What is the expected output? What do you see instead?
I would expect it not to crash. Instead it crashes.

What version of the product are you using? On what operating system?
I'm on Windows 7 64, using 64 bit everything (jdk, opencv, javacv).

Please provide any additional information below.

Here's the stack trace from the scala example:
java.lang.RuntimeException: bad allocation
        at com.googlecode.javacv.cpp.opencv_features2d$FeatureDetector.detect(Native Method)
        at SURF$delayedInit$body.apply(<console>:46)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:60)
        at scala.App$$anonfun$main$1.apply(App.scala:60)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
        at scala.App$class.main(App.scala:60)
        at SURF$.main(<console>:39)
        at .<init>(<console>:41)
        at .<clinit>(<console>)
        at .<init>(<console>:11)
        at .<clinit>(<console>)
        at $print(<console>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)

        at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
        at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
        at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
        at java.lang.Thread.run(Thread.java:662)

Original issue reported on code.google.com by jacob.ge...@gmail.com on 26 Oct 2011 at 4:16

GoogleCodeExporter commented 9 years ago
Which version of JavaCV?

Original comment by samuel.a...@gmail.com on 26 Oct 2011 at 4:24

GoogleCodeExporter commented 9 years ago
I downloaded javacv-bin-20111001.zip

Original comment by jacob.ge...@gmail.com on 26 Oct 2011 at 4:26

GoogleCodeExporter commented 9 years ago
Also, the OpticalFlowTracker java sample worked fine, so I believe that JavaCV 
is installed correctly.

Original comment by jacob.ge...@gmail.com on 26 Oct 2011 at 4:34

GoogleCodeExporter commented 9 years ago
and which version of OpenCV?

Original comment by samuel.a...@gmail.com on 27 Oct 2011 at 1:37

GoogleCodeExporter commented 9 years ago
OpenCV 2.3 (64bit)

Original comment by jacob.ge...@gmail.com on 27 Oct 2011 at 3:19

GoogleCodeExporter commented 9 years ago
Could you please try again with OpenCV 2.3.1 instead? Thank you

Original comment by samuel.a...@gmail.com on 28 Oct 2011 at 4:46

GoogleCodeExporter commented 9 years ago
Sorry, my mistake, I actually am using 2.3.1, the dll files are all named like 
opencv_core231.dll

Original comment by jacob.ge...@gmail.com on 30 Oct 2011 at 6:33

GoogleCodeExporter commented 9 years ago
And are you certain that your system is loading the ones compiled for Visual 
C++ 2010? You can make sure of this by deleting all the files within 
directories other than "vc10"...

Original comment by samuel.a...@gmail.com on 31 Oct 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Ah, that fixed it. Thanks!

Original comment by jacob.ge...@gmail.com on 31 Oct 2011 at 3:25

GoogleCodeExporter commented 9 years ago
Great!

Original comment by samuel.a...@gmail.com on 2 Nov 2011 at 1:18