Catkin package to detect labels on images of industrial boxes.
This repo should be cloned into a folder called label_detector in the src/ folder of your catkin workspace top-level directory.
The project has been organized using the catkin workspace approach and catkin's CMake macros.
LabelDetection.ipynb: Rough prototype of the computer vision pipeline algorithm itself; used for rapid experimentation with opencv. Path to image file directory may need to be modified to test/imagefiles/ in order to run this after cloning the repo.
src/main.cpp: Entry point for primary output executablelabel_detector_node.src/dynamic_label_detector_node.cppandinclude/dynamic_label_detector_node.h: Wraps cv_bridge and message handling around dynamic label detector.src/dynamic_label_detector.cppandinclude/dynamic_label_detector.h: Wraps dynamic_reconfigure tunability around label detector. This is included in an exported project library.src/label_detector.cppandinclude/label_detector.h: Implements the computer vision pipeline algorithms.include/label_detector_debug.h: For popping up lots of debug opencv image windows and messages depending on DEBUG #define flag.src/image_publisher.cpp: Entry point (only file) fortest_image_publisherexecutable.test/test_label_detector.cpp: Entry point for gtest unit test oflabel_detector.cpp.test/csvrow.h: CSV file reading helper class for reading in hand-annotated ground truth rectangle vertices for test.
label_detector_node: Primary node that subscribes to a (hardcoded) image topic, detects labels, posts a custom topic of detection parameters, and shows an opencv window with the image annotated. The node may be tuned using rqt_reconfigure.test_image_publisher: Roughly written image publishing node hardcoded to publish the two test images back and forth at a 0.5Hz rate. Used to demonstrate a basic system.
To build just this package's executables, type this at the catkin workspace top-level directory:
$ catkin_make -DCATKIN_WHITELIST_PACKAGES="label_detector"
A gtest unit test of label_detector.h functionality. It checks for the expected number of label detections on each image. It also computes an Intersection Over Union metric and checks that the performance exceeds 0.9 on each image. To build and run this test, type this at the catkin workspace top-level directory:
$ catkin_make run_tests
A launch file has been created to bring up a basic system using two test images. To run:
$ roslaunch label_detector basic_system.launch
To tune the algorithmic parameters of the computer vision algorithm use rqt_reconfigure:
$ rosrun rqt_reconfigure rqt_reconfigure
- Go through TODO comments to swap in identified cv::cuda versions of opencv routines.
- Add file/function headers with doxygen tags if desired.
- Figure out why the detections are slightly biased away from the origin as scaled_height_ decreases.
- Add a rostest+gtest for automated testing of label_detector_node.
- Profile the cpu cycle/time contribution of major algorithm subroutines; confirm python jupyter notebook analysis' preliminary relative running time analysis.
- Consider swapping findContours for a Hough based approach.
- Consider additional confidence measurement components: rectangularity, size, color histogram, etc.
- Apply random relevant random transformations (rotation, scale, illumination) along with transformations to the ground truth to perform further robustness testing. Maybe add dynamic_reconfigure rotation parameter for experimentation.