Halcon——测量边长

* Image Acquisition 01: Code generated by Image Acquisition 01
read_image (Image, 'C:/Users/caida/Desktop/halcon计划/halcon计划/测量/_1.png')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_display (Image)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()

*循环分割
for i := 1 to 3 by 1
    read_image (Image1, 'C:/Users/caida/Desktop/halcon计划/halcon计划/测量/_'+i+'.png')
    fast_threshold (Image1, Region, 128, 255, 20)
    dev_set_draw ('margin')
    edges_sub_pix (Image1, Edges, 'canny', 1, 20, 40)
    segment_contours_xld (Edges, ContoursSplit, 'lines', 5, 4, 2)
    count_obj (ContoursSplit, Number)
    for j := 1 to Number by 1
        select_obj (ContoursSplit, ObjectSelected, j)
        length_xld (ObjectSelected, Length)
        fit_line_contour_xld (ObjectSelected, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
        gen_contour_polygon_xld (line, [RowBegin,RowEnd], [ColBegin,ColEnd])
        distance_pp (RowBegin, ColBegin, RowEnd, ColEnd, Distance)
        disp_message (WindowHandle, 'L'+j, 'image', (RowBegin+RowEnd)/2, (ColBegin+ColEnd)/2, 'yellow', 'false')
        disp_message (WindowHandle, 'Length: '+Length, 'window', 20*j, 12, 'green', 'false')
        disp_continue_message (WindowHandle, 'black', 'true')
        stop ()
    endfor
    stop ()
endfor

在这里插入图片描述

Hi~ 可私信我了解后再进行下载~ 本资源上传时,遗漏了两个文件,分别是:data_filter_keep_order_output_index.hdvp 以及 IntensityImageToPiontsCloudImage.hdvp,购买了该资源的同学,给我留言,我会私信发给你们。 1.基于halcon算法平台; 2.提供深度图源文件以及解压密码; 3.代码预览: */****************************** * @文档名称: 基于点云的平面度测量。 * @作者: hugo * @版本: 1.1 * @日期: 2021-6-20 * @描述: 该方法支持点云的平面的平面度测量。 ********************************/ dev_update_window ('on') dev_get_window (WindowHandle) read_image (imageReal, './replay_38893_2021-6-7.tif') xResolution:=0.06 yResolution:=0.06 zResolution:=0.001 ScaleFactor:=[xResolution,yResolution,zResolution] *采样区域1 create_drawing_object_rectangle2 (300, 120, rad(90), 30, 20, DrawID) set_drawing_object_params (DrawID, 'color', 'forest green') set_drawing_object_params (DrawID, 'line_width', 1) attach_drawing_object_to_window (WindowHandle, DrawID) .......... *平面度 height:=theta/zScale*0.001 *可视化高度差效果 visParamName := ['lut','alpha_0','intensity','color_1'] visParamValue := ['hsi',0.7,'coord_z','yellow'] Labels := ['','平面度:'+height+'mm',''] objs:=[ObjectModel3Ds[2],final_ObjectModel3Ds] visualize_object_model_3d (WindowHandle, objs, [], [], visParamName, visParamValue, 'Edited by AmazingRobot+', [Labels], '', PoseOut) *stop () clear_object_model_3d (plane_balls) for Index := 0 to |final_ObjectModel3Ds|-1 by 1 clear_object_model_3d (final_ObjectModel3Ds[Index]) endfor return () 谢谢您的信任~
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值