From 7bd4edde9b2bd2788f1bf1934ecbf7864acf25d8 Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 1 Feb 2026 11:19:44 +0000 Subject: [PATCH 1/6] READ-ME Update Updated READ-ME to reflect current state of the project, deleted excess files --- src/computer_vision/README.md | 20 ++++++++++++++++---- src/computer_vision/resource/computer_vision | 0 2 files changed, 16 insertions(+), 4 deletions(-) delete mode 100644 src/computer_vision/resource/computer_vision diff --git a/src/computer_vision/README.md b/src/computer_vision/README.md index 9e50966..2d56fcc 100644 --- a/src/computer_vision/README.md +++ b/src/computer_vision/README.md @@ -1,13 +1,25 @@ +# Computer Vision +## Repository Organisation +### computer_vision +board_detection.py - Contains a ROS2 node that takes an image of a chessboard and identify the inner and outer corners of the chessboard, publishing whether coordinates have been found and their 2D image coordinates + +### config +Contains camera configuration for the club webcam if using. + +### test +Three basic tests and 3 images of random chessboards + +### train +chess_piece_detection.py - Contains code to load data from roboflow and train a yolov8n model with it + + # Setup 1. (Optional) If you are planning on training the YOLO model, copy `.roboflow_key.example` to `.roboflow_key`, get your Roboflow key and write it into the file 2. Get camera calibration and parameter files and put them into `config/cam_params.yaml` and `config/camera_info.yaml`. This can be done in 2 ways: - Copy over the templates `config/cam_params_template.yaml` and `config/camera_info_template.yaml`. This is done by default in `install.py`. -- Calibrate the camera by yourself (See the section below). +- Calibrate the camera by yourself. -## TODO: add documentation for how to calibrate the camera -TODO: calibrate camera -TODO: optimise params # Usage ## Running the nodes diff --git a/src/computer_vision/resource/computer_vision b/src/computer_vision/resource/computer_vision deleted file mode 100644 index e69de29..0000000 From 0a70f2f44681e793a77fd36be51349dc3c896a6c Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 1 Feb 2026 11:45:24 +0000 Subject: [PATCH 2/6] Update README.md Update READ-ME with resources from various communication channels --- src/computer_vision/README.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/computer_vision/README.md b/src/computer_vision/README.md index 2d56fcc..187ba66 100644 --- a/src/computer_vision/README.md +++ b/src/computer_vision/README.md @@ -13,7 +13,7 @@ Three basic tests and 3 images of random chessboards chess_piece_detection.py - Contains code to load data from roboflow and train a yolov8n model with it -# Setup +## Setup 1. (Optional) If you are planning on training the YOLO model, copy `.roboflow_key.example` to `.roboflow_key`, get your Roboflow key and write it into the file 2. Get camera calibration and parameter files and put them into `config/cam_params.yaml` and `config/camera_info.yaml`. This can be done in 2 ways: @@ -21,13 +21,33 @@ chess_piece_detection.py - Contains code to load data from roboflow and train a - Calibrate the camera by yourself. -# Usage -## Running the nodes +## Usage +### Running the nodes `board_detection` node doesn't use any extra parameters: just do `ros2 run computer_vision board_detection` -## Debugging +### Debugging To start the camera node directly, run `ros2 run usb_cam usb_cam_node_exe --ros-args --params-file config/cam_params.yaml` To simulate a camera with an image, run `ros2 run stub_scripts compressed_image_publisher --ros-args -p input_path:="test/test_images/chessboards/1.jpeg"`, where the image path can be replaced for other images To view camera output, run `rqt`, select "Plugins/visualization/Image view" and select the correct topic + + +## Resources +### YOLO +YOLOv8 Model Specification - https://github.com/ultralytics/ultralytics/blob/main/docs/en/models/yolov8.md + +### Camera Calibration +Monocular camera calibration using ROS - https://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration + +### Roboflow +Roboflow Guide - https://blog.roboflow.com/train-yolov8-obb-model/ + +### Ros Intergration +YOLO integration - https://github.com/leggedrobotics/darknet_ros +Ultralytics integration - https://docs.ultralytics.com/guides/ros-quickstart/#use-ultralytics-with-ros-sensor_msgsimage + +### Webcams +Using Android phone as a webcam - https://adityatelange.in/blog/android-phone-webcam-linux/ +Physical Webcam model - https://amzn.eu/d/99ZbQrP + From a918e35a5272db20c5b468c536077bac314aeccd Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 1 Feb 2026 12:50:10 +0000 Subject: [PATCH 3/6] Update README.md Update READ-ME to the correct path to test images --- src/computer_vision/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/computer_vision/README.md b/src/computer_vision/README.md index 187ba66..5049afd 100644 --- a/src/computer_vision/README.md +++ b/src/computer_vision/README.md @@ -28,7 +28,7 @@ chess_piece_detection.py - Contains code to load data from roboflow and train a ### Debugging To start the camera node directly, run `ros2 run usb_cam usb_cam_node_exe --ros-args --params-file config/cam_params.yaml` -To simulate a camera with an image, run `ros2 run stub_scripts compressed_image_publisher --ros-args -p input_path:="test/test_images/chessboards/1.jpeg"`, where the image path can be replaced for other images +To simulate a camera with an image, run `ros2 run stub_scripts compressed_image_publisher --ros-args -p input_path:="src/computer_vision/test/test_images/chessboards/1.jpeg", where the image path can be replaced for other images To view camera output, run `rqt`, select "Plugins/visualization/Image view" and select the correct topic From fffd8f5ecf2d595e0ef568df70eb54524daa4749 Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 8 Feb 2026 11:12:10 +0000 Subject: [PATCH 4/6] Modification: Updated README with links to more YOLO and OpenCV tutorials --- src/computer_vision/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/computer_vision/README.md b/src/computer_vision/README.md index 5049afd..6a41680 100644 --- a/src/computer_vision/README.md +++ b/src/computer_vision/README.md @@ -34,7 +34,11 @@ To view camera output, run `rqt`, select "Plugins/visualization/Image view" and ## Resources +### OpenCV +OpenCV Tutorial - https://www.youtube.com/watch?v=oXlwWbU8l2o + ### YOLO +How YOLO works - https://www.youtube.com/watch?v=svn9-xV7wjk YOLOv8 Model Specification - https://github.com/ultralytics/ultralytics/blob/main/docs/en/models/yolov8.md ### Camera Calibration From 98f07a1a8c31880b2b10deafc89f23ee9993ed14 Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 8 Feb 2026 12:28:38 +0000 Subject: [PATCH 5/6] UPDATE: Altered parameters and file name for chess_piece_detection --- ...s_piece_detection.py => chess_piece_detection_training.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/computer_vision/train/{chess_piece_detection.py => chess_piece_detection_training.py} (89%) diff --git a/src/computer_vision/train/chess_piece_detection.py b/src/computer_vision/train/chess_piece_detection_training.py similarity index 89% rename from src/computer_vision/train/chess_piece_detection.py rename to src/computer_vision/train/chess_piece_detection_training.py index 2449b7f..3fd1d66 100644 --- a/src/computer_vision/train/chess_piece_detection.py +++ b/src/computer_vision/train/chess_piece_detection_training.py @@ -4,7 +4,7 @@ from ultralytics import YOLO try: - with open(".roboflow_key", "r") as f: + with open("src/computer_vision/config/.roboflow_key", "r") as f: ROBOFLOW_KEY = f.read().strip() except FileNotFoundError: from sys import exit, stderr @@ -29,4 +29,4 @@ model = YOLO("yolov8n.pt") -results = model.train(data=f"{dataset.location}/data.yaml", epochs=100, imgsz=640) +results = model.train(data=f"{dataset.location}/data.yaml", epochs=100, imgsz=640, device="cpu", batch=8) \ No newline at end of file From d6a204c33a9d627c42812b2bff29f842de13a0c2 Mon Sep 17 00:00:00 2001 From: Kirsten Date: Sun, 8 Feb 2026 12:33:29 +0000 Subject: [PATCH 6/6] UPDATE: Altered file name in README --- src/computer_vision/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/computer_vision/README.md b/src/computer_vision/README.md index 6a41680..1a9a0df 100644 --- a/src/computer_vision/README.md +++ b/src/computer_vision/README.md @@ -10,7 +10,7 @@ Contains camera configuration for the club webcam if using. Three basic tests and 3 images of random chessboards ### train -chess_piece_detection.py - Contains code to load data from roboflow and train a yolov8n model with it +chess_piece_detection_training.py - Contains code to load data from roboflow and train a yolov8n model with it ## Setup