halcon多个形状模板匹配

* Image Acquisition 01: Code generated by Image Acquisition 01 open_framegrabber ('GigEVision2', 0, 0, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', 'c42f90f5f892_Hikvision_MVCA06010GC', 0, -1, AcqHandle) set_framegrabber_param (AcqHandle, 'DeviceUserID', '') set_framegrabber_param (AcqHandle, 'RegionSelector', 'Region0') set_framegrabber_param (AcqHandle, 'Width', 3072) set_framegrabber_param (AcqHandle, 'Height', 2048) set_framegrabber_param (AcqHandle, 'OffsetX', 0) set_framegrabber_param (AcqHandle, 'OffsetY', 0) set_framegrabber_param (AcqHandle, 'PixelFormat', 'YUV422_8') set_framegrabber_param (AcqHandle, 'TestPattern', 'Off') set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'Continuous') set_framegrabber_param (AcqHandle, 'AcquisitionBurstFrameCount', 1) set_framegrabber_param (AcqHandle, 'AcquisitionFrameRate', 3.0) set_framegrabber_param (AcqHandle, 'AcquisitionFrameRateEnable', 1) set_framegrabber_param (AcqHandle, 'ExposureMode', 'Timed') set_framegrabber_param (AcqHandle, 'ExposureAuto', 'Continuous') set_framegrabber_param (AcqHandle, 'TriggerSelector', 'FrameBurstStart') grab_image_start (AcqHandle, -1) *使用上次的校验数据调整图像 read_cam_par ('MV_HIK_Division2.cal', CameraParam) change_radial_distortion_cam_par ('adaptive', CameraParam, 0, CamParamOut) gen_radial_distortion_map (Map, CameraParam, CamParamOut, 'bilinear') dev_update_pc ('off') dev_update_window ('off') dev_update_var ('off') dev_close_window () dev_open_window (0, 0, 3072, 2048, 'black', WindowHandle) dev_set_draw ('margin') dev_set_line_width (3) IndexS := [] IndexE := [] gen_empty_obj (Models) * The variable ModelIDs holds the different models that are created below. ModelIDs := [] Colors := ['red','green','cyan'] for Index := 1 to 2 by 1 read_shape_model ('shape_m'+Index$'01', ModelID) get_shape_model_contours (ModelContours, ModelID, 1) count_obj (ModelContours, NumModel) count_obj (Models, NumModels) concat_obj (Models, ModelContours, Models) IndexS := [IndexS,NumModels + 1] IndexE := [IndexE,NumModels + NumModel] ModelIDs := [ModelIDs,ModelID] endfor while (true) grab_image_async (Image, AcqHandle, -1) map_image (Image, Map, ImageMapped) rgb1_to_gray (ImageMapped, GrayImage) count_seconds (S1) find_shape_models (GrayImage, ModelIDs, rad(0), rad(360), 0.5, 0, 0.5, 'least_squares', 0, 0.8, Row, Column, Angle, Score, Model) count_seconds (S2) Time := (S2 - S1) * 1000 dev_display (GrayImage) Num := |Score| for J := 0 to Num - 1 by 1 * Select the correct XLD contours from the Models object. copy_obj (Models, ModelSelected, IndexS[Model[J]], IndexE[Model[J]] - IndexS[Model[J]] + 1) * Compute the transformation from the model object to the current instance. vector_angle_to_rigid (0, 0, 0, Row[J], Column[J], Angle[J], HomMat2D) affine_trans_contour_xld (ModelSelected, ModelTrans, HomMat2D) dev_set_color (Colors[Model[J]]) dev_display (ModelTrans) *dev_disp_text (Row[J] + ',' + Column[J], 'window', Row[J], Column[J], 'black', [], []) set_tposition (WindowHandle, Row[J], Column[J]+200) write_string (WindowHandle, Row[J] + ',' + Column[J]) endfor dev_set_color ('yellow') wait_seconds (0.4) * Image Acquisition 01: Do something endwhile for J := 0 to |ModelIDs| - 1 by 1 clear_shape_model (ModelIDs[J]) endfor close_framegrabber (AcqHandle)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
2019-07-02 关于约会时间的联合概率问题
2013-07-02 AOP之拦截函数调用链实现
2010-07-02 广告位管理系统--跨域广告加载问题