当前位置:网站首页>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)
边栏推荐
- leetcode刷题:栈与队列06(前 K 个高频元素)
- What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
- 收藏:存储知识全面总结
- 2022年高处安装、维护、拆除考题模拟考试平台操作
- ORA-01950
- RichView TRVDocParameters 页面参数设置
- Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
- Arduino stepper library drive 28byj-48 stepper motor test program
- 升级版手机检测微信工具小程序源码-支持多种流量主模式
- Simple but modern server dashboard dashdot
猜你喜欢
随机推荐
[Mysql]安装Mysql5.7
BC35&BC95 ONENET MQTT(旧)
Is it safe to open an account online? Can a novice open a stock trading account.
数据分析师听起来很高大上?了解这几点你再决定是否转型
[mysql] install mysql5.7
PLC模拟量输入 模拟量转换FB S_ITR(三菱FX3U)
王者战力查询改名工具箱小程序源码-带流量主激励广告
牛客编程题--必刷101之字符串(高效刷题,举一反三)
Myslq ten kinds of locks, an article will take you to fully analyze
internship:复杂json格式数据编写接口
写博客文档
Iframe 父子页面通信
Flask 常用组件
2022安全员-B证考试练习题模拟考试平台操作
【Leetcode】最大连续1的个数
考虑关系的图卷积神经网络R-GCN的一些理解以及DGL官方代码的一些讲解
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
Optimization of the problem that the request flow fails to terminate during page switching of easycvr cluster video Plaza
EURA eurui E1000 series inverter uses PID to realize the relevant parameter setting and wiring of constant pressure water supply function
Accelera Systems Initiative是一个独立的非营利组织











