This is a command-line Python tool for performing a wide range of image processing operations. The tool supports:
- Elementary image transformations (e.g., brightness, contrast, negative)
- Geometric transformations (e.g., flip, scale)
- Noise filtering and smoothing
- Image comparison and similarity metrics
- Histogram and power transformations
- Image statistics and characteristics
- Convolution-based filters
- Morphological transformations
- Fourier transform and frequency domain filtering
All functionality is exposed via CLI arguments, making it easy to chain into scripts or integrate with other tools.
All commands follow the format:
python imageprocessing.py [OPERATION FLAGS] --input=INPUT_PATH --output=OUTPUT_PATH [OPTIONS]Apply basic image enhancements and transformations:
python imageprocessing.py --negative --input=data/lenac.bmp --output=data/negative-lenac.bmp
python imageprocessing.py --brightness --strength=100 --input=data/lenac.bmp --output=data/bright-lenac.bmp
python imageprocessing.py --contrast --strength=3 --input=data/lenac.bmp --output=data/contrast-lenac.bmpManipulate image orientation and scale:
python imageprocessing.py --hflip --input=data/lenac.bmp --output=data/hflip-lenac.bmp
python imageprocessing.py --vflip --input=data/lenac.bmp --output=data/vflip-lenac.bmp
python imageprocessing.py --dflip --input=data/lenac.bmp --output=data/dflip-lenac.bmp
python imageprocessing.py --enlarge --proportion=1.5 --input=data/interpolation_test.bmp --output=data/large-lenac.bmp
python imageprocessing.py --shrink --proportion=0.6 --input=data/lenac.bmp --output=data/shrink-lenac.bmpReduce noise using different filtering techniques:
python imageprocessing.py --median --input=data/lenac_normal3.bmp --output=data/lenac_normal3-median.bmp
python imageprocessing.py --gmean --input=data/lenac_normal3.bmp --output=data/lenac_normal3-gmean.bmpCompare images to calculate distortion or similarity:
python imageprocessing.py --mse --input=data/lenac_normal3-median.bmp --reference=data/lenac.bmp
python imageprocessing.py --pmse --input=data/lenac_normal3-median.bmp --reference=data/lenac.bmp
python imageprocessing.py --snr --input=data/lenac_normal3-median.bmp --reference=data/lenac.bmp
python imageprocessing.py --psnr --input=data/lenac_normal3-median.bmp --reference=data/lenac.bmp
python imageprocessing.py --md --input=data/lenac_normal3-median.bmp --reference=data/lenac.bmpVisualize pixel intensity distributions:
python imageprocessing.py --histogram --input=data/lena.bmp --output=data/hist/h-lena.bmp
python imageprocessing.py --hpower --input=data/lena.bmp --output=data/hist/lena-hpower.bmp
python imageprocessing.py --histogram --input=data/hist/lena-hpower.bmp --output=data/hist/h-lena-hpower.bmpExtract image-level statistics:
python imageprocessing.py --cmean --input=data/lena.bmp
python imageprocessing.py --cvariance --input=data/lena.bmp
python imageprocessing.py --cstdev --input=data/lena.bmp
python imageprocessing.py --cvarcoi --input=data/lena.bmp
python imageprocessing.py --casyco --input=data/lena.bmp
python imageprocessing.py --cflatco --input=data/lena.bmp
python imageprocessing.py --cvarcoii --input=data/lena.bmp
python imageprocessing.py --centropy --input=data/lena.bmpApply edge enhancement and other spatial domain filters:
python imageprocessing.py --sedgesharp --input=data/lena.bmp --output=data/conv/lena-sharp.bmp --kernel=2
python imageprocessing.py --orosenfeld --input=data/lena.bmp --output=data/conv/lena-rosenfeld.bmp --P=2Process binary or grayscale images for shape analysis:
python imageprocessing.py --dilation --input=data/lenabw.bmp --output=data/morphological/dilation.bmp
python imageprocessing.py --erosion --input=data/lenabw.bmp --output=data/morphological/erosion.bmp
python imageprocessing.py --opening --input=data/morphological/test.bmp --output=data/morphological/opening.bmp
python imageprocessing.py --closing --input=data/morphological/test.bmp --output=data/morphological/closing.bmp
python imageprocessing.py --hmt --input=data/morphological/test.bmp --output=data/morphological/hmt.bmp
python imageprocessing.py --m3 --input=data/boatbw.bmp --output=data/morphological/m3.bmp --p=280,500
python imageprocessing.py --regions --input=data/camera.bmp --output=data/morphological/regions.bmp --sthreshold=10 --seeds=100Perform transformations and frequency-based filtering:
python imageprocessing.py --dft-test --input=data/fourier/test-dft.bmp --output=data/fourier/dft.bmp
python imageprocessing.py --fft-test --input=data/fourier/test-dft.bmp --output=data/fourier/fft.bmp
python imageprocessing.py --fft --input=data/fourier/test-dft.bmp --output=data/fourier/fft.bmpApply filters based on frequency bands:
python imageprocessing.py --low-pass --input=data/lena.bmp --output=data/fourier/lena.bmp --band=16
python imageprocessing.py --high-pass --input=data/lena.bmp --output=data/fourier/lena.bmp --band=16
python imageprocessing.py --band-pass --input=data/lena.bmp --output=data/fourier/lena.bmp --band-min=8 --band-max=128
python imageprocessing.py --band-cut --input=data/lena.bmp --output=data/fourier/lena.bmp --band-min=32 --band-max=128Use masks and phase manipulation:
python imageprocessing.py --filter --input=data/fourier/f5/F5test1.png --mask=data/fourier/f5/F5mask1.png --output=data/fourier/f5/F5test1-filtered.bmp
python imageprocessing.py --phase-filter --input=data/lena.bmp --output=data/fourier/lena.bmp --k=100 --l=256- This tool is designed to work primarily with
.bmpand.pngimages. - Output paths must include filenames with appropriate extensions (e.g.,
.bmp,.png). - All options are case-sensitive.
- Python 3.x
- Libraries:
Pillow,NumPy, and others depending on your features
You can install dependencies with:
pip install -r requirements.txtThis project is licensed under the MIT License.