halcon车刀崩边检测
list_files ('新建文件夹', 'files', Files)
read_image (Image, Files[0])
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width/1.5, Height/1.5, 'black', WindowHandle)
dev_set_draw ('margin')
dev_set_colored (12)
for Index:=0 to |Files|-1 by 1read_image (Image, Files[Index])
edges_sub_pix (Image, Edges, 'canny', 1, 70, 100)
select_contours_xld (Edges, SelectedContours, 'contour_length', 50, 2000, -0.5, 0.5)
union_adjacent_contours_xld (SelectedContours, UnionContours, 10, 1, 'attr_keep')
smooth_contours_xld (UnionContours, SmoothedContours, 5)
smallest_rectangle2_xld (SmoothedContours, Row2, Column1, Phi, Length1, Length2)
gen_rectangle2 (Rectangle, Row2, Column1, Phi, Length1, Length2)
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_rotate (HomMat2DIdentity, -Phi, Row2, Column1, HomMat2DRotate)
* hom_mat2d_scale (HomMat2DRotate, 1.5, 1.5, 256, 256, HomMat2DScale)
affine_trans_contour_xld (SmoothedContours, ContoursAffinTrans, HomMat2DRotate)segment_contours_xld (SmoothedContours, ContoursSplit, 'lines_circles', 5, 4, 2)
select_shape_xld (ContoursSplit, SelectedXLD, ['circularity','contlength'], 'or', [0.01,0], [1,50])
union_adjacent_contours_xld (SelectedXLD, CircleXld, 10, 1, 'attr_keep')
select_shape_xld (CircleXld, SelectedXLD3, 'contlength', 'and', 0, 200)
obj_diff (CircleXld, SelectedXLD3, CircleXld)
obj_diff (ContoursSplit, SelectedXLD, LinesXld)
concat_obj (LinesXld, SelectedXLD3, LinesXld)
union_adjacent_contours_xld (LinesXld, LinesXld, 10, 1, 'attr_keep')gen_empty_obj (SelectedXLD2)
gen_empty_obj (SelectedXLD1)fit_circle_contour_xld (CircleXld, 'geotukey', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
if(|Row|>0)
gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, 6.28318, 'positive', 1)distance_cc (ContCircle, CircleXld, 'point_to_segment', DistanceMin, DistanceMax)
difference_closed_contours_xld (CircleXld, ContCircle, ContoursDifference)
difference_closed_contours_xld (ContCircle, CircleXld, ContoursDifference1)
select_shape_xld (ContoursDifference1, SelectedXLD2, ['rect2_len2','compactness'], 'and', [1,0], [50,50])
select_shape_xld (ContoursDifference, SelectedXLD1, ['rect2_len2','compactness'], 'and', [1,0], [50,50])
endiffit_line_contour_xld (LinesXld, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
segment_contours_xld (LinesXld, ContoursSplitLines, 'lines_circles', 5, 5, 1)
select_shape_xld (ContoursSplitLines, SelectedXLDLines, ['circularity','contlength'], 'or', [0.015,0], [1,30])smallest_rectangle2_xld (SelectedXLDLines, Row3, Column2, Phi1, Length11, Length21)
gen_region_contour_xld (SelectedXLDLines, Region, 'filled')
dilation_circle (Region, RegionDilation, 3.5)dev_display (Image)
dev_display (SelectedXLD2)
dev_display (SelectedXLD1)
dev_display (SelectedXLDLines)
dev_display (RegionDilation)
stop()
endfor
halcon车刀崩边检测相关推荐
- halcon工件圆孔检测
halcon工件圆孔检测 下面展示一些 码片. * This program gets the deviation between * circular contours and their best ...
- 基于Halcon学习的缺陷检测【四】光伏电池片的指纹以及划痕检测【第一种方法】
此例子主要是为了把光伏电池片的指纹以及划痕标注出来. 总代码: *读取图片 read_image (Image, 'E:/研究生学习/电池片练习/手指印/截图.png') *清除窗口 dev_cle ...
- 基于Halcon学习的缺陷检测【五】光伏电池片的指纹以及划痕检测【第二种方法】
此例子主要是为了把光伏电池片的指纹以及划痕标注出来. 总代码: *读取图片 read_image (Image, 'E:/研究生学习/电池片练习/手指印/截图.png')*清除窗口 dev_cle ...
- halcon圆环完整度检测
文章目录 处理要求 程序源码 处理结果 博主写作不容易,孩子需要您鼓励 万水千山总是情 , 先点个赞行不行 处理要求 查找好的圆环,检测圆环不良 程序源码 read_image (Image, 'F: ...
- halcon 圆环类缺陷检测的一种方法(极坐标变换法)
目录 简介 极坐标变换 定义 原理 Halcon中的极坐标变换 1.polar_trans_image_ext算子用法与参数剖析 2.polar_trans_region_inv算子用法与参数剖析 圆 ...
- Halcon 3D 切片法检测物料
一.简介 在上一篇中,学习了鞋底切片法来求轮廓,那个思路是比较简单的,其次还提到了法向量重建的方法,目前由于没有用法向量重建来做那个项目,所以还是有很大的疑问,后续会继续学习那个方法然后重新在做一次, ...
- 【Halcon】直线划伤检测:bandpass_image
重拾运动,只为能拼命的时候,有命续-.. Y忍冬草 在看算子的时候,无意间发现还有这么有用的算子.虽还没实际应用,但以后可以应用到划伤之类的缺陷检测上.PS: Halcon帮助手册还是需要多看看的! ...
- Halcon 中mura缺陷检测
目录 文章目录 前言 最近一直在研究高纹理图像中Mura类型缺陷的检测,此类缺陷检测属于表面检测的范畴,以下是对Halcon官方例子中一个相似案例的分享学习. 一.Mura是什么? Mura概述 Mu ...
- halcon脚本-电池正反检测【附源码】
文章目录 前言 一.原图 二.实现思路 三.halcon完整脚本 四.效果展示 前言 本文以一个项目来讲解,检测电池的正负极 一.原图 二.实现思路 首先定义一个region,用来创建模板,为了寻找所 ...
最新文章
- ASP.NET前台代码绑定后台变量方法总结
- android listview 禁止滚动
- Hessian使用记录
- Cordova Embedded Server
- 是、大于等于_血压高,是不是等于患上高血压?吃药之前,先搞清楚
- python selenium 如何选中iframe中的元素?
- Android混淆编译Proguard
- DetoursHook
- SQL入门经典 第一章
- 封装、继承、多态 详解
- linux某用户 计划任务,Linux计划任务管理
- PLC同时连接多个触摸屏和电视机显示器解决方案
- Synchronized和Reentrantlock的区别
- 九城加设网游防沉迷 3千名玩家声称罢玩魔兽
- 羚数智能入选 IDC关于中国制造执行系统(MES)的市场2021年度份额报告
- EXCEL 启动参数设置
- oracle中的drm是什么文件,oracle RAC DRM基本概念
- edge 此项内容已下载并添加到 Chrome 中。_比肩迅雷的下载神器大盘点
- 服务器线路有几种分类?
- 步进电机的特点、选型方法以及型号参数说明
热门文章
- 关于Services.exe开机CPU内存使用暴增解决方案
- React AntD 表格查看修改时默认选中几行数据
- [转]Tomcat中8005/8009/8080/8443端口的作用
- tornada-数据库
- [译]写程序更快、更好、更便宜的艺术
- Go Python 7: 2-Layer Neural Network
- unity 中的UGUI 屏蔽鼠标穿透
- zabbix监控系列(5)之通过trap模式监控网络设备
- 往文件中写数据--增量
- 把A表中的a字段和b字段数据 复制到B表中的aa字段和bb字段