halcon學習要點

1、圖像處理輪廓時所處理的輪廓必須位於圖中,否則輪廓轉區域,不在圖中的那一部分輪廓不能轉爲區域(第15天,34課)

2、get_shape_model_contours(第15天,34課)

      該算子得到的模板輪廓位置位於(0,0),注意仿射變換時模板位置的設置設爲(0,0)

3、hom_mat2d_scale (HomMat2DRotate, 0.5, 0.5, 256, 256, HomMat2DScale)

      hom_mat2d_scale算子既可以縮放也可以放大,看sx和sy所設置的值,如果大於1則爲擴大,如果小於1則爲縮放

dev_close_window ()
dev_open_window (0, 0, 512, 512, 'white', WindowID)
dev_set_color ('black')
* Draw with the mouse an arbitrary region into the window
draw_region (Region, WindowID)
hom_mat2d_identity (HomMat2DIdentity)
*求一個單位矩陣
hom_mat2d_rotate (HomMat2DIdentity, 0.3, 256, 256, HomMat2DRotate)
*求一個旋轉矩陣,繞點256,256旋轉-0.3度(逆時針)
hom_mat2d_scale (HomMat2DRotate, 0.5, 0.5, 256, 256, HomMat2DScale)
*求一個縮放矩陣,以點256,256爲基點,擴大X軸1.5,Y軸擴大1.5倍
affine_trans_region (Region, RegionAffineTrans, HomMat2DScale, 'nearest_neighbor')
*將得出的矩陣作用於畫出的圖
dev_clear_window ()
dev_set_draw ('margin')
dev_set_color ('red')
dev_display (Region)
dev_set_color ('green')
dev_display (RegionAffineTrans)

      

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章