Ask Your Question
1

OpenCV4Android: calcOpticalFlowPyrLK: exception after toArray() for status

asked 2013-08-14 07:20:02 -0600

Patrick Tyll gravatar image

updated 2013-08-14 07:24:40 -0600

Hey guys,

My Code:

status = new MatOfByte();
err = new MatOfFloat();

Video.calcOpticalFlowPyrLK(previousMatFrame, currentMatFrame, prevuisMatOfPoint2f, pointsWichAreFound, status, err);

byte statusS[] = status.toArray();
//the exception after status.toArray(); 
08-14 14:00:11.086: E/AndroidRuntime(6639): java.lang.RuntimeException: Native Mat has unexpected type or size: Mat [ 6*1*CV_32FC2, isCont=true, isSubmat=false, nativeObj=0x6c0bb388, dataAddr=0x6c0b3f00 ]
08-14 14:00:11.086: E/AndroidRuntime(6639):     at org.opencv.core.MatOfByte.toArray(MatOfByte.java:54)
08-14 14:00:11.086: E/AndroidRuntime(6639):     at de.itintouch.mausapp.activitys.MausActivity.onCameraFrame(MausActivity.java:266)
08-14 14:00:11.086: E/AndroidRuntime(6639):     at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:387)
08-14 14:00:11.086: E/AndroidRuntime(6639):     at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:321)
08-14 14:00:11.086: E/AndroidRuntime(6639):     at java.lang.Thread.run(Thread.java:864)

If i delete line 54 for converting the status object into an array, the application runs in normal case without errors. What could it be?? Please help me.

edit retag flag offensive close merge delete

Comments

Please, in the future, try to focus on using tags without the hashtags. These hashtags create tons of double tags, which is not interesting if you want to apply filtering on topics. As to your problem, you adapted line 54 of which file or piece of code?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-14 07:25:34 -0600 )edit

I adapted line 54 of my .java file. My code at the last post is only a piece. In line 54 is only this code: byte statusS[] = status.toArray(); Sorry for my bad english. I hope you understand me..

Patrick Tyll gravatar imagePatrick Tyll ( 2013-08-14 07:35:18 -0600 )edit

I dont know exactly if this is intended to be like that, but the error says something of a 2 channel matrix. Most likely its the status Mat. I dont know if toArray works with a 2 channel matrix when copying it into a 1-dimensional array. Im not sure about that though

Moster gravatar imageMoster ( 2013-08-16 09:41:42 -0600 )edit

What is about the return value of the toArray() method? public byte[] toArray() The return value is a 1 dimension Array. It should be correct if i try to copy it into a 1-dimensional array. In some test-runs on a galaxy s2 or nexus 7 I print the status array on the console: Output = [0,1,1,0,1] I think it's a camera problem. The Version 2.4.6 can't connect correctly to the camera of the htc-one or some camera config changes like changing the resolution is the reason.

Patrick Tyll gravatar imagePatrick Tyll ( 2013-08-19 02:41:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-08-16 09:24:35 -0600

Patrick Tyll gravatar image

I have not solution for this problem wich solve it, but i know the reason of the problem.

I used a HTC-one for testing my application to Debug it and many other devices.

I found the same problem in the opecCV-Devzone: [http://code.opencv.org/issues/2359]

edit flag offensive delete link more

Comments

Are you sure this is the right bug report? I dont think he has issues with the camera itself.

Moster gravatar imageMoster ( 2013-08-16 09:36:19 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-08-14 07:20:02 -0600

Seen: 784 times

Last updated: Aug 16 '13