Skip to content

keineahnung2345/digital-image-processing-cpp

Repository files navigation

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:

drawing

Linear Transform

Set dFa as 2.0, set dFb as -55:

drawing

Gamma Transform

Set gamma as 1.8, set comp as 0:

drawing

Log Transform

Set dC as 10:

drawing

Partial Linear Transform

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

drawing

Histogram equalization

drawing

Histogram matching to dark

drawing

Histogram matching to light

drawing

CH4 geometric transformation

Move

Move 20 right and 50 down:

drawing

Horizontal mirror

drawing

Vertical mirror

drawing

Scale

drawing

Rotate

Rotate 30 degrees counterclockwise:

drawing

Image projection restore

drawing

drawing

CH5 spatial domain image enhancement

Smooth average

Kernel size 3:

drawing

Kernel size 5:

drawing

Kernel size 7:

drawing

Smooth gaussian

drawing

Log edge detection

drawing

Average vs Gaussian vs Median filter

drawing

Roberts cross gradient operator

Positive 45 degrees v.s. Negative 45 degrees v.s. Positive+Negative 45 degrees:

drawing

Sobel gradient operator

Vertical v.s. Horizontal v.s. Vertical+Horizontal:

drawing

Laplacian operator

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

drawing

Enhancement

Roberts positive 45 degrees:

drawing

Sobel vertical:

drawing

Laplacian weighted:

drawing

CH6 frequency domain image enhancement

Ideal low pass filter

drawing

Gauss low pass filter

drawing

Gauss high pass filter

drawing

Laplace filter

drawing

Gauss band rejection filter

Image and noised image in frequency domain: drawing

Filter and filterd image in frequency domain: drawing

Before and after applying Gauss band rejection filter: drawing

CH7 color image processing

CMY

drawing

HSI

drawing

HSV

drawing

YUV

drawing

YIQ

drawing

Color compensating

drawing

drawing

Color balancing

drawing

CH8 morphology image processing

Erode using 3 x 3 square kernel and using cross kernel

drawing

Dilate using 3 x 3 square kernel and using cross kernel

drawing

Erode operation and open operation

drawing

Dilate operation and close operation

drawing

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

drawing

Extract boundary

drawing

Trace boundary

drawing

Fill region

drawing

Label connected component

drawing

Thining

drawing

Pixelate

drawing

Convex hull unconstrained and constrained(using bounding rectangle)

drawing

Gray dilate

drawing

Gray erode

drawing

Gray open

drawing

Gray close

drawing

Top-hat transform

drawing

CH9 image segmentation

Edge detection using Prewitt operator

drawing

Edge detection using Sobel operator

drawing

Edge detection using LoG operator

drawing

Canny edge detector

drawing

Hough transformation for line detection

drawing

Automatically choose threshold for binarization

drawing

Region growing for image segmentation

drawing

Region splitting(decomposing) for image segmentation

drawing