Image_conv is a Kotlin-based image convolution project that demonstrates and benchmarks multiple convolution strategies using OpenCV.
It applies various 3×3 and 5×5 filters (e.g., blur, Gaussian blur, sharpen, edge detection, etc.) to images using both sequential and parallel approaches.
Make sure you have Java (JDK 8 or higher) and Gradle installed.
git clone https://github.com/SecretPersona5/Image_conv.git
cd Image_conv
./gradlew build
I would recommend simply shift + f10 to launch the program
This will compile the Kotlin source and download the required OpenCV native libraries.
Launch the program in interactive mode (with a console menu):
./gradlew run
# or:
./gradlew run --args="-i"In this mode, you will be prompted to:
- Select an input image
- Choose a convolution mode (
seq,row,col,grid,pix) - Pick a filter (e.g.,
blur_3x3,sharpen, etc.) - Optionally process a whole directory (pipeline mode)
Run a single image with a specific mode:
./gradlew run --args="<mode> <inputImagePath> [gridBlockSize]"Example (row-parallel convolution):
./gradlew run --args="row path/to/image.jpg"For grid mode, add a block size:
./gradlew run --args="grid path/to/image.jpg 64"Process all images in a directory concurrently:
./gradlew run --args="pipe <inputDir> <outputDir> <mode> [blockSize] [convWorkers] [saveWorkers] [capacity]"Example:
./gradlew run --args="pipe ./photos ./photos_out grid 128 8 1 8"Output images will be saved in <outputDir>.
Run quick JMH benchmarks:
./gradlew jmhQuickResults are saved to:
build/bench/jmh_quick.csv
It measures performance for different:
- Modes (
seq,row,col,grid,pix) - Filters (e.g.,
gaussian_blur_3x3) - Image sizes
- Thread counts
Run full pipeline benchmarks:
./gradlew run --args='bench src/main/resources/img out/benchmarks --modes=row,seq,pix,grid,col --filters=all --tag=try1 --repeats=1 --cleanup'Results are saved to:
out/benchmarks/
Each CSV contains throughput and timing results for all strategies across multiple runs.
src/main/kotlin/
Main.kt # Entry point
Sequential.kt # Sequential convolution
RowParallel.kt # Row-parallel convolution
ColParallel.kt # Column-parallel convolution
GridParallel.kt # Grid-based parallel convolution
PixelParallel.kt # Pixel-level parallel convolution
Pipeline.kt # Batch processing pipeline
Filters.kt # Filter definitions
Logger.kt # Timing logger
- JDK 8+
- Gradle (wrapper included)
- OpenCV (downloaded automatically via
nu.pattern.OpenCV)
MIT