I am trying to use the OpenCV cvFitLine() function using the Python SWIG interface to OpenCV. My problem has to do with the fact that the last argument is a pointer to an array of four floats (to return the fitted line parameters). My first mindless attempt looked like this:
This produced the error:
After googling around bit, I decided that ctypes would give me the array pointer that I needed, so I modified my code as follows:
But this produced the same error. I'm stuck. Can someone please point me in the right direction?
Thanks...
Code:
line = [] cv.cvFitLine(img, cv.CV_DIST_L2, 0, 0.01, 0.01, line)
TypeError: in method 'cvFitLine', argument 6 of type 'float *'
Code:
FourFloats = ctypes.c_float * 4 line = FourFloats() cv.cvFitLine(img, cv.CV_DIST_L2, 0, 0.01, 0.01, ctypes.byref(line))
Thanks...