* xing.hdev: Traffic monitoring (by Kalman filtering)
*
dev_update_off ()
dev_close_window ()
read_image (Image, 'xing/init')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowID)
set_display_font (WindowID, 14, 'mono', 'true', 'false')
read_region (XingRegion, 'xing/xing_region')
dev_set_draw ('margin')
dev_set_colored (12)
dev_set_line_width (3)
dev_display (Image)
disp_continue_message (WindowID, 'black', 'true')
stop ()
zoom_image_factor (Image, ImageZoomed, 0.5, 0.5, 'constant')
create_bg_esti (ImageZoomed, 0.7, 0.7, 'fixed', 0.001, 0.03, 'on', 8.0, 10, 3.25, 15, BgEstiHandle)
for I := 0 to 587 by 1
read_image (ActualImage, 'xing/xing' + (I$'03'))
zoom_image_factor (ActualImage, ImageZoomed, 0.5, 0.5, 'constant')
run_bg_esti (ImageZoomed, ForegroundRegion, BgEstiHandle)
zoom_region (ForegroundRegion, RegionZoom, 2, 2)
intersection (RegionZoom, XingRegion, RegionIntersection)
connection (RegionIntersection, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 20, 99999)
shape_trans (SelectedRegions, RegionTrans, 'convex')
union1 (RegionTrans, RegionUnion)
connection (RegionUnion, FinalConnected)
select_gray (FinalConnected, ActualImage, SelectedRegionsGray, 'deviation', 'and', 25, 1000)
union1 (SelectedRegionsGray, RegionUnionFinal)
dilation_rectangle1 (RegionUnionFinal, RegionDilation, 5, 5)
complement (RegionDilation, BackGround)
clip_region (BackGround, RegionClipped, 0, 0, Height - 1, Width - 1)
zoom_region (RegionClipped, BackGroundZoom, 0.5, 0.5)
update_bg_esti (ImageZoomed, BackGroundZoom, BgEstiHandle)
shape_trans (SelectedRegionsGray, Rects, 'rectangle1')
dev_display (ActualImage)
dev_display (Rects)
endfor
give_bg_esti (BackgroundImage, BgEstiHandle)
dev_display (BackgroundImage)
dev_set_draw ('fill')
dev_update_on ()
halcon_cheliang
最新推荐文章于 2024-05-31 08:44:28 发布