- ***********************************************************************************
- * 点胶有无判读 *
- ***********************************************************************************
- read_image (ModelImage, '1.jpg')
- //draw_rectangle1 (3600, Rect1Rowm, Rect1Colm, Rect2Rowm, Rect2Colm)
- gen_rectangle1 (ModelROI,171, 366, 205, 472)
- area_center (ModelROI, Area, RowRef, ColumnRef)
- reduce_domain (ModelImage, ModelROI, ImageROI)
- create_ncc_model(ImageROI, 'auto', -0.39, 0.79, 'auto', 'use_polarity', ModelID)
- //draw_rectangle1 (3600, Rect1Row, Rect1Col, Rect2Row, Rect2Col)
- gen_rectangle1 (MeasureROI1, 121, 144, 377, 529)
- reduce_domain(ModelImage,MeasureROI1, ImageReduced)
- threshold(ImageReduced, Region, 128, 255)
- connection(Region, ConnectedRegions)
- select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 25000, 99999)
- reduce_domain(ModelImage,SelectedRegions, ImageOri)
- read_image (Image, '3.jpg')
- find_ncc_model(Image,ModelID , -0.39, 0.78, 0.8, 1, 0.5, 'true', 0, Row, Column, Angle, Score)
- vector_angle_to_rigid (RowRef, ColumnRef, 0, Row, Column, Angle, HomMat2D)
- affine_trans_region (SelectedRegions, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
- affine_trans_image(ModelImage, ImageAffinTrans, HomMat2D, 'constant', 'false')
- reduce_domain(ImageAffinTrans, RegionAffineTrans, ImageOri2)
- reduce_domain(Image,RegionAffineTrans,ImageThreshold)
- dyn_threshold(ImageOri2,ImageThreshold, RegionDynThresh, 50, 'light')
- erosion_circle(RegionAffineTrans,RegionErosion, 3.5)
- difference(RegionErosion,RegionDynThresh,RegionDifference)
- connection(RegionDifference, ConnectedRegions1)
- select_shape(ConnectedRegions1, SelectedRegions1, 'area', 'and', 150, 99999)
- dev_display(Image)
- dev_set_draw ('fill')
- dev_set_color ('red')
- dev_set_line_width (1)
- dev_display(SelectedRegions1)
复制代码
完整图片和例程的下载链接
链接:https://pan.baidu.com/s/1hTwTd5hM8wv66r_9p0gvGQ
提取码:yov5
|