Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

01

Camera Calibration

1. Activate the Camera
  • Connect the CSI camera to the Raspberry Pi camera interface, ensuring that the blue side of the cable faces the black switch cover;
  • Connect the Raspberry Pi to a display and open the terminal to input commands;
Camera Calibration and Distance Measurement Made Easy
  • Select Interface option and then choose P1 Camera;
Camera Calibration and Distance Measurement Made Easy
Camera Calibration and Distance Measurement Made Easy
  • Save and exit, then reboot the Raspberry Pi
2. Take Photos
  • Prepare a chessboard as shown in the picture, assigning coordinates (0,0,0), (1,0,0), (2,0,0) … (11,8,0) to the chessboard;
Camera Calibration and Distance Measurement Made Easy
  • Open the terminal on the Raspberry Pi and input the command to activate the camera;
cheese
Camera Calibration and Distance Measurement Made Easy
  • Select the external camera and take multiple photos of the chessboard from different angles;
Camera Calibration and Distance Measurement Made Easy
Camera Calibration and Distance Measurement Made Easy
Camera Calibration and Distance Measurement Made Easy
  • Save the photos taken into a folder, renaming them as ‘1.jpg’‘2.jpg’

Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

3. Remove Distortion
  • Copy the photos to the computer, placing them in the same directory as the code file (link at the end)

Camera Calibration and Distance Measurement Made Easy

  • Open the code with pycharm (calib_camera), add the libraries used in settings numpyopencv-pythonglob

Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

  • Modify path 1 to the path where the chessboard photos are stored, modify path 2 to the path for the test photo (using the 17th photo as an example)

Camera Calibration and Distance Measurement Made Easy
  • Run the program to obtain the corrected photo, which will be automatically stored in the same path as the captured photos
Camera Calibration and Distance Measurement Made Easy

Camera Calibration and Distance Measurement Made Easy

  • Record the camera’s parameter matrix

Camera Calibration and Distance Measurement Made Easy

02

Monocular Distance Measurement

1. Modify Parameters
  • Measure the height of the camera from the ground where the object is placed

    Camera Calibration and Distance Measurement Made Easy

  • Open the code in the Raspberry Pi using codeblock to access Object_detection&&Distance (link at the end), and modify the height parameter in the appropriate location

Camera Calibration and Distance Measurement Made Easy

  • Modify the camera’s parameter matrix based on the test data
Camera Calibration and Distance Measurement Made Easy

2. Measure Distance

  • Compile and run the program

Camera Calibration and Distance Measurement Made Easy

03

Debugging Video

(Detailed operations can refer to the video)

We have prepared the complete program and examples for target detection and distance measurement, and you are welcome to join our group chat. After joining, send: “Target Detection and Distance Measurement” to receive the prepared image; you can also download it from our repository:
https://github.com/COONEO/neor_mini.git     # Melodic branch
Welcome to join our group chat, which is for friends who love robot development, making it easier for everyone to learn, share, and exchange ideas about creating intelligent robots, and to meet more like-minded friends. There are also irregular community exclusive benefits! Follow our public account or send "join group" in the dialog box to get the way to join.
Camera Calibration and Distance Measurement Made Easy

Layout: SUSU

Review: X

Creating is not easy, if you like this content, please share it with your friends to share and exchange the joy of creation, and also encourage us to create more robot development guides for everyone, so let’s learn by doing together!

Camera Calibration and Distance Measurement Made Easy

———

Recommended Reading:

The Robot Taps You, Let’s Understand Simulation Testing
Robot Target Detection | To Know You, Just a Moment
The Flat World in the Robot’s Mind
Three Minutes to Understand PID Algorithm
Gesture Recognition and Control | “No Contact” Mode During the Pandemic
ROS Takes You Through Simulation and Reality
Depth Camera | The Wise Eye of the Robotic Arm
Odometry | The Distance Between You and Autonomous Mobile Robots
Mystery Unboxing | NEOR mini User Feedback

Building a ROS Open Source Mini Unmanned Vehicle from Scratch

Standing on the Shoulders of PX4-Autopilot: Outdoor Autonomous Driving Path Planning

NEOR mini Runs Wild on the Track

Building an Open Source Crop Inspection Robot from Scratch

Open Source! Step-by-Step Guide to Building an Arduino + Raspberry Pi ROS Car (Part 1)

Open Source! Step-by-Step Guide to Building an Arduino + Raspberry Pi ROS Car (Part 2)

Building ROS Robot – Ubuntu Binding Serial Port Devices

Open Source! Vision Line Following ROS Car Based on OpenCV

Open Source! Webots + ABB Robotic Arm Inverse Kinematics Calculation Building ROS Robot – Raspberry Pi System Image Copy and Mounting Free Memory
Step-by-Step Guide to Velodyne Lidar Simulation + 3D Mapping
Open Source! Step-by-Step Guide to Multi-Channel Ultrasonic Sensor Obstacle Avoidance Simulation
Camera Calibration and Distortion Removal – Taking Raspberry Pi Wide Angle as an Example
Raspberry Pi Wide Angle Camera’s Target Detection and Monocular Distance Measurement
Building ROS Robot – Ackermann Chassis Odometry Calculation Node
Building ROS Robot – Using Program to Publish Navigation Target Points
Building ROS Robot – Step-by-Step Guide to Implementing 2D Mapping with Gmapping
Building ROS Robot – Overview of Laser Radar 2D Mapping Methods
Measured! ROS Robot 400 Square Meter Circular Floor Different Method Mapping Analysis
Open Source! Step-by-Step Guide to Building Arduino + NVIDIA Jetson ROS Car (Part 1)
Open Source! Step-by-Step Guide to Driving Arduino + ROS Car Motor
2021 Annual Free Open Resource Sharing – Ackermann and Differential Chassis Series Simulation
2021 Annual Free Open Resource Sharing – Building ROS Car Series NEOR mini Self-Collected Dataset LeGO-LOAM Mapping Open Source! Step-by-Step Guide to Building Arduino + NVIDIA Jetson ROS Car (Part 2) VMware Virtual Machine Network Configuration
Open Source! Step-by-Step Guide to Adjusting Encoder Motor Speed PID
Open Source! Step-by-Step Guide to Driving Arduino + ROS Car High-Power DC Hall Encoder Motor
Step-by-Step Guide to Velodyne Lidar Simulation + LIO_SAM Mapping
NEOR mini Self-Collected Dataset LIO_SAM Mapping Open Source! Step-by-Step Guide to Visualizing Ultrasonic Data with Rviz is That Simple! Using NVIDIA SDK Manager to Install JetPack
Get a Head Start! Ubuntu 20.04 Supporting ROS2 JetPack 5.0 is Released
Open Source! Step-by-Step Guide to Building Arduino + NVIDIA Jetson ROS Car (Part 2)
Open Source! Step-by-Step Guide to Building Ackermann Autonomous Driving Car (Part 1)

Open Source! Step-by-Step Guide to Driving Arduino + ROS Car Motor (A4950T)

Whaaat?! Install Ubuntu 22.04 Desktop Directly on Raspberry Pi 4 2GB to Run ROS2 for Robot Development

Step-by-Step Guide to Debugging ROS Chassis with Ultrasonic + Remote Control + Light Combination

Open Source! Step-by-Step Guide to Implementing a Servo Gimbal

Leave a Comment

Your email address will not be published. Required fields are marked *