当前位置:网站首页>Halcon知识:三维重构的一个尝试
Halcon知识:三维重构的一个尝试
2022-07-01 19:29:00 【无水先生】
提要
尝试一个三维重构的方法,目前尚不成熟,但是做为长期需要研究的题目,有必要把过程如实记录下来,以便备忘。或以后在此基石上继续研究。
一、生成灰度斜面
- gen_image_surface_first_order( : ImageSurface : Type, Alpha, Beta, Gamma, Row, Column, Width, Height : )
算子 gen_image_surface_first_order 根据以下面方程,创建一个倾斜的灰度值表面:
ImageSurface(r,c) = Alpha(r - Row) + Beta(c - Column) + Gamma
图像的大小由宽度和高度决定。参数 Row 和 Column 定义了创建的灰色表面的参考点。灰度值的类型为 Type(有关像素类型的详细描述,请参见 gen_image_const)。有效区域之外的灰度值被剪裁掉。
如:下列代码
gen_image_surface_first_order(Surface,'uint2',0.3, 0.7, 10, 100, 100,512,512 )
上面图中,左面为生成的斜面图像,右面为灰度平面方程。
二、 图像的分块剪切
- crop_rectangle1(Image : ImagePart : Row1, Column1, Row2, Column2 : )
运算符crop_rectangle1 从每个输入图像中剪切一个或多个矩形区域。这些区域由矩形表示,矩形由它们的左上角和右下角的坐标定义。左上角必须在图像内。在右侧和底部,矩形可能超出图像,但输出图像的域被设置为仅包含可以从输入图像导出的部分。如果矩形区域落在图像内,则每个生成的图像都具有其对应矩形的大小。
三、转换图像的数据类型
- convert_image_type (ZMap, ImageMeasureReal, 'real')
将图像ZMap的数据类型改变,生成ImageMeasureReal图像。
四、元组的幂函数
- tuple_pow( : : T1, T2 : Pow)
tuple_pow 计算输入元组 T1^{T2} 的幂函数。如果两个元组的长度相同,则幂函数将应用于两个元组的相应元素。否则,T1 或 T2 的长度必须为 1。在这种情况下,对较长元组的每个元素与另一个元组的单个元素执行幂函数。结果总是一个浮点数。不允许使用字符串的幂函数。
五、图像灰度线性变换
- scale_image(Image : ImageScaled : Mult, Add : )
运算符 scale_image 通过以下变换缩放输入图像 (Image):
g' := g * mult + add
如果发生上溢或下溢,值将被剪裁。请注意,循环和方向图像并非如此。
例如,可以应用此运算符将图像的灰度值(即区间 [GMin,GMax])映射到最大范围 [0:255]。为此,参数选择如下:
六、三维图像生成
- xyz_to_object_model_3d(X, Y, Z : : : ObjectModel3D)
运算符 xyz_to_object_model_3d 将包含 3D 点的 X、Y 和 Z 坐标的图像三元组转换为 3D 对象模型。仅使用所有三个图像的相交域中的点。在 ObjectModel3D 中返回创建的 3D 对象模型的句柄。创建的 3D 对象模型包含点的坐标,以及包含每个 3D 点的原始行和列的映射属性。其中一个坐标为无穷大或“非数字”(NaN) 的点将被忽略并且不会添加到 3D 对象模型中。
请注意,如果不再需要或应该覆盖 3D 对象模型,则必须首先通过调用运算符 clear_object_model_3d 释放内存。
使用一阶多项式创建一个倾斜的灰色表面。
七、示例代码
read_image (Image, 'E:/Image/257.png')
get_image_size (Image, Width, Height)
threshold (Image, Regions, 30058, 39762)
reduce_domain (Image, Regions, ImageReduced1)
NumberOfZILCaptured :=1000 //设置采集行数为1000
ZILLatRes :=0.056
ZILVerRes :=0.0085
TransportRate := 0.1
* 筛选出XYZ面
* 创建一个X面
gen_image_surface_first_order (PointCloudX, 'real', TransportRate, 0, 0, NumberOfZILCaptured / 2, Width / 2, Width, NumberOfZILCaptured)
* 创建一个Y面
gen_image_surface_first_order (PointCloudY, 'real', 0, ZILLatRes, 0, NumberOfZILCaptured / 2, Width / 2, Width, NumberOfZILCaptured)
* 将图像转换成区域
crop_rectangle1 (ImageReduced1, ZMap, 0, 0, NumberOfZILCaptured - 1, Width-1) //剪出一个或多个矩形图像区域
convert_image_type (ZMap, ImageMeasureReal, 'real') //转换图像类型
get_image_size (ImageMeasureReal, zMap_Width, zMap_Height)
gen_image_const (ImageGray, 'real', zMap_Width, zMap_Height) //创建一个恒定灰度值的图像
threshold (ImageMeasureReal, Region_Valid, 1, 9999999)
tuple_pow (2, 15, hv_offset)
scale_image (ImageMeasureReal, ImageGray, ZILVerRes, -hv_offset * ZILVerRes) //缩放灰度值
* 筛选出Z面
reduce_domain (ImageGray, Region_Valid, PointCloudZ)
* X、Y、Z 面组合成Object物体
xyz_to_object_model_3d (PointCloudX, PointCloudY, PointCloudZ, ObjectModel3D)
GenParaName:=[ 'lut', 'color_attrib', 'alpha', 'disp_pose']
GenParaValue:=['color1', 'coord_z', 0.5, 'true']
visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], GenParaName, GenParaValue, [], [], [], PoseOut)
边栏推荐
- 目標檢測——Yolo系列
- 升级版手机检测微信工具小程序源码-支持多种流量主模式
- 【级联分类器训练参数】Training Haar Cascades
- How to prevent repeated submission of new orders
- [Blue Bridge Cup web] analysis of the real topic of the 13th Blue Bridge Cup web university group match in 2022
- Keras机器翻译实战
- 薛定谔的日语学习小程序源码
- C # joint Halcon application - Dahua camera acquisition class
- internship:逐渐迈向项目开发
- 8K HDR!|为 Chromium 实现 HEVC 硬解 - 原理/实测指南
猜你喜欢
RichView RichEdit SRichViewEdit PageSize 页面设置与同步
leetcode刷题:二叉树03(二叉树的后序遍历)
Principle of motion capture system
Kuberntes云原生实战一 高可用部署架构
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
Big factories are wolves, small factories are dogs?
[multithreading] realize the singleton mode (hungry and lazy) realize the thread safe singleton mode (double validation lock)
leetcode刷题:栈与队列03(有效的括号)
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
目标检测——Yolo系列
随机推荐
Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
想得到股票开户的优惠链接,如何得知?在线开户是安全么?
[Blue Bridge Cup web] analysis of the real topic of the 13th Blue Bridge Cup web university group match in 2022
开环和闭环是什么意思?
8K HDR!| Hevc hard solution for chromium - principle / Measurement Guide
[Mysql]安装Mysql5.7
Using qeventloop to realize synchronous waiting for the return of slot function
Develop those things: easycvr cluster device management page function display optimization
Test of NSI script
C#聯合halcon應用——大華相機采集類
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
2022熔化焊接与热切割上岗证题目模拟考试平台操作
300题线性代数 第四讲 线性方程组
Internship: gradually moving towards project development
Getting started with fastdfs
Accelera Systems Initiative是一个独立的非营利组织
Items in richview documents
写博客文档
EURA eurui E1000 series inverter uses PID to realize the relevant parameter setting and wiring of constant pressure water supply function
极客DIY开源方案分享——数字幅频均衡功率放大器设计(实用的嵌入式电子设计作品软硬件综合实践)