Halcon示例之角点检测(包含自定义函数的创建)

简介: Halcon示例之角点检测(包含自定义函数的创建)

1、角点检测有关算子:


points_harris()

proj_match_points_ransac()

gen_projective_mosaic()


2、安装Halcon后下面有很多例程,里面有几个关于拼接的例子,推荐看一下:文件->浏览例程->方法->拼接->mosaicking.hdev。


3、Halcon角点官方自带的测试示例,interest_points_comparison.hdev,


转载一篇文章http://blog.sina.com.cn/s/blog_61cc743001017ss9.html


* This program compares the result of different operators
* which detect points of interest
* 
dev_update_off ()
Dark := 100
Background := 175
Light := 250
Angle := rad(45)
Size := 3
create_test_image (Image, Background, Light, Dark)
dev_close_window ()
get_image_size (Image, Width, Height)
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_color ('black')
dev_set_line_width (3)
* 
* Foerstner interest points detector
points_foerstner (Image, 1, 2, 3, 200, 0.3, 'gauss', 'true', RowJunctions, ColJunctions, CoRRJunctions, CoRCJunctions, CoCCJunctions, RowArea, ColArea, CoRRArea, CoRCArea, CoCCArea)
gen_cross_contour_xld (CrossFoerstner, RowJunctions, ColJunctions, Size, Angle)
dev_display (Image)
dev_display (CrossFoerstner)
disp_message (WindowHandle, 'Foerstner interest points detector', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
* Harris interest points detector
points_harris (Image, 0.7, 2, 0.04, 0, RowHarris, ColHarris)
gen_cross_contour_xld (CrossHarris, RowHarris, ColHarris, Size, Angle)
dev_display (Image)
dev_display (CrossHarris)
disp_message (WindowHandle, 'Harris interest points detector', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
* Harris binomial interest points detector
points_harris_binomial (Image, 5, 15, 0.04, 1000, 'on', RowHarrisBinomial, ColHarrisBinomial)
gen_cross_contour_xld (CrossHarrisBinom, RowHarrisBinomial, ColHarrisBinomial, Size, Angle)
dev_display (Image)
dev_display (CrossHarrisBinom)
disp_message (WindowHandle, 'Harris binomial interest points detector', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
* Sojka interest points detector
points_sojka (Image, 9, 2.5, 0.75, 30, 90, 0.5, 'true', RowSojka, ColSojka)
gen_cross_contour_xld (CrossSojka, RowSojka, ColSojka, Size, Angle)
dev_display (Image)
dev_display (CrossSojka)
disp_message (WindowHandle, 'Sojka interest points detector', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
* Lepetit interest points detector
points_lepetit (Image, 3, 1, 20, 35, 'interpolation', RowLepetit, ColLepetit)
gen_cross_contour_xld (CrossLepetit, RowLepetit, ColLepetit, Size, Angle)
dev_display (Image)
dev_display (CrossLepetit)
disp_message (WindowHandle, 'Lepetit interest points detector', 'window', 12, 12, 'black', 'true')
其中,红色的create_test_image (Image, Background, Light, Dark)这个函数为外部函数(即自己所写函数)。具体的过程创建见下一节。
create_test_image 函数程序如下:
gen_image_const (Image, 'byte', 256, 280)
scale_image (Image, Image, 1, Background)
gen_rectangle1 (Rectangle, 40, 40, 80, 80)
overpaint_region (Image, Rectangle, Light, 'fill')
gen_rectangle1 (Rectangle, 81, 81, 121, 121)
overpaint_region (Image, Rectangle, Light, 'fill')
gen_rectangle1 (Rectangle, 40, 81, 80, 121)
overpaint_region (Image, Rectangle, Dark, 'fill')
gen_rectangle1 (Rectangle, 81, 40, 121, 80)
overpaint_region (Image, Rectangle, Dark, 'fill')
gen_circle (Circle, 160, 40, 2)
overpaint_region (Image, Circle, Dark, 'fill')
gen_circle (Circle, 160, 100, 4)
overpaint_region (Image, Circle, Dark, 'fill')
gen_circle (Circle, 160, 160, 6)
overpaint_region (Image, Circle, Dark, 'fill')
gen_circle (Circle, 220, 40, 6)
overpaint_region (Image, Circle, Light, 'fill')
gen_circle (Circle, 220, 100, 4)
overpaint_region (Image, Circle, Light, 'fill')
gen_circle (Circle, 220, 160, 2)
overpaint_region (Image, Circle, Light, 'fill')
gen_rectangle1 (Rectangle, 140, 220, 240, 222)
overpaint_region (Image, Rectangle, Light, 'fill')
gen_rectangle1 (Rectangle, 200, 180, 202, 240)
overpaint_region (Image, Rectangle, Light, 'fill')
gen_rectangle2 (Rectangle, 60, 200, rad(45), 40, 10)
overpaint_region (Image, Rectangle, Dark, 'fill')
gen_rectangle2 (Rectangle, 60, 200, rad(-45), 40, 10)
overpaint_region (Image, Rectangle, Dark, 'fill')
return ()



4、Halcon函数调用


HDevelop主菜单->函数->创建新函数



image.png





image.png

然后,就可以编辑新的函数了。包括名称,参数设置等等。设置完成后,应用,确定。


最后编辑完函数后记得保存。



相关文章
|
9月前
|
SQL 定位技术 API
GEE python:按照矢量中的几何位置、属性名称和字符串去筛选矢量集合
GEE python:按照矢量中的几何位置、属性名称和字符串去筛选矢量集合
107 0
|
1月前
|
API 开发者 Python
Pygame Zero(pgzrun)详解(简介、使用方法、坐标系、目录结构、语法参数、安装、实例解释)
Pygame Zero(pgzrun)详解(简介、使用方法、坐标系、目录结构、语法参数、安装、实例解释)
139 17
|
9月前
|
算法 Python
从原始边列表到邻接矩阵:使用Python构建图的表示
从原始边列表到邻接矩阵:使用Python构建图的表示
97 0
|
5月前
|
存储 计算机视觉
Opencv的基本操作(一)图像的读取显示存储及几何图形的绘制
本文介绍了使用OpenCV进行图像读取、显示和存储的基本操作,以及如何绘制直线、圆形、矩形和文本等几何图形的方法。
Opencv的基本操作(一)图像的读取显示存储及几何图形的绘制
|
9月前
|
存储 算法 数据可视化
|
前端开发 Python
Python tkinter库之Canvas 根据函数解析式或参数方程画出图像
Python tkinter库之Canvas 根据函数解析式或参数方程画出图像
339 0
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(一)
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(一)
257 0
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(一)
|
索引
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(二)
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(二)
334 0
【MATLAB】进阶绘图 ( MATLAB 颜色值 | 条形图示例 | 查找对象属性方法 | 修改条形图属性 )(二)
【MATLAB】基本绘图 ( text 函数 | annotation 函数 | 绘制图像示例 )
【MATLAB】基本绘图 ( text 函数 | annotation 函数 | 绘制图像示例 )
541 0
【MATLAB】基本绘图 ( text 函数 | annotation 函数 | 绘制图像示例 )
|
编解码 计算机视觉 Python
Python 获取图片某像素BGR值并生成纯色图 | Python工具
Python 获取图片某像素BGR值并生成纯色图 | Python工具
Python 获取图片某像素BGR值并生成纯色图 | Python工具

热门文章

最新文章

相关实验场景

更多