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

时间:2023-01-01 21:56:29

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

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. 在VS项目中使用SVN版本号作为编译版本号

    在实际项目中(特别是作为产品的项目),版本号是必不可少的一部分.版本号的规则也有许多种,在此不讨论具体的编码规范.对于迭代的产品,版本繁多,特别是有多个实施项目所使用产品的版本不同(基于定制需求)时, ...

  2. 不要让mysql犹豫不决

    DROP TABLE IF EXISTS `w1`; CREATE TABLE `w1` ( `waid` ) NOT NULL AUTO_INCREMENT, `wa1` ) COLLATE utf ...

  3. (中等) CF 585D Lizard Era: Beginning,中途相遇。

    In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana a ...

  4. express传输buffer文件

    最近要做一个功能,导出动态生成的excel文件,这个普普通通的功能却让我折腾了半天.大致流程是这样的,将数据结合excel模板通过ejsExcel库,动态生成excel文件,并发送到客户端. 在exp ...

  5. Log4j 2翻译 Garbage-free Steady State Logging(稳定的以不会生成垃圾的状态来记录日志)

    本人菜鸟,在学习Log4j 2 的时候做的一些笔记---对"官方网站"的翻译,部分内容自己也不懂,希望大家指点 Garbage collection pauses are a co ...

  6. 记录Nginx作为静态资源web服务场景配置

    server { listen   80; server_name    localhost; sendfile    on; access_log    /var/log/nginx/host.ac ...

  7. Asp.net core Identity + identity server + angular 学习笔记 (第一篇)

    用了很长一段时间了, 但是一直没有做过任何笔记,感觉 identity 太多东西要写了, 提不起劲. 但是时间一久很多东西都记不清了. 还是写一轮吧. 加深记忆. 这是 0-1 的笔记, 会写好多篇. ...

  8. html5-css渐变应用小实例,按钮

    .but1{    padding: 10px 20px;    font-size: 16px;    text-shadow: 2px 2px 3px rgba(0,0,0,0.8);    bo ...

  9. 课程三(Structuring Machine Learning Projects),第一周(ML strategy(1)) —— 1.Machine learning Flight simulator:Bird recognition in the city of Peacetopia (case study)

    []To help you practice strategies for machine learning, the following exercise will present an in-de ...

  10. 简单的贝叶斯分类器的python实现

    # -*- coding: utf-8 -*- ''' >>> c = Classy() >>> c.train(['cpu', 'RAM', 'ALU', 'io ...