cdut007 / javacv

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

Sample 2: How to use and visualize optical flow #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile and run the code

What is the expected output? What do you see instead?
This example should fully functional.

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

Please provide any additional information below.
It would be nice if anyone will extend the code or add a new functionality.

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

Attachments:

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
Sorry, didn't work for me...

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77a12a1d, pid=1964, tid=576
#
# JRE version: 6.0_23-b05
# Java VM: Java HotSpot(TM) Client VM (19.0-b09 mixed mode, sharing windows-x86 
)
# Problematic frame:
# C  [ntdll.dll+0x32a1d]

Tested with OpenCV 2.1, Windows 7 Professional 64bit, Netbeans IDE 6.9.1

no Idea what is wrong.

But thanks für the samples, now i just need to get them working :)

Original comment by stefan.b...@gmail.com on 14 Feb 2011 at 3:51

Attachments:

GoogleCodeExporter commented 9 years ago
Please, check the file paths to all the PNG files - i.e. 
- image0.png
- image1.png
- image0.png (dont forget the last one)

Original comment by burge...@gmail.com on 14 Feb 2011 at 7:19

GoogleCodeExporter commented 9 years ago
Thanks for the quick answer, but i already checked that. To be sure about that, 
i just deleted the images, now i get a different Error (Runtime Error - Array 
should be CvMat or IplImage...), so this is not the Problem. 
With the last one i guess you mean image0-1.png

I already figured out, that the cvCalcOpticalFlowPyrLK causes the problem.

Now i tried on another System, Vista 32bit, OpenCV 2.1, Netbeans 3.8: same 
problem

I would say there is something wrong with the environment, but no idea what. I 
have the latest Java Version, OpenCV 2.1, added the .jar (JNA and JavaCv) to my 
Project. That shuold have been all.

Original comment by stefan.b...@gmail.com on 15 Feb 2011 at 7:05

GoogleCodeExporter commented 9 years ago
I have almost the same configuration as you mentioned before:
OpenCV 2.1, Windows 7 Professional 64bit, Eclipse IDE (not importatnt), JRE 
version 1.6.0_23

I think that the problem is in DLLs

You can try these DLLs:
http://spl.utko.feec.vutbr.cz/cs/component/content/article/21-zpracovani-medicin
skych-signalu/261-rapidminer-5-opencv-extension

Download the i686 version
http://spl.utko.feec.vutbr.cz/images/stories/rapidminer/rmx_opencv/opencv210_Win
_i686.zip

Run the JRE with this VM argument:
-Djna.library.path=c:\path\to\downloaded\DLLs

Original comment by burge...@gmail.com on 15 Feb 2011 at 8:48

GoogleCodeExporter commented 9 years ago
Sorry, i dont really know what i should download here. 
The first link points to a homepage with a lot of dead links, do you mean i 
should try something with rapidminer?

second link does not work either

Original comment by stefan.b...@gmail.com on 15 Feb 2011 at 9:16

GoogleCodeExporter commented 9 years ago
Sorry for that and thank you for notifying me about that. The links on the site 
should be now corrected. 

i686
http://spl.utko.feec.vutbr.cz/images/stories/rapidminer/rmx_opencv/opencv210_win
_i686.zip

and 

AMD64
http://spl.utko.feec.vutbr.cz/images/stories/rapidminer/rmx_opencv/opencv210_win
_amd64.zip

-RB-

Original comment by burge...@gmail.com on 15 Feb 2011 at 10:24

GoogleCodeExporter commented 9 years ago
Thanks, links work fine now!
I did what yous suggested, downloaded the new .dlls, and ran the code with the 
VM argument (of course with my own path to the .dlls).

I'm sorry to say, that nothing changed, still the same Error. But i have some 
new information which might help:

Sometimes the build is successful! I dit not change anything, but in maybe 1 of 
20 builds i do not get an Error.(I really keep on klicking and re-executing the 
program until it works). This happens both with your new .dlls and also with 
the old .dlls
The whole thing is getting even more confusing now, I have no idea what cuold 
cause such an undeterministic behaviour...

But thanks a lot for your effort, i really appreciate it

Original comment by stefan.b...@gmail.com on 15 Feb 2011 at 12:16

GoogleCodeExporter commented 9 years ago
These lines are incorrect:
                CvPoint2D32f[] cornersB = new CvPoint2D32f[MAX_CORNERS];
                for (int i = 0; i < MAX_CORNERS; i++) {
                        cornersB[i] = new CvPoint2D32f();
                }
Please refer to the README.txt to see how we need to allocate arrays.. 

Original comment by samuel.a...@gmail.com on 15 Feb 2011 at 1:21

GoogleCodeExporter commented 9 years ago
thank you Samuel!

i replaced the array allocation with:
CvPoint2D32f[] cornersB = CvPoint2D32f.createArray(MAX_CORNERS);

now it works! I am very glad that my environment was set up corretly, was 
beginning to doubt myself.

Still, i am very greatful for the examples

Original comment by stefan.b...@gmail.com on 15 Feb 2011 at 2:01

GoogleCodeExporter commented 9 years ago
Added (a fixed version of this) sample to the samples in latest version. Thank 
you for your contribution. Please change status to "Verified" if satisfied.

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