概念
該算法可以在不使用標定板的情況下計算相機內參,從而進行畸變校正,適用于畸變較大的情況。算法很簡單:
1.求出圖像邊緣應進行分割。
2.基于篩選線段的自標定radial_distortion_self_calibration。
3.得到標定區域。
4.根據指定的徑向畸變確定新的相機參數change_radial_distortion_cam_par。
5.改變圖像的徑向失真,從而得到新圖像。
需要注意:
1.保證在圖像的四周邊緣有足夠的直線線段
2.保證運行環境內存>=2G。
例子
read_image (Image, 'D:/TestBMP/Test_2D_S4.png')
edges_sub_pix(Image, Edges, 'canny', 1, 20, 40)
segment_contours_xld(Edges, ContoursSplit, 'lines_circles', 5, 4, 2)
select_shape_xld(ContoursSplit, SelectedXLD, 'width', 'and', 200, 99999)
radial_distortion_self_calibration(SelectedXLD, SelectedContours, 3024, 4032, 0.02, 50, 'division', 'variable', 0, CameraParam)
get_domain(Image, Domain)
change_radial_distortion_cam_par('fixed', CameraParam, 0, CamParamOut)
change_radial_distortion_image(Image, Domain, ImageRectified, CameraParam, CamParamOut)