Image preprocessing

Halcon Basics (I)_ leo_888's column - CSDN blog

hom_mat2d_identity (HomMat2DIdentity)
Explanation: define an identity matrix with diagonal 1, which is multiplied by any matrix equal to the original matrix itself.

hom_mat2d_translate (HomMat2DIdentity, Tx, Ty, HomMat2DTranslate)
Function: add translation to anti fire transformation matrix
Hommat2d (input parameter): affine transformation matrix
TX (input parameter): the distance to translate along the x axis
Ty (input parameter): the distance to translate along the y axis
Hommat2dtranslate (output parameter): output transformation matrix


##Image preprocessing part
#1 image translation, rotation, scaling, affine transformation, projection transformation

hom_mat2d_identity (HomMat2DIdentity)
affine_trans_image (Image, ImageAffineTrans, HomMat2DIdentity, 'constant', 'false')
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_rotate (HomMat2DIdentity, 0.78, 300, 300, HomMat2DRotate)
affine_trans_image (Image, ImageAffineTrans, HomMat2DRotate, 'constant', 'false')
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_scale (HomMat2DIdentity, 0.5, 0.5, 0, 0, HomMat2DScale)
affine_trans_image (Image, ImageAffineTrans, HomMat2DScale, 'constant', 'false')

2, ROI

The region of interest is extracted to reduce the amount of calculation. In image matching, you can define templates. It's an area.

Halon learning ROI_ Bronze small yard farmer CSDN blog

In halcon, ROI needs two steps to complete. The first step is to delimit the area and the second step is to cut out the area.

There are two ways to divide areas. The first is to use the create ROI of the interface, and various block diagrams can be selected. The second is to use the operator: gen_rectangle et al.

Cut out the region, because we only drew the region in the image, but did not cut it out. Use the operator reduce_domain. You can understand this operator as ROI, that is, the scope of the image. The establishment of ROI reduces the scope of the original whole image to ROI, that is, the scope of the area we specify is reduced, so there is the origin of the operator name.

3, Image enhancement

Histogram equalization, contrast enhancement, out of focus image processing

Starting from the gray image, a gray histogram of 0-255 is established to count the times of each gray value. Then the histogram is equalized to make the gray value distribution of pixels more uniform, so as to enhance the brightness of the image.

#Histogram equalization



equ_histo_image: histogram equalization (including two steps: gray conversion histogram and histogram equalization)

gray_histo: convert to histogram

gen_region_histo: display histogram

Enhance contrast: enhance the edges and details of the image to make it more obvious. emphasize function


Processing out of focus images: images with inaccurate focus may be blurred, and sharpening operation shall be considered. Some impact is formed at the edge of the highlight to enhance the edge of the image.


Tags: linear algebra

Posted on Tue, 09 Nov 2021 20:11:54 -0500 by rix