Distance Transformation of Binary BMP Images Using Different Distance Metrics

Resource Overview

Building upon MATLAB's built-in distance transform function, this implementation explores various distance metrics and demonstrates their visual effects. The code has been successfully tested and verified on MATLAB 6.5, with enhanced compatibility across different MATLAB versions.

Detailed Documentation

Based on MATLAB's native distance transform function (bwdist), we conducted an in-depth investigation into its applications and implementation methodologies. Our research focused on modifying the core algorithm to improve transformation accuracy and output quality. Through extensive experimentation with different distance metrics (Euclidean, Cityblock, Chessboard), we developed an optimized approach that produces superior results compared to standard implementations. Key enhancements include algorithmic improvements for precise pixel-distance calculations and code optimization for cross-version MATLAB compatibility. The implementation specifically addresses binary BMP image processing, utilizing MATLAB's image processing toolbox functions while incorporating custom distance calculation logic. After rigorous testing and compatibility adjustments, the program successfully runs on MATLAB 6.5 and delivers satisfactory transformation results across various test images. The code structure maintains modularity for easy adaptation of different distance metrics while ensuring computational efficiency.