Use calcOpticalFlowFarneback java
I am trying to use calcOpticalFlowFarneback in java. I found this http://docs.opencv.org/java/org/opencv/video/Video.html#calcOpticalFlowFarneback(org.opencv.core.Mat, org.opencv.core.Mat, org.opencv.core.Mat, double, int, int, int, int, double, int) which is so helpful but i am trying to define all the variables but i do not know the structure. I used to use openCv for c++ however i did not find any documentation which help me!
I resolve that issue. i am not sure what it was the problem!! Now have this isseu inside the function... OpenCV Error: Assertion failed (prev0.size() == next0.size() && prev0.channels() == next0.channels() && prev0.channels() == 1 && pyr_scale < 1) in unknown function, file ......\src\opencv\modules\video\src\optflowgf.cpp, line 579 Exception in thread "main" CvException [org.opencv.core.CvException: ......\src\opencv\modules\video\src\optflowgf.cpp:579: error: (-215) prev0.size() == next0.size() && prev0.channels() == next0.channels() && prev0.channels() == 1 && pyr_scale < 1 ] at org.opencv.video.Video.calcOpticalFlowFarneback_0(Native Method) at org.opencv.video.Video.calcOpticalFlowFarneback(Video.java:293) at openCvHello.main(openCvHello.java:48)
this is my code.. import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.net.URL;
import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.highgui.Highgui; import org.opencv.video.Video;
public class openCvHello { public static void main( String[] args ) { System.loadLibrary( Core.NATIVE_LIBRARY_NAME ); Mat mat = Mat.eye( 800, 600, CvType.CV_8UC1 ); Mat prev=Mat.ones( 800, 600, CvType.CV_8UC1 ); Mat next =Mat.ones( 800, 600, CvType.CV_8UC1 ); Mat flow=Mat.ones( 800, 600, CvType.CV_32FC2);
it seems that the problem is on images! there is any sample that it is working?