A command-line tool for batch processing images with various computer vision feature enhancement techniques. This tool is designed to help calibrate and test different CV preprocessing methods by applying them to a set of source images.
- Process all images in a source directory with various CV-specific transformations
- Multiple edge detection methods (Canny, Sobel, Laplacian, structured edges)
- Feature enhancement techniques (CLAHE, adaptive thresholding)
- Morphological operations for feature manipulation
- Corner and blob detection enhancement
- Parallel processing support for faster execution
- Progress bar to track processing status
- Organizes processed images in timestamped subfolders for easy tracking and comparison
Here's a demonstration of various transformations applied to a sample image:
Canny edge detection with thresholds (50, 150) after Gaussian blur (5x5)
Advanced edge detection combining Sobel gradients with non-maximum suppression and double thresholding
CLAHE (Contrast Limited Adaptive Histogram Equalization) applied in LAB color space, clipLimit=2.0, tileGrid=8x8
Adaptive Gaussian thresholding with block size=11 and C=2
Harris corner detection (blockSize=2, ksize=3, k=0.04) with corners highlighted in red
Blob detection using SimpleBlobDetector with minThreshold=10, maxThreshold=200, minArea=100
- Clone this repository
- Create and activate a conda environment (recommended):
conda create -n cv_imgprocessor python=3.8
conda activate cv_imgprocessor- Install dependencies:
pip install -r requirements.txtPlace your source images in the img_source directory and run:
python img_processor.pyThis will apply all available transformations to each image and save the results in a timestamped subfolder within the img_output directory (e.g., img_output/processed_20230619_142530/).
python img_processor.py [-h] [-s SOURCE] [-o OUTPUT] [-t TRANSFORM [TRANSFORM ...]]
[-c COMBO [COMBO ...]] [-w WORKERS] [-l]Arguments:
-h, --help: Show help message-s, --source: Source directory (default: img_source)-o, --output: Output directory (default: img_output)-t, --transform: Apply specific transformations-c, --combo: Apply specific combination transformations-w, --workers: Number of worker processes (default: 1)-l, --list: List available transformations and exit
Apply all transformations to all images:
python img_processor.pyApply specific edge detection methods:
python img_processor.py --transform canny_edges structured_edgesApply feature extraction combination:
python img_processor.py --combo feature_extractionList available transformations:
python img_processor.py --listProcess with multiple worker processes:
python img_processor.py --workers 4canny_edges: Standard Canny edge detectioncanny_edges_tight: Canny with tighter thresholds for stronger edgescanny_edges_loose: Canny with looser thresholds for weaker edgessobel_edges: Sobel gradient-based edge detectionlaplacian_edges: Laplacian edge detectionstructured_edges: Advanced edge detection combining multiple methodsridge_detection: Ridge detection using Hessian matrix eigenvalues
clahe_enhance: Contrast Limited Adaptive Histogram Equalizationadaptive_threshold: Adaptive Gaussian thresholdingotsu_threshold: Otsu's automatic thresholding
dilate_features: Dilation to expand featureserode_features: Erosion to shrink featuresopen_features: Opening operation (erosion followed by dilation)close_features: Closing operation (dilation followed by erosion)tophat_features: Top-hat transformation for bright features on dark background
corner_enhance: Harris corner detection enhancementblob_enhance: Blob detection and enhancement
feature_extraction: Combines CLAHE and structured edges for optimal feature extractionblob_detection: Enhances and detects blob-like structurescorner_detection: Enhances and detects corner featuresedge_analysis: Multi-step edge detection and enhancementtexture_analysis: Enhances texture features using multiple methods
