3d_coordinates 测量世界坐标中的倾斜物体
- 测量世界坐标中的倾斜物体
- Initialize the program
dev_close_window ()
dev_open_window (0, 0, 768, 576, ‘black’, WindowHandle)
dev_update_off ()
dev_set_draw (‘margin’)
dev_set_line_width (3)
set_display_font (WindowHandle, 14, ‘mono’, ‘true’, ‘false’) - Calibrate the camera
- CalTabDescrFile := ‘caltab_big.descr’
StartCamPar := [0.008,0,0.0000086,0.0000086,384,288,768,576]
create_calib_data (‘calibration_object’, 1, 1, CalibDataID)
set_calib_data_cam_param (CalibDataID, 0, ‘area_scan_division’, StartCamPar)
set_calib_data_calib_object (CalibDataID, 0, CalTabDescrFile)
NumImages := 10
for I := 1 to NumImages by 1
read_image (Image, ‘calib/calib-3d-coord-’ + I$’02d’)
dev_display (Image)
Message := ‘Find calibration plate in\nall calibration images (’ + I + ‘/’ + NumImages + ‘)’
disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)- Find the calibration plate
find_calib_object (Image, CalibDataID, 0, 0, I - 1, [], [])
get_calib_data (CalibDataID, ‘camera’, 0, ‘init_params’, StartCamPar)
get_calib_data_observ_points (CalibDataID, 0, 0, I - 1, Row, Column, Index, Pose)
get_calib_data_observ_contours (Contours, CalibDataID, ‘caltab’, 0, 0, I - 1)
gen_cross_contour_xld (Cross, Row, Column, 6, 0.785398)
dev_set_color (‘green’)
dev_display (Contours)
dev_set_color (‘yellow’)
dev_display (Cross)
endfor
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
calibrate_cameras (CalibDataID, Error)
get_calib_data (CalibDataID, ‘camera’, 0, ‘params’, CamParam)
- Find the calibration plate
- 此时得到了Pose和CamParam
- Perform measurements
- for I := 1 to NumImages by 1
read_image (Image, ‘calib/calib-3d-coord-’ + I$’02d’)- 现在找到标定板的黑色边缘
- Now, measure the size of the black border of the plate
get_measure_positions (Image, PlateRegion, CalibDataID, I, Distance, Phi, RowCenter, ColumnCenter)
*用矩形的形状创建一个XLD轮廓,依次为矩形的XLD轮廓,中心的行坐标,矩形的中心坐标,矩形的主轴的方向
gen_rectangle2_contour_xld (Rectangle, RowCenter, ColumnCenter, Phi, Distance * 0.52, 8)
gen_measure_rectangle2 (RowCenter, ColumnCenter, Phi, Distance * 0.52, 8, 768, 576, ‘nearest_neighbor’, MeasureHandle) - 提取垂直于矩形或环形弧的直边共18个点
measure_pos (Image, MeasureHandle, 1, 40, ‘all’, ‘all’, RowEdge, ColumnEdge, Amplitude, Distance1)
close_measure (MeasureHandle)
Rows := [RowEdge[0],RowEdge[|RowEdge| - 1]]
Columns := [ColumnEdge[0],ColumnEdge[|RowEdge| - 1]]
gen_cross_contour_xld (Cross, Rows, Columns, 16, Phi) - 将两个边界点转换为世界坐标系
- Transform the two border points into the world coordinate system
get_calib_data (CalibDataID, ‘calib_obj_pose’, [0,I - 1], ‘pose’, Pose)
*将图像点转换为z=0的世界坐标系
image_points_to_world_plane (CamParam, Pose, Rows, Columns, ‘m’, SX, SY)
distance_pp (SY[0], SX[0], SY[1], SX[1], Width) - Display results of width measurement
dev_display (Image)
dev_set_color (‘white’)
dev_set_line_width (3)
dev_display (Rectangle)
dev_set_color (‘green’)
dev_set_draw (‘fill’)
dev_set_line_width (2)
dev_display (Cross)
dev_set_draw (‘margin’)
disp_message (WindowHandle, ‘Width = ’ + (Width * 100)$’8.3f’ + ‘cm’, ‘window’, 12, 12, ‘black’, ‘true’)
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
- Display results of width measurement
- 现在,测量校准标记点的尺寸
- Now, measure the size of the calibration marks
- 提取图像中的圆
- Extract the ellipses in the image用环状结构元素侵蚀一个区域
erosion_circle (PlateRegion, ROI, 17.5)
reduce_domain (Image, ROI, ImageReduced)
edges_sub_pix (ImageReduced, Edges, ‘canny’, 1, 20, 60)
select_contours_xld (Edges, SelectedEdges, ‘contour_length’, 20, 99999999, -0.5, 0.5) - Fit ellipses to extracted edges,拟合圆
fit_ellipse_contour_xld (SelectedEdges, ‘fitzgibbon’, -1, 2, 0, 200, 3, 2, Row, Column, Phi, Radius1, Radius2, StartPhi, EndPhi, PointOrder)
*取均值
MeanRadius1 := mean(Radius1)
MeanRadius2 := mean(Radius2)
DevRadius1 := deviation(Radius1)
DevRadius2 := deviation(Radius2) - Transform the ellipses to world coordinates, where they should be circles
*吧圆转换到世界坐标 - and convert the circles from meters to millimeters so that we can see them.
contour_to_world_plane_xld (SelectedEdges, WorldCircles, CamParam, Pose, ‘mm’) - Fit ellipses to the circles in world coordinates
fit_ellipse_contour_xld (WorldCircles, ‘fitzgibbon’, -1, 2, 0, 200, 3, 2, Row, Column, Phi, RadiusW1, RadiusW2, StartPhi, EndPhi, PointOrder)
MeanRadiusW1 := mean(RadiusW1)
MeanRadiusW2 := mean(RadiusW2)
DevRadiusW1 := deviation(RadiusW1)
DevRadiusW2 := deviation(RadiusW2) - Display results of ellipse measurement
dev_display (Image)
dev_set_color (‘yellow’)
dev_set_line_width (3)
dev_display (SelectedEdges)
Message := ‘Measured dimensions of the ellipses’
Message[0] := ’ Mean Radius1; Mean Radius2; (Standard deviations [%])’
Message[1] := ‘Image coordinates: ’ + MeanRadius1 ′5.2f′+′px;′+MeanRadius2 '5.2f' + 'px; ' + MeanRadius2’5.2f’ + ‘px (’ + (DevRadius1 / MeanRadius1 * 100) ′4.2f′+′,′+(DevRadius2/MeanRadius2∗100) '4.2f' + ', ' + (DevRadius2 / MeanRadius2 * 100)’4.2f’ + ‘)’
Message[2] := ‘World coordinates: ’ + (MeanRadiusW1 / 10) ′5.2f′+′cm;′+(MeanRadiusW2/10) '5.2f' + 'cm; ' + (MeanRadiusW2 / 10)’5.2f’ + ‘cm (’ + (DevRadiusW1 / MeanRadiusW1 * 100) ′4.2f′+′,′+(DevRadiusW2/MeanRadiusW2∗100) '4.2f' + ', ' + (DevRadiusW2 / MeanRadiusW2 * 100)’4.2f’ + ‘)’
disp_message (WindowHandle, Message, ‘window’, 12, 12, ‘black’, ‘true’)
if (I < 10)
disp_continue_message (WindowHandle, ‘black’, ‘true’)
stop ()
endif
endfor
clear_calib_data (CalibDataID)
- Display results of ellipse measurement
3d_coordinates 测量世界坐标中的倾斜物体相关推荐
- 使用OpenCV测量图像中物体的大小
本文翻译自pyimagesearch技术博客上的一篇文章,<Measuring size of objects in an image with OpenCV>,原文作者:Adrian R ...
- IEEE2019论文:使用基于特征融合和缩放的具有空间上下文分析的单镜头检测器在无人机图像中检测小物体
摘要: 无人机(UAV)图像中的目标由于拍摄高度较高通常都很小,我们虽然在目标检测方面已经做了很多工作,但是如何准确.快速地检测出小目标仍然是一个有待解决的挑战.本文针对无人机图像中的小目标检测问题, ...
- python照相机标定、在图像中放置虚拟物体、PyGame和PyOpenGL
一.照相机标定 标定照相机是指计算出该照相机的内参数,在我们的例子中,是指计算矩阵K,如果你的应用要求高精度,那么可以扩展照相机模型,使其包含径向畸变和其他条件.对于大多数应用来说,简单的照相机模型已 ...
- 【虚拟仿真】Unity3D中实现控制物体的旋转、移动、缩放
推荐阅读 CSDN主页 GitHub开源地址 Unity3D插件分享 简书地址 我的个人博客 大家好,我是佛系工程师☆恬静的小魔龙☆,不定时更新Unity开发技巧,觉得有用记得一键三连哦. 一.前言 ...
- 用matlab求残余误差,matlab在测量误差分析中的应用
matlab在测量误差分析中的应用 MATLAB在测量误差分析中的应用 在技术测量中,按照误差的特点与性质,误差可分为:系统误差,粗大误差和随机误差.在假定不含有系统误差的情况下,可借助MATLAB对 ...
- [Unity] Perfab 和 Scene 中显示的物体局部坐标系的原点不是实际原点
Perfab 和 Scene 中显示的物体局部坐标系的原点不是实际原点 如图,我在原点创建了一个球,然后复制两份,移出去,现在显示的局部坐标系的原点就不在最开始的原点了-- 但是实际上程序获得的还是最 ...
- 用深度学习来解析梦境中出现的物体
这篇文章主要的工作算是机器学习和神经科学的结合工作,需要读者在这两个方向有一定的基础. 另有科普版本,结构更加清晰,不过删减了很多内容.科普版本如下: 用深度学习来解析梦境中出现的物体 - 行为与认知 ...
- Unity中获取一个物体下所有的子物体的方法
Unity中获取一个物体下所有的子物体的方法 方法1(获取全部子物体,无论子物体SetActive是否为true): using System.Collections; using System.Co ...
- unity中控制游戏物体移动最基本的三种方法
**unity**中控制游戏物体移动的最基本的三种方法 第一种移动方法-transform.Translate,游戏物体按照你给的方向和速度进行运动 代码如下: Public float speed; ...
最新文章
- 2011考研数学复习注意三点 不提倡题海战术
- 《调制解调算法》专栏导航贴
- LEADTOOLS概览
- python能做页面加载动画吗_HTML+CSS实现页面加载(loading)动画效果
- LWIP2.0.2 FreeRTOS MQTT 客户端的 使用
- GPS串口报文NMEA格式,Python解析L76-gps数据流
- php和xml区别,html与xhtml和xml有什么区别
- hbase shell 入门
- vue省市区三级联动-封装集成
- 无源贴片晶振四角引脚_如何区分贴片晶振的脚位方向
- 干货 | 6大商品数据分析模型分享!
- 微信公众号(订阅号)文章阅读数监控V0.1
- 操作系统之文件管理思维导图
- 手机备忘录里的照片怎么保存到相册里
- 仅需三步完成微信小程序注册
- 【小王的安卓之路】Android原生网络请求
- 宏碁 (ACER) TravelMate P449-G2-MG安装Win7系统
- 有多少人等着看百度区块链的笑话?
- 铁道部官网如何体现了互联网思维?
- linux在root下不能用gedit,root不能运行gedit
热门文章
- 如何用Python欢度六一?
- HTTP状态码(响应码)
- Vue上传文件操作(没有CV,认真看)
- 局域网联结打印机,不出现登陆框
- 降维算法之Isomap原理推导
- X86汇编——标志寄存器
- A Systematic Evaluation of Transient Execution Attacks and Defenses (对暂态执行的攻击和防御的系统评估)(前四节)
- [EPLAN]中的“安全参考”
- Win11删除的东西没有进入回收站
- CentOS 7.2 配置mysql5.7