idiap / multicamera-calibration

Multi-Camera Calibration Suite
GNU General Public License v3.0
184 stars 50 forks source link

Running the calibration #1

Closed kennege closed 6 years ago

kennege commented 6 years ago

Hi there,

I am currently trying to run the intrinsic calibration for a dataset of 40 images of a checkerboard with squares of 25mm by 25mm. The directory that these images are in is /home/images/. I tried to run the intrinsic calibration using the following command:

bin/intrinsic -p chessboard -n 40 -W 25 -H 25 /home/images/*.png /home/images/intrinsic.json

But this is throwing the error:

[ INFO:0] Initialize OpenCL runtime... Traceback (most recent call last): File "bin/intrinsic", line 173, in main() File "bin/intrinsic", line 121, in main images, image_points = filter_images(opts.input, opts.pattern, opts.width, opts.height) File "bin/intrinsic", line 72, in filter_images ret, interest_points = cv2.findChessboardCorners(gray, (width, height), None) TypeError: an integer is required

Is anyone able to explain where I have gone wrong?

Cheers, Gerard

SalimKayal commented 6 years ago

Well, width and height are the number of intersections of the chessboard, not the size of a square. However that should not get you a TypeError. This was developed for python 2. Which version do you use?

kennege commented 6 years ago

Hi Salim, thanks for the reply.

I am using Python 3, which is probably what the problem is. I managed to fix the issue by changing lines 49 and 50 of intrinsic.py to the following:

parser.add_argument('-W', '--width', default=4, type=int, help='board width') 
parser.add_argument('-H', '--height', default=11, type=int, help='board height') 

I also had to change line 144 to:

cv2.calibrateCamera(opoints, ipoints, image_resolution,None,None)

After that, intrinsic.py ran successfully.

I may post again if I run into further problems. I hope that's OK, and that these fixes are somewhat helpful.

Cheers, Gerard

SalimKayal commented 6 years ago

It was written a while ago. When I find the time I'll update it to python 3