ChitraPathak / javacv

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

Rewriting to Java an opencv sample #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Samuel, greetings from Spain. I hope you to help me, I'm not a great 
programmer at all.

I'm actually working with Eclipse on rewriting to Java "squares.cpp", one of 
the OpenCV sample files, within a project related to automation of usability 
metric calculations in user interfaces.

The matter is related to this error happened on execution time:

"in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
com.googlecode.javacpp.Pointer cannot be cast to 
com.googlecode.javacv.cpp.opencv_core$CvPoint"

The error message lead me to these code lines:

 t = Math.abs(angle(
                 (CvPoint)cvGetSeqElem( result, i ),
             (CvPoint)cvGetSeqElem( result, i-2 ),
             (CvPoint)cvGetSeqElem( result, i-1 )));

The problem is that it's trying to do a downcasting from Pointer to CvPoint 
(CvPoint is Pointer subclass). I have been reviewing the sources Pointer.java 
and opencv_core.java but I don't know how to solve it, may you can advise me to 
make it works.

Thank for your attention.

Original issue reported on code.google.com by ensambla...@gmail.com on 12 Jan 2012 at 11:49

GoogleCodeExporter commented 9 years ago
As explained in the README.txt file, you need to do something like this: `new 
CvPoint(cvGetSeqElem(result, i))`.

And please post your questions on the mailing list next time, this is not an 
issue

Original comment by samuel.a...@gmail.com on 14 Jan 2012 at 8:21

GoogleCodeExporter commented 9 years ago
Thank you very much Samuel, it's working!

Sorry, It was the first time I wrote in code.google.com, God bless you.

Original comment by ensambla...@gmail.com on 14 Jan 2012 at 8:57