wordpress站名在哪改,抖音代运营协议模板,阜宁专业做网站的公司,小程序api文章目录 算子optical_flow_mg 计算两个图像之间的光流vector_field_length 计算向量场的向量长度select_shape_std 选择给定形状的区域vector_field_to_real 将矢量场图像转换为两个实值图像intensity 计算灰度值的均值和偏差local_max_sub_pix 以亚像素精度检测局部极大值 Ha… 文章目录 算子optical_flow_mg 计算两个图像之间的光流vector_field_length 计算向量场的向量长度select_shape_std 选择给定形状的区域vector_field_to_real 将矢量场图像转换为两个实值图像intensity 计算灰度值的均值和偏差local_max_sub_pix 以亚像素精度检测局部极大值 Halcon 光流算子示例Halcon 获取移动物体的移动方向Halcon 卫星图获取移动物体的移动方向 算子
optical_flow_mg 计算两个图像之间的光流
optical_flow_mg(ImageT1, ImageT2 : VectorField : Algorithm, SmoothingSigma, IntegrationSigma, FlowSmoothness, GradientConstancy, MGParamName, MGParamValue : )
当使用光流计算函数时以下是参数的解释ImageT1输入的第一幅图像。ImageT2输入的第二幅图像。VectorField计算得到的光流结果会存储在这个变量中。Algorithm用于计算光流的算法可以选择 clg, ddraw, fdrig 中的一个。SmoothingSigma初始高斯平滑的标准差。这个参数用于控制光流计算过程中的图像平滑程度。IntegrationSigma积分滤波器的标准差。这个参数影响了光流场的积分过程。FlowSmoothness平滑项相对于数据项的权重。它影响了光流场的平滑程度。GradientConstancy梯度稳定性相对于灰度稳定性的权重。这个参数用于平衡梯度稳定性和灰度稳定性在光流计算中的影响。MGParamName多网格算法的参数名称可以指定不同的参数名来调整多网格算法的行为。MGParamValue多网格算法的参数值根据实际需求进行设置。vector_field_length 计算向量场的向量长度
vector_field_length(VectorField : Length : Mode : )
以下是各个参数的解释VectorField输入的矢量场包含了需要计算长度的向量。Length计算得到的向量长度结果将会存储在这个变量中。Mode用于计算向量长度的模式选择参数。length计算向量的长度。squared_length计算向量的平方长度。select_shape_std 选择给定形状的区域
select_shape_std(Regions : SelectedRegions : Shape, Percent : )
以下是各个参数的解释Regions输入的区域包含需要进行选择的区域。SelectedRegions经过选择后具有所需形状的区域将会存储在这个变量中。Shape要检查的形状特征参数。max_area检查最大面积。rectangle1检查矩形1。rectangle2检查矩形2。Percent相似性度量参数用于确定区域形状的相似度。默认值70.0推荐值范围10.0, 30.0, 50.0, 60.0, 70.0, 80.0, 90.0, 95.0, 100.0典型取值范围0.0 ≤ Percent ≤ 100.0最小增量0.1推荐增量10.0vector_field_to_real 将矢量场图像转换为两个实值图像
vector_field_to_real(VectorField : Row, Col : : )VectorField (输入对象): 这个参数代表一个矢量场通常描述图像中每个点处矢量的方向和大小。Row (输出对象): 表示沿着行方向的矢量分量指示图像中沿着行的矢量场分量。Col (输出对象): 表示沿着列方向的矢量分量指示图像中沿着列的矢量场分量。intensity 计算灰度值的均值和偏差
intensity(Regions, Image : : : Mean, Deviation)
参数如下Regions (输入对象): 计算特征的区域。Image (输入对象): 灰度值图像用于计算特征。Mean (输出控制): 区域的平均灰度值。Deviation (输出控制): 区域内灰度值的偏差local_max_sub_pix 以亚像素精度检测局部极大值
local_max_sub_pix(Image : : Filter, Sigma, Threshold : Row, Column)
参数说明如下Image输入对象单通道图像表示输入图像。Filter输入控制字符串用于计算局部导数的方法。默认值facet可选值facet、gaussSigma输入控制实数高斯核的标准差。如果Filter为facet则Sigma可以设为0.0以避免对输入图像进行平滑处理。建议值0.7, 0.8, 0.9, 1.0, 1.2, 1.5, 2.0, 3.0约束Sigma 0.0Threshold输入控制实数Hessian矩阵特征值的绝对值最小值。默认值5.0建议值2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0约束Threshold 0.0Row输出控制点y数组检测到的极大值的行坐标。Column输出控制点x数组检测到的极大值的列坐标。
Halcon 光流算子示例 dev_update_off ()
dev_close_window ()
* Initialize the image sequence.
read_image (Image1, xing/xing000)
dev_open_window_fit_image (Image1, 0, 0, -1, -1, WindowHandle)
* Set the display parameters for the vector field.
dev_set_paint ([vector_field,6,1,2])
dev_set_draw (margin)
for I : 1 to 587 by 1* Read the current image of the image sequence.read_image (Image2, xing/xing I$03)* Compute the optical flow.* 计算光流optical_flow_mg (Image1, Image2, VectorField, fdrig, 0.8, 1, 8, 5, default_parameters, accurate)* Segment the optical flow vector field.* 阈值处理threshold (VectorField, Region, 1, 10000)* Display the current image of the sequence. Note that this means that* the optical flow vectors will also be displayed at the end of the movement* of the objects in the image.* 显示dev_display (Image2)* Display the optical flow.dev_set_color (yellow)dev_set_line_width (1)dev_display (VectorField)* Display the segmented optical flow.dev_set_color (green)dev_set_line_width (3)dev_display (Region)* Copy the current image to the previous image of the sequence.* 将当前图像复制到序列的前一个图像copy_obj (Image2, Image1, 1, 1)
endforHalcon 获取移动物体的移动方向
* This example demonstrates the use of the optical flow for
* the detection of moving objects in an image sequence.
* The region of interest is analyzed to detect moving objects.
* If a moving object is detected, the exit gate is opened automatically.
*
* Initialize output window
dev_update_off ()
read_image (Image1, bicycle/bicycle_01)
ZoomFactor : 0.5
* 按照指定倍数放大图像
zoom_image_factor (Image1, Image1, ZoomFactor, ZoomFactor, constant)
dev_close_window ()
dev_open_window_fit_image (Image1, 0, 0, -1, -1, WindowHandle)
dev_set_draw (margin)
*
* Generate ROI
* 产生一个xld多边形区域
gen_contour_polygon_xld (ROI, [0,0,283,348,479,479] * ZoomFactor, [0,379,379,434,639,0] * ZoomFactor)
* 产生轮廓
gen_region_contour_xld (ROI, RegionROI, filled)
* 裁剪
reduce_domain (Image1, RegionROI, Image1ROI)
*
* Main loop: Calculate optical flow and display moving area
*
for I : 2 to 27 by 1read_image (Image2, bicycle/bicycle_ I$.2)* * Zoom images to speed-up calculation of optical flow* 图片放大zoom_image_factor (Image2, Image2, ZoomFactor, ZoomFactor, constant)* 按照xld轮廓裁剪reduce_domain (Image2, RegionROI, Image2ROI)* 光流计算optical_flow_mg (Image1ROI, Image2ROI, VectorField, fdrig, 0.8, 1, 10, 5, [default_parameters,warp_zoom_factor], [fast,0.8])* 计算向量场的平方长度vector_field_length (VectorField, LengthImage, squared_length)* * Segment regions with moving objects in the defined ROI* 计算最小灰度值min_max_gray (RegionROI, LengthImage, 0.1, Min, Max, Range)dev_display (Image2)if (Max 2)* 阈值处理向量场threshold (LengthImage, RegionMovement, 2, Max)* 形成单独的连通域connection (RegionMovement, ConnectedRegions)* Select largest moving region* 筛选出移动的区域select_shape_std (ConnectedRegions, RegionMovement, max_area, 70)area_center (RegionMovement, Area, RCenterNew, CCenterNew)* 移动区域大于0if (Area 0)* 形成一个外轮廓shape_trans (RegionMovement, ConvexHullregion, convex)* 外轮廓和ROI区域求交集intersection (RegionROI, ConvexHullregion, RegionMovementInROI)* 将光流图片和外轮廓裁剪reduce_domain (VectorField, ConvexHullregion, VectorReduced)* 矢量图转换为实际图vector_field_to_real (VectorReduced, Row, Column)* * Estimate the movement direction and the speed* 计算方向和速度intensity (RegionMovementInROI, Row, MeanRow, Deviation)intensity (RegionMovementInROI, Column, MeanColumn, Deviation1)* * Display resultsdev_set_line_width (1)dev_set_color (yellow)dev_display (VectorReduced)* Display region of interestdev_set_line_width (3)dev_set_color (magenta)dev_display (RegionROI)* Display region of moving object in the region of interestdev_set_color (green)dev_display (RegionMovementInROI)* 产生右箭头的轮廓gen_arrow_contour_xld (Arrow, RCenterNew, CCenterNew, RCenterNew MeanRow, CCenterNew MeanColumn, 10, 10)dev_display (Arrow)endifendif* copy_obj (Image2ROI, Image1ROI, 1, 1)
endforHalcon 卫星图获取移动物体的移动方向
* 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.
* 1. 读取图片
dev_update_off ()
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 1read_image (Image2, hydraulic_engineering/hydraulic_engineering_ Index$02)* 2.估计移动粒子的区域* 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)* * 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)* * Find the position of particles in the original image using* an estimated ROIdilation_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* 3.获取移动方向count_obj (PointsDilated, NumberReg)dev_display (Image2)dev_display (PointsDilated)for J : 1 to NumberReg by 1select_obj (PointsDilated, SelectedRegions, J)* * Estimate the speed of the particlesreduce_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, 5, 10)dev_display (Arrow)endforendifendifcopy_obj (Image2, Image1, 1, 1)
endfor