erget / StereoVision

Library and utilities for 3d reconstruction from stereo cameras.
http://erget.github.io/StereoVision
GNU General Public License v3.0
649 stars 268 forks source link

SystemError: new style getargs format but argument is not a tuple #15

Closed sponsCA closed 7 years ago

sponsCA commented 7 years ago

Hey !

First of all, a big thank you for this project. It helps me a lot to understand how it works.

I'm facing a problem when using the calibration.py provided. Here is my code :

import numpy as np
import cv2
import subprocess

from stereovision import calibration

def ouverture(nbimages):
    liste = []
    for i in range(1, nbimages + 1):
        img = cv2.imread(str(i) + ".jpg", 1)
        liste.append(img)
    return liste

listeImages = ouverture(2)

calibrator = calibration.StereoCalibrator(9, 6, 2.6, 1941390)
calibrator.add_corners((listeImages[0], listeImages[1]), show_results=1)
calibration = calibrator.calibrate_cameras()

And here is the output :

File "C:\Python27\lib\site-packages\stereovision\calibration.py", line 233, in calibrate_cameras
    flags=flags)[1:]
SystemError: new style getargs format but argument is not a tuple

image

show_results gives me good chessboard matches as you can see. I tried to modify the calibration.py and when I send a tuplet in "flag =" it tells me "an integer is required" 👎

erget commented 7 years ago

The error is coming out of line 233 in calibrate_cameras.py - but that's not the full stack trace, I'm guessing. Otherwise I would have heard from others who are having trouble with that specific module.

Does your script get all the way to the bottom? It'd be useful to know where it dies.

sponsCA commented 7 years ago

I'm using Pyton 2.7 and OpenCV 2

Here is the full error :

C:\Python27\python.exe D:/Dropbox/PyCharmProjet/test.py
Traceback (most recent call last):
  File "D:/Dropbox/PyCharmProjet/test.py", line 18, in <module>
    calibration = calibrator.calibrate_cameras()
  File "C:\Python27\lib\site-packages\stereovision\calibration.py", line 233, in calibrate_cameras
    flags=flags)[1:]
SystemError: new style getargs format but argument is not a tuple

Process finished with exit code 1

Sorry about that, I thought it was obvious but it wasn't ^^

erget commented 7 years ago

I don't actually see any problem here, except perhaps for the fact that you are calibrating so few images. Have you tried using the CLI tool directly to calibrate the camera with your images?

Otherwise I'd throw the code in a debugger and try to figure out what's going on. Looking at it from here I'm sadly not able to see any problem.

sponsCA commented 7 years ago

Yep, the CLI tool works fine, that's why I don't understand this error...

I use only 2 images just for the test. I'm using your code with only 1 camera on printer tracks. But I don't think the error comes from that as long as it works fine with the CLI tool. :/

erget commented 7 years ago

Hmm... Yes, sorry, I don't see any other problems either. Try running it in your interpreter line for line and fiddling it as if you were working with a debugger is my best hint. Hope that helps!