简介:
区域分割,可用于分割目标区域。
介绍:
ImageRed (input_object) | Input image (red channel). | 通道R图像 | ||
ImageGreen (input_object) | Input image (green channel). | 通道G图像 | ||
ImageBlue (input_object) | Input image (blue channel). | 通道B图像 | ||
ImageResult1 (output_object) | Color-transformed output image (channel 1). | 输出的结果1 | ||
ImageResult2 (output_object) | Color-transformed output image (channel 1). | 输出的结果2 | ||
ImageResult3 (output_object) | Color-transformed output image (channel 1). | 输出的结果3 | ||
ColorSpace (input_control) | Color space of the output image.
| 输出图像的颜色空间 |
Image (input_object) | Input image. | 图像 |
Regions (output_object) | Regions with gray values within the automatically determined intervals. | 输出的区域 |
Sigma (input_control) | Sigma for the Gaussian smoothing of the histogram. Default value: 2.0 Suggested values: 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0 Typical range of values: 0.0 ≤ Sigma ≤ 100.0 (lin) Minimum increment: 0.01 Recommended increment: 0.3 Restriction: Sigma >= 0.0 | 高斯平滑的数值 |
Image (input_object) | Input image. | 图像 |
Region (output_object) | Segmented region. | 输出的分割区域 |
MinGray (input_control) | Lower threshold for the gray values. Default value: 128.0 Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0 | 灰度值最小的阈值 |
MaxGray (input_control) | Upper threshold for the gray values. Default value: 255.0 Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0 Restriction: MaxGray >= MinGray | 灰度值最大的阈值 |
使用:
- 彩色图像要转成灰色图像。
- 自动阈值提取目标区域。也可以通过其它阈值函数(threshold等)提取。
- 根据特征进行区域分割,提取目标区域。
read_image (Image, 'E:/照片/RGB')
decompose3 (Image, Image1, Image2, Image3)
trans_from_rgb (Image1, Image2, Image3, ImageResult1, ImageResult2, ImageResult3, 'hsv')
*自动阈值
auto_threshold (ImageResult3, Regions, 2)
*全局阈值
*threshold (ImageResult3, Regions, 128, 255)
connection (Regions, ConnectedRegions)
*特征选择,面积
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 100, 1500)
count_obj (SelectedRegions, Number)
for Index := 1 to Number by 1
select_obj (SelectedRegions, ObjectSelected, Index)
area_center (ObjectSelected, Area1, Row1, Column1)
disp_message (3600, Area1, 'image', Row1, Column1, 'black', 'true')
endfor