Halcom 发表于 2017-2-6 22:42:22

基于光流法的运动目标检测

dev_update_off ()
dev_close_window ()
* 初始化一张参考图像
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_image (Image2, 'xing/xing' + I$ '03')
    * 计算光流optical flow.
    optical_flow_mg (Image1, Image2, VectorField, 'fdrig', 0.8, 1, 8, 5, 'default_parameters', 'accurate')
    * 阈值分割
    threshold (VectorField, Region, 1, 10000)
   
    * 显示当前图像以及分割结果
    dev_display (Image2)
    * Display the optical flow.
    dev_set_color ('yellow')
    dev_set_line_width (1)
    dev_display (VectorField)
    * 显示光流分割结果
    dev_set_color ('green')
    dev_set_line_width (3)
    dev_display (Region)
    * 更新当前参考图像
    copy_obj (Image2, Image1, 1, 1)
endfor

页: [1]
查看完整版本: 基于光流法的运动目标检测