digital-image-processing-cpp
digital-image-processing-cpp copied to clipboard
cpp implementation for algorithms in the book "digital image processing and computer vision"("数字图像处理与机器视觉-Visual C++与Matlab实现")
digital-image-processing-cpp
cpp implementation for algorithms in the book "数字图像处理与机器视觉-Visual C++与Matlab实现"
To compile CH3_pixel_operation.cpp
:
./compile.sh -DCH3 CH3_pixel_operation.cpp utility.cpp
In which -DCH3
activates the main
function in the source file, otherwise main
function is ignored. And this source file includes utility.h
, so we need to compile CH3_pixel_operation.cpp
with utility.h
's implementation, which is utility.cpp
.
Similar method for CH 4,5,6,7,8 to compile.
To compile CH9_image_segmentation.cpp
:
./compile.sh -DCH9 CH9_image_segmentation.cpp CH3_pixel_operation.cpp CH5_spatial_domain_image_enhancement.cpp CH8_morphology_image_processing.cpp utility.cpp
Because it includes the corresponding headers.
CH3 pixel operation
Threshold
Set threshold as 100:

Linear Transform
Set dFa
as 2.0
, set dFb
as -55
:

Gamma Transform
Set gamma
as 1.8
, set comp
as 0
:

Log Transform
Set dC
as 10:

Partial Linear Transform
Set x1
, x2
, y1
, y2
as 20
, 50
, 100
, 200
:

Histogram equalization

Histogram matching to dark

Histogram matching to light

CH4 geometric transformation
Move
Move 20
right and 50
down:

Horizontal mirror

Vertical mirror

Scale

Rotate
Rotate 30 degrees counterclockwise:

Image projection restore


CH5 spatial domain image enhancement
Smooth average
Kernel size 3:

Kernel size 5:

Kernel size 7:

Smooth gaussian

Log edge detection

Average vs Gaussian vs Median filter

Roberts cross gradient operator
Positive 45 degrees v.s. Negative 45 degrees v.s. Positive+Negative 45 degrees:

Sobel gradient operator
Vertical v.s. Horizontal v.s. Vertical+Horizontal:

Laplacian operator
90 degrees rotation isotropy v.s. 45 degrees rotation isotropy v.s. Weighted

Enhancement
Roberts positive 45 degrees:

Sobel vertical:

Laplacian weighted:

CH6 frequency domain image enhancement
Ideal low pass filter

Gauss low pass filter

Gauss high pass filter

Laplace filter

Gauss band rejection filter
Image and noised image in frequency domain:
Filter and filterd image in frequency domain:
Before and after applying Gauss band rejection filter:
CH7 color image processing
CMY

HSI

HSV

YUV

YIQ

Color compensating


Color balancing

CH8 morphology image processing
Erode using 3 x 3 square kernel and using cross kernel

Dilate using 3 x 3 square kernel and using cross kernel

Erode operation and open operation

Dilate operation and close operation

Hit-or-miss transform with 50 x 50 square kernel

Extract boundary

Trace boundary

Fill region

Label connected component

Thining

Pixelate

Convex hull unconstrained and constrained(using bounding rectangle)

Gray dilate

Gray erode

Gray open

Gray close

Top-hat transform

CH9 image segmentation
Edge detection using Prewitt operator

Edge detection using Sobel operator

Edge detection using LoG operator

Canny edge detector

Hough transformation for line detection

Automatically choose threshold for binarization

Region growing for image segmentation

Region splitting(decomposing) for image segmentation
