Haclon学习程序.doc_第1页
Haclon学习程序.doc_第2页
Haclon学习程序.doc_第3页
Haclon学习程序.doc_第4页
Haclon学习程序.doc_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

*读取图像read_image (Image2, C:/2.png)read_image (Testnum, C:/testnum.bmp)*显示图像dev_display(Image2)*保存图像write_image (Image2, png, 0 , C:/Save.png)*获得图像长宽get_image_size(Image2,SourceWith,SourceHeigh)*获取图像通道数count_channels (Image2, Channels)*获取图像数据类型get_image_type(Image2,SourceType)*获得图像指针get_image_pointer1 (Image2, Pointer, SourceType, SourceWith, SourceHeigh)*利用数据指针构造图像gen_image1 (NewImage, byte, SourceWith, SourceHeigh, Pointer)*计算图像均值和方差intensity (NewImage, NewImage, Mean, Deviation)*图像统计直方图gray_histo (NewImage, NewImage, AbsoluteHisto, RelativeHisto)*三通道图像分离成三个单通道图像decompose3 (Image2, ImageR, ImageG, ImageB)*颜色空间转换trans_from_rgb (ImageR, ImageG, ImageB, ImageResult1, ImageResult2, ImageResult3, hsv)*Region(矩形,圆,椭圆)gen_rectangle1 (Rectangle, 30, 20, 100, 200)gen_circle (Circle, 200, 200, 100.5)gen_ellipse (Ellipse, 200, 200, 0, 100, 60)*鼠标绘制多边形draw_region (Region, 3600)read_image (Clip, C:/Program Files/MVTec/HALCON-10.0/images/clip.png)threshold (Clip, Region, 0, 128)*查找连通域connection(Region,ConnectedRegions)*选着回形针区域select_shape (ConnectedRegions, SelectedRegions, area, and, 5000.99, 8367)threshold (ImageResult2, Regions, 183, 255)*Region膨胀操作dilation_circle (Regions, RegionDilation, 3.5)*Region腐蚀操作erosion_circle (RegionDilation, RegionErosion, 3.5)*Region开运算opening_circle (RegionErosion, RegionOpening, 3.5)*Region闭运算closing_circle (RegionOpening, RegionClosing, 3.5)*Region补运算complement (RegionClosing, RegionComplement)draw_region (union2, 3600)*Region 差运算difference (RegionClosing, union2, RegionDifference)*Region 交运算intersection (RegionClosing, union2, RegionIntersection)*Region 并运算union2 (RegionClosing, union2, RegionUnion)read_image (Image4, C:/4.png)*获得XLDthreshold_sub_pix (Image4, Border, 128)*XLD转化为Regiongen_region_contour_xld (Border, Region1, filled)threshold (Image4, Region, 0, 64)*Region转化为XLDgen_contour_region_xld (Region, Contours, border)read_image (Image, C:/5.png)dev_close_window ()get_image_size (Image, Width, Height)dev_open_window (0, 0, Width, Height, black, WindowHandle)*快速二值化fast_threshold (Image, Region, 0, 120, 7)*取region的边界boundary (Region, RegionBorder,inner)*剪切、膨胀定位弧形区域clip_region_rel (RegionBorder, RegionClipped, 5, 5, 5, 5)dilation_circle (RegionClipped, RegionDilation, 2.5)reduce_domain (Image, RegionDilation, ImageReduced)*在弧形区域进行边缘检测edges_sub_pix (ImageReduced, Edges, lanser2, 0.5, 40, 60)*分割边缘:线和圆segment_contours_xld (Edges, ContoursSplit, lines_circles, 5, 4, 3)count_obj (ContoursSplit, Number)dev_display (Image)dev_set_draw (margin)dev_set_color (white)dev_update_window (off)for i := 1 to Number by 1 *选择轮廓并根据特性确定是否拟合圆:* Attrib = -1 线段 0 椭圆 1圆 select_obj (ContoursSplit, ObjectSelected, i) get_contour_global_attrib_xld (ObjectSelected, cont_approx, Attrib) if (Attrib 0) *逼近结果生成一个圆轮廓 fit_circle_contour_xld (ObjectSelected, ahuber, -1, 2, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder) gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, rad(360), positive, 1.0) dev_display (ContCircle) else fit_line_contour_xld (ObjectSelected, tukey, -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist) disp_line (WindowHandle, RowBegin, ColBegin, RowEnd, ColEnd) endifendforread_image (Image3, C:/3.bmp)get_image_size (Image3, Width, Height)dev_close_window ()dev_open_window (0, 0, Width, Height, black, WindowID)threshold (Image3, Regions, 55, 248)connection (Regions, ConnectedRegions)area_center (ConnectedRegions, Area, Row, Column)intensity (ConnectedRegions, Image3, Mean, Deviation)for i := 0 to |Mean|-1 by 1 disp_message (WindowID, Mean +Meani, image, Rowi, Columni-20, black, false) endforstop()union1 (ConnectedRegions, RegionUnion)closing_circle (RegionUnion, RegionClosing, 4.5)* clip.hdev: Orientation of clips* dev_update_window (off)read_image (Clip, clip)get_image_size (Clip, Width, Height)dev_close_window ()dev_open_window (0, 0, Width/2, Height/2, black, WindowID)dev_display (Clip)set_display_font (WindowID, 14, mono, true, false)disp_continue_message (WindowID, black, true)stop ()bin_threshold (Clip, Dark)connection (Dark, Single)select_shape (Single, Selected, area, and, 5000, 10000)dev_set_draw (fill)dev_set_colored (12)dev_display (Selected)disp_continue_message (WindowID, black, true)stop ()dev_display (Clip)dev_set_color (green)dev_display (Selected)orientation_region (Selected, Phi)area_center (Selected, Area, Row, Column)dev_set_line_width (3)dev_set_draw (margin)Length := 80for i := 0 to |P

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论