* Segment an image using two-dimensional pixel classification.** For interactive mode set this variable to 1
Interactive :=1* 读取照片
read_image(Image,'ic')dev_close_window()* 获取图片大小
get_image_size(Image, Width, Height)dev_open_window(0,0, Width, Height,'white', WindowID)* Convert a three-channel image into three images
* 产生R,G,B三种颜色通道
decompose3(Image, Red, Green, Blue)dev_display(Red)dev_set_color('red')if(Interactive)* 绘制区域
draw_region(Pattern, WindowID)else*产生矩形
gen_rectangle1(Pattern,362,276,371,298)
endif
* Calculate the histogram of two-channel gray value images
* 计算两种颜色的通道灰度值图像的直方图(如果是红色则填写绿色和蓝色)
histo_2dim(Pattern, Red, Blue, Histo2Dim)threshold(Histo2Dim, Features,1,255)* Close a region with a circular structuring element
closing_circle(Features, FeaturesClosed,11.5)dev_set_draw('fill')dev_set_part(0,0,511,511)dev_display(Red)* 使用二维像素分类对图像进行分割(如果是红色则填写绿色和蓝色)
class_2dim_sup(Red, Blue, FeaturesClosed, RegionClass2Dim)