Staircase Detection Using Image Processing
Hexapod robots offer unique mobility advantages, particularly in navigating complex terrains like staircases. However, analyzing their gait in real-world conditions requires precise tracking of movement. This project processes a video of a hexapod robot climbing stairs to detect staircase edges from the video feed, enabling step-by-step analysis without relying on onboard sensors. AprilTags on both the staircase and the robot provide stable reference points for perspective correction and spatial alignment, forming the basis for background extraction, homography transformation, and edge/line detection.
Background Extraction
The robot is an unwanted moving element when detecting staircase edges. Two approaches were compared: frame averaging (mean across frames) and median blending (per-pixel median across frames). Frame averaging left faint “ghosts” of the robot; median blending removed dynamic elements while preserving the staircase, so it was adopted for a clean background.
Homography Transformation
To analyze the staircase structure, perspective distortion must be corrected. Using detected AprilTags as correspondences, a homography warps the frame into a rectified, top-down view. This alignment ensures step edges are horizontal and comparable across frames.
Masking
After rectification, masks remove irrelevant regions (surrounding environment), leaving only the staircase. This focuses computation where it matters and improves the reliability of downstream edge and line detection.
Radon Transform
Stair steps form a set of near-parallel lines. The Radon Transform projects image intensity along many angles to highlight linear structure; the resulting sinogram exposes dominant lines as high-intensity ridges. Here, peaks concentrate near 90°, consistent with horizontal step edges in the rectified view.
Peak Detection
Peak-finding on Radon angle profiles recovers the precise locations of individual step edges. The detected peaks at 90° align with staircase treads, confirming correct rectification and robust line extraction.
Staircase Detection (Overlay)
Detected edges are overlaid on the rectified image to produce a clean, structured visualization of the staircase geometry. This output serves as the basis for gait analysis, allowing measurement of the robot’s foot placements relative to the detected step boundaries.
Results
By combining median-blend background extraction, AprilTag-guided homography, and Radon-based line detection with peak picking, this pipeline enables robust, sensor-free step tracking directly from video. The approach generalizes to other terrain recognition tasks where simple, dependable geometry beats heavyweight modeling. Code is part of an ongoing research effort; feel free to reach out with questions.