某些区域生成概念很多,初学者往往不得要领,如果不系统地学一下,几年下来,思想依然模糊,做项目感觉到“书到用时方恨少”,本篇是前几篇的后续,目的在于全面系统地渗透,达水滴石穿之功效。
算子:get_region_contour(region, Rows, Columns)
获取已知区域region的散点,保存在Rows, Columns内。
- read_image (Image, 'f:/images/DOTS/block.jpg')
- rgb1_to_gray(Image,gray)
-
- get_image_size(gray,width,height)
- * gen_rectangle1(rect,0,0,height,width)
- fast_threshold (gray,rect,0, 50 , 7)
- * get_region_chain(rect, Row, Column, Chain)
- get_region_contour(rect, Rows, Columns)
-
- gen_image_const(BlkImage,'byte',width,height)
-
-
- for I:=0 to |Rows|-1 by 1
- tmpRow:=Rows[I]
- tmpClm:=Columns[I]
- set_grayval(BlkImage, tmpRow, tmpClm, 228)
- endfor
- dev_display(BlkImage)
gen_region_line(regline,row1,col1,row2,col2)
获取一条线段的区域,注意,regline是个区域,不是像素列表;若要获取散列点需要如下步骤:
- gen_region_line(RegionLines, 100, 50, 150, 250)
- get_region_points(RegionLines, Rows, Columns)
gen_region_points(regin,rows,cos)
功能:将个别的像素存储为图像区域。
gen_region_polygon
功能:将一个多边形存储为一个区域。
- gen_image_const(BlkImage,'byte',width,height)
- gen_region_polygon(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])

gen_region_polygon_filled(region,rows,cols)
功能:将一个多边形存储为一个已填充区域。
- gen_image_const(BlkImage,'byte',width,height)
- gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])

gen_contour_region_xld (reg, Contours, 'border')
reg是输入区域,Contours是得到的xld对象。
- gen_image_const(BlkImage,'byte',width,height)
- gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
- gen_image_const(xldImage,'byte',width,height)
- gen_contour_region_xld (reg, Contours, 'border')
gen_region_polygon_xld
功能:创建一个XLD多边形中的区域。
以下代码生成外轮廓的region边缘。
- gen_image_const(BlkImage,'byte',width,height)
- gen_region_polygon_filled(reg,[100,50,50,100,300,300,300,100],[50,100,200,400,400,200,50,50])
- gen_image_const(xldImage,'byte',width,height)
- gen_contour_region_xld (reg, Contours, 'border')
- gen_polygons_xld(Contours,Polygons , 'ramer', 1 )
-
- gen_region_polygon_xld( Polygons,Region, 'margin')
gen_region_runs
功能:创建一个扫描宽度编码中的图像区域。
label_to_region
功能:提取一幅图像中灰度值相同的区域。