Halcon's Image Segmentation
Threshold segmentation for image segmentation:
See the Halcon routine: gray_histo.hdev
In this routine, there are two main uses:
1. Gray_histo (Regions, Image:: Absolute Histo, Relative Histo)
Function: Get the gray level distribution in a specified area of the image, and write the data to the parameters Absolute Histo and Relative Histo.
Absolute Histo refers to the number of occurrences of 0-255 gray values in the image.
Relative Histo: Convert the number of occurrences above to frequency, totaling 1.
2. gen_region_histo (: Region: Histogram, Row, Column, Scale:)
Function: Convert the gray level distribution map to regional output
Region: Output parameter,
Histogram: The number of occurrences of 0-255 gray values in the image mentioned in the previous operator.
Row, Column: Central coordinates of the generated region
Scale: Reduced Scale of Region Histogram
3. Threshold segmentation operator:
Threshold (Image: Region: MinGray, MaxGray:)
Function: The region output of gray value in the range of MinGray-MaxGray
As mentioned before, it should be noted that if the operator inputs a RGB color image, it only performs threshold analysis on the first channel of the graph.
4. Threshold segmentation operator:
Auto_threshold (Image: Regions: Sigma:)
Function: Automatic threshold and multi-threshold segmentation for single channel image.
Among them, Sigma is the Gauss standard deviation of gray histogram, which smoothly eliminates noise.
5. Threshold segmentation operator:
Bin_threshold (Image: Region::)
Function: The background is white, and the background is clear before and after extraction. Sigma value is automatically selected for Gauss smoothing, which is smooth until there is only one minimum value at last. For example, this operator can be used to extract black and white characters.
6. Threshold segmentation operator:
Char_threshold (Image, HistoRegion: Characters: Sigma, Percent: Threshold)
Function: Threshold Segmentation for Character Extraction
Image: The original image, the image to be character extraction
HistoRegion: The region where the character is to be extracted
Characters: Extracted region
Sigma: Gauss smoothing factor
Percent: Percentage of gray difference in gray histogram
Threshold: Output Threshold for Threshold Processing
The key of this method is to find the maximum value in the histogram and the reading threshold on the left side of the maximum value. Refer to the char_threshold.hdev routine
7. Threshold segmentation operator:
Dual_threshold (Image: RegionCrossings: MinSize, MinGray, Threshold:)
Function: Threshold processing of segmented symbolic images is usually used together with operators such as diff_of_gauss sum_image. Like the image obtained by difference between two frames (difference frame method), the pixel value has positive and negative values (gray value has positive and negative points).
Image: Input Symbolic Image
RegionCrossings: The area of output
MinSize: Minimum Area Output (Limited Conditions)
MinGray: The absolute gray value of the output area must be greater than MinGray
Threshold: The absolute value of the gray value of the output area must be greater than Threshold. Note that this is the absolute value. See Help Document.
See the dual_threshold.hdev routine for specific usage
Operator:
Convert_image_type (Image: Image Converted: NewType:)
Role: Convert image types
Image: The type of image to be converted
ImageConverted: Converted Image
NewType: Specify an image type (int1, int2, uint2, int4, int8, byte, real, direction, cyclic, complex)
Then the difference between the two images is made, and the result is that the pixel values are positive or negative, and the image difference operator is obtained:
Sub_image (Image Minuend, Image Subtrahend, Image Sub, Mult, Add)
Function: The gray value of the two images is different.
Operation: ImageSub = (ImageMinuend-ImageSubtrahend)*Mult+Add
8. Threshold segmentation operator:
Dyn_threshold (OriImage, ThresholdImage: RegionDynThreh: Offset, LightDark:)
Function: Dynamic threshold is not a global threshold, but a local threshold. It determines the threshold according to the situation around the pixel. It is generally used with the smooth operator mean_image(), so that other pixel values can be compared with the surrounding pixels. This operator can take dark boundary region or bright boundary region. Generally, the gray value boundary region is extracted.
OriImage: Single Channel original image
Threshold Image: Image used to compare local thresholds
RegionDynThreh: The region obtained after threshold segmentation
Offset: Cancellation value of the original image compared with the pixel value of the contrast image
LightDark: Decide whether to choose dark or bright boundaries and similar boundaries... If LightDark ='light'is equivalent to: OriImage >= ThresholdImage + Offset. If LightDark ='dark'is equivalent to OrigImage >= ThresholdImage + Offset. If LightDark ='equal'is equivalent to: ThresholdImage-Offset <= OrigImage <= ThresholdImage + Offset. If LightDark ='not_equal'is equivalent to: ThresholdImage-Offset > OrigImage or OrigImage > ThresholdImage + Offset
9. Threshold segmentation operator var_threshold
Var_thresholds are also local thresholds, which are segmented according to local mean and standard deviation; they are similar to dyn_thresholds.
See dyn_threshold.hdev routine
There is an operator: fill_interlace() function is to modify the process of image acquisition caused by two half image mosaic problem.
Bi-image segmentation
Please the Chinese versiong for details.