A lightweight Computer Vision CLI toolkit written in Go
A modular image processing framework featuring classic computer vision algorithms implemented from scratch in pure Go.
CVForge is a lightweight Computer Vision command-line toolkit implemented entirely in Go.
Unlike wrappers around OpenCV, CVForge focuses on implementing classical image processing algorithms from scratch while maintaining a clean, modular architecture.
It is designed for both practical image processing and educational purposes.
- Resize
- Rotate
- Crop
- Grayscale
- Histogram Equalization
- Box Blur
- Gaussian Blur
- Median Blur
- Sharpen
- Emboss
- Sobel Edge Detection
- Binary
- Binary Inverse
- Truncate
- To Zero
- To Zero Inverse
- Erosion
- Dilation
- Opening
- Closing
| Original |
|---|
![]() |
| Grayscale | Gaussian | Median |
|---|---|---|
![]() |
![]() |
![]() |
| Sharpen | Emboss | Equalize |
|---|---|---|
![]() |
![]() |
![]() |
| Sobel |
|---|
![]() |
| Binary | Binary Inv |
|---|---|
![]() |
![]() |
| Truncate | To Zero | To Zero Inv |
|---|---|---|
![]() |
![]() |
![]() |
| Operation | Square | Cross |
|---|---|---|
| Erosion | ![]() |
![]() |
| Dilation | ![]() |
![]() |
| Opening | ![]() |
![]() |
| Closing | ![]() |
![]() |
CVForge adopts a modular filter pipeline architecture.
Each image processing operation is implemented as an independent filter.
+-------------+
Input Image ->| Load Image |
+-------------+
│
▼
+-----------------+
| Filter Pipeline |
+-----------------+
│ │
│ ├── Grayscale
│ ├── Gaussian
│ ├── Sobel
│ ├── Threshold
│ └── ...
▼
+-------------+
| Save Image |
+-------------+
Every filter implements the same interface:
type Filter interface {
Process(
image.Image,
progress.Reporter,
) image.Image
}CVForge
├── assets/
├── cmd/
│ ├── blur.go
│ ├── crop.go
│ ├── dilation.go
│ ├── emboss.go
│ ├── equalize.go
│ ├── erosion.go
│ ├── gaussian.go
│ ├── grayscale.go
│ ├── median.go
│ ├── opening.go
│ ├── closing.go
│ ├── resize.go
│ ├── rotate.go
│ ├── sobel.go
│ └── threshold.go
│
├── internal/
│ ├── filters/
│ ├── histogram/
│ ├── imageio/
│ ├── imageutil/
│ ├── kernel/
│ ├── morphology/
│ ├── pipeline/
│ ├── progress/
│ └── service/
│
├── examples/
└── main.go
| Command | Description |
|---|---|
grayscale |
Convert image to grayscale |
blur |
Box blur |
gaussian |
Gaussian blur |
median |
Median blur |
resize |
Resize image |
rotate |
Rotate image |
crop |
Crop image |
sharpen |
Sharpen image |
emboss |
Emboss effect |
sobel |
Sobel edge detection |
threshold |
Binary thresholding |
equalize |
Histogram equalization |
erosion |
Morphological erosion |
dilation |
Morphological dilation |
opening |
Morphological opening |
closing |
Morphological closing |
Clone the repository
git clone https://github.com/kylin419/CVforge.git
cd CVforgeBuild
go buildcvforge grayscale input.jpg output.jpgcvforge gaussian input.jpg output.jpg \
--size 5 \
--sigma 1.5cvforge median input.jpg output.jpg \
--radius 2cvforge resize input.jpg output.jpg \
--w 800 \
--h 600cvforge rotate input.jpg output.jpg \
--angle 90cvforge crop input.jpg output.jpg \
--x 100 \
--y 50 \
--w 400 \
--h 300cvforge threshold input.jpg output.jpg \
--value 127 \
--type binaryAvailable threshold types:
- binary
- binary-inv
- truncate
- tozero
- tozero-inv
cvforge equalize input.jpg output.jpgcvforge erosion input.png output.png \
--element squarecvforge dilation input.png output.png \
--element squarecvforge opening input.png output.png \
--element squarecvforge closing input.png output.png \
--element squareSupported structuring elements:
- square
- cross
- Box Blur
- Gaussian Blur
- Median Blur
- Generic Convolution Engine
- Dynamic Gaussian Kernel
- Preset Kernels
- Sharpen
- Emboss
- Histogram Equalization
- Sobel Operator
- Binary
- Binary Inverse
- Truncate
- To Zero
- To Zero Inverse
- Binary Erosion
- Binary Dilation
- Opening
- Closing
- Configurable Structuring Elements
- Pure Go implementation
- No OpenCV dependency
- Modular filter pipeline
- Reusable convolution engine
- Reusable morphology engine
- Easy to extend
- Educational implementation of classical computer vision algorithms
- Pure Go implementation
- Streaming image processing pipeline
- Progress reporting for long-running operations
- No external computer vision libraries
- Geometry Transformations
- Grayscale
- Generic Convolution Engine
- Gaussian Blur
- Median Blur
- Sharpen
- Emboss
- Sobel Edge Detection
- Histogram Equalization
- Threshold Family
- Morphological Operations
- Erosion
- Dilation
- Opening
- Closing
- Canny Edge Detection
- Histogram Visualization
- CLAHE
- Harris Corner Detection
- Hough Transform
- Template Matching
MIT License
Kylin
GitHub: https://github.com/kylin419




















