TWI762353B - Method for generating projection image with scaling adjustment and seam cut stitching - Google Patents
Method for generating projection image with scaling adjustment and seam cut stitching Download PDFInfo
- Publication number
- TWI762353B TWI762353B TW110121015A TW110121015A TWI762353B TW I762353 B TWI762353 B TW I762353B TW 110121015 A TW110121015 A TW 110121015A TW 110121015 A TW110121015 A TW 110121015A TW I762353 B TWI762353 B TW I762353B
- Authority
- TW
- Taiwan
- Prior art keywords
- seam
- image
- images
- vertex
- area
- Prior art date
Links
Images
Landscapes
- Image Processing (AREA)
- Studio Devices (AREA)
Abstract
Description
本發明係有關於影像處理,特別地,尤有關於一種以縮放調整及接縫拼接來產生投影影像的方法。本發明有助於在影像處理系統產生投影影像。 The present invention relates to image processing, and more particularly, to a method for generating projected images with scaling and seam stitching. The present invention facilitates the generation of projected images in an image processing system.
圖1A係顯示一立方體架構11與一球體12之間的關係。如圖1A所示,一習知照相機具有四個鏡頭且分別架設在一立方體架構11的四個工作面(右面、左面、正面、背面)上,該四個工作面的任二個鄰近面係實質上正交,例如該四個工作面分別朝向虛擬球體12的經度(longitude)0度、90度、180度及270度,以同時捕捉到一個具有360度水平視域(field of view,FOV)及90度垂直FOV的視野,並產生四個鏡頭影像。架設該具四鏡頭的照相機的一個必要條件是任二個鄰近鏡頭的視野之間應有足夠的重疊,以助影像拼接(image mosaicking)。請參考圖1B,區域A(1)~A(2)內的像素是由二個鏡頭/紋理影像重疊而成,而區域15內的像素則來自於單一鏡頭/紋理影像。因此,可對該些重疊區域13進行拼接(stitch)操作,以形成一等距全景影像(equirectangular panoramic image)。
FIG. 1A shows the relationship between a
一個完美的投影影像處理系統應讓觀賞者無法察覺視訊是由多個鏡頭所捕捉,因此,觀賞者可以感受到多鏡頭看起來像單一鏡頭的無縫體驗。 A perfect projected image processing system should make it impossible for the viewer to perceive that the video is being captured by multiple cameras, so the viewer can experience a seamless experience where multiple cameras look like a single camera.
有鑒於上述問題,本發明的目的之一是提供一種影像處理方法,以縮放調整及接縫拼接來產生投影影像。 In view of the above problems, one of the objectives of the present invention is to provide an image processing method to generate a projected image by scaling adjustment and seam splicing.
根據本發明之一實施例,係提供一種影像處理方法,用以接收M個鏡頭影像及產生一投影影像,該方法包含:根據一個2D誤差表格及該M個鏡頭影像,決定該投影影像內P個控制區的P個最佳接合係數,其中,以一影像擷取模組,捕捉一個具有X度水平視域及Y度垂直視域的視野,以產生該M個鏡頭影像;根據一第一頂點列表、該P個最佳接合係數以及該M個鏡頭影像,產生M張工作面影像;決定N個接縫區的N條接縫;以及,根據各接縫區的接縫,拼接各接縫區的二張重疊的接縫影像以產生一拼接後接縫影像。其中,各工作面影像包含z張接縫影像以及一張主影像,以及各接縫區係位在該投影影像內的二相鄰主影像之間;該2D誤差表格包含多個測試接合係數以及該P個控制區中對應的多個累積像素值誤差量;該P個控制區係分別位在該N個接縫區之內,以及該N個接縫區係分別位在該M個工作面的N個重疊區之內;該第一頂點列表包含多個具有資料結構的第一頂點,該些資料結構定義單一鏡頭影像及該投影影像之間的第一頂點映射;其中,1<=z<=2、M>=2、N>=1、P>=3、X<=360以及Y<180。 According to an embodiment of the present invention, an image processing method is provided for receiving M lens images and generating a projection image, the method comprising: determining P in the projection image according to a 2D error table and the M lens images P optimal bonding coefficients of each control area, wherein an image capture module is used to capture a field of view with a horizontal field of view of X degrees and a vertical field of view of Y degrees to generate the M lens images; according to a first The vertex list, the P optimal joint coefficients, and the M lens images, generate M work surface images; determine N seams in the N seam areas; and, according to the seams in each seam area, splicing Two overlapping seam images in the seam area to generate a stitched seam image. Wherein, each working surface image includes z seam images and a main image, and each seam area is located between two adjacent main images in the projected image; the 2D error table includes a plurality of test joint coefficients and A plurality of accumulated pixel value error amounts corresponding to the P control areas; the P control areas are respectively located in the N seam areas, and the N seam areas are respectively located in the M working surfaces within the N overlapping regions of ; the first vertex list includes a plurality of first vertices with data structures that define the first vertex mapping between a single lens image and the projected image; wherein, 1<=z <=2, M>=2, N>=1, P>=3, X<=360, and Y<180.
茲配合下列圖示、實施例之詳細說明及申請專利範圍,將上述及本發明之其他目的與優點詳述於後。 The above-mentioned and other objects and advantages of the present invention will be described in detail below in conjunction with the following figures, detailed descriptions of the embodiments and the scope of the patent application.
11:立方體架構 11: Cube Architecture
12:球體 12: Sphere
15:非重疊區域 15: Non-overlapping regions
21:影像擷取模組 21: Image capture module
22:補償裝置 22: Compensation device
23:對應性產生器 23: Correspondence Generator
40:理想成像位置 40: Ideal imaging position
41、44:影像中心 41, 44: Image Center
42:控制區的位置 42: The location of the control area
43:影像擷取模組21的系統中心
43: System Center of
45:物體 45: Objects
46、47:鏡頭中心 46, 47: Lens Center
48:實際成像位置 48: Actual imaging position
55:圖像引擎 55: Image Engine
56:接縫引擎 56: Seam Engine
71:交叉點/頂點 71: Intersection/Vertex
72:四邊形 72: Quadrilateral
78:接縫 78: Seams
81:更新視窗 81: Update Windows
82:分隔點 82: Separation point
200:投影影像處理系統 200: Projection Image Processing System
210:頂點處理裝置230
210:
220:影像處理裝置 220: Image processing device
230:拼接決策單元 230: Splicing Decision Unit
510:目的緩衝器 510: Destination Buffer
520:暫時緩衝器 520: Temporary Buffer
560:柵格化引擎 560: Rasterization Engine
570:紋理映射電路 570: Texture Mapping Circuit
571、572:紋理映射引擎 571, 572: Texture mapping engine
580:量測單元 580: Measurement unit
[圖1A]係顯示一立方體架構與一球體之間的關係。 [FIG. 1A] shows the relationship between a cube frame and a sphere.
[圖1B]顯示一等距長方全景影像,係源自於一影像擷取模組21的四個鏡頭影像(背面、左面、右面、正面)的等距長方投影。
FIG. 1B shows an equidistant rectangular panoramic image, which is derived from the equidistant rectangular projection of four lens images (back, left, right, and front) of an
[圖2]係根據本發明一實施例,顯示投影影像處理系統的方塊圖。 2 is a block diagram showing a projection image processing system according to an embodiment of the present invention.
[圖3A]顯示一個三角形網格,係用以模型化一球體表面。 [FIG. 3A] shows a triangular mesh used to model the surface of a sphere.
[圖3B]顯示一個多邊形網格,係用以組成/模型化該等距長方全景影像。 [FIG. 3B] shows a polygon mesh used to compose/model the isometric panorama.
[圖3C]顯示一等距長方全景影像中具有四個重疊區域及二十個控制區的例子。 [ FIG. 3C ] An example of an equidistant rectangular panoramic image with four overlapping regions and twenty control regions is shown.
[圖4A]顯示於正面鏡頭影像中該目標頂點P及十個控制區R(6)~R(15)間的關係之一示例。 [ FIG. 4A ] An example of the relationship between the target vertex P and the ten control regions R( 6 ) to R( 15 ) in the frontal lens image is shown.
[圖4B]顯示在頂點處理裝置210根據接合係數修改所有頂點的紋理座標後,一物體之不匹配的影像缺陷如何被改善。
[FIG. 4B] shows how the mismatched image defect of an object is improved after the
[圖5]係根據本發明一實施例,顯示該影像處理裝置的示意圖。 5 is a schematic diagram showing the image processing apparatus according to an embodiment of the present invention.
[圖6A]係根據本發明一實施例,顯示決定所有控制區之最佳接合係數之方法流程圖。 FIG. 6A is a flowchart showing a method for determining the optimal bonding coefficients of all control regions according to an embodiment of the present invention.
[圖6B]係根據本發明一實施例,顯示該拼接決策單元230進行步驟S612之係數決策操作之方法流程圖。
FIG. 6B is a flowchart showing a method for the
[圖6C]顯示在該連結計量之所有路徑中,路徑0-1-1(實線路徑)的連結計量值總和是最小的。 [ FIG. 6C ] It is shown that among all the paths of the connection meter, the sum of the connection meter values of the path 0-1-1 (solid line path) is the smallest.
[圖7A]顯示一等距長方全景影像包含四個主影像及其接縫區的例子。 FIG. 7A shows an example of an equidistant rectangular panorama image including four main images and their seam areas.
[圖7B]顯示圖7A的接縫區S(2)的放大圖。 [ FIG. 7B ] An enlarged view showing the seam area S( 2 ) of FIG. 7A .
[圖7C]係根據本發明一實施例,顯示決定一接縫區的最小化誤差路徑(或一接縫)之方法的流程圖。 [FIG. 7C] A flow chart showing a method of determining an error-minimizing path (or a seam) for a seam region according to an embodiment of the present invention.
[圖7D]顯示一接縫78係位在一接縫區內且該接縫區位在一左面主影像及一右面主影像之間的一個例子。
[FIG. 7D] shows an example where a
[圖8A]係根據本發明一實施例,顯示一影像處理方法的流程圖。 8A is a flowchart showing an image processing method according to an embodiment of the present invention.
[圖8B]顯示一接縫區的其中一段的例子,且該接縫區係有關於一接縫78、一接縫影像A以及一接縫影像B。
[ FIG. 8B ] An example of a section of a seam area is shown, and the seam area is related to a
[圖8C]顯示一接縫區的大小以及三列的更新視窗81的大小及不同位置。
[FIG. 8C] shows the size of a seam area and the size and different positions of the
[圖8D]顯示一接縫區同時位在等距長方全景影像的最左側及最右側。 [FIG. 8D] shows that a seam area is located at the leftmost and rightmost sides of the equidistant rectangular panoramic image at the same time.
在通篇說明書及後續的請求項當中所提及的「一」及「該」等單數形式的用語,都同時包含單數及複數的涵義,除非本說明書中另有特別指明。在通篇說明書中,具相同功能的電路元件使用相同的參考符號。 References in the singular form of "a" and "the" throughout this specification and subsequent claims shall include both the singular and the plural, unless the specification expressly states otherwise. Throughout the specification, circuit elements with the same function use the same reference symbols.
圖2係根據本發明一實施例,顯示投影影像處理系統的方塊圖。本發明投影影像處理系統200包含一影像擷取模組21、一補償裝置22以及一對應性產生器(correspondence generator)23。該補償裝置22接收來自對應性產生器23之原始頂點列表及來自影像擷取模組21的多張鏡頭影像,以產生一投影影像。請注意,影像擷取模組21是一部具多鏡頭的照相機可以是一部全景照相機或是一部廣角(wide angle)照相機,因此,上述投影影像可以是一張全景影像或是一張廣角影像。
FIG. 2 is a block diagram showing a projection image processing system according to an embodiment of the present invention. The projection
許多投影方式都適用於本發明投影影像處理系統200。「投影」一詞指的是:將一球體表面攤平成一個二維平面,例如一投影平面。該投影包含,但不受限於,等距長方投影、圓柱(cylindrical)投影以及修正圓柱投影。修正圓柱形投影包含,但不受限於,米勒(Miller)投影、墨卡托(Mercator)投影、蘭伯特圓柱等面積(Lambert cylindrical equal area)投影、帕尼尼(Pannini)投影等。據此,上述投影影像包含,但不受限於,一等距長方投影影像、一圓柱投影影像以及一修正圓柱投影影像。圖1A-1B及3A-3C係有關等距長方投影。至於圓柱投影以及修正圓柱投影的實施方式已為本領域技術人士所熟知,在此不予贅述。請注意,無論本發明投影影像處理系統200採用哪一種投影方式,上述對應性產生器23都會對應地產生一原始頂點列表(例如表一),其定義了該些鏡頭影像及該投影影像之間的頂點映射關係。為清楚及方便描述,以下的例子及實施例僅以等距長方投影及等距長方全景影像作說明。須注意的是,本發明投影影像處理系統
200的運作方式及影像處理方法(圖6A-6B、7C及8A)同樣亦適用於上述廣角照相機、圓柱投影以及修正圓柱投影。
Many projection methods are applicable to the projection
該影像擷取模組21是一部具多鏡頭的照相機,可同時捕捉到一個涵蓋X度水平FOV以及Y度的垂直FOV的視野,以產生多個鏡頭影像,其中X<=360,Y<180,例如360×160或180×90等。舉例而言,如圖1A所示,影像擷取模組21包含四個鏡頭(圖未示)且分別架設在一立方體架構11的四個工作面上,以同時捕捉到一個具有360度水平視域FOV及90度垂直FOV的視野,以產生四個鏡頭影像。請注意,只要能捕捉到一個X度水平FOV及Y度垂直FOV的視野,本發明不會限制該影像擷取模組21所包含的鏡頭數量,其中X<=360,Y<180。架設該影像擷取模組21的一個必要條件是任二個鄰近鏡頭的視野之間應有足夠的重疊,以助影像拼接。
The
在通篇說明書及後續的請求項當中所提及的相關用語定義如下,除非本說明書中另有特別指明。「紋理座標」一詞指的是一紋理空間(如一紋理影像或鏡頭影像)中的座標;「柵格化(rasterization)操作」一詞指的是將場景幾何形狀(scene geometry)(或一投影影像)映射至各鏡頭影像的紋理座標的計算過程。投影影像處理系統200的處理管線(pipeline)分為離線階段(offline phase)和連線階段。於離線階段,分別校正該影像擷取模組21的四個鏡頭,該對應性產生器23採用適合的影像對準(registration)技術來產生一原始頂點列表,並且該原始頂點列表中的各頂點提供該等距長方全景影像及該些鏡頭影像之間(或該等距長方座標及該些紋理座標之
間)的映射關係。例如,半徑2公尺(r=2)的球體12表面上被劃出許多圓圈,當作經度及緯度,其多個交叉點被視為多個校正點。該四個鏡頭捕捉該些校正點,且該些校正點於該些鏡頭影像上的位置為已知。然後,因為該些校正點的視角(view angle)和該些紋理座標被連結,故可建立該等距長方全景影像及該些鏡頭影像之間的映射關係。在本說明書中,具上述映射關係的校正點被定義為一個”頂點”。簡言之,該對應性產生器23對於各頂點,校正在該等距長方全景影像及該些鏡頭影像之間的關係,以得到該原始頂點列表。在離線階段中,該對應性產生器23會完成所有必要計算。
Relevant terms referred to throughout the specification and subsequent claims are defined below, unless otherwise specifically indicated in this specification. The term "texture coordinates" refers to coordinates in a texture space (such as a texture image or lens image); the term "rasterization" refers to the Image) is mapped to the calculation process of the texture coordinates of each lens image. The processing pipeline of the projection
圖3A顯示一個三角形網格(mesh),係用以模型化一球體表面。參考圖3A,利用一個三角形網格來模型化一球體12的表面。圖3B顯示一個多邊形網格,係用以組成/模型化該等距長方全景影像。透過對圖3A的三角形網格進行一等距長方投影而產生圖3B的多邊形網格,而圖3B的多邊形網格是多個四邊形或/及多個三角形的集合。
Figure 3A shows a triangular mesh used to model the surface of a sphere. Referring to Figure 3A, the surface of a
於離線階段,根據該等距長方全景影像及該些鏡頭影像的幾何形狀,該對應性產生器23為多邊形網格(圖3B)的各頂點,計算其等距長方座標及紋理座標,以產生該原始頂點列表。之後,該對應性產生器23將該原始頂點列表傳送給該頂點處理裝置210。該原始頂點列表是多個頂點的列表,該些頂點形成該多邊形網格(圖3B)的多個四邊形或/及三角形,且各頂點由一相對應資料結構所定義。該資料結構定義了一目的空間及一紋理空間之間(或該等距長方座標及該紋理座
標之間)的頂點映射關係。表一顯示該原始頂點列表中各頂點之資料結構的一個例子。
In the offline stage, according to the geometric shapes of the equidistant rectangular panoramic image and the lens images, the
為清楚及方便描述,以下的例子及實施例係假設影像擷取模組21包含四個鏡頭影像且分別架設在立方體架構11的四個工作面(右面、左面、正面、背面)上。
For clarity and convenience of description, the following examples and embodiments assume that the
圖3C顯示一等距長方全景影像中具有四個重疊區域及二十個控制區R(1)~R(20)的例子。請同時參考圖1B,各重疊區A(1)~A(4)包含P1個控制區,其中P1>=3。以下的例子及實施例係以等距長方全景影像的各重疊區包含5個(P1=5)控制區為例做說明。在圖3C的例子中,該等距長方全景影像有二十個控制區R(1)~R(20), 且該些控制區R(1)~R(20)分別具有二十個接合(warping)係數C(1)~C(20),該二十個接合係數分別表示該二十個控制區R(1)~R(20)的不同接合程度。 FIG. 3C shows an example of an equidistant rectangular panoramic image with four overlapping regions and twenty control regions R(1)-R(20). Please also refer to FIG. 1B , each of the overlapping areas A( 1 ) to A( 4 ) includes P1 control areas, where P1 >=3. The following examples and embodiments are described by taking as an example that each overlapping area of the equidistant rectangular panoramic image includes five (P1=5) control areas. In the example of FIG. 3C, the equidistant rectangular panoramic image has twenty control regions R(1)-R(20). And the control regions R(1)-R(20) respectively have twenty warping coefficients C(1)-C(20), and the twenty warping coefficients respectively represent the twenty control regions R( 1) The different degrees of engagement of ~R(20).
該補償裝置22包含一頂點處理裝置210、一拼接決策單元230以及一影像處理裝置220。在一量測模式下,該頂點處理裝置210接收該原始頂點列表及來自該拼接決策單元320的測試接合係數C(1)~C(20)、以逐頂點方式修正該原始頂點列表中各頂點於所有鏡頭影像之所有紋理座標、以及產生一修正頂點列表(將於稍後說明);根據該修正頂點列表及來自影像擷取模組21的四個鏡頭影像,該影像處理裝置210量測該等距長方全景影像中所有控制區R(1)~R(20)的區域誤差量E(1)~E(20),並輸出該些區域誤差量,之後,該拼接決策單元230根據該些測試接合係數C(1)~C(20),接收該些區域誤差量,以產生一2D誤差表格,再根據該2D誤差表格,產生最佳接合係數C(1)~C(20)。另一方面,在一顯像模式下,該拼接決策單元320被禁能,因此,根據該拼接決策單元230輸出的該些控制區的最佳接合係數,該頂點處理裝置210以及該影像處理裝置220一起運作以產生該些等距長方全景影像。
The
在該量測或顯像模式下,該頂點處理裝置210接收來自該原始頂點列表的目標頂點P(及其資料結構),以及來自該拼接決策單元230的二十個測試/最佳接合係數C(1)~C(20);接著,該頂點處理裝置210對於該目標頂點P有關的各鏡頭影像,根據該目標頂點P的原始紋理座標,對該二十個測試/最佳接合係數之其二進行內插操作,以產生
各鏡頭影像的內插接合係數C’。以正面鏡頭影像為例,根據該原始頂點列表,假設該目標頂點P在正面鏡頭影像中具有原始紋理座標(uP,vP)。第4A圖顯示於正面鏡頭影像中該目標頂點P及十個控制區R(6)~R(15)間的關係之一示例,其中該十個控制區R(6)~R(15)分別具有十個測試/最佳接合程度/係數C(6)~C(15)。一實施例中,根據角度θ,該頂點處理裝置210對該目標頂點P(在該正面鏡頭影像中具有原始紋理座標(uP,vP))最鄰近的二個控制區的二個接合係數,進行內插操作,以產生該目標頂點P在該正面鏡頭影像的內插接合係數C’。其中,該角度θ為順時針方向且形成於一第一向量V1及一第二向量V2之間;該第一向量V1以影像中心41(具紋理座標(ucenter,vcenter))為起點,以啟始控制區R(13)的位置42為終點,而該第二向量V2以影像中心41為起點,以該目標頂點P(uP,vP)為終點。假設θ=119.5°,因為該正面鏡頭影像的左側及右側分別有五個控制區,故90°/4=22.5°、idx=θ/22.5°=5及θ mod 22.5°=θ-idx×22.5°=7°。因此,頂點P最鄰近的二個控制區為R(9)及R(10),且在該正面鏡頭影像中該目標頂點P的內插接合係數C’係以下列方程式定義/計算:C’=C(9)×(7/22.5)+C(10)×(1-7/22.5)。各控制區的位置42包含,但不限於,該控制區的重心(gravity center)、該控制區的區域中心、及該控制區的中間點(median point)。請注意,啟始控制區R(13)僅為示例而非本發明之限制,在另一實施例中,可選擇另一控制區,例如R(11),當作該正面鏡頭影像的啟始控制區,只要該角度仍為順時針方向,以及是從該第一向量V1(以影像中心41(具紋理座標(ucenter,vcenter))為起點,指向啟始控制區R(11)的位置42)量測至該第二向
量V2。
In the measurement or visualization mode, the
以上述目標頂點P為例,為簡化上述計算,該對應性產生器23預先決定哪二個控制區(即R(9)及R(10))是最鄰近該目標頂點P,並將其索引(9及10)寫到該原始頂點列表內該目標頂點P的資料結構之該正面鏡頭影像的”接合係數索引”欄位中;另外,該對應性產生器23亦預先計算接合係數(C(9)及C(10))的混合權值(=7/22.5),並將該混合權值寫到該原始頂點列表內該目標頂點P的資料結構之該正面鏡頭影像的”接合係數的混合權值(Alpha)”欄位中。請注意,從該拼接決策單元230輸出的該些測試/最佳接合係數(C(1)~C(20))被安排為1D的接合係數陣列或1D的資料串流。該頂點處理裝置210接收來自該原始頂點列表後,根據該目標頂點P的資料結構中在該正面鏡頭影像的”接合係數索引”欄位(即9及10),從該拼接決策單元230輸出的1D的接合係數陣列中擷取出二個接合係數(C(9)及C(10)),再根據該目標頂點P的資料結構中在該正面鏡頭影像(請參考表一)的”接合係數的混合權值(Alpha)”欄位(即7/22.5),計算出內插接合係數C’。
Taking the above target vertex P as an example, in order to simplify the above calculation, the
於接收該內插接合係數C’後,該頂點處理裝置210根據下列方程式,計算該目標頂點P在正面鏡頭影像中的修正紋理座標(uP’,vP’):uP’=(uP-ucenter)* C’+ucenter;vP’=(vP-vcenter)*C’+vcenter。依此方式,該目標頂點P在正面鏡頭影像中的原始紋理座標(u2,v2)就變成修正紋理座標(u2’,v2’)。依此方式,根據該二十個測試/最佳接合係數C(1)~C(20),該頂點處理裝置210依序修正來自該原始頂點列表之各
頂點之四個鏡頭影像的所有紋理座標,以產生該修正頂點列表。表二顯示該修正頂點列表中各頂點之資料結構的一個例子。
After receiving the interpolated joint coefficient C', the
在該頂點處理裝置210根據該些測試/最佳接合係數C(1)~C(20)修正完來自該原始頂點列表之所有頂點之所有紋理座標之後,因影像擷取模組21的鏡頭中心偏移(亦即一鏡頭中心46相對於其系統中心43有一個偏移量ofs的距離)而造成的不匹配影像缺陷問題即可大幅改善(即實際成像位置48會被推向理想成像位置40),如圖4B所示。請注意,因為球體12是虛擬的,故物體45有可能位在球體12的外面或裡面或表面。
After the
在接收該修正頂點列表及該四個鏡頭影像後,該影像處理裝置220在量測模式下產生二十個控制區R(1)~R(20)的區域誤差量E(1)~E(20),或在顯像模式下產生一等距長方全景影像。圖5係根據本發明一實施例,顯示該影像處理裝置的示意圖。請參考圖5,該影
像處理裝置220包含一圖像引擎(graphics engine)55、一接縫引擎(seam engine)56、一目的緩衝器510以及一暫時緩衝器520。該圖像引擎55包含一柵格化引擎560、一紋理映射電路570以及一量測單元580。該紋理映射電路570包含二個紋理映射引擎571~572。圖3B的多邊形網格是多個四邊形或/及多個三角形的集合。因此,柵格化引擎560可對來自該修正頂點列表的任四個頂點所形成之一個四邊形(如圖3B)內的各像素進行四邊形柵格化操作,或者對來自該修正頂點列表的任三個頂點所形成一個三角形(如圖3B)內的各像素進行三角形柵格化操作。
After receiving the corrected vertex list and the four lens images, the
在四邊形的情況下,假設來自該修正頂點列表的四個頂點(A、B、C、D)(形成圖3B的多邊形網格的一個四邊形)係位在上述二十個控制區R(1)~R(20)之一範圍內且被二個鏡頭影像所重疊(正面及右面;N=2),該頂點列表中該四個頂點(A、B、C、D)分別包含以下資料結構:頂點A:{(xA,yA),2,IDFront,(u1A,v1A),w1A,IDRight,(u2A,v2A),w2A};頂點B:{(xB,yB),2,IDFront,(u1B,v1B),w1B,IDRight,(u2B,v2B),w2B};頂點C:{(xC,yC),2,IDFront,(u1C,v1C),w1C,IDRight,(u2C,v2C),w2C,};頂點D:{(xD,yD),2,IDFront,(u1D,v1D),w1D,IDRight,(u2D,v2D),w2D}。該柵格化引擎560直接對四邊形ABCD進行四邊形柵格化操作。具體而言,該柵格化引擎560利用以下步驟,對一個點Q(具有等距長方座標(x,y)且位在該多邊形網格的該四邊形ABCD內)計算各鏡頭影像的紋理座標:1.利用一雙線性內插(bi-linear interpolation)方法,根據等距長方座標(xA,yA,xB,yB,xC,yC,xD,yD,x,y),計算四個空間權值(a,b,c,d);2.計算該正面鏡
頭影像中該取樣點QF(對應該點Q)之紋理座標:(u1,v1)=(a*u1A+b*u1B+c*u1C+d*u1D,a*v1A+b*v1B+c*v1C+d*v1D);計算該右面鏡頭影像中該取樣點QR(對應該點Q)之紋理座標:(u2,v2)=(a*u2A+b*u2B+c*u2C+d*u2D,a*v2A+b*v2B+c*v2C+d*v2D)。最後,該柵格化引擎560將該二個紋理座標(u1,v1)及(u2,v2)平行傳送給該二個紋理映射引擎571~572。其中,a+b+c+d=1。根據該二個紋理座標(u1,v1)及(u2,v2),該二個紋理映射引擎571~572利用任何合適的方法(例如最近相鄰內插(nearest-neighbour interpolation)法、雙線性內插法、或三線性(trilinear)內插法),紋理映射正面及右面鏡頭影像的紋理資料,以產生二個取樣值s1、s2。其中,各該取樣值可以是一亮度(luma)值、一色度(chroma)值、一邊緣(edge)值,一像素顏色值(RGB)或一移動向量(motion vector)。
In the case of quadrilaterals, it is assumed that four vertices (A, B, C, D) from the modified vertex list (forming a quadrilateral of the polygonal mesh of FIG. 3B ) are located in the aforementioned twenty control regions R(1) Within a range of ~R(20) and overlapped by two lens images (front and right; N=2), the four vertices (A, B, C, D) in the vertex list respectively contain the following data structures: Vertex A: {(x A ,y A ),2,ID Front ,(u 1A ,v 1A ),w 1A ,ID Right ,(u 2A ,v 2A ),w 2A }; Vertex B: {(x B ,y B ),2,ID Front ,(u 1B ,v 1B ),w 1B ,ID Right ,(u 2B ,v 2B ),w 2B }; vertex C: {(x C ,y C ),2, ID Front ,(u 1C ,v 1C ),w 1C ,ID Right ,(u 2C ,v 2C ),w 2C ,}; vertex D: {(x D ,y D ),2,ID Front ,(u 1D ,v 1D ),w 1D ,ID Right ,(u 2D ,v 2D ),w 2D }. The
在三角形的情況下,柵格化引擎560及二個紋理映射引擎571~572對來自該修正頂點列表的任三個頂點所形成一個三角形(如圖3B)內的各像素進行類似的操作(類似四邊形的情況)以產生二個對應的取樣值s1、s2,除了柵格化引擎560於步驟(1)中是利用一重心加權(barycentric weighting)方法,而非利用上述雙線性內插方法,根據等距長方座標(xA,yA,xB,yB,xC,yC,x,y),計算三個空間權值(a,b,c)。
In the case of triangles, the
在該量測模式下,該量測單元580根據該點Q的等距長方座標(x,y)及二個取樣值(s1~s2),量測/估計該等距長方全景影像中二十個控制區R(1)~R(20)的區域誤差量E(1)~E(20)。根據該點Q的等距長方座標(x,y),量測單元580判斷該點Q是否落入該二十個控制區(請
參考圖3C)之一,若判斷該點Q落入任一控制區,即開始估計/量測該控制區的區域誤差量。該量測單元580可利用任何已知的演算法,例如絕對差值和(sum of absolute differences,SAD)、平方差值和(sum of squared differences,SSD)、中位數絕對誤差(median absolute deviation,MAD)等等,估計/量測該些控制區的區域誤差量。舉例而言,若判斷該點Q落入控制區R(11),即N=2,該量測單元580利用下列方程式:E=|s1-s2|;E(11)+=E,累積該右面鏡頭影像中控制區R(11)的各點與該正面鏡頭影像中控制區R(11)的對應點之間的取樣值差異的絕對值,以得到一SAD值當作該控制區R(11)的區域誤差量E(11)。依此方式,該量測單元580量測二十個控制區R(1)~R(20)的區域誤差量E(1)~E(20)。
In the measurement mode, the
本發明特色之一是在一預設的迴圈數目(圖6A中的Q1)內最小化不匹配的影像缺陷。該預設的迴圈數目係有關於一偏移量ofs,該偏移量ofs係上述影像擷取模組21的鏡頭中心46偏離其系統中心43的距離(參考圖4B)。
One of the features of the present invention is to minimize mismatched image defects within a predetermined number of loops (Q1 in FIG. 6A). The predetermined number of loops is related to an offset ofs, and the offset ofs is the distance that the
請回到圖2,在量測模式下,根據圖4B的偏移量ofs,該拼接決策單元230將二十個接合係數C(1)~C(20)設定至不同數值範圍,以量測該些區域誤差量,且每一次(或每一次迴圈)係將該二十個接合係數設定至相同值。例如,假設ofs=3公分,該二十個接合係數C(1)~C(20)被設定至數值範圍0.96~1.04,倘若每次增量是0.01,就會有總共九次的量測;假設ofs=1公分,該二十個接合係數
C(1)~C(20)被設定至數值範圍0.99~1.00,若每次增量是0.001,就會有總共十次的量測。
Returning to FIG. 2 , in the measurement mode, according to the offset ofs in FIG. 4B , the
圖6A係根據本發明一實施例,顯示決定所有控制區之最佳接合係數之方法流程圖。以下,請參考圖4B、5及6A,假設ofs=3公分,說明本發明決定所有控制區之最佳接合係數之方法(適用於量測模式下之拼接決策單元230)。
FIG. 6A is a flowchart showing a method for determining the optimal bonding coefficients of all control regions according to an embodiment of the present invention. 4B, 5 and 6A, assuming ofs=3 cm, the method of determining the optimal joint coefficients of all control regions in the present invention will be described (applicable to the
步驟S602:將迴圈數目Q1及測試接合係數分別設成新的值。一實施例中,第一次迴圈中將Q1設為1,之後每次迴圈都將Q1增加1;若ofs=3公分,第一次迴圈中將該些測試接合係數C(1)~C(20)都設為0.96(即C(1)=...=C(20)=0.96),並在後續迴圈中,依序將該些接合係數C(1)~C(20)設為0.97,....,1.04。 Step S602: Set the number of loops Q1 and the test engagement coefficient to new values respectively. In one embodiment, Q1 is set to 1 in the first loop, and Q1 is increased by 1 for each subsequent loop; if ofs=3 cm, these test joint coefficients C(1) are set in the first loop ~C(20) are all set to 0.96 (ie, C(1)=...=C(20)=0.96), and in the subsequent loops, these joint coefficients C(1)~C(20 ) is set to 0.97,....,1.04.
步驟S604:將所有區域誤差量E(m)清除為0,其中,m=1,2,...,20。 Step S604: Clear all the regional error amounts E(m) to 0, where m=1, 2, . . . , 20.
步驟S606:在該頂點處理裝置210根據步驟S602中所設定的測試接合係數,完成操作後,由該影像處理裝置220的圖像引擎56量測/取得該等距長方全景影像的二十個控制區R(1)~R(20)的區域誤差量E(1)~E(20)。為方便描述,利用E(m)=f(C(m))來代表本步驟S606,其中,m=1,2,...,20,以及f()代表(由該圖像引擎56)根據對應的測試接合係數C(m)與該影像擷取模組21輸出的四個鏡頭影像,量測該些區域誤差量E(m)。
Step S606 : After the
步驟S608:儲存所有區域誤差量E(1)~E(20)於一個2D誤差表格中。表三顯示當ofs=3公分(測試接合係數的數值範圍 0.96~1.04)時,該2D誤差表格的一個例子。 Step S608: Store all the regional error quantities E(1)-E(20) in a 2D error table. Table 3 shows that when ofs=3 cm (the numerical range of the test joint coefficient 0.96~1.04), an example of this 2D error table.
在表三的2D誤差表格中,總共有二十個區域誤差量及九個不同的測試接合係數。由於篇幅的限制,表四僅顯示出八個區域誤差量及六個不同的測試接合係數,其餘暫時跳過。請注意,在上述2D誤差表格中區域誤差量及測試接合係數的數目僅為一示例,而非本發明的限制。在實際實施時,上述2D誤差表格可以使用任何數目的區域誤差量及接合係數。 In the 2D error table of Table 3, there are a total of twenty regional error quantities and nine different test joint coefficients. Due to space limitations, Table 4 only shows eight regional error quantities and six different test junction coefficients, and the rest are temporarily skipped. Please note that the area error amount and the number of test joint coefficients in the above 2D error table are only an example, and not a limitation of the present invention. In practical implementation, the above 2D error table can use any number of regional error quantities and joint coefficients.
步驟S610:決定迴圈次數Q1是否到達上限9。若是,跳到步驟S612,否則,回到步驟S602。
Step S610: Determine whether the number of loops Q1 reaches the
步驟S612:根據上述2D誤差表格,進行係數決策操作。 Step S612: Perform a coefficient decision operation according to the above 2D error table.
步驟S614:輸出最佳接合係數C(m),其中,m=1,2,...,20。在該顯像模式中,輸出該些最佳接合係數C(m)至該頂點
處理裝置210,使得該影像處理裝置220產生一對應的等距長方全景影像。
Step S614 : output the optimal joint coefficient C(m), where m=1, 2, . . . , 20. In the developing mode, output the optimal joint coefficients C(m) to the vertex
The
圖6B係根據本發明一實施例,顯示該拼接決策單元230進行步驟S612之係數決策操作之方法流程圖。以下,請參考圖3C及6A-6B,說明該進行係數決策操作之所有步驟。
FIG. 6B is a flowchart showing a method for the
步驟S661:將Q2設為0以進行初始化。 Step S661: Set Q2 to 0 for initialization.
步驟S662:從上述2D誤差表格中,擷取出一選定之決策群組。回到圖3C及7B,通常各控制區係分別鄰接二個控制區,一選定之控制區及其鄰接的二個控制區形成一選定之決策群組,以決定該選定之控制區之最佳接合係數。例如,一選定控制區R(9)及其鄰接的二個控制區R(8)及R(10)形成一決策群組。然而,若一選定之控制區(如R(1))係位在重疊區的頂部或底部,則該選定之控制區R(1)就只會與其唯一鄰接的控制區R(2)形成一決策群組,以決定其最佳接合係數C(1)。後續步驟的說明係假設選定一控制區R(2),且R(2)與其鄰接的二個控制區R(1)及R(3)形成一選定之決策群組,以決定其最佳接合係數C(2)。 Step S662: Extract a selected decision group from the 2D error table. 3C and 7B, usually each control area is adjacent to two control areas, a selected control area and its adjacent two control areas form a selected decision group to determine the best control area for the selected control area engagement factor. For example, a selected control region R(9) and its adjacent two control regions R(8) and R(10) form a decision group. However, if a selected control region (eg, R(1)) is located at the top or bottom of the overlapping region, then the selected control region R(1) will only form a single adjacent control region R(2). Decision group to determine its best engagement coefficient C(1). The description of the subsequent steps assumes that a control region R(2) is selected, and that R(2) and its adjacent two control regions R(1) and R(3) form a selected decision group to determine its optimal bonding Coefficient C(2).
步驟S664:在該選定決策群組的各控制區的區域誤差量中,決定局部最小值。表四顯示R(1)~R(3)的區域誤差量及測試接合係數的一個例子。 Step S664: Determine a local minimum value among the regional error amounts of each control area of the selected decision group. Table 4 shows an example of the area error amounts of R(1)~R(3) and the test joint coefficient.
如表四所示,在R(1)的九個區域誤差量中只有一個局部最小值,而在R(2)及R(3)的九個區域誤差量中各有二個局部最小值,其中表四中各局部最小值旁分別標出星號(*)。 As shown in Table 4, there is only one local minimum in the nine regional error quantities of R(1), and there are two local minima in each of the nine regional error quantities of R(2) and R(3). Among them, each local minimum value in Table 4 is marked with an asterisk (*).
步驟S666:根據該些局部最小值,選出候選者。表五顯示從表四之該些局部最小值中,選出候選者,其中ID表示索引、WC表示接合係數,而RE表示區域誤差量。候選者的數目等於表四中該些局部最小值的數目。 Step S666: Select candidates according to the local minima. Table 5 shows that candidates are selected from the local minima in Table 4, where ID represents the index, WC represents the junction coefficient, and RE represents the regional error amount. The number of candidates is equal to the number of the local minima in Table 4.
步驟S668:根據表五的該些候選者,建立一連結計量(link metric)。如圖6C所示,根據表五的該些候選者,建立一連結計量。 Step S668: Create a link metric according to the candidates in Table 5. As shown in FIG. 6C , according to the candidates in Table 5, a link meter is established.
步驟S670:在該連結計量的所有路徑中,決定連結計量 值的最小總和。關於二個連結計量值及,其二者 間的最小值。關於二個連結計量值 及,其二者間的最小值 。之後,分別計算路徑0-0-0及路徑0-1- 1的連結計量值的總和如下:及 。因為>,故可決定(路徑0-1-1)是 該連結計量的所有路徑中,連結計量值的最小總和,如第6C圖中的實線路徑。 Step S670 : In all the paths of the connection measurement, determine the minimum sum of connection measurement values. About two linked metrics and , the minimum value between the two . About two linked metrics and , the minimum value between the two . After that, calculate the sum of the connection meter values of path 0-0-0 and path 0-1-1 respectively as follows: and . because > , so it can be determined (Path 0-1-1) is the smallest sum of connection meter values among all paths of the connection meter, such as the solid line path in Figure 6C.
步驟S672:決定該選定控制區之最佳接合係數。關於步驟S670所舉的例子中,因為(路徑0-1-1)是所有路徑中連結計量值的最小總和,故決定1.02為控制區R(2)之最佳接合係數。然而,若結束計算時有二條或更多路徑的連結計量值總和相同,就選擇具最小區域誤差量之節點的接合係數,當作該選定控制區之最佳接合係數。在此,將迴圈次數Q2的值遞增1。 Step S672: Determine the optimal bonding coefficient of the selected control area. In the example given in step S670, because (Path 0-1-1) is the minimum sum of connection metering values in all paths, so 1.02 is determined as the optimal bonding coefficient for the control region R(2). However, if there are two or more paths with the same sum of link metrics at the end of the calculation, the joint coefficient of the node with the smallest area error is selected as the best joint coefficient for the selected control area. Here, the value of the number of loops Q2 is incremented by one.
步驟S674:決定迴圈次數Q2是否到達上限20。若是,結束本流程,否則,回到步驟S662以處理下一個控制區。 Step S674: Determine whether the number of laps Q2 reaches the upper limit of 20. If yes, end the flow, otherwise, go back to step S662 to process the next control area.
在通篇說明書及後續的請求項當中所提及的相關用語定義如下,除非本說明書中另有特別指明。「工作面(face)影像」一詞指的是源自於該影像擷取模組21的一對應鏡頭影像的投影而產生的影像;該投影例如等距長方投影、圓柱投影、米勒投影、墨卡托投影、蘭伯特圓柱等面積投影或帕尼尼(Pannini)投影等。「接縫(seam)區」一詞指的是在一投影影像中,位在二個相鄰的第一主影像及第二主影像的中間,且被一接縫影像A以及一接縫影像B所重疊,其中該第一主影像與該接縫影像A是一第一工作影像的一部分,而該第二主影像與該接縫影像B是一第二工作影像的一部分。一般而言,工作面影像係分割成三部分以進行後續的拼接處理,例如,圖7A中,左面工作面影像的第一部份係位在接縫區S(2)內或位在左面主影像的右側,稱為接縫影像A;左面工作面影像的第二部份係位在接縫區S(1)內或在左主影像的左側,稱為接縫影像B;左面工作面影像的第三部份係位在接縫區S(1)及S(2)的中間,稱為左面主影像。相同的分割方式也適用於右面工作面影像、正面工作面影像、背面工作面影像。
Relevant terms referred to throughout the specification and subsequent claims are defined below, unless otherwise specifically indicated in this specification. The term "face image" refers to an image derived from the projection of a corresponding lens image of the
圖7A顯示一等距長方全景影像包含四個主影像及四個接縫區的例子。圖7B顯示圖7A的接縫區S(2)的放大圖。圖7B中的四邊形72對應圖3B多邊形網格的四邊形,以及四邊形72的交叉點71就是頂點。根據影像擷取模組21中鏡頭的FOV、鏡頭感測器的解析度以及鏡頭的角度,重疊區的大小會隨之變動。根據本發明,P1個控制區位在一接縫區內,而該接縫區位在一對應重疊
區內,其中P1>=3。一般來說,該重疊區的寬度大於或等於該接縫區的寬度,而該接縫區的寬度大於或等於該P1個控制區的寬度。例如,接縫區S(2)位在重疊區A(2)內(圖未示),A(2)的寬度大於或等於S(2)的寬度,而S(2)的寬度大於或等於R(6)~R(10)的寬度。一較佳實施例中,重疊區(如A(2))、接縫區(如S(2))及控制區(如R(6)~R(10))的寬度的比例為7:5:1。另一實施例中,重疊區(如A(2))、接縫區(如S(2))及控制區(如R(6)~R(10))的寬度的比例為9:7:1、9:9:1、9:5:1、7:7:1或5:5:1。
FIG. 7A shows an example of an equidistant rectangular panoramic image including four main images and four seam regions. FIG. 7B shows an enlarged view of the seam area S( 2 ) of FIG. 7A . The
為了產生圖7A的等距長方全景影像,圖像引擎56根據來自影像擷取模組21的四個鏡頭影像的等距長方投影,產生四個工作面影像,實際運作時,係產生與上述四個工作面影像有關的九個影像,即一個首要影像(包含背面主影像、正面主影像、左面主影像及右面主影像)以及八個接縫影像(包含四個接縫影像A與四個接縫影像B)。為了在九個不同緩衝器儲存上述九個影像以進行後續的拼接操作,於顯像模式中,對應性產生器23產生(m1+8)個原始單鏡頭頂點列表,亦即m1個原始主要頂點列表以及八個原始接縫頂點列表分別對應至上述四個工作面影像與八個接縫影像,其中1<=m1<=4。舉例而言,若m1=1,則利用一個原始主要頂點列表來一次產生四個主影像;若m1=2,則利用二個原始主要頂點列表之任一來一次產生二個主影像;若m1=4,則利用四個原始主要頂點列表之任一來一次產生該四個主影像之一。對應地,為最小化因影像擷取模組21的鏡頭中心偏移而造成的不匹配影像缺陷問題,根據該(m1+8)個原始單鏡頭頂點列表及上述二十個最佳接合係數C(1)~C(20),該頂點處理裝置210產生(m1+8)個修正單鏡頭頂點列表,亦即m1個修正主要頂點列表以及八個修正接縫
頂點列表以分別對應至上述四個工作面影像與八個接縫影像。請注意,各該(m1+8)個原始單鏡頭頂點列表的格式類似於表一,但僅包含單一鏡頭的一組參數,即IDk、(uk,vk)、(idxk0,idxk1)以及Alphak,其中k=0、1、2或3。請注意,各該(m1+8)個修正單鏡頭頂點列表的格式類似於表二,但僅包含單一鏡頭的一組參數,即IDk以及(u’k,v’k),其中k=0、1、2或3。
In order to generate the equidistant rectangular panorama image shown in FIG. 7A , the
於顯像模式中,根據上述m1個修正主要頂點列表以及該四個鏡頭影像,該圖像引擎56進行柵格化操作及紋理映射以產生上述首要影像(包含背面主影像、正面主影像、左面主影像及右面主影像)。接著,根據上述八個修正接縫頂點列表以及該四個鏡頭影像,該圖像引擎56”依序”進行柵格化操作及紋理映射以產生上述四個接縫影像A及四個接縫影像B,亦即一次產生一張接縫影像。例如,該圖像引擎56根據一個對應的修正接縫頂點列表以及一正面鏡頭影像,進行柵格化操作及紋理映射,以一次產生一個與該正面工作面影像有關的接縫影像A。於另一實施例中,該圖像引擎56可以相反順序來產生上述影像,亦即,可以先產生上述八個接縫影像,再產生上述首要影像。
In the development mode, according to the m1 corrected main vertex lists and the four lens images, the
有一個特例是該影像擷取模組21包含一部廣角照相機時,在等距長方投影影像的最左側工作面影像與最右側工作面影像都僅包含一主影像及一接縫影像,亦即該最左側工作面影像與最右側工作面影像的接縫影像A及接縫影像B之其一會被併入主影像。例如,假設該影像擷取模組21包含一部雙鏡頭的廣角照相機(如180°×60°)以產生一左鏡頭影像與一右鏡頭影像,該圖像引擎56根據該二個鏡頭影像、一個或二個修正主要頂點列表以及二個修正接縫頂點列表,產生一首要影像
(包含一左面主影像與一左面主影像)以及與單一接縫區有關的一接縫影像A及一接縫影像B。最後,該影像處理裝置220再將該首要影像、該接縫影像A及該接縫影像B組成一廣角影像。
There is a special case that when the
圖7C係根據本發明一實施例,顯示決定一接縫區的最小化誤差路徑(或一接縫)之方法的流程圖。以下,請參考圖5及7A-7D,說明該決定一接縫區的最小化誤差路徑之方法(由該影像處理裝置220之接縫引擎55於顯像模式下所進行)。
7C is a flowchart illustrating a method of determining an error-minimizing path (or a seam) for a seam region, according to an embodiment of the present invention. Hereinafter, referring to FIGS. 5 and 7A-7D, the method of determining the minimizing error path of a seam region (performed by the
為方便說明,座標(x,y)指的是在一等距長方投影領域中一像素的位置。 For the convenience of description, the coordinates (x, y) refer to the position of a pixel in an equidistant rectangular projection field.
步驟S702:於同一個接縫區中,計算接縫影像A中各像素位置相對於接縫影像B中之鄰近像素位置的像素值差異的絕對值。一實施例中,提供以下程式碼來計算同一個接縫區(範圍由Y0至Y1及X0至X1)中,接縫影像A中各像素位置(x,y)相對於接縫影像B的鄰近像素位置(x+1,y)的像素值差異的絕對值|A(x,y)-B(x+1,y)|,其中A(x,y)表示與一第一工作面影像有關之接縫影像A中位置(x,y)上的像素值,而B(x+1,y)表示與一第二工作面影像有關之接縫影像B中位置(x+1,y)上的像素值。請注意,二個像素A(x,y)及B(x+1,y)必須位在同一列y上,以及該第一工作面影像與該第二工作面影像在上述接縫區重疊。 Step S702 : In the same seam area, calculate the absolute value of the pixel value difference between each pixel position in the seam image A relative to the adjacent pixel position in the seam image B. In one embodiment, the following code is provided to calculate the proximity of each pixel position (x, y) in the seam image A relative to the seam image B in the same seam area (range from Y0 to Y1 and X0 to X1) The absolute value of the pixel value difference at the pixel position (x+1,y) |A(x,y)-B(x+1,y)|, where A(x,y) indicates that it is related to a first working plane image The pixel value at the position (x, y) in the seam image A, and B(x+1, y) represents the position (x+1, y) in the seam image B related to a second working plane image pixel value. Please note that the two pixels A(x, y) and B(x+1, y) must be located on the same row y, and the first working plane image and the second working plane image overlap in the seam area.
另一實施例中,係計算接縫影像A中各像素位置相對於接縫影像B中之鄰近像素位置的像素值平方差(squared error),而非像素值差異或誤差的絕對值。 In another embodiment, the squared error of the pixel value of each pixel position in the seam image A relative to the adjacent pixel position in the seam image B is calculated, rather than the absolute value of the pixel value difference or error.
步驟S704:於上述接縫區中,計算於一目前列中各像素的最小累積誤差(或最小累積像素值差異的絕對值),並找出上一列中具最小累積誤差的X座標。一實施例中,提供以下程式碼來計算計算於一目前列y中各像素的最小累積誤差,並找出上一列(y-1)中具最小累積誤差的X座標,其中y的範圍從Y0至Y1。 Step S704: Calculate the minimum cumulative error (or the absolute value of the minimum cumulative pixel value difference) of each pixel in a current row in the seam area, and find the X coordinate with the minimum cumulative error in the previous row. In one embodiment, the following code is provided to calculate the minimum cumulative error of each pixel in a current row y, and find the X coordinate with the smallest cumulative error in the previous row (y-1), where y ranges from Y0 to Y1.
步驟S706:於該接縫區的最下面一列中,找出具最小累積誤差的X座標。一實施例中,提供以下程式碼來找出該接縫區的最下面一列中具最小累積誤差的X座標。 Step S706: Find the X coordinate with the smallest accumulated error in the bottom row of the seam area. In one embodiment, the following code is provided to find the X coordinate with the smallest accumulated error in the bottom row of the seam region.
步驟S708:從該接縫區的最下面一列追蹤/回溯至最上面一列,以形成一最小化誤差路徑(或一接縫)。如圖7D所示,一接縫78橫跨該接縫區S(2)且於每一列具有一像素位置,即x座標。其中,該接縫78是該接縫區的所有列上的一連串分隔點(或接縫點)的集合。一實施例中,提供以下程式碼來形成一接縫區的接縫:
Step S708: Trace/backtrack from the bottom row of the seam area to the top row to form an error-minimizing path (or a seam). As shown in FIG. 7D, a
於本步驟結束時,陣列Seam[y]會包含該接縫區的所有列(Y0~Y1)上的一連串分隔點,即該最小化誤差路徑或該接縫。於另一實施例中,本領域技術人士可適當地修正步驟S704~S708的內容,以相反順序(從該接縫區的最上面一列追蹤至最下面一列),形成該接縫區的接縫,此亦落入本發明之申請專利範圍內。 At the end of this step, the array Seam[y] will contain a series of separation points on all columns (Y0~Y1) of the seam region, ie the minimized error path or the seam. In another embodiment, those skilled in the art can appropriately modify the contents of steps S704-S708 to form the seam of the seam area in the reverse order (trace from the uppermost row to the lowermost row of the seam area). , which also falls within the scope of the patent application of the present invention.
圖8A係根據本發明一實施例,顯示一影像處理方法的流程圖。以下,請參考圖2、5及8A-8D,說明該影像處理方法(係適用於本發明投影影像處理系統200)。
8A is a flowchart illustrating an image processing method according to an embodiment of the present invention. Hereinafter, please refer to FIGS. 2 , 5 and 8A-8D to describe the image processing method (which is applicable to the projection
步驟S802:得到具有所有測試接合係數及所有控制區的區域誤差量的2D誤差表格。請參考圖6A的步驟S602~S610。於本步驟S802結束時,可得到包含所有測試接合係數以及所有控制區R(1)~R(20)的區域誤差量E(1)~E(20)的2D誤差表格(如表三)。請注意,所有測試接合
係數係有關於上述影像擷取模組21的鏡頭中心46偏離系統中心43的偏移量ofs,如圖4B所示。
Step S802: Obtain a 2D error table with all the test bonding coefficients and the regional error amounts of all the control regions. Please refer to steps S602 to S610 in FIG. 6A . At the end of this step S802, a 2D error table (see Table 3) including all the test bonding coefficients and the regional error amounts E(1)-E(20) of all the control regions R(1)-R(20) can be obtained. Note that all tests engage
The coefficient is related to the offset ofs from the
步驟S804:根據上述2D誤差表格,決定所有控制區之最佳接合係數。請參考圖6A的步驟S612~S61及圖6B的步驟S661~S674。於本步驟S804結束時,可得到所有控制區R(1)~R(20)的最佳接合係數C(1)~C(20),並傳送至該頂點處理裝置210;同時,結束量測模式及開始顯像模式。
Step S804: According to the above-mentioned 2D error table, determine the optimal bonding coefficients of all control regions. Please refer to steps S612 - S61 in FIG. 6A and steps S661 - S674 in FIG. 6B . At the end of this step S804, the optimal bonding coefficients C(1)-C(20) of all the control regions R(1)-R(20) can be obtained, and sent to the
步驟S806:根據多個鏡頭影像、多個原始單鏡頭頂點列表以及於步驟S804取得之最佳接合係數,產生各工作面影像。如前面所述,該頂點處理裝置210根據對應性產生器23輸出的多個原始單鏡頭頂點列表(包含至少一原始主要頂點列表及多個原始接縫頂點列表)以及於步驟S804取得之最佳接合係數,依序產生多個修正單鏡頭頂點列表(包含至少一修正主要頂點列表及多個修正接縫頂點列表)。於圖7的具四個接縫區的等距長方全景影像的例子中,於量測模式下,圖5的圖像引擎56根據來自上述影像擷取模組21的四個鏡頭影像、(m1+8)個修正單鏡頭頂點列表以及於步驟S804取得之二十個最佳接合係數C(1)~C(20),產生四個工作面影像(包含四個主影像、四個接縫影像A以及四個接縫影像B),其中1<=m1<=4。於產生上述四個工作面影像後,圖像引擎56利用以下二種方式之一來儲存九個影像(包含一個首要影像(共包含該四個主影像)、該四個接縫影像A以及該四個接縫影像B)。方式一:首先,由該圖像引擎56將該九個影像儲存於九個不同暫時緩衝器520,且該九個影像之間彼此不重疊;之後,將該首要影像傳送至一目的緩衝器510,其中的四個接縫區是空的;最後,由該接縫引擎55根據上述四
個接縫影像A以及該四個接縫影像B,產生四個拼接後接縫影像後,再將該四個拼接後接縫影像儲存於該目的緩衝器510的四個接縫區以進行顯示。方式二:首先,由該圖像引擎56將該首要影像直接儲存於該目的緩衝器510以及將該上述四個接縫影像A以及該四個接縫影像B分別儲存於八個不同暫時緩衝器520;接著,由該接縫引擎55根據上述四個接縫影像A以及該四個接縫影像B產生四個拼接後接縫影像之後,再將該四個拼接後接縫影像儲存於該目的緩衝器510的四個接縫區。舉例而言,為左面工作面影像之一部份的接縫影像A以及為正面工作面影像之一部份的接縫影像B被饋入至該接縫引擎55以進行拼接,並產生一拼接後接縫影像後,再將該拼接後接縫影像儲存於該目的緩衝器510的接縫區S(2),如圖7A所示。
Step S806 : According to the plurality of lens images, the plurality of original single-lens vertex lists, and the optimal joint coefficient obtained in step S804 , each working surface image is generated. As described above, the
假設上述影像擷取模組21包含一個具三鏡頭的廣角照相機且產生三個鏡頭影像(即一左面鏡頭影像、一正面鏡頭影像以及一右面鏡頭影像),圖5的圖像引擎56將根據來自上述三個鏡頭影像、至少五個修正單鏡頭頂點列表以及多個最佳接合係數,產生三個工作面影像(包含三個主影像以及與二個接縫區有關之二個接縫影像A及二個接縫影像B)。於產生上述三個工作面影像後,圖像引擎56利用上述方式一或方式二來儲存五個影像(包含一個首要影像(共包含該三個主影像)、上述二個接縫影像A及二個接縫影像B),以便進行後續的影像拼接。
Assuming that the above-mentioned
步驟S808:決定各接縫區的最小化誤差路徑(或接縫)。一實施例中,係對圖7A的四個接縫區S(1)~S(4)執行圖7C之決定一接縫區的最小化誤差路徑之方法。於本步驟S808結束時,將產生該四個接縫區S(1)~S(4)的四條最小化誤差路徑或接縫。 Step S808: Determine the minimum error path (or seam) of each seam area. In one embodiment, the method of determining an error minimization path for a seam region of FIG. 7C is performed on the four seam regions S( 1 ) to S( 4 ) of FIG. 7A . At the end of this step S808, four error-minimizing paths or seams of the four seam regions S(1)-S(4) will be generated.
步驟S810:根據各接縫區的最小化誤差路徑或接縫,將重疊的接縫影像A與接縫影像B拼接起來。在圖7D的例子中,接縫78是用來將與左面工作面影像有關之接縫影像A以及與正面工作面影像有關之接縫影像B拚接起來,以產生一拼接後接縫影像。最後,總共四張拼接後接縫影像分別儲存於該目的儲存器510的四個接縫區S(1)~S(4),因此,該四張拼接後接縫影像以及上述四張主影像形成一張完整的等距長方全景影像。
Step S810: splicing the overlapping seam image A and seam image B according to the minimized error path or seam of each seam area. In the example of FIG. 7D,
圖8B顯示一接縫區的其中一段的例子,且該接縫區係有關於一接縫78、一接縫影像A以及一接縫影像B。圖8C顯示一接縫區的大小以及三列的更新視窗81的大小及不同位置的例子。於步驟S810中,本發明提供以下三種方式(1)~(3)來拼接接縫影像A與接縫影像B,以產生一對應拼接後接縫影像。(1)傳統方式:根據各接縫區的最小化誤差路徑或接縫,將對應的接縫影像A與接縫影像B拼接起來。如圖8B所示,對於拼接後接縫影像或接縫區的每一列,若一像素位置(x,y)是位在接縫78的左側,則指定其在接縫影像A的像素值當做該拼接後接縫影像中同一像素位置(x,y)的像素值;相反地,若一像素位置(x,y)是位在接縫78的右側,則指定其在接縫影像B的像素值會當做該拼接後接縫影像中同一像素位置(x,y)的像素值。
FIG. 8B shows an example of a section of a seam area, and the seam area is associated with a
(2)接縫混和方式(各接縫區是一個連續的整體區域,沒有被切割):根據一接縫區的接縫78,施予一更新視窗81至接縫區的每一列,以拼接對應的接縫影像A與接縫影像B。為平滑化接縫78附近的像素值轉變,本發明提供一種接縫混和方式來更新一更新視窗81中的像素值,其中該更新視窗81的寬度等於2×Ra以及該接縫78上的一分隔點82係位在該
更新視窗81的中心,如圖8C所示。對於接縫區S(2)的每一列,若一像素位置(x,y)是位在更新視窗81的左側,則指定其在接縫影像A的像素值當做該拼接後接縫影像中同一像素位置(x,y)的像素值;相反地,若一像素位置(x,y)是位在更新視窗81的右側,則指定其在接縫影像B的像素值當做拼接後接縫影像中同一像素位置(x,y)的像素值;再者,若一像素位置(x,y)是位在更新視窗81之內,根據該更新視窗81的最後寬度及該像素位置(x,y)相對於更新視窗81之左邊緣的距離,計算一混和權值,再根據該混和權值及於接縫影像A及接縫影像B的二個對應像素值(即ImgA(x,y)及ImgB(x,y)),計算同一像素位置(x,y)的混和像素值。一實施例中,提供以下程式碼來根據接縫區的每一列中更新視窗81的最後寬度及各像素位置(x,y)相對於該更新視窗81的位置,來更新該更新視窗81內的像素值。
(2) Seam blending method (each seam area is a continuous integral area, not cut): according to the
(3)環繞式(wrap around)接縫混和方式(上述多個接縫區之一被分割成二個不連續的部分且位在全景影像的相對二側):在一特例中,一接縫區可能同時位在等距長方全景影像的左邊緣及右邊緣附近。如圖8D所示,接縫區S(3)同時位在等距長方全景影像的最左側及最右側,換言之,接縫區S(3)被分割成二個部分。為處理這種狀況,本發明提供一種環繞式的接縫混和方式。一實施例中,提供以下程式碼來根據該環繞式的接縫混和方式,形成一接縫區(範圍從Y0至Y1及X0至X1)的拼接後接縫影像: (3) Wrap around seam blending method (one of the above-mentioned seam areas is divided into two discontinuous parts and located on opposite sides of the panoramic image): In a special case, a seam The area may be located near the left and right edges of the equirectangular panorama at the same time. As shown in FIG. 8D , the seam area S( 3 ) is located at the leftmost and rightmost sides of the equidistant rectangular panoramic image, in other words, the seam area S(3) is divided into two parts. To address this situation, the present invention provides a wraparound seam blend. In one embodiment, the following code is provided to form a stitched seam image of a seam region (ranging from Y0 to Y1 and X0 to X1) according to the wraparound seam blending method:
因此,即使圖8D接縫區S(3)係同時位在等距長方全景影像的最左側及最右側,利用上述環繞式的接縫混和方式依然可以產生一正確的拼接後的接縫影像。 Therefore, even if the seam area S(3) in FIG. 8D is located at the leftmost and rightmost sides of the equidistant rectangular panoramic image, the above-mentioned wraparound seam blending method can still generate a correct stitched seam image .
本發明補償裝置22及對應性產生器23可以軟體、硬體、或軟體(或韌體)及硬體的組合來實施,一單純解決方案的例子是現場可程式閘陣列(field programmable gate array)或一特殊應用積體電路(application specific integrated circuit)。一較佳實施例中,該頂點處理裝置210以及該影像處理裝置220係利用一圖形處理單元(Graphics Processing Unit)以及一第一程式記憶體來實施;該拼接決策單元230及該對應性產生器23利用一第一一般用途(general-purpose)處理器以及一第二程式記憶體來實施。該第一程式記憶體儲存一第一處理器可執行程式,而第二程式記憶體儲存一第二處理器可執行程式。當該圖形處理單元執行該第一處理器可執行程式時,該圖形處理單元被組態(configured)以運作有如:該頂點處理裝置210以及該影像處理裝置220。當該第一一般用途處理器執行該第二處理器可執行程式時,該第一一般用途處理器被組態以運作有如:該拼接決策單元230及該對應性產生器23。
The
另一實施例中,該補償裝置22及對應性產生器23利用一第二一般用途處理器以及一第三程式記憶體來實施。該第三程式記憶體儲存一第三處理器可執行程式。當該第二一般用途處理器執行該第三處理器可執行程式時,該第二一般用途處理器被組態以運作有如:該頂點處理裝置210、該拼接決策單元230、該對應性產生器23以及該影像處理裝置220。
In another embodiment, the
上述僅為本發明之較佳實施例而已,而並非用以限定本發明的申請專利範圍;凡其他未脫離本發明所揭示之精神下所完成的等效改變或修飾,均應包含在下述申請專利範圍內。 The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the patent application of the present invention; all other equivalent changes or modifications without departing from the spirit disclosed in the present invention shall be included in the following application. within the scope of the patent.
Claims (22)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110121015A TWI762353B (en) | 2021-06-09 | 2021-06-09 | Method for generating projection image with scaling adjustment and seam cut stitching |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110121015A TWI762353B (en) | 2021-06-09 | 2021-06-09 | Method for generating projection image with scaling adjustment and seam cut stitching |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI762353B true TWI762353B (en) | 2022-04-21 |
TW202248951A TW202248951A (en) | 2022-12-16 |
Family
ID=82199269
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW110121015A TWI762353B (en) | 2021-06-09 | 2021-06-09 | Method for generating projection image with scaling adjustment and seam cut stitching |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI762353B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI807845B (en) * | 2022-06-01 | 2023-07-01 | 信驊科技股份有限公司 | System and method of generating projection image with region of interest |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7889948B2 (en) * | 2006-04-10 | 2011-02-15 | Microsoft Corporation | Image stitching using partially overlapping views of a scene |
US9979900B2 (en) * | 2013-04-04 | 2018-05-22 | Sony Corporation | Method and apparatus for applying a border to an image |
TWI660328B (en) * | 2017-02-23 | 2019-05-21 | 鈺立微電子股份有限公司 | Image device utilizing non-planar projection images to generate a depth map and related method thereof |
TW202025716A (en) * | 2018-09-26 | 2020-07-01 | 美商卡赫倫特羅吉克斯公司 | Surround view generation |
-
2021
- 2021-06-09 TW TW110121015A patent/TWI762353B/en active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7889948B2 (en) * | 2006-04-10 | 2011-02-15 | Microsoft Corporation | Image stitching using partially overlapping views of a scene |
US9979900B2 (en) * | 2013-04-04 | 2018-05-22 | Sony Corporation | Method and apparatus for applying a border to an image |
TWI660328B (en) * | 2017-02-23 | 2019-05-21 | 鈺立微電子股份有限公司 | Image device utilizing non-planar projection images to generate a depth map and related method thereof |
TW202025716A (en) * | 2018-09-26 | 2020-07-01 | 美商卡赫倫特羅吉克斯公司 | Surround view generation |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI807845B (en) * | 2022-06-01 | 2023-07-01 | 信驊科技股份有限公司 | System and method of generating projection image with region of interest |
Also Published As
Publication number | Publication date |
---|---|
TW202248951A (en) | 2022-12-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10104288B2 (en) | Method and apparatus for generating panoramic image with stitching process | |
Szeliski et al. | Creating full view panoramic image mosaics and environment maps | |
TWI728620B (en) | Method of adjusting texture coordinates based on control regions in a panoramic image | |
JP4832878B2 (en) | Image composition processing apparatus and method | |
Shum et al. | Systems and experiment paper: Construction of panoramic image mosaics with global and local alignment | |
Shum et al. | Panoramic image mosaics | |
US7006709B2 (en) | System and method deghosting mosaics using multiperspective plane sweep | |
US10872396B2 (en) | Image stitching method and device | |
JPH11509946A (en) | Method and system for image combination using parallax dependent technique | |
JP2005500756A (en) | Multi-projector mosaic with automatic alignment | |
JP2005244916A (en) | Image processor | |
CN110246161B (en) | Method for seamless splicing of 360-degree panoramic images | |
US11616909B2 (en) | Method of compensating for color differences between adjacent lens images in a panoramic image | |
TWI762353B (en) | Method for generating projection image with scaling adjustment and seam cut stitching | |
KR20060056050A (en) | Creating method of automated 360 degrees panoramic image | |
JP2000155831A (en) | Method and device for image composition and recording medium storing image composition program | |
JP4581512B2 (en) | Three-dimensional image processing apparatus, optical axis adjustment method, and optical axis adjustment support method | |
CN115484442A (en) | Method for generating projection image by scaling and seam splicing | |
JP4776983B2 (en) | Image composition apparatus and image composition method | |
CN116437165A (en) | Image processing system and method thereof | |
JP3540696B2 (en) | Image synthesizing method, image synthesizing device, recording medium storing image synthesizing program | |
TWI807845B (en) | System and method of generating projection image with region of interest | |
TWI837563B (en) | Image processing system and method thereof for generating projection images based on a multiple-lens camera | |
JP2003316256A (en) | Method, system, and program for ortho-photo generation | |
JP2004227095A (en) | Texture map formation method, program for texture map formation, and texture map formation device |