saviopalmieri / ctypes-opencv

Automatically exported from code.google.com/p/ctypes-opencv
0 stars 0 forks source link

Null pointer in cvFindStereoCorespondenceBM #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

left=cvCreateMat(480, 640, CV_8U)
right=cvCreateMat(480, 640, CV_8U)
state=cvCreateStereoBMState()
cvFindStereoCorrespondenceBM(left, right, None, state)

What is the expected output? What do you see instead?

Should internally create and return disparity. Instead we get an error window:

Null pointer (Stereo BM state is NULL.)
in function cvFindStereoCorrespondenceBM, .\cvstereobm.cpp(574)

What version of the product are you using? On what operating system?

ctypes-opencv 0.7.3
OpenCV 1.1.0
Python 2.6

Windows XP Professional SP3

Please provide any additional information below.

From looking at the C source, this error triggers when the state parameter
passed in is NULL, which is strange because prior to the call, the state
parameter is non-null.

Same thing happens if I supply my own disparity parameter instead of having
it be internally created.

A strange thing I noticed in the debugger is that after setting a
parameter, the addresses of the fields inside it change. E.g:

# the object beforehand
CvStereoBMState(preFilterType=0,preFilterSize=41,preFilterCap=31,SADWindowSize=1
5,minDisparity=0,numberOfDisparities=64,textureThreshold=10,uniquenessRatio=15,s
peckleWindowSize=0,speckleRange=0,preFilteredImg0=<opencv.cxcore.LP_CvMat
object at 0x01A80A30>,preFilteredImg1=<opencv.cxcore.LP_CvMat object at
0x01A809E0>,slidingSumBuf=<opencv.cxcore.LP_CvMat object at 0x01A80A30>)

>>> state.SADWindowSize = 41

# the object after executing this line, note address changes.
CvStereoBMState(preFilterType=0,preFilterSize=41,preFilterCap=31,SADWindowSize=4
1,minDisparity=0,numberOfDisparities=64,textureThreshold=10,uniquenessRatio=15,s
peckleWindowSize=0,speckleRange=0,preFilteredImg0=<opencv.cxcore.LP_CvMat
object at 0x01A809E0>,preFilteredImg1=<opencv.cxcore.LP_CvMat object at
0x01A80A30>,slidingSumBuf=<opencv.cxcore.LP_CvMat object at 0x01A809E0>)

I am not sure if this has anything to do with it, but thought I would
mention just in case.

Original issue reported on code.google.com by ChrisM6794@gmail.com on 4 Jun 2009 at 7:25

GoogleCodeExporter commented 8 years ago
Any news on this? Will have to rewrite in C soon otherwise.

Original comment by ChrisM6794@gmail.com on 10 Jun 2009 at 12:53

GoogleCodeExporter commented 8 years ago
Oh, sorry. I haven't got time to look into the matter yet. I'm still busy with a
research project in my university. I'll investigate the problem asap, probably 
next
week, if you don't mind. Thanks for having raised the issue.

Best regards,

Minh-Tri

Original comment by pmtri80@gmail.com on 10 Jun 2009 at 1:06

GoogleCodeExporter commented 8 years ago
I have found the bug. I did not wrap function cvFindStereoCorrespondenceBM()
properly. Thanks for having raised the issue. Please let me know if it works on 
your end.

Minh-Tri

Original comment by pmtri80@gmail.com on 17 Jun 2009 at 3:54

GoogleCodeExporter commented 8 years ago
Thank you again, it's working great now :)

Original comment by ChrisM6794@gmail.com on 17 Jun 2009 at 5:50