Halcon馬賽圖拼接(雙圖)

不需要事先獲取相機內參
*在拼接應用程序中匹配兩個圖像。
read_image (Image1, 'C:/Users/zjm/Desktop/圖像拼接/3.jpg')
read_image (Image2, 'C:/Users/zjm/Desktop/圖像拼接/4.jpg')
get_image_size (Image1, Width, Height) 
* 使用Foerstner尋找特徵點
points_foerstner (Image1, 1, 2, 3, 50, 0.1, 'gauss', 'true', Rows1, Columns1, CoRRJunctions, CoRCJunctions, CoCCJunctions, RowArea, ColumnArea, CoRRArea, CoRCArea, CoCCArea)
points_foerstner (Image2, 1, 2, 3, 50, 0.1, 'gauss', 'true', Rows2, Columns2, CoRRJunctions, CoRCJunctions, CoCCJunctions, RowArea, ColumnArea, CoRRArea, CoRCArea, CoCCArea)
*****************************進行了畸變修正*************************************
*之前實現的憑藉功能並未實現修正圖像畸變現在,我們將執行一個徑向的投影匹配。現在,我們要做一個投影匹配,它是徑向的。扭曲。
get_image_size (Image1, Width, Height)
*根據兩幅圖像的特徵點,計算兩幅圖像之間的投影變換矩陣和徑向畸變係數。
proj_match_points_distortion_ransac (Image1, Image2, Rows1, Columns1, Rows2, Columns2, 'ncc', 10, 0, 0, Height, Width, 0, 0.5, 'gold_standard', 1, 42, HomMat2D, Kappa, Error, Points1, Points2)
*構造相機參數以校正圖像,以消除徑向畸變。
CamParDist := [0.0,Kappa,1.0,1.0,0.5 * (Width - 1),0.5 * (Height - 1),Width,Height]
*從消除圖像中的徑向畸變。
change_radial_distortion_cam_par ('fixed', CamParDist, 0, CamPar)
change_radial_distortion_image (Image1, Image1, Image1Rect, CamParDist, CamPar)
change_radial_distortion_image (Image2, Image2, Image2Rect, CamParDist, CamPar)
*從兩幅已校正的圖像中構建馬賽克。注意,圖片配合完美。
concat_obj (Image1Rect, Image2Rect, ImagesRect)
gen_projective_mosaic (ImagesRect, MosaicImage, 1, 1, 2, HomMat2D, 'default', 'false', MosaicMatrices2D)
* Display rectified results
get_image_size (MosaicImage, Width, Height)
dev_clear_window ()
dev_open_window (0, 0, Width/3, Height/3, 'white', WindowHandle)
dev_display (MosaicImage)

效果圖:


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