I am trying to stitch images taken by a camera that moves on a known helical trajectory, with known step size and straight axis. The camera takes pictures of the internal surface of a cylinder within which it moves. The helix and cylinder have the same axis.
My goal: to use the pictures captured by the camera to reconstruct the internal surface of the cylinder in the form of a cylindrical surface, and then flatten this surface to visualize the cylinder unwrapped (like a sheet of paper that you wrap to be a cylinder and then unfold to go back to a rectangle).
Example of the application: a camera is installed on a device which has a threaded center, and this moves on a threaded axis. The system is coaxial with a pipe and through the images we want to see the cylindrical map of the pipe and inspect it to check for defects.
I have studied standard panorama image stitching algorithms, but I am not able to define the pipeline and instruments necessary for this kind of application.
I believe these could be the steps:
- Calibrate the camera (in my case, I have a camera with horizontal FoV = 132°, vertical FoV = 65°, so I am using OpenCV's fisheye camera calibration and have obtained good undistortion results).
- Select initial keyframe from the video stream.
- Select a new keyframe from the video stream so that its overlap with the previous keyframe is >50%.
- Extract features in current keyframe and previous keyframe.
- Match features across the adjacent keyframes.
- Stitch the keyframes together.
- Project the stitched image on a cylindrical map of known radius.
- Iterate points 3. to 7. to update the map (need to make the map "grow" along the cylindrical axis).
- Stop the map generation, flatten the cylinder into a rectangle.
I don't know if my pipeline is correct and, most importantly, how to implement steps 7 and 8 (make the map "grow"). I would like to use Python and OpenCV.
Moreover, I think that if a rotation encoder were available, image stitching could be performed even without feature matching; by knowing the relative transformation of the two frames. Indeed, moving on a helical path means there's only one degree of freedom.
Best regards