Basic knowledge
Halcon Learning Notes -- Image, Region, XLD Preliminary
Three ways of reading:
Read_image (image,'filename')//image is the output object, followed by the path and name of the input file
Read multiple images:
1. Declare an array and save paths separately
ImagePath:=[]
ImagePath [0]: ='D:/1.bmp'
ImagePath [1]: ='D:/2.bmp'
ImagePath [2]: ='D:/3.bmp'
For i:= 0 to 2 by 1
Read_image (Image, Image Path [i])
Endfor
2, for loop
For i:= 1 to 3 by 1
Read_image (Image,'D:/'+'i'+'.bmp')
Endfor
3. Read all files in the directory
Assistant, open the image, select the path, insert the code
List_files (input file directory address, selection requirements (files specify selection file format, recursive recursion, in-depth all, derectories select folders, follow_links, max_depth 5...), output list of selected files)
Select a rule-compliant tuple, where\ is an escape, equivalent to'-->'
Tuple_regexp_select (file name, ['\\. (bmp | tif) $','ignore_case ignores case'], output)
Fabric file path
Two Image Variable Region
Pretreatment:
Denoising Mean_image/binomial_filter
Suppression of small spots or fine lines median_image
Smoothing smooth_image
Save edge smoothness anisotropic_diffusion
Variable Region:
Region is a subset of some required pixels, or some selected block areas s. The size of region is not limited by image. There are filling and margin expressions, similar to run-length coding, which can be used for compression. eg: a2b3c4 is used to represent aabbbcccc.
Region operation:
Select the appropriate area
Select_shape (regions, output,'select type',... Requirements)
Calculate the area of the corresponding area, central coordinates:
Area_center (regions, areas, row, column)
Conversion of irregular regions:
Shape_trans (region, region trans, type)
Image
Convex hull convex surround (from outside to inside)
Outer_circle outer circle (can include the circle with the smallest radius of the object)
Inner_circle inner circle
Rectangle 1 rectangle
Rectangle 2 minimum bounding rectangle
Inn_rectangle 1 Maximum Inner Rectangle
Three-graph variable XLD (eXtended Line Descriptions)
XLD represents sub-pixel contours or polygons
Threshold_sub_pix (input image, output, requirement)
Gen_contour_region_xld (input region, output,...)
XLD selection operation (select_shape_xld/selet_contours_xld):
Select_shape_xld (XLD: Selected XLD: Features, Operation, Min, Max:)
Select_contours_xld (Contours: Selected Contours: Feature, Min1, Max1, Min2, Max2:)
Calculate the area and center position of xld:
Area_center_xld (XLD::: Area, row, column, pointOrder)
Merge operation of xld:
Union_colliner_contours_xld: XLD combined with the same line
Union_cocircular_contours_xld: merging XLD of the same circle
Union_adjacent_contours_xld: Merge adjacent xlds
The transformation operation of XLD is similar to that of region:
Shape_trans_xld (XLD: XLDTrans: Type:)
There are several types above.
Segmentation operation of Xld (segment_contours_xld)
Divide the initial XLD into straight lines, straight lines and circles, straight lines and ellipses
Segment_contours_xld (Contours: ContoursSplit: Mode, SmoothCont, MaxLineDist1, MaxLineDist2:)
Image
The fitting operation of Xld (fit_***_contour_xld) completes the fitting of incomplete shapes
Fit_line_contour_xld
Fit_circle_contour_xld
Fit_ellipse_contour_xld
Fit_rectangle2_contour_xld
Summary:
Image and Video, File Reading
Preliminary Introduction to Region and XLD
Be careful:
The result extracted by edges_sub_pix is not always a complete circle, and it needs union to integrate the whole circle.
Originally from Burning_foot's blog
Author: Han Zhaoxin
Origin: http://hanzhaoxin.cnblogs.com/
Copyright of this article belongs to the author and the blog park. Reprint is welcome, but this statement must be retained without the author's consent, and the link of the original text should be given clearly on the article page, otherwise the right to pursue legal responsibility will be reserved.