LearnTechWithUs / Stereo-Vision

This program has been developed as part of a project at the University of Karlsruhe in Germany. The final purpose of the algorithm is to measure the distance to an object by combining two webcams and use them as a Stereo Camera.
MIT License
343 stars 114 forks source link

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

Closed prasad01dalavi closed 6 years ago

prasad01dalavi commented 6 years ago

When we run "Main_Stereo_Vision_Prog.py" it gives the above error in stereocalibrate function

# StereoCalibrate function
flags = 0
flags |= cv2.CALIB_FIX_INTRINSIC
#flags |= cv2.CALIB_FIX_PRINCIPAL_POINT
#flags |= cv2.CALIB_USE_INTRINSIC_GUESS
#flags |= cv2.CALIB_FIX_FOCAL_LENGTH
#flags |= cv2.CALIB_FIX_ASPECT_RATIO
#flags |= cv2.CALIB_ZERO_TANGENT_DIST
#flags |= cv2.CALIB_RATIONAL_MODEL
#flags |= cv2.CALIB_SAME_FOCAL_LENGTH
#flags |= cv2.CALIB_FIX_K3
#flags |= cv2.CALIB_FIX_K4
#flags |= cv2.CALIB_FIX_K5
retS, MLS, dLS, MRS, dRS, R, T, E, F= cv2.stereoCalibrate(objpoints,
                                                          imgpointsL,
                                                          imgpointsR,
                                                          mtxL,
                                                          distL,
                                                          mtxR,
                                                          distR,
                                                          ChessImaR.shape[::-1],
                                                          criteria_stereo,
                                                          flags)

Output:

Starting calibration for the 2 cameras... 
Cameras Ready to use
Traceback (most recent call last):
  File "/home/prasad/Desktop/Distance with SV/Main_Stereo_Vision_Prog.py", line 135, in <module>
    (flags,flags))
SystemError: new style getargs format but argument is not a tuple
LearnTechWithUs commented 6 years ago

Hello @prasad01dalavi and thank you for testing our code!

Do you have opencv3 installed on your computer? Because some people seems to have the same kind of error when it is installed: https://github.com/ros-perception/image_pipeline/issues/124

prasad01dalavi commented 6 years ago

Hello LearnTechWithUs, I have opencv 2.4.9 and 2.4.13

prasad01dalavi commented 6 years ago

I am using ubuntu. How do I install opencv3. could you just help me with that please? What do I do? I visited that link but not able to understand what to do.

LearnTechWithUs commented 6 years ago

Can you try to enter this in your python command line to see which version is actually used when importing opencv? import cv2 and then cv2.__version__

prasad01dalavi commented 6 years ago

yes. I got 2.4.9.1. I am unable to install opencv3. Should i try desperately. May I know which version of opencv and python are you using for this project ???????

prasad01dalavi commented 6 years ago

done. opencv3 solves that error. But not able to get the clear display of object. FILTER COLOR DEPTH IS NOT SHOWING MY OBJECT. :-(

prasad01dalavi commented 6 years ago

Hello? Are you there man. Let me show you the results: Please have a look on them. can you please suggest how to get that white box as shown in your video? result Please check this image. It was expected to show atleast same distance. how do I deal with this.

LearnTechWithUs commented 6 years ago

I'm glad you could finally run the script! The stereo calibration has certainly not been done correctly. One possible reason is that you don't have enough calibration pictures or they are maybe blurry! You should certainly take new (and more) pictures of the chessboard with your cameras.

Don't give up ;) I hope it will work!

prasad01dalavi commented 6 years ago

Thank you so much for your reply. I had taken 65 images (65 left + 65 right). As you said i am also doubtful about their blurry style. I am gonna do it and let you know.

prasad01dalavi commented 6 years ago

It works bro! Thank you so much. Moving towards accuracy like you had in your video. i was just 50% of that.