最近的項目中要做關于一個EPSON機器人和兩個康耐視相機之間的手眼标定,而剛好之前有接觸過強大的halcon,是以打算利用halcon手眼标定例程來做,在看代碼的過程中發現,halcon在标定之前會讀取一個.cpd的檔案,作為關鍵詞百度,很少有這方面的資訊,那隻能從halcon的幫助文檔中尋找答案了,好在halcon的文檔部分是中文的,中間夾雜着英文,相關的資訊在如下網址中:
https://www.mvtec.com/doc/halcon/12/en/create_caltab.html
關鍵的兩句:
The file CalPlateDescr contains the calibration plate description, and must be passed to all HALCON operations using the generated calibration plate (e.g. set_calib_data_calib_object or sim_caltab). The default HALCON file extension for the description of a calibration plate with hexagonally arranged marks is 'cpd'.
就是說這個.cpd檔案其實是一個标定闆的描述檔案,而這個檔案是通過另一個函數生成的;在利用标定闆做标定之前,需要告訴标定函數,這個标定闆長什麼樣,長度多少,寬度多少等等。
A calibration plate description file contains information about:
- the number of row and columns of the calibration plate
- the number of marks per row and column
- the offset of the coordinate system to the plate's surface in z-direction
- the rim of the calibration plate
- the polarity of the marks
- the number and position of finder patterns
- the x,y coordinates and radius of the calibration marks
A file generated by create_caltab looks like the following (comments are marked by a '#' at the beginning of a line):
(上面這句話就提到了,這個.cpd檔案是由create_caltab函數生成的)
create_caltab (27, 31, 0.00258065, [13,6,6,20,20], [15,6,24,6,24], 'light_on_dark', 'F:/calplate.cpd', 'F:/calplate.ps')
利用上面的這段代碼,就可以生成一個标定闆,這個标定闆的相關資訊在前面的一些參數裡面,并且這個函數輸出了兩個檔案,包括前面說到的一個.cpd檔案和.ps檔案,在halcon中運作這行代碼,在F盤的根目錄下面我們就可以得到兩個檔案,如下圖所示:
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIwczLcVmds92czlGZvwVP9EUTDZ0aRJkSwk0LcxGbpZ2LcBDM08CXlpXazRnbvZ2LcRlMMVDT2EWNvwFdu9mZvwVeW1mY5Z0VaNXOsRma1clW3ljMMBjVtJWd0ckW65UbM5WOHJWa5kHT20ESjBjUIF2LcRHelR3LcJzLctmch1mclRXY39zN0MDMzMDM5ADNygDM4EDMy8CX0Vmbu4GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.jpg)
# Plate Description Version 3
# HALCON Version 12.0 -- Tue Aug 12 15:40:14 2014
# Description of the standard calibration plate
# used for the camera calibration in HALCON
# (generated by create_caltab)
#
#
好了,說了這麼多,應該說清楚了,還有好多代碼要去一一解讀。。。