zw版【转发·台湾nvp系列Delphi例程】HALCON 3D Position Of Circles


procedure TForm1.action();
var
ho_Image, ho_EllipseContoursLarge : HUntypedObjectX;
ho_EllipseContoursSmall, ho_EllipseContours : HUntypedObjectX;
hv_Width, hv_Height : OleVariant;
hv_WindowHandle, hv_NumberLarge : OleVariant;
hv_NumberSmall, hv_RadiusLarge : OleVariant;
hv_RadiusSmall, hv_CamParam : OleVariant;
hv_Pose1, hv_Pose2, hv_CenterNormal1 : OleVariant;
hv_CenterNormal2, hv_ClusterP1 : OleVariant;
hv_ClusterP2, hv_ClusterCN1 : OleVariant;
hv_ClusterCN2, hv_HomMat3D : OleVariant;
hv_i : Longint;
hv_Qx, hv_Qy, hv_Qz : OleVariant;
hv_Row, hv_Column : OleVariant;
val1, val2 : double;
begin
hv_WindowHandle := HWindowXCtrl1.HalconWindow.HalconID;
Op.ReadImage(ho_Image, 'rim');
Op.GetImageSize(ho_Image, hv_Width, hv_Height);
Op.SetPart(hv_WindowHandle, 0, 0, hv_Height - 1, hv_Width - 1);
set_display_font(hv_WindowHandle, 16, 'courier', 'true', 'false');
Op.DispObj(ho_Image, hv_WindowHandle);
Op.SetLineWidth(hv_WindowHandle, 3);
p_determine_ellipse_contours(hv_WindowHandle, ho_Image, ho_EllipseContoursLarge, ho_EllipseContoursSmall, 0, hv_NumberLarge, hv_NumberSmall);
Op.ConcatObj(ho_EllipseContoursLarge, ho_EllipseContoursSmall, ho_EllipseContours);
hv_RadiusLarge := Tuple.TupleDiv(10.25, 1000.0);
hv_RadiusSmall := Tuple.TupleDiv(5.91, 1000.0);
val1 := 0.00000739;
val2 := 0.0000074;
hv_CamParam := Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleConcat(0.0122, -261.04), val1), val2), 303.12), 234.17), 652), 494);
Op.GetCirclePose(ho_EllipseContours, hv_CamParam, Tuple.TupleConcat(Tuple.TupleGenConst(hv_NumberLarge, hv_RadiusLarge), Tuple.TupleGenConst(hv_NumberSmall, hv_RadiusSmall)), 'pose', hv_Pose1, hv_Pose2);
Op.GetCirclePose(ho_EllipseContours, hv_CamParam, Tuple.TupleConcat(Tuple.TupleGenConst(hv_NumberLarge, hv_RadiusLarge), Tuple.TupleGenConst(hv_NumberSmall, hv_RadiusSmall)), 'center_normal', hv_CenterNormal1, hv_CenterNormal2);
p_cluster_normals(hv_Pose1, hv_Pose2, hv_CenterNormal1, hv_CenterNormal2, hv_ClusterP1, hv_ClusterP2, hv_ClusterCN1, hv_ClusterCN2);
Op.DispObj(ho_Image, hv_WindowHandle);
Op.SetColored(hv_WindowHandle, 12);
Op.DispObj(ho_EllipseContours, hv_WindowHandle);
for hv_i := 0 to Longint(Tuple.TupleSub(Tuple.TupleAdd(hv_NumberLarge, hv_NumberSmall), 1)) do
begin
Op.PoseToHomMat3d(Tuple.TupleSelectRange(hv_ClusterP1, Tuple.TupleMult(hv_i, 7), Tuple.TupleAdd(Tuple.TupleMult(hv_i, 7), 6)), hv_HomMat3D);
Op.AffineTransPoint3D(hv_HomMat3D, 0, 0, 0, hv_Qx, hv_Qy, hv_Qz);
Op.Project3DPoint(hv_Qx, hv_Qy, hv_Qz, hv_CamParam, hv_Row, hv_Column);
hv_Row := Tuple.TupleSub(hv_Row, 95);
hv_Column := Tuple.TupleSub(hv_Column, 60);
disp_message(hv_WindowHandle, Tuple.TupleConcat(Tuple.TupleConcat(Tuple.TupleAdd('X=', Tuple.TupleString(Tuple.TupleSelect(hv_ClusterCN1, Tuple.TupleMult(hv_i, 6)), '6.3f')), Tuple.TupleAdd('Y=', Tuple.TupleString(Tuple.TupleSelect(hv_ClusterCN1, Tuple.TupleAdd(Tuple.TupleMult(hv_i, 6), 1)), '6.3f'))), Tuple.TupleAdd('Z=', Tuple.TupleString(Tuple.TupleSelect(hv_ClusterCN1, Tuple.TupleAdd(Tuple.TupleMult(hv_i, 6), 2)), '6.3f'))), 'window', hv_Row, hv_Column, 'black', 'true');
end;
end;

zw版【转发·台湾nvp系列Delphi例程】HALCON 3D Position Of Circles的更多相关文章

  1. zw版【转发·台湾nvp系列Delphi例程】HALCON DirectShow (Delphi Prism)

    zw版[转发·台湾nvp系列Delphi例程]HALCON DirectShow (Delphi Prism) namespace DirectShow_Prism;interfaceuses Sys ...

  2. zw版【转发·台湾nvp系列Delphi例程】HALCON HImage与Bitmap格式转换

    zw版[转发·台湾nvp系列Delphi例程]HALCON HImage与Bitmap格式转换 (Delphi Prism)namespace HImage_Bitmap_Prism;interfac ...

  3. zw版【转发·台湾nvp系列Delphi例程】.NET调用HALCON COM控件内存释放模式

    zw版[转发·台湾nvp系列Delphi例程].NET调用HALCON COM控件内存释放模式 ------------------------------------方法一 :Imports Sys ...

  4. zw版【转发·台湾nvp系列Delphi例程】HALCON HWindow Overlayer 1

    zw版[转发·台湾nvp系列Delphi例程]HALCON HWindow Overlayer 1 ------------------------------------HALCON HWindow ...

  5. zw版【转发·台湾nvp系列Delphi例程】HALCON DirectFile

    zw版[转发·台湾nvp系列Delphi例程]HALCON DirectFile unit Unit1;interfaceuses Windows, Messages, SysUtils, Varia ...

  6. zw版【转发·台湾nvp系列Delphi例程】HALCON DirectShow

    zw版[转发·台湾nvp系列Delphi例程]HALCON DirectShow unit Unit1;interfaceuses Windows, Messages, SysUtils, Varia ...

  7. zw版【转发·台湾nvp系列Delphi例程】Delphi 使用 HALCON库件COM控件数据格式转换

    zw版[转发·台湾nvp系列Delphi例程]Delphi 使用 HALCON库件COM控件数据格式转换 Delphi 使用 HALCON库件COM控件数据格式转换,与IHObjectX接口有关 va ...

  8. zw版【转发·台湾nvp系列Delphi例程】HALCON AddNoiseWhite

    zw版[转发·台湾nvp系列Delphi例程]HALCON AddNoiseWhite unit Unit1;interfaceuses Windows, Messages, SysUtils, Va ...

  9. zw版【转发·台湾nvp系列Delphi例程】HALCON CheckDifference

    zw版[转发·台湾nvp系列Delphi例程]HALCON CheckDifference unit Unit1;interfaceuses Windows, Messages, SysUtils, ...

  10. zw版【转发·台湾nvp系列Delphi例程】HALCON BinThreshold

    zw版[转发·台湾nvp系列Delphi例程]HALCON BinThreshold unit Unit1;interfaceuses Windows, Messages, SysUtils, Var ...

随机推荐

  1. jQuery 遍历json数组的实现代码

    <script type="text/javascript"> "}]; $(d1).each(function(){ alert(this.text+&qu ...

  2. ArcGIS API for Silverlight实现地图测距功能

    原文:ArcGIS API for Silverlight实现地图测距功能 问题:如何实现地图测距功能? 地图工具栏 <Grid x:Name="gToolMenu" Hei ...

  3. CocoaPods的安装及使用/利用开源库Diplomat实现分享及第三方登录/git的使用

    <<史上最简洁版本>> 1.gem sources -l查看 当前的源 //1.1 sudo -i..以下都是以管理员的身份来操作的 2.gem sources --remov ...

  4. JS之call/apply/bind

    测试代码: var a = 1; var obj = { a = 2; } function test(a){ alert(a); alert(this.a); } 1.test(3); 结果:3,1 ...

  5. c#上传文件(一)使用 .net 控件上传文件

    1.html代码: <body> <form id="form1" runat="server"> <div> <as ...

  6. IN和exists 之间的比较

    IN和exists 之间的比较 NOT IN 和 NOT EXISTS之间的比较

  7. case语法练习脚本之判断

    case语法练习脚本之判断 #!/bin/bash read -p "请输入一个字符,并按enter键确认:" key case "$key" in [a-z] ...

  8. event.pageY和event.pageX

    event.pageY 属性返回鼠标指针的位置,相对于文档的上边缘. 提示:该事件属性通常与 event.pageX属性一起使用.(简写:e.pageY(或者e.pageX)) 实例: drag 首先 ...

  9. 背景建模SACON

    http://www.cnblogs.com/dwdxdy/p/3530862.html

  10. android 线程学习

    很多人觉得线程难理解,主要有两个问题: 线程休眠,既然线程已经休眠了,程序的运行速度还能提高吗? 线程体一般都进行死循环,既然线程死循环,程序就应该死掉了,就会没有反应. 1.关于线程休眠问题 对线程 ...