1339361 九、發明說明: …【發明所屬之技術領域】 本發明係有關-種魚眼校正之方法,特別是指一種取得魚眼影像扭曲 參數及影像校正關係表,並實現魚眼校正技術之方法。 【先前技術】 不論是傳統相機或數位攝相機,㈣配合鏡頭呈像於感光材料(例如: 銀鹽底片)或感光元細如:咖仏咖),而相機可依據不同場合更換 籲#種鏡頭’如廣角鏡頭、魚眼鏡頭及長焦鏡頭等。魚眼鏡頭是一種超廣角 的特殊鏡頭’由於為了讓鏡頭達到最大的攝影視角,這種攝影鏡頭的前鏡 片直徑很短且呈抛物狀向鏡頭前部凸出,和魚的眼睛很相似,故名魚眼鏡 頭。 魚眼鏡頭具有相當長的景深與相的視角,有利於表現觀場景的長 景深與近距離就能得到接近全景的效果(超廣角),但利用魚眼鏡頭所攝得影 像變形相當嚴重。亦因為利用魚眼鏡頭所拍攝之影像扭曲變形的情況嚴 φ 重,故需要將這些變形影像校正為人們所習慣之透視投影影像。 人類眼睛的視覺暫留約為1/16秒,亦即每秒播放16個以上之畫格,我 們就會產生假象涊為這是連續動作,故時常可見一些視訊檔案使用每秒15 格之畫格速率’ 一般畫格速率為每秒29,97幅(NTSC )及每秒25幅(PAL ), 以NTSC系統而言,每十分鐘為17982個畫格,所以,會平均在每分鐘結 束時遺漏兩個畫格’而第十分鐘則不做遺漏畫格的動作,如此便可流暢袼 播放。以數位化的資料為例,NTSC格式、ITU-656 D1品質的影像,一幅 影像的視訊流(Video Stream)為900,900 bytes,所以每秒將近13MB,故此資 1339361 料量是相當驚人的。 而視訊流(Video 且魚眼的扭曲影 傳統的魚眼校正技術必須錢重且娜的計算過程, Stream)為相當大哺料量,故無法聽即時的校正處理, 像’對於人類視覺上感受是相當不自然的。 有鑑於此’本發明遂針對上述習知技術之缺失,提出一種取得备眼影 像校正關係與即喊眼校正之方法,以姐克服上述之該等問題。 【發明内容】1339361 IX. Description of the invention: [Technical field to which the invention pertains] The present invention relates to a method for correcting fisheyes, and more particularly to a method for obtaining a fisheye image distortion parameter and an image correction relationship table, and realizing a fisheye correction technique. [Prior Art] Whether it is a traditional camera or a digital camera, (4) with the lens is like a photosensitive material (such as: silver salt film) or a photosensitive element such as: coffee, coffee, and the camera can be replaced according to different occasions 'such as wide-angle lens, fisheye lens and telephoto lens. The fisheye lens is a special lens with a super wide angle. Because the lens has a short front diameter and a parabolic shape protruding toward the front of the lens in order to achieve the maximum photographic angle of the lens, it is similar to the fish's eyes. Fisheye lens. The fisheye lens has a relatively long depth of field and phase angle, which is good for the long depth of field and close range of the scene to get close to the panoramic effect (super wide angle), but the image taken by the fisheye lens is quite deformed. Also, because the distortion of the image taken by the fisheye lens is severe, it is necessary to correct these deformed images into perspective projection images that people are accustomed to. The visual persistence of human eyes is about 1/16 second, that is, more than 16 frames per second. We will produce artifacts. This is a continuous action, so it is often seen that some video files use 15 frames per second. The grid rate is a typical frame rate of 29,97 frames per second (NTSC) and 25 frames per second (PAL). For the NTSC system, there are 17,982 frames per ten minutes, so it will average at the end of each minute. Missing two frames 'and the tenth minute will not make the action of missing the frame, so you can play smoothly. Taking digital data as an example, NTSC format, ITU-656 D1 quality video, video streaming of one video is 900,900 bytes, so it is nearly 13MB per second. Therefore, the amount of 1339361 is quite amazing. And video streaming (Video and fisheye distortion traditional fisheye correction technology must be heavy and Na's calculation process, Stream) is a considerable amount of feed, so can not listen to immediate correction processing, like 'for human visual perception It is quite unnatural. In view of the above-described drawbacks of the present invention, a method for obtaining an eye-image correction relationship and a call-eye correction is proposed to overcome the above problems. [Summary of the Invention]
本發明之主要目的在提供一種取得魚眼影像校正關係之方法,其係利 用複數校正點座標及-函式得到—組影像㈣參數,並反運算出原始影像 與輸出影像像素間之對應關係。 本發明之另-目的在提供—觀得魚眼影像校正_之方法,其係利 用比例尺建立校正後影像與原始輯之賴_,找出校錢影像之重置 座標。 本發明之再-目的在提供一種取得魚眼影像校正關係之方法,其係比 較原始影像與輸出影像之座標是轉同—視場,以建立内㈣之對應關係。The main object of the present invention is to provide a method for obtaining a fisheye image correction relationship, which uses a complex correction point coordinate and a function to obtain a group image (four) parameter, and inversely calculates a correspondence between the original image and the output image pixel. Another object of the present invention is to provide a method for viewing fisheye image corrections, which uses a scale to establish a corrected image and an original series to find the reset coordinates of the money image. A further object of the present invention is to provide a method for obtaining a fisheye image correction relationship in which the coordinates of the original image and the output image are converted to the same field of view to establish an internal (four) correspondence.
為達上述之目的’本發明提供—種取得魚眼影像校正義之方法,包 括下列步称··_—織獅出,作㈣晴,並從原始影 像中取件複數校正點座標(Xd’ yd),估算出校正點座標對應到實際平面上之實 際座標(Xu’yu);利職正點座標及實際座標,以多項式近似方程式V 序讀入原始影像中每—個像素的座標位置;以—函式推算_影像在經 過校正後得到之—校正影像社小,並_比例尺計算縣影像之座標對 6 1339361 而這四個緩衝區分別為視訊輸入存放區、視訊輸出存放區、視訊處理參考 區以及視訊處理緩衝區,這四塊緩衝記憶體架構連接成環狀緩衝區’而以 韌體而言,也有四個指標分別指向這四個緩衝區,且這四個指標不能有任 兩個以上是同一數值,如有相等表示輸入資料有問題,必須重新啟動系統。 第4圖所示為四個指標與緩衝區之關係,如圖所示,四個緩衝區1〇、 12、14、16,而四個指標為視訊輸入存放區指標、視訊輸出存放區指標、 視訊處理參考區指標以及視訊處理緩衝區指標。如圖所示,視訊輸入存放 鲁 區指標指向緩衝區14,視訊輸出存放區指標指向緩衝區16,視訊處理緩衝 區指標指向緩衝區10,視訊處理參考區指標指向緩衝區12,而在處理完一 筆影像資料後’四個指標全部指向下一個緩衝區,視訊輸入存放區指標指 向緩衝區16,視訊輸出存放區指標指向緩衝區10,視訊處理緩衝區指標指 向緩衝區12,視訊處理參考區指標指向緩衝區η,因此影像資料從視訊輸 出存放區輸出之後,同一個緩衝區可接受視訊輸入存放區指標所輸入之下 一筆影像資料,加快處理時間。 ® 完成系統初始化後,如步驟S202所述,讀入魚眼校正表到同步動態隨 機存取記憶體(Synchronous Dynamic Random Access Memory,SDRAM ) 内,此表中包含有内插數值;接著,為了減少數位訊號處理器之運算量, 故如㈣S2G4所述’先將視蹄_實際·f料的每行隨記憶體位 置先行找出’並將其表示為表格,以利數位訊號處理器使用。再如步驟82〇6 所述’利用步驟S200中所得到之四個指標,設定直接記憶體存取所要讀取 10 1339361 與寫入之位置,並在完成設定後,如步驟S2〇8所述修改直接記憶體存取 之設定值’發出觸發職,峨動直接記賴存取。 由於在硬體運作過程中,攝相機的輸出訊號有可能不穩定,會造成同 步訊號不-致’故需如步驟S210所述進行檢查,檢查方式為週期地掃晦視 訊訊號的標權位置是否為—直維持於同—記憶體位置上,如是,表示沒 有發生問題,反之同步訊號發生問題;若發生同步訊號非同步,則如步驟 切2 ’重新啟動平行周邊介面(_丨d peripheraiρρι)與直接記 • 憶體存取,讓硬體能再次與視訊訊號同步β 反之’若無發生非同步之問題,則如步驟S214進入處理視訊訊號程序, 首先,先取得原始影像令任一點的座標位置,其係利用步驟㈣所取得之 起始位置表’再配合步驟S2〇〇之四個指標作為基底(b咖祕㈤,每行 影像資料起始位置表作為偏移量(〇細_小故可以快速找出記憶雜内 每行真實影像資料之正確位置,公式如下: A=pBase ~hOffset[y] 其中y表不y-th订’ pBase表示要處理的緩衝區開頭記憶趙位置, ⑽細咖鳴量,A術_歸峨機存取 記憶體内的記憶體位置。此方法亦可推導出任一點的位置公式如下: B"( PBase +〇ffset[y]) +2x -f j 其中x為視訊畫面上的,座標點,B為座標x,y之真實對應到同步動態 隨機存取記憶體内的記憶體位置,因為ITU656標準格式為爾奶,故 為了得到正確的UV位置,必須配合乂位置求得如下公式: 1339361 數,再以此建立隱含内插與重置大小功能之魚眼影像校正對應關係表。當 以此魚眼雜校正關絲_在賴平台上實❹、·正時,經由本發明 所提供之方法更可大幅減少數位訊號處理器之運算量,加快處理時間並 免除同步城不-致可能造成之賴,完美呈❹、眼影像。 唯乂上所述者僅為本發明之較佳實施例而已,並非用來限定本發明For the above purposes, the present invention provides a method for obtaining fisheye image correction meaning, including the following steps: _ _ lion lion out, for (four) sunny, and take a plurality of correction point coordinates from the original image (Xd' yd ), it is estimated that the coordinates of the correction point correspond to the actual coordinates (Xu'yu) on the actual plane; the coordinates of the positive point and the actual coordinates are read into the coordinate position of each pixel in the original image by the polynomial approximation equation V; The function of the function is obtained after the correction is obtained. The corrected image is small, and the scale of the county image is calculated as 6 1339361. The four buffers are the video input storage area, the video output storage area, and the video processing reference area. And the video processing buffer, the four buffer memory structures are connected into a ring buffer. In terms of firmware, there are also four indicators pointing to the four buffers, and the four indicators cannot have more than two. It is the same value. If there is an equality indicating that there is a problem with the input data, the system must be restarted. Figure 4 shows the relationship between the four indicators and the buffer. As shown in the figure, four buffers are 1, 12, 12, 14, and 16, and the four indicators are video input storage area indicators, video output storage area indicators, Video processing reference area indicators and video processing buffer indicators. As shown in the figure, the video input storage area indicator points to the buffer 14, the video output storage area indicator points to the buffer 16, the video processing buffer indicator points to the buffer 10, and the video processing reference area indicator points to the buffer 12, and is processed. After one image data, the four indicators all point to the next buffer, the video input storage area indicator points to the buffer 16, the video output storage area indicator points to the buffer 10, the video processing buffer indicator points to the buffer 12, and the video processing reference area indicator Pointing to the buffer η, after the image data is output from the video output storage area, the same buffer can accept the image data input by the video input storage area indicator to speed up the processing time. After completing the system initialization, as described in step S202, the fisheye correction table is read into a Synchronous Dynamic Random Access Memory (SDRAM), and the table includes interpolated values; then, in order to reduce The amount of calculation of the digital signal processor, so as described in (4) S2G4 'first look at each line of the hoof _ actual f material with the memory location first' and represent it as a table for the digital signal processor. Further, as shown in step 82〇6, using the four indicators obtained in step S200, the location where the direct memory access is to be read 10 1339361 and written is set, and after the setting is completed, as described in step S2〇8. Modify the setting value of the direct memory access to 'issue the trigger, and call the direct access. Since the output signal of the camera may be unstable during the hardware operation, the synchronization signal may not be caused. Therefore, the inspection is performed as described in step S210. The inspection mode is to periodically scan the position of the video signal. For - directly maintained in the same - memory location, if so, it means that no problem occurs, and vice versa; if the synchronization signal is not synchronized, then step 2 'restart parallel parallel interface (_丨d peripheraiρρι) and Directly remembering the memory access, allowing the hardware to synchronize with the video signal again. β. If there is no problem with the non-synchronization, then the process of processing the video signal is entered in step S214. First, the coordinate position of the original image is obtained first. It uses the starting position table obtained in step (4) to match the four indicators of step S2 as the base (b coffee secret (five), the starting position table of each line of image data as an offset (〇 _ _ small can Quickly find the correct position of the real image data in each line of memory, the formula is as follows: A=pBase ~hOffset[y] where y is not y-th order 'pBase indicates where to go The beginning of the buffer buffer memory position, (10) fine coffee volume, A surgery _ 峨 machine access memory location in memory. This method can also derive the position formula of any point is as follows: B " ( PBase + 〇 ffset [ y]) +2x -fj where x is the video image, the coordinate point, B is the coordinate x, and the y corresponds to the memory location in the synchronous dynamic random access memory. Because the ITU656 standard format is milk, therefore In order to get the correct UV position, the following formula must be obtained in conjunction with the 乂 position: 1339361 number, and then the fisheye image correction correspondence table of the implicit interpolation and reset size function is established. _ On the platform, the method provided by the present invention can greatly reduce the amount of calculation of the digital signal processor, speed up the processing time and eliminate the synchronization of the city, which may cause a flaw, and is perfect, Eye image. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention.
實施之翻。故即凡依本發财請細所述之特徵及精神所為之均等變化 或修飾,均應包括於本發明之申請專利範圍内。 【圖式簡單說明】 第1a圖為本發明取得魚眼影像扭曲參數之流程^ 第1b圖為本發明取得魚眼影像校正_之流程圖。 2圓為本請術顺軸蝴,之示意圖。 L正關係表之流程圖 第4 意圖 圖為巾原始歸與輸㈣像在州鄕並進行崎之 Γ為本發明中朗觀得之魚眼影像校. 四個指標分継向四鱗區衝之示 圓為應用魚眼影像校正關係表時,Implementation of the turn. Therefore, any changes or modifications to the characteristics and spirit of the present invention should be included in the scope of the patent application of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1a is a flow chart for obtaining fisheye image distortion parameters according to the present invention. Fig. 1b is a flow chart of obtaining fisheye image correction_ in the present invention. 2 round-based, please follow the axis, the schematic. The flow chart of the L positive relation table is the fourth intentional picture for the original return of the towel (four) like the state in the state and carry out the smashing of the fisheye image school in the invention. The four indicators are divided into four scales. When the circle is used to apply the fisheye image correction relationship table,