本次先對halcon的自標定做個整體介紹,了解屌炸天的自標定在實際應用中的應用與實現方法,具體的編程細節將在后續的文章中介紹。
halcon提供了一種自標定的算子,它可以在不用標定板的情況下,標定出相機內參(無焦距),相對於多幅標定無法獲取相機的外參。
求出了相機內參就可以進行畸變校正,因而自標定相對於多幅標定,在畸變校正方面更快捷,這樣設備在現場更容易操作、維護。
在畸變校正以后我們同樣可以放置一個參考物求取像素當量,構建XY世界坐標系,以用於測量、定位等應用。
-
edges_sub_pix (GrayImage,Edges,'canny',1.0,20,40) segment_contours_xld (Edges,ContoursSplit,'lines_circles',5,8,4) radial_distortion_self_calibration (ContoursSplit,SelectedContours, \ 640,480,0.08,42,'division', \ 'variable',0,CameraParam) get_domain (GrayImage,Domain) change_radial_distortion_cam_par ('fullsize',CameraParam,0,CamParamOut) change_radial_distortion_image (GrayImage,Domain,ImageRectified, \ CameraParam,CamParamOut)
上述代碼是一個常規的自標定流程:
1.求出拍攝物體的邊緣XLD
2.使用radial_distortion_self_calibration函數,根據邊緣求出相機內參
3.change_radial_distortion_cam_par 求出理想無畸變內參
4.change_radial_distortion_image 根據相機內參,對圖像進行畸變校正
更多例程參考halcon example
Calibrate the radial distortion coefficient and the center of distortion |
||
Compare results of camera calibration and radial distortion self-calibration |
T. Thormälen, H. Broszio: “Automatic line-based estimation of radial lens distortion”; in: Integrated Computer-Aided Engineering; vol. 12; pp. 177-190; 2005.
