halcon学习之运动跟踪定位

halcon学习之运动跟踪定位
⼤家去研究这个例⼦就可以了:optical_flow_hydraulic_engineering.hdev,这⾥只是记录⼀下,备忘
* This example demonstrates the use of the optical flow operators.
* By calculating the optical flow between two images, the
* position, speed, and movement direction of particles are calculated.
* optical_flow_hydraulic_engineering.hdev
* 这个例⼦演⽰这个使⽤属于这个视⼒的流操作员。由精明的这个视⼒的流之间⼆图像, 这个位置, 速度, 和运动⽅向属于粒⼦是计算。dev_update_off ()
u魅
dev_close_window ()
*
read_image (Image1, 'hydraulic_engineering/hydraulic_engineering_01')
dev_open_window_fit_image (Image1, 0, 0, -1, -1, WindowHandle)
*
dev_set_draw ('margin')
RCenter := -1
CCenter := -1回转窑烧嘴
MeanR := 0
MeanC := 0
tanDir := 0
ArrowLength := 15
MinLength := 0.375
*
for Index := 2 to 50 by 1
背板制作
read_image (Image2, 'hydraulic_engineering/hydraulic_engineering_' + Index$'02')
* 计算两幅图像之间的光流温泉浴片
* Calculate the optical flow between two images
optical_flow_mg (Image1, Image2, VectorField, 'clg', 1, 1, 1000, 5, 'default_parameters', 'fast')
vector_field_length (VectorField, LengthImage, 'squared_length')
*
inu-006
* Estimate the region with moving particles using the length of the vectors of the calculated vector field
* ⽤计算出的向量场的向量长度估计运动粒⼦的区域
min_max_gray (LengthImage, LengthImage, 0, Min, MaxLength, Range)
if (MaxLength > MinLength)
threshold (LengthImage, ROI, MinLength, MaxLength)
* 使⽤估计ROI到原始图像中粒⼦的位置
* Find the position of particles in the original image using  an estimated ROI
*
dilation_circle (ROI, RegionDilation, 3.5)
reduce_domain (Image2, RegionDilation, ImageReduced)
local_max_sub_pix (ImageReduced, 'facet', 1.0, 4, Row, Column)
*
dev_set_color ('cyan')
dev_set_line_width (2)
if (|Row| > 0)
gen_region_points (Points, Row, Column)
connection (Points, ConnectedRegions)
dilation_circle (ConnectedRegions, PointsDilated, 2.5)
* 显⽰器发现了粒⼦及其运动⽅向
* Display found particles and their movement directions
count_obj (PointsDilated, NumberReg)
dev_display (Image2)
dev_display (PointsDilated)
for J := 1 to NumberReg by 1
select_obj (PointsDilated, SelectedRegions, J)
* 估计粒⼦的速度
* Estimate the speed of the particles
蒲公英化妆品reduce_domain (VectorField, SelectedRegions, ImageReducedVF)
vector_field_to_real (ImageReducedVF, RowImage, ColumnImage)
intensity (ColumnImage, ColumnImage, MeanC, Deviation)
intensity (RowImage, RowImage, MeanR, Deviation)
Length := sqrt(MeanR * MeanR + MeanC * MeanC)
gen_arrow_contour_xld (Arrow, Row[J - 1], Column[J - 1], Row[J - 1] + MeanR / Length * ArrowLength, Column[J - 1] + MeanC / Length * ArrowLength,                dev_display (Arrow)
endfor
endif
endif
copy_obj (Image2, Image1, 1, 1)
endfor

本文发布于:2024-09-23 12:31:37,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/2/200302.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:运动   图像   估计   记录   背板   备忘   制作
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议