Linear polar unwrap implemented with NumPy for Machine/Computer vision. A linear polar unwrap is a 2D geometric transformation that remaps an image to a polar coordinate space.
- OpenCV Reference: warpPolar()
- OpenCV Reference: InterpolationFlags
- OpenCV Reference: Remapping
This implementation of the polar unwrap allows for selecting a minimum or inner radius instead of starting at a center point. In this way, the transformation only selects the necessary pixel region (an annulus vs a circle) for the function, allowing for faster execution.
- Refactor Code w/ optimizations.
- Add google colab notebook.
- Add flags for specifying unwrap directions.
- Change ccw flag to direction over vertical axis. (clock-wise vs. counter clock-wise).
- Change flip flag to flip output image over horizontal axis.
- Remove np.meshgrid and replace with faster broadcasting method. (Performance Increase)
- Add remap function from opencv. Allows for the use of interpolation methods for improved quality. Without remap function the produced image quality was equivalent to cv2.INTER_NEAREST (IMAGE Quality Increase)
- Add .astype('float') to numpy array initialization vs. separate conversion step for remap. (Performance Increase)
- Replace math.pi with np.pi.
- Replace time.time() with perf_counter() to calculate execution time, more accurate.
- Add interpolated images to README for quality comparison.
Here is an example input image of a 806-2RS ball bearing.
The example output image of the unwrapped 806-2RS ball bearing.
The example output image of the unwrapped 806-2RS ball bearing - INTER_LINEAR.
The example output image of the unwrapped 806-2RS ball bearing - INTER_CUBIC.
The example output image of the unwrapped 806-2RS ball bearing - INTER_LANCZOS4.