get_shape_model_contours( : ModelContours : ModelID, Level : )算子

时间: 2024-03-11 10:45:50 浏览: 30
get_shape_model_contours是HALCON中用于获取基于形状匹配的模板匹配模型的轮廓数据的算子,它可以根据输入的模型ID和金字塔层数,获取相应层数的轮廓数据,并返回包含轮廓数据的XLD对象。 具体来说,get_shape_model_contours算子可以通过以下参数进行调用: - ModelID:需要获取轮廓数据的模型的ID。 - Level:需要获取轮廓数据的金字塔层数。 - ModelContours:输出的XLD对象,包含了轮廓数据。 在运行该算子时,它会根据输入的模型ID和金字塔层数,获取相应层数的轮廓数据,并返回包含轮廓数据的XLD对象。XLD对象中包含了模型在指定层数下的轮廓数据,可以用于可视化或其他的后续处理操作。 需要注意的是,get_shape_model_contours算子仅能处理基于形状匹配的模板匹配模型,且需要在create_shape_model算子中指定NumLevels参数。在获取轮廓数据前,应该先创建模型并训练模型。
相关问题

gen_contours_skeleton_xld(Skeleton : Contours : Length, Mode : )算子

gen_contours_skeleton_xld算子是HALCON中用于从骨架图生成轮廓的算子。它可以根据骨架图生成一系列轮廓,并返回轮廓的长度和类型。 具体来说,gen_contours_skeleton_xld算子可以通过以下参数进行调用: - Skeleton:输入的骨架图。 - Contours:输出的轮廓。 - Length:输出的轮廓长度。 - Mode:轮廓类型,可以选择"outer"(外轮廓)或者"inner"(内轮廓)。 在运行该算子时,它会根据指定的轮廓类型(outer或者inner)从骨架图中提取相应类型的轮廓,并将轮廓返回到Contours参数中。同时,它还会计算轮廓的长度,并将长度返回到Length参数中。 需要注意的是,gen_contours_skeleton_xld算子仅能处理二值图像的骨架图,并且对于非连通的骨架图,它只能处理其中的一个连通分支。如果需要处理多个连通分支,可以将骨架图分解成多个骨架图,并分别对每个骨架图调用该算子。

opencv find_shape_model

The `find_shape_model` function in OpenCV is used for finding a shape model from a set of training images. It is part of the Shape Matching module in OpenCV, which provides tools for matching shapes based on their contour and other features. The `find_shape_model` function takes as input a set of training images, which are typically binary images with the object of interest represented as a white shape on a black background. The function then computes a shape model based on the contours of the objects in the training images. The shape model can be used for shape matching, which involves finding the best match between a given image and the shape model. This can be useful for object recognition and tracking. To use the `find_shape_model` function, you first need to create a ShapeContextDistanceExtractor object, which defines the distance metric used for shape matching. You then call the `find_shape_model` function, passing in the training images and the ShapeContextDistanceExtractor object. Here's an example of how to use the `find_shape_model` function: ``` import cv2 # Load training images img1 = cv2.imread("train1.png", cv2.IMREAD_GRAYSCALE) img2 = cv2.imread("train2.png", cv2.IMREAD_GRAYSCALE) img3 = cv2.imread("train3.png", cv2.IMREAD_GRAYSCALE) # Create ShapeContextDistanceExtractor object sc_extractor = cv2.createShapeContextDistanceExtractor() # Find shape model from training images shape_model = cv2.findShapeModel([img1, img2, img3], sc_extractor) ``` In this example, we load three training images and create a ShapeContextDistanceExtractor object. We then call the `findShapeModel` function, passing in the three training images and the ShapeContextDistanceExtractor object. The function returns a shape model, which can be used for shape matching.

相关推荐

* This example shows how to use shape-based matching * in order to find a model region and use it for * further tasks. * Here, the additional task consists of reading text * within a certain region, wherefore the image has * to be aliged using the matching transformation. * * Initialization. dev_update_window ('off') dev_close_window () * Initialize visualization. read_image (ReferenceImage, 'board/board_01') get_image_size (ReferenceImage, Width, Height) initialize_visualization (Width / 2, Height / 2, WindowHandle, WindowHandleText) disp_continue_message (WindowHandle, 'black', 'true') disp_description_text (WindowHandleText) * * Define ROIs: * ROI for the shape model. dev_set_window (WindowHandle) dev_display (ReferenceImage) gen_rectangle1 (ROIModel, 60, 535, 185, 900) dev_display (ROIModel) * ROI for the text. gen_rectangle1 (ROIText, 445, 585, 590, 765) dev_display (ROIText) disp_model_message (WindowHandle) stop () * * Prepare the shape-based matching model. reduce_domain (ReferenceImage, ROIModel, ModelImage) * Create shape model and set parameters (offline step). create_generic_shape_model (ModelHandle) * Train the shape model. train_generic_shape_model (ModelImage, ModelHandle) * * Prepare the text model. create_text_model_reader ('auto', 'Industrial_0-9A-Z_Rej.omc', TextModel) * * We look for the reference transformation which we will need * for the alignment. We can extract it by finding the instance * on the reference image. * Set find parameters. set_generic_shape_model_param (ModelHandle, 'num_matches', 1) set_generic_shape_model_param (ModelHandle, 'min_score', 0.5) find_generic_shape_model (ReferenceImage, ModelHandle, MatchResultID, Matches) get_generic_shape_model_result (MatchResultID, 'all', 'hom_mat_2d', HomMat2DModel) * * Find the object in other images (online step). for i := 1 to 9 by 1 read_image (SearchImage, 'board/board_' + i$'02') find_generic_shape_model (SearchImage, ModelHandle, MatchResultID, Matches) get_generic_shape_model_result (MatchResultID, 'all', 'hom_mat_2d', HomMat2DMatch) * Compute the transformation matrix. hom_mat2d_invert (HomMat2DMatch, HomMat2DMatchInvert) hom_mat2d_compose (HomMat2DModel, HomMat2DMatchInvert, TransformationMatrix) affine_trans_image (SearchImage, ImageAffineTrans, TransformationMatrix, 'constant', 'false') * * Visualization. dev_set_window (WindowHandle) dev_display (SearchImage) get_generic_shape_model_result_object (InstanceObject, MatchResultID, 'all', 'contours') dev_display (InstanceObject) * * Reading text and numbers on the aligned image. reduce_domain (ImageAffineTrans, ROIText, ImageOCR) find_text (ImageOCR, TextModel, TextResultID) get_text_object (Characters, TextResultID, 'all_lines') get_text_result (TextResultID, 'class', RecognizedText) * * Visualization. dev_set_window (WindowHandleText) dev_display (ImageAffineTrans) dev_set_colored (12) dev_display (Characters) disp_finding_text (Characters, WindowHandle, WindowHandleText, RecognizedText) wait_seconds (0.5) endfor disp_end_of_program_message (WindowHandle, 'black', 'true') stop () dev_close_window ()

最新推荐

recommend-type

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a
recommend-type

matlab建立计算力学课程的笔记和文件.zip

matlab建立计算力学课程的笔记和文件.zip
recommend-type

FT-Prog-v3.12.38.643-FTD USB 工作模式设定及eprom读写

FT_Prog_v3.12.38.643--FTD USB 工作模式设定及eprom读写
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

2. 通过python绘制y=e-xsin(2πx)图像

可以使用matplotlib库来绘制这个函数的图像。以下是一段示例代码: ```python import numpy as np import matplotlib.pyplot as plt def func(x): return np.exp(-x) * np.sin(2 * np.pi * x) x = np.linspace(0, 5, 500) y = func(x) plt.plot(x, y) plt.xlabel('x') plt.ylabel('y') plt.title('y = e^{-x} sin(2πx)') plt.show() ``` 运行这段
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

实现实时监控告警系统:Kafka与Grafana整合

![实现实时监控告警系统:Kafka与Grafana整合](https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X2pwZy9BVldpY3ladXVDbEZpY1pLWmw2bUVaWXFUcEdLT1VDdkxRSmQxZXB5R1lxaWNlUjA2c0hFek5Qc3FyRktudFF1VDMxQVl3QTRXV2lhSWFRMEFRc0I1cW1ZOGcvNjQw?x-oss-process=image/format,png) # 1.1 Kafka集群架构 Kafka集群由多个称为代理的服务器组成,这