Closed GoogleCodeExporter closed 9 years ago
This is most likely caused by the "auto-synch" feature in JNA, details here
under "Large Structure":
https://jna.dev.java.net/javadoc/overview-summary.html#performance
Unfortunately, functions like cvFindContours() and cvApproxPoly() create CvSeq
objects and the programmer does not get a chance to setAutoSynch(false) before
they get read... I'll think about what could be done to keep things clean. You
may however modify the source code of cxcore.java, as a quick fix, by adding
setAutoSynch(false) to constructors of the CvSeq class.
Samuel
Original comment by samuel.a...@gmail.com
on 16 Jul 2010 at 3:01
To answer some of the other questions, the number of parameters to the
cvContourArea() method changes with the version of OpenCV, so you need to
import one of the subclasses based on the version of OpenCV you wish to use.
The problem with blobslib is that it's written in C++.. It's quite hard to use
C++ interfaces from other languages. Someone would need to produce an interface
in C first.
Original comment by samuel.a...@gmail.com
on 16 Jul 2010 at 3:10
Great,
Thanks, I will try your suggestion.
Additionally, I was wondering why cvContourArea was commented out?
Original comment by supert...@gmail.com
on 16 Jul 2010 at 3:18
Sorry, did not see your last reply before I posted my last comment.
Makes sense regarding parameter numbers changing.
I'll experiment with the setAutoSynch too. I'd assume that all the fields would
be null until forcefully read into - not sure how to do that, but I'll look.
Thanks for pointing me in the right direction.
Greg.
Original comment by supert...@gmail.com
on 16 Jul 2010 at 8:29
I modified CvSeq slightly in this test package to include a static autoSynch
flag:
http://www.ok.ctrl.titech.ac.jp/~saudet/javacv.jar
With that, something like the following should disable the default auto-synch
behavior of any newly constructed CvSeq objects:
CvSeq.autoSynch = false;
Once "auto-synch" is disabled, you need to call the readField() method to read
the native values of the fields in the Structure. The values of the Java fields
will not be correct..
If that works, I plan to add the flag to all Structures in the next release...
Please let me know if it works, thanks
Original comment by samuel.a...@gmail.com
on 12 Aug 2010 at 3:06
I am having the same problem. Blob detection is a pain using javaCV. I have
turned to opencv for processing and it works quite good, but it would be nice
to see a fix or improvement on the javaCV side.
that jar file did not work for me. Did not notice a difference.
Original comment by victamin...@gmail.com
on 25 Oct 2010 at 12:07
You have to put this line somewhere before your blob detection:
CvSeq.autoSynch = false;
If you did put this line and it did not improve the performance, then please
let me know. Otherwise, I am considering this problem fixed, thank you.
Original comment by samuel.a...@gmail.com
on 25 Oct 2010 at 2:03
Original issue reported on code.google.com by
supert...@gmail.com
on 11 Jul 2010 at 2:46