Demo 5

Code for part 1: https://github.com/MandyMeindersma/Robotics/blob/master/Demos/Demo5/Part1-images.py

We had to do a lot to make the code work from the link that was given to us:

  • Instead of loading data from "B.npz" we had to go into the camera settings for ROS (cd ~, cd .ros/camera_information) then look through these files to find the matrix and distribution numbers. After that we had to reshape the matrix (3,3) but leave the distribution as is.

  • cv2.line() does not return anything, it modifies the image itself, we removed any mentions of it returning anything in the draw function.

  • Draw should not return anything since cv2.line() modifies the image itself.

  • This code is searching for a 7*6 checkerboard, we changed this to 8*6.

  • cv2.CornerSubPix() does not return anything, it just modifies corners so we removed use of corners2 and replaced with corners.

  • Draw should not return an image, replaced everything with the previous img as draw just modifies the object, not create a new one.

  • Saving the calibration in the hidden tmp folder gives the photos.