TWI769782B - Method for optimizing image stitching and computer readable storage medium - Google Patents

Method for optimizing image stitching and computer readable storage medium Download PDF

Info

Publication number
TWI769782B
TWI769782B TW110113230A TW110113230A TWI769782B TW I769782 B TWI769782 B TW I769782B TW 110113230 A TW110113230 A TW 110113230A TW 110113230 A TW110113230 A TW 110113230A TW I769782 B TWI769782 B TW I769782B
Authority
TW
Taiwan
Prior art keywords
image
camera
subject
fisheye
fisheye image
Prior art date
Application number
TW110113230A
Other languages
Chinese (zh)
Other versions
TW202240534A (en
Inventor
郭俊毅
高曉雯
Original Assignee
中華電信股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中華電信股份有限公司 filed Critical 中華電信股份有限公司
Priority to TW110113230A priority Critical patent/TWI769782B/en
Application granted granted Critical
Publication of TWI769782B publication Critical patent/TWI769782B/en
Publication of TW202240534A publication Critical patent/TW202240534A/en

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The present invention provides a method for optimizing image stitching and a computer readable storage medium, which obtains a flat fisheye image that projects each pixel of the fisheye image onto a three-dimensional spherical surface and maps it back to a two-dimensional plane by calculating a corresponding non-linear deformation relationship between a fisheye image of an object and entity thereof, and then stitches the continuous fisheye images, such that problems of stitching afterimages and screen breaks that occur when the fisheye image is flattened and stitched will be greatly reduced, and a better image stitching optimization effect can be achieved.

Description

用於影像縫合優化之方法及電腦可讀儲存媒介 Method and computer-readable storage medium for image stitching optimization

本發明係關於多媒體技術與其應用,特別是關於用於影像縫合優化之方法及電腦可讀儲存媒介。 The present invention relates to multimedia technology and its applications, in particular to a method and computer-readable storage medium for image stitching optimization.

隨著5G時代的來臨,影音傳輸的頻寬不足問題已被解決,促使新型態的多媒體互動應用相繼產生。其中,360度全景影像提供的高互動、高沉浸感深受消費者喜愛,也應用於展演活動、球賽等大型活動,藉此帶來傳統平面影像無法比擬的臨場感。 With the advent of the 5G era, the problem of insufficient bandwidth for audio and video transmission has been solved, prompting the emergence of new types of multimedia interactive applications. Among them, the high interaction and high immersion provided by 360-degree panoramic images are deeply loved by consumers, and are also used in large-scale activities such as exhibitions and ball games, thereby bringing a sense of presence that traditional flat images cannot match.

然而,使用魚眼相機取得360度全景影像時,通常需要將兩張具有180度視角的魚眼影像進行攤平(dewarping)及縫合(stitching)的處理。此時,縫合影像的品質好壞取決於攤平後的魚眼影像的扭曲變形程度,會有縫合殘影及畫面斷裂等問題。 However, when a fisheye camera is used to obtain a 360-degree panoramic image, it is usually necessary to perform dewarping and stitching processing on two fisheye images with a viewing angle of 180 degrees. At this time, the quality of the stitched image depends on the degree of distortion of the flattened fisheye image, and there may be problems such as stitching afterimage and screen breakage.

因此,本發明係提供一種用於影像縫合優化之方法及電腦可讀媒介,以解決根據魚眼影像產製全景影像時的縫合殘影及畫面斷裂等問題,進而提供較佳之優化360度全景影像的畫面效果。 Therefore, the present invention provides a method and a computer-readable medium for image stitching optimization, so as to solve the problems of stitching afterimage and screen breakage when producing panoramic images from fisheye images, thereby providing better optimized 360-degree panoramic images screen effect.

為解決上述問題,本發明提供一種用於影像縫合優化之方法,包括:拍攝被攝物與相機之光軸間具有特定夾角之魚眼影像,其中,該被攝物具有複數標記點;紀錄各該魚眼影像中該複數標記點之各者相距該魚眼影像之中心點的第一距離與拍攝該魚眼影像時所對應該特定夾角的配對數據;以及根據各該配對數據計算代表該相機進行拍攝時入射光與成像半徑間的非線性關係。 In order to solve the above problems, the present invention provides a method for image stitching optimization, which includes: shooting a fisheye image with a specific angle between the object and the optical axis of the camera, wherein the object has a plurality of marking points; recording each The pairing data of the first distance between each of the plurality of marking points in the fisheye image and the center point of the fisheye image and the specific angle corresponding to the fisheye image when shooting the fisheye image; and calculating a representative of the camera according to the pairing data Non-linear relationship between incident light and imaging radius when shooting.

在上述之方法中,該拍攝被攝物與相機之光軸間具有特定夾角之魚眼影像之步驟復包括以下子步驟:以固定角度使該相機繞其腳架軸心樞轉,使該被攝物與該相機之該光軸的該特定夾角為每次樞轉時該固定角度的累加值;於該相機每次樞轉時拍攝該被攝物與該相機之該光軸於該特定夾角之該魚眼影像;及當該特定夾角大於或等於360度時,停止該相機之樞轉及拍攝。 In the above method, the step of photographing a fisheye image with a specific angle between the optical axis of the subject and the camera further includes the following sub-steps: pivoting the camera around the axis of the tripod at a fixed angle to make the subject The specific angle between the subject and the optical axis of the camera is the cumulative value of the fixed angle each time the camera is pivoted; the subject and the optical axis of the camera are photographed at the specific angle each time the camera is pivoted the fisheye image; and when the specific angle is greater than or equal to 360 degrees, stop the camera from pivoting and shooting.

在上述之方法中,該非線性關係係以N次方程式表示,其中,該配對數據之該第一距離係對應該N次方程式之變數值,其中,該配對數據之該特定夾角係對應該N次方程式之函數值,並且其中,該根據各該配對數據計算代表該相機進行拍攝時入射光與成像半徑間的非線性關係之步驟係包括根據該配對數據計算該N次方程式之係數值。 In the above method, the nonlinear relationship is represented by an N-degree equation, wherein the first distance of the paired data corresponds to a variable value of the N-degree equation, wherein the specific included angle of the paired data corresponds to the N-degree equation The function value of the equation, and wherein, the step of calculating the nonlinear relationship between the incident light and the imaging radius when the camera shoots according to the paired data includes calculating the coefficient value of the Nth-order equation according to the paired data.

在上述之方法中,復包括根據該非線性關係執行該魚眼影像之攤平,係包括以下子步驟:以該魚眼影像之該中心點為基準獲得該魚眼影像中像素的二維平面座標值;根據該像素的該二維平面座標值計算該像素相距該魚眼影像之該中心點的第二距離;將該第二距離根據該非線性關係計算該像素投射至三維球面的仰角,並根據該像素的該二維平面座標值計算該像素投射至該三維球面的水平角;根據該仰角與該水平角計算該像素投射至該三維球面的三 維座標值;將該魚眼影像之所有該像素根據所對應各該三維座標值投射至該三維球面;及將所有該像素自該三維球面藉由等距柱狀投影映射回二維平面以產生攤平魚眼影像。 In the above-mentioned method, further comprising performing the flattening of the fisheye image according to the nonlinear relationship, it includes the following sub-steps: obtaining two-dimensional plane coordinates of pixels in the fisheye image based on the center point of the fisheye image Calculate the second distance between the pixel and the center point of the fisheye image according to the two-dimensional plane coordinate value of the pixel; calculate the second distance according to the nonlinear relationship to calculate the elevation angle of the pixel to the three-dimensional spherical surface, and according to The two-dimensional plane coordinate value of the pixel calculates the horizontal angle of the pixel projected to the three-dimensional spherical surface; calculates the three-dimensional projection of the pixel to the three-dimensional spherical surface according to the elevation angle and the horizontal angle dimensional coordinate values; project all the pixels of the fisheye image to the 3D sphere according to the corresponding 3D coordinate values; and map all the pixels from the 3D sphere back to a 2D plane by equidistant cylindrical projection to generate Flatten the fisheye image.

在上述之方法中,復包括:將該攤平魚眼影像中具有連續景物之二者進行縫合,以獲得全景影像。 In the above-mentioned method, the method further comprises: stitching the two continuous scenes in the flattened fisheye image to obtain a panoramic image.

本發明復提供一種電腦可讀儲存媒介,應用於電腦中,係儲存有指令,以執行如上述之用於影像縫合優化之方法。 The present invention further provides a computer-readable storage medium, which is applied to a computer and stores instructions for executing the above-mentioned method for image stitching optimization.

綜上所述,本發明之用於影像縫合優化之方法及電腦可讀媒介係藉由計算相機所拍攝被攝物之魚眼影像與實體間對應的非線性變形關係,得出將魚眼影像之各像素投射至三維球面並映射回二維平面的攤平魚眼影像,再進行連續之魚眼影像的縫合,故能大幅減少魚眼影像攤平並縫合時所產生縫合殘影及畫面斷裂的問題,達到較佳之影像縫合優化之效果。 To sum up, the method and computer-readable medium for image stitching optimization of the present invention obtain the fisheye image by calculating the corresponding nonlinear deformation relationship between the fisheye image of the subject captured by the camera and the entity. Each pixel is projected to a 3D spherical surface and mapped back to a flat fisheye image of a 2D plane, and then continuous fisheye images are stitched, which can greatly reduce the stitching afterimage and screen breakage generated when the fisheye image is flattened and stitched. problem, to achieve better image stitching optimization effect.

10:相機 10: Camera

20:被攝物 20: Subject

21:標記點 21: Mark Points

m:像素 m: pixel

O:球心 O: ball center

o:魚眼影像中心點 o: center point of fisheye image

Q:入射光 Q: Incident light

q:標點 q: punctuation

r:距離 r: distance

rm:距離 r m : distance

S1~S10:步驟 S1~S10: Steps

W:常數 W: constant

θm:仰角 θ m : elevation angle

φ:水平角 φ: horizontal angle

本案揭露之具體實施例將搭配下列圖式詳述,這些說明顯示在下列圖式: The specific embodiments disclosed in this case will be described in detail with the following drawings, and these descriptions are shown in the following drawings:

圖1係揭示本發明之用於影像縫合優化之方法的步驟流程圖; FIG. 1 is a flowchart showing the steps of the method for image stitching optimization of the present invention;

圖2係揭示本發明之用於影像縫合優化之方法的實施階段示意圖; FIG. 2 is a schematic diagram showing the implementation stage of the method for image stitching optimization of the present invention;

圖3係揭示本發明之用於影像縫合優化之方法的實施階段示意圖; 3 is a schematic diagram showing the implementation stage of the method for image stitching optimization of the present invention;

圖4係揭示本發明之用於影像縫合優化之方法的實施階段示意圖; 4 is a schematic diagram showing the implementation stage of the method for image stitching optimization of the present invention;

圖5係揭示本發明之用於影像縫合優化之方法的實施階段示意圖; FIG. 5 is a schematic diagram showing the implementation stage of the method for image stitching optimization of the present invention;

圖6係揭示本發明之用於影像縫合優化之方法的實施階段示意圖;以及 6 is a schematic diagram showing the implementation stages of the method for image stitching optimization of the present invention; and

圖7係揭示本發明之用於影像縫合優化之方法的實施態樣示意圖。 FIG. 7 is a schematic diagram showing the implementation of the method for image stitching optimization of the present invention.

以下藉由特定的實施例說明本發明之實施方式,熟習此項技藝之人士可由本文所揭示之內容輕易地瞭解本案之其他優點及功效。本說明書所附圖式所繪示之結構、比例、大小等均僅用於配合說明書所揭示之內容,以供熟悉此技藝之人士之瞭解與閱讀,非用於限定本發明可實施之限定條件,故任何修飾、改變或調整,在不影響本案所能產生之功效及所能達成之目的下,均應仍落在本發明所揭示之技術內容得能涵蓋之範圍內。 The embodiments of the present invention are described below by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed herein. The structures, proportions, sizes, etc. shown in the drawings in this specification are only used to cooperate with the contents disclosed in the specification for the understanding and reading of those skilled in the art, and are not intended to limit the conditions for the implementation of the present invention. Therefore, any modification, change or adjustment should still fall within the scope that the technical content disclosed in the present invention can cover without affecting the effect that the case can produce and the purpose that can be achieved.

圖1係揭示本發明之用於影像縫合優化之方法的步驟流程圖,其中,各步驟S1~S10可藉由以下描述及與下列圖式的實施階段示意圖結合清楚理解。 FIG. 1 is a flow chart showing the steps of the method for image stitching optimization of the present invention, wherein each step S1 - S10 can be clearly understood by the following description and the schematic diagrams of the implementation stages in the following figures.

在步驟S1處,如圖2所示,可於相機(例如,魚眼相機,或其他適於產生全景影像的拍攝設備)10前方準備一被攝物20,所述被攝物20具有複數個標記點21(如元件符號21所示的棋盤圖案表面),以作為被攝物20於所拍攝魚眼影 像中被變形或扭曲的參考。其中,相機10可相對其腳架之軸心樞轉,故能取得相機10在不同拍攝角度下拍攝被攝物20的魚眼影像。 At step S1, as shown in FIG. 2, a subject 20 can be prepared in front of the camera (eg, a fisheye camera, or other photographing equipment suitable for generating panoramic images) 10, and the subject 20 has a plurality of Mark the dots 21 (the surface of the checkerboard pattern as indicated by the reference numeral 21) as the subject 20 in the fish-eye shadow captured Deformed or distorted reference in the image. The camera 10 can pivot relative to the axis of the tripod, so that fisheye images of the subject 20 captured by the camera 10 at different shooting angles can be obtained.

在步驟S2處,如圖3所示,可依固定角度α向同一方向進行相機10之樞轉並拍攝包括被攝物20的魚眼影像。亦即,每次相機10進行拍攝時被攝物20與相機10光軸之夾角將較前一次增加α度,而所得魚眼影像中各標記點21與相機10的關係係如圖3中環繞相機10的影像一般,呈圓周的方式分布。須知,對於每次樞轉相機10所增加光軸與被攝物20之夾角α的值可根據操作需求而改變,在本文中並不特別限定。 At step S2 , as shown in FIG. 3 , the camera 10 can be pivoted in the same direction according to a fixed angle α to capture a fisheye image including the subject 20 . That is, each time the camera 10 shoots, the angle between the subject 20 and the optical axis of the camera 10 will increase by α degree compared with the previous time, and the relationship between the marker points 21 in the obtained fisheye image and the camera 10 is circled as shown in FIG. 3 . The images of the camera 10 are generally distributed in a circular manner. It should be noted that, the value of the included angle α between the optical axis and the subject 20 for each pivoting of the camera 10 can be changed according to operational requirements, which is not particularly limited herein.

在一替代實施例中,亦可在不旋轉相機10下,將被攝物20之標記點21面向相機10,並以固定半徑的圓周繞著相機10以每次增加夾角α的方式進行圓周移動,同樣可產生被攝物20與相機10光軸之不同夾角的魚眼影像。然而,根據影像縫合優化的效果需求,本文對相機10之旋轉或被攝物20之圓周移動方式並不特別限定。進一步地,上述相機10之旋轉或被攝物20之圓周移動方式可以手動或自動方式進行,本文對此亦不特別限定。 In an alternative embodiment, without rotating the camera 10 , the marking point 21 of the subject 20 may face the camera 10 , and move around the camera 10 with a fixed radius around the camera 10 by increasing the included angle α each time. , the fisheye images of different angles between the optical axis of the subject 20 and the camera 10 can also be generated. However, according to the effect requirements of image stitching optimization, the rotation of the camera 10 or the circular movement of the subject 20 is not particularly limited herein. Further, the rotation of the camera 10 or the circular movement of the subject 20 can be performed manually or automatically, which is not particularly limited herein.

在步驟S3處,如圖4所示,在拍攝被攝物20與相機10光軸不同夾角的魚眼影像時,將紀錄每張魚眼影像中被攝物20之各標記點21相對魚眼影像中心點o(即,相機10光軸處)的距離(此時以代號r表示)、以及被攝物20當下與相機10光軸之夾角(此時以代號θ表示),並以(θ,r)之配對數據的形式紀錄。 At step S3, as shown in FIG. 4, when shooting fisheye images with different angles between the optical axis of the subject 20 and the camera 10, the relative fisheye relative to the fisheye of each marking point 21 of the subject 20 in each fisheye image will be recorded The distance from the center point o of the image (that is, at the optical axis of the camera 10) (represented by the code r at this time), and the angle between the subject 20 and the optical axis of the camera 10 (represented by the code θ at this time), and represented by ( θ ,r ) in the form of paired data records.

在一實施例中,以相機10每次旋轉的角度α為20度的情況進行拍攝,則所紀錄的被攝物20之各標記點21相對魚眼影像中心點o的距離r及被攝物20當下與相機10光軸之夾角θ例如可表示為以下數學式: In one embodiment, the camera 10 is shot with the angle α of each rotation being 20 degrees, then the recorded distance r of each marked point 21 of the subject 20 relative to the center point o of the fisheye image and the subject The angle θ between the 20 present and the optical axis of the camera 10 can be expressed as the following mathematical formula, for example:

[數學式1]

Figure 110113230-A0101-12-0006-5
[Mathematical formula 1]
Figure 110113230-A0101-12-0006-5

其中,每個夾角θ針對被攝物20之每個標記點均會有各自的距離(例如若一被攝物有20個標記點,則每個夾角θ就會有20個距離(θ,r))。 Among them, each included angle θ will have its own distance for each marked point of the subject 20 (for example, if a subject has 20 marked points, then each included angle θ will have 20 distances ( θ, r )).

接續於步驟S4,上述旋轉相機10(或移動被攝物20)及紀錄配對數據(θ,r)的步驟S2至S3將重複進行直到被攝物20在魚眼影像中的位置回到最初位置(旋轉相機10之夾角α的累加值達到360度或以上時)為止(即,相機10完成一圈旋轉或被攝物20完成一圈圓周移動)。 Following step S4, the above-mentioned steps S2 to S3 of rotating the camera 10 (or moving the subject 20) and recording the pairing data ( θ,r ) will be repeated until the position of the subject 20 in the fisheye image returns to the original position (when the accumulated value of the included angle α of the rotating camera 10 reaches 360 degrees or more) (ie, the camera 10 completes one rotation or the subject 20 completes one circular movement).

須知,本文對於步驟S4處是否重複進行步驟S2至S3之判定並不以相機10完成一圈旋轉或被攝物20完成一圈圓周移動(即,360度)為限,所述判定之標準亦可視相機10之拍攝能力或工作需求而有不同設定。詳細而言,此處限定之一圈旋轉或一圈圓周移動係針對具備二個或多個魚眼鏡頭之相機10(例如,將二個或多個具備180度視角的魚眼鏡頭以互相背對方式配置的相機10)的拍攝視角(總合約360度視角)所設計,然而,對於僅具備一個魚眼鏡頭之相機10,則可設計僅需判斷相機10之旋轉或被攝物20之圓周移動完成半圈(即,180度)即可停止步驟S2至S3的重複執行。 It should be noted that the determination of whether to repeat steps S2 to S3 at step S4 is not limited to the completion of one rotation of the camera 10 or the completion of a circular movement (ie, 360 degrees) of the subject 20, and the criteria for the determination are also There are different settings depending on the shooting capability or work requirements of the camera 10 . Specifically, a circle of rotation or a circle of circular movement as defined herein is for the camera 10 with two or more fisheye lenses (for example, two or more fisheye lenses with a 180-degree viewing angle are positioned away from each other However, for the camera 10 with only one fisheye lens, it can be designed only to determine the rotation of the camera 10 or the circumference of the subject 20. The repeated execution of steps S2 to S3 can be stopped when the movement completes half a circle (ie, 180 degrees).

以上步驟S1至S4係用於取得對相機10所拍攝魚眼影像進行攤平時的校正用數據,藉以於後續步驟找出相機10拍攝魚眼像時被攝物20與其成像變形間的關係。 The above steps S1 to S4 are used to obtain calibration data when flattening the fisheye image captured by the camera 10 , so as to find out the relationship between the subject 20 and its imaging deformation when the camera 10 captures the fisheye image in subsequent steps.

由於在魚眼影像中,隨著被攝物20與相機10光軸的夾角(θ)愈大,被攝物20在魚眼影像中的扭曲程度愈嚴重,而被攝物20之各標記點21在魚眼影 像中相對中心點的距離r亦愈遠,故此關係可視為相機10(魚眼相機)在拍攝被攝物20時入射光角度(即,夾角θ)及成像半徑(即,距離r)的非線性關係。故步驟S5係針對上述關係對於蒐集完成的配對數據(θ,r)執行N次方程式之係數值的求解,如以下數學式所示: In the fisheye image, as the included angle (θ) between the subject 20 and the optical axis of the camera 10 is larger, the distortion of the subject 20 in the fisheye image is more serious, and each marked point of the subject 20 is more serious. 21 is farther from the center point in the fisheye image, so the relationship can be regarded as the incident light angle (that is, the included angle θ) and the imaging radius (that is, the distance of the camera 10 (fisheye camera) when shooting the subject 20 ). r) nonlinear relationship. Therefore, step S5 is to solve the coefficient value of the Nth equation for the collected paired data ( θ, r ) according to the above relationship, as shown in the following mathematical formula:

[數學式2]a 0+a 1+…+a N r N =θ [Math 2] a 0 + a 1 +…+ a N r N = θ

其中,變數值r係代表前述被攝物20之各標記點21在魚眼影像中相對中心點(即,相機10光軸處)的距離; Wherein, the variable value r represents the distance of each marked point 21 of the aforementioned subject 20 relative to the center point (ie, the optical axis of the camera 10 ) in the fisheye image;

其中,函數值θ係代表前述被攝物20當下與相機10光軸之夾角; Wherein, the function value θ represents the angle between the aforementioned subject 20 and the optical axis of the camera 10;

在一實施例中,所述N次方的N值根據不同廠牌、規格的相機10可能不同,藉此提供相機10最佳的影像縫合優化效果,且須知的是,所述N值越大,影像縫合優化的效果愈顯著,然而對於電腦運算的負擔亦愈重,因此對於電腦運算能力較強的設備,會有更顯著的效果。 In one embodiment, the N value of the N-th power may be different according to cameras 10 of different brands and specifications, so as to provide the camera 10 with the best image stitching optimization effect, and it should be noted that the larger the N value is, the larger the N value is. , the effect of image stitching optimization is more significant, but the burden on the computer is heavier, so it will have a more significant effect for devices with strong computer computing power.

接著,可將所有紀錄之配對數據(θ,r)(例如,數學式1的所有數值)帶入上述數學式2,以求得N次方程式的a 0a N 的係數值,進而獲得此相機10所拍攝被攝物20與其成像變形間的非線性關係。在本實施例中,係假設所述N次方程式的N值為4,然而,根據不同的相機10廠牌或規格,N值亦可為任意有助於最佳影像縫合優化效果的值,在本文中並不特別限定。 Then, all recorded paired data ( θ, r ) (for example, all the values of Equation 1) can be brought into the above Equation 2 to obtain the coefficient values of a 0 to a N of the Nth-order equation, and then obtain this The nonlinear relationship between the subject 20 captured by the camera 10 and its imaging deformation. In this embodiment, it is assumed that the N value of the N-th degree equation is 4. However, according to different brands or specifications of the camera 10, the N value can also be any value that contributes to the best image stitching optimization effect. It is not particularly limited herein.

須知,前述步驟S1至S5之目的在於利用拍攝測試物(即,被攝物20)以求得相機10所拍攝影像與對應實物間變形的關係,故對於一特定的相機10,只須執行一次步驟S1至S5,即可根據步驟S5得出之數學式2針對後續透過相機10得到的魚眼影像執行步驟S6至S10以進行對應之影像縫合優化。 It should be noted that the purpose of the aforementioned steps S1 to S5 is to obtain the relationship between the deformation of the image captured by the camera 10 and the corresponding object by photographing the test object (ie, the subject 20 ), so for a specific camera 10 , it only needs to be performed once In steps S1 to S5 , steps S6 to S10 can be performed according to the mathematical formula 2 obtained in step S5 for subsequent fisheye images obtained through the camera 10 to perform corresponding image stitching optimization.

如圖5由左至右所示的轉變過程,步驟S6至S8係揭示將魚眼影像中各像素投射至三維球面(類似於模擬魚眼相機將景物之影像納入其鏡頭以產生影像)的過程。此時,由於步驟S5已求得N次方程式(即,數學式2)中a 0a N 各自的係數值,故可在步驟S6將上述數學式2用作計算魚眼影像中任一像素(如圖5中的像素m)投射至三維球面的仰角θmAs shown in the conversion process from left to right in FIG. 5 , steps S6 to S8 reveal the process of projecting each pixel in the fisheye image to a 3D sphere (similar to simulating a fisheye camera that incorporates the image of the scene into its lens to generate an image) . At this time, since the coefficient values of a 0 to a N in the Nth-order equation (ie, the mathematical equation 2) have been obtained in step S5, the mathematical equation 2 can be used to calculate any pixel in the fisheye image in step S6. (pixel m in Figure 5) is projected to the elevation angle θ m of the three-dimensional sphere.

步驟S6的處理流程係包括:將圖5左側所示像素m以魚眼影像中心點o為基準得出其在魚眼影像的二維平面座標值(u,v);根據像素m的二維平面座標值(u,v)計算其相對於魚眼影像中心點o的距離rm;將所得距離rm帶入求得解的數學式2中,以得到像素m投射至三維球面的仰角θm。其中,上述距離rm的計算方式係如以下數學式所示: The processing flow of step S6 includes: taking the pixel m shown on the left side of FIG. 5 as a reference to the center point o of the fisheye image to obtain its two-dimensional plane coordinate value ( u, v ) in the fisheye image; The plane coordinate value ( u, v ) calculates its distance r m relative to the center point o of the fisheye image; the obtained distance r m is brought into the mathematical formula 2 of the solution to obtain the elevation angle θ of the pixel m projected to the three-dimensional spherical surface m . Among them, the calculation method of the above distance rm is shown in the following mathematical formula:

Figure 110113230-A0101-12-0008-4
Figure 110113230-A0101-12-0008-4

接續於步驟S7,根據上述像素m的二維平面座標值(u,v),還可計算像素m投射至三維球面的水平角φ,如以下數學式所示: Continuing from step S7, according to the two-dimensional plane coordinate values ( u, v ) of the above-mentioned pixel m, the horizontal angle φ of the pixel m projected to the three-dimensional spherical surface can also be calculated, as shown in the following mathematical formula:

Figure 110113230-A0101-12-0008-6
Figure 110113230-A0101-12-0008-6

接續至步驟S8,根據計算得出之仰角θm及水平角φ,可計算出魚眼影像中像素m投射至三維球面的座標點q的三維座標值,係如以下數學式所示: Continue to step S8, according to the calculated elevation angle θ m and horizontal angle φ, the three-dimensional coordinate value of the coordinate point q of the pixel m in the fisheye image projected to the three-dimensional spherical surface can be calculated, as shown in the following mathematical formula:

[數學式5]X=W sin θ cos φ,Y=W sin θ sin φ,Z=W cos θ [Equation 5] X=W sin θ cos φ , Y=W sin θ sin φ , Z=W cos θ

其中,數學式5中的W係作為一常數,代表三維球面上任一點(例如,座標點q)相對其球心O的距離,亦等同於魚眼影像的外圍相對於其魚眼影像中心點o的距離; Among them, W in the mathematical formula 5 is used as a constant, representing the distance of any point (for example, the coordinate point q) on the three-dimensional spherical surface relative to the center of the sphere O, which is also equivalent to the periphery of the fisheye image relative to the center point of the fisheye image o the distance;

並且其中,經上述數學式5得出的X、Y及Z值係代表魚眼影像中像素m投射至三維球面的座標點q的三維座標值(X,Y,Z),亦即當相機10拍攝像素m對應之實物時,入射光Q進入三維球面的位置。 And among them, the X, Y and Z values obtained by the above-mentioned mathematical formula 5 represent the three-dimensional coordinate values ( X, Y, Z ) of the coordinate point q of the pixel m projected to the three-dimensional spherical surface in the fisheye image, that is, when the camera 10 When shooting the real object corresponding to the pixel m, the position where the incident light Q enters the three-dimensional spherical surface.

上述步驟S6至S8及圖5所示的轉變過程係針對魚眼影像中的所有像素執行,當計算出魚眼影像中的所有像素投射至三維球面的三維座標值後,可接續執行步驟S9,以將此魚眼影像的各像素利用等距柱狀投影由上述三維球面的座標值映射回二維平面,以產生攤平魚眼影像。如圖6所示的轉變過程,原本的魚眼影像(左側圖)根據計算之各像素於三維球面的三維座標值利用等距柱狀投影(中間圖)進行攤平後,可得到優化之攤平魚眼影像(右側圖)。 The transformation process shown in the above-mentioned steps S6 to S8 and FIG. 5 is performed for all the pixels in the fisheye image. After calculating the three-dimensional coordinate values of all the pixels in the fisheye image projected to the three-dimensional spherical surface, step S9 can be executed successively, Each pixel of the fisheye image is mapped from the coordinate values of the three-dimensional spherical surface back to a two-dimensional plane by equidistant cylindrical projection, so as to generate a flattened fisheye image. As shown in the transformation process shown in Figure 6, the original fisheye image (left image) is flattened according to the calculated 3D coordinate values of each pixel on the 3D spherical surface using the equidistant cylindrical projection (middle image), and an optimized distribution can be obtained. Flat fisheye image (right image).

最後於步驟S10處,可將兩張具有連續景物之攤平魚眼影像(例如,兩張具有180度視角的攤平魚眼影像)進行縫合,以得到優化的360度全景影像。圖7係揭示將兩張魚眼影像攤平並縫合前後的實施態樣示意圖。可以明顯看出,利用上述步驟S1至S10將兩張魚眼影像產生為360度全景影像的過程中,縫合殘影及畫面斷裂等現象已被大幅優化。 Finally, at step S10 , two flattened fisheye images with continuous scenes (eg, two flattened fisheye images with a viewing angle of 180 degrees) may be stitched to obtain an optimized 360-degree panoramic image. FIG. 7 is a schematic diagram showing the implementation before and after flattening and stitching two fisheye images. It can be clearly seen that in the process of using the above steps S1 to S10 to generate the two fisheye images into a 360-degree panoramic image, phenomena such as stitching afterimages and screen breakage have been greatly optimized.

如先前已描述的,由於對於一特定相機10僅需進行一次前述數學式2中a 0a N 的係數值求值計算,故在步驟S5得到數學式2後,可對於相機10所拍攝任意連續魚眼影像重複進行步驟S6至S10的攤平及縫合,達到影像縫合優化之效果。 As described previously, since only one evaluation calculation of the coefficient values of a 0 to a N in the aforementioned mathematical formula 2 is required for a specific camera 10 , after the mathematical formula 2 is obtained in step S5 , any arbitrary value captured by the camera 10 can be obtained. The flattening and stitching of steps S6 to S10 are repeated for the continuous fisheye images, so as to achieve the effect of image stitching optimization.

本發明另外提供一種電腦可讀儲存媒介,應用於具有處理器及/或記憶體的電腦或計算裝置中,係儲存有指令,電腦或計算裝置透過處理器(例如,CPU、GPU等)及/或記憶體透過指令執行如上所述之影像縫合優化之方法。 The present invention further provides a computer-readable storage medium, which is applied to a computer or computing device having a processor and/or a memory, and stores instructions. The computer or computing device uses the processor (eg, CPU, GPU, etc.) and/or Or the memory can execute the image stitching optimization method described above through the instruction.

綜上所述,本發明之用於影像縫合優化之方法及電腦可讀媒介係藉由計算相機所拍攝被攝物之魚眼影像與實體間對應的非線性變形關係,得出將魚眼影像之各像素投射至三維球面並映射回二維平面的攤平魚眼影像,再進行連續之魚眼影像的縫合,故能大幅減少魚眼影像攤平並縫合時所產生縫合殘影及畫面斷裂的問題,達到較佳之影像縫合優化之效果。 To sum up, the method and computer-readable medium for image stitching optimization of the present invention obtain the fisheye image by calculating the corresponding nonlinear deformation relationship between the fisheye image of the subject captured by the camera and the entity. Each pixel is projected to a 3D spherical surface and mapped back to a flat fisheye image of a 2D plane, and then continuous fisheye images are stitched, which can greatly reduce the stitching afterimage and screen breakage generated when the fisheye image is flattened and stitched. problem, to achieve better image stitching optimization effect.

S1~S10:步驟 S1~S10: Steps

Claims (7)

一種用於影像縫合優化之方法,包括:拍攝被攝物與相機之光軸間具有特定夾角θ之魚眼影像,其中,該被攝物具有複數標記點;紀錄各該魚眼影像中該被攝物之各該標記點至該魚眼影像之中心點的第一距離r與拍攝該魚眼影像時所對應之該特定夾角θ兩者的配對數據(θ,r);以及根據該被攝物之各該標記點至該魚眼影像之中心點的該第一距離r與拍攝該魚眼影像時所對應之該特定夾角θ兩者所紀錄而成之各該配對數據(θ,r)計算代表該相機進行拍攝時入射光與成像半徑間以N次方程式為a0+a1r+…+aNrN=θ所表示的非線性關係,其中,將各該配對數據(θ,r)中該被攝物之各該標記點至該魚眼影像之中心點的該第一距離r與拍攝該魚眼影像時所對應之該特定夾角θ兩者帶入該N次方程式為a0+a1r+…+aNrN=θ中,以利用各該配對數據(θ,r)計算出該N次方程式為a0+a1r+…+aNrN=θ中之複數個係數值a0至aNA method for image stitching optimization, comprising: shooting a fish-eye image with a specific angle θ between a subject and an optical axis of a camera, wherein the subject has a plurality of marking points; recording the subject in each fish-eye image pairing data (θ, r) of the first distance r from each of the marked points of the subject to the center point of the fisheye image and the specific angle θ corresponding to the fisheye image; and according to the subject The paired data (θ, r) recorded from the first distance r from each marker point of the object to the center point of the fisheye image and the specific angle θ corresponding to the fisheye image when shooting The calculation represents the nonlinear relationship between the incident light and the imaging radius when the camera is shooting, which is represented by the Nth-order equation as a 0 +a 1 r+...+a N r N =θ, where the paired data (θ, r ) in the first distance r from the marked point of the subject to the center point of the fisheye image and the specific angle θ corresponding to the fisheye image are brought into the N-th equation as a 0 +a 1 r+...+a N r N = θ, so that the N-th equation is calculated as a 0 +a 1 r+...+a N r N = θ by using the paired data (θ, r). Coefficient values a 0 to a N . 如請求項1所述之方法,其中,該拍攝被攝物與相機之光軸間具有特定夾角之魚眼影像之步驟復包括以下子步驟:以固定角度使該相機繞其腳架軸心樞轉,使該被攝物與該相機之該光軸的該特定夾角為每次樞轉時該固定角度的累加值;以及於該相機每次樞轉時拍攝該被攝物與該相機之該光軸於該特定夾角之該魚眼影像。 The method of claim 1, wherein the step of capturing a fish-eye image with a specific angle between the optical axis of the subject and the camera further comprises the following sub-steps: pivoting the camera around its tripod axis at a fixed angle rotating, so that the specific angle between the subject and the optical axis of the camera is the accumulated value of the fixed angle each time the camera is pivoted; and shooting the subject and the camera each time the camera is pivoted. The fisheye image with the optical axis at the specific angle. 如請求項2所述之方法,其中,該拍攝被攝物與相機之光軸間具有特定夾角之魚眼影像之步驟復包括以下子步驟: 當該特定夾角大於或等於360度時,停止該相機之樞轉及拍攝。 The method of claim 2, wherein the step of capturing a fish-eye image with a specific angle between the subject and the optical axis of the camera further comprises the following sub-steps: When the specific angle is greater than or equal to 360 degrees, the camera is stopped from pivoting and shooting. 如請求項1所述之方法,其中,該配對數據之該第一距離係對應該N次方程式之變數值,而該配對數據之該特定夾角係對應該N次方程式之函數值。 The method of claim 1, wherein the first distance of the paired data corresponds to a variable value of the Nth-degree equation, and the specific included angle of the paired data corresponds to a function value of the Nth-degree equation. 如請求項1所述之方法,復包括根據該非線性關係執行該魚眼影像之攤平,係包括以下子步驟:以該魚眼影像之該中心點為基準獲得該魚眼影像中像素的二維平面座標值;根據該像素的該二維平面座標值計算該像素相距該魚眼影像之該中心點的第二距離;將該第二距離根據該非線性關係計算該像素投射至三維球面的仰角,並根據該像素的該二維平面座標值計算該像素投射至該三維球面的水平角;根據該仰角與該水平角計算該像素投射至該三維球面的三維座標值;將該魚眼影像之所有該像素根據所對應各該三維座標值投射至該三維球面;以及將所有該像素自該三維球面藉由等距柱狀投影映射回二維平面以產生攤平魚眼影像。 The method of claim 1, further comprising performing the flattening of the fisheye image according to the nonlinear relationship, including the following sub-steps: obtaining two pixels of the fisheye image based on the center point of the fisheye image dimensional plane coordinate value; calculate the second distance between the pixel and the center point of the fisheye image according to the two-dimensional plane coordinate value of the pixel; calculate the second distance according to the nonlinear relationship to calculate the elevation angle of the pixel projected to the three-dimensional spherical surface , and calculate the horizontal angle of the pixel projected to the three-dimensional spherical surface according to the two-dimensional plane coordinate value of the pixel; calculate the three-dimensional coordinate value of the pixel projected to the three-dimensional spherical surface according to the elevation angle and the horizontal angle; All the pixels are projected onto the 3D sphere according to the corresponding 3D coordinate values; and all the pixels are mapped from the 3D sphere back to a 2D plane by equidistant cylindrical projection to generate a flattened fisheye image. 如請求項5所述之方法,復包括:將該攤平魚眼影像中具有連續景物之二者進行縫合,以獲得全景影像。 The method according to claim 5, further comprising: stitching two of the flattened fisheye images with continuous scenes to obtain a panoramic image. 一種電腦可讀儲存媒介,應用於電腦中,係儲存有指令,以執行如請求項1至6中任一項所述之用於影像縫合優化之方法。 A computer-readable storage medium used in a computer and storing instructions for executing the method for image stitching optimization as described in any one of claims 1 to 6.
TW110113230A 2021-04-13 2021-04-13 Method for optimizing image stitching and computer readable storage medium TWI769782B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW110113230A TWI769782B (en) 2021-04-13 2021-04-13 Method for optimizing image stitching and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110113230A TWI769782B (en) 2021-04-13 2021-04-13 Method for optimizing image stitching and computer readable storage medium

Publications (2)

Publication Number Publication Date
TWI769782B true TWI769782B (en) 2022-07-01
TW202240534A TW202240534A (en) 2022-10-16

Family

ID=83439474

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110113230A TWI769782B (en) 2021-04-13 2021-04-13 Method for optimizing image stitching and computer readable storage medium

Country Status (1)

Country Link
TW (1) TWI769782B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109362234A (en) * 2016-04-28 2019-02-19 深圳市大疆创新科技有限公司 System and method for obtaining Spherical Panorama Image
CN110009567A (en) * 2019-04-09 2019-07-12 三星电子(中国)研发中心 For fish-eye image split-joint method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109362234A (en) * 2016-04-28 2019-02-19 深圳市大疆创新科技有限公司 System and method for obtaining Spherical Panorama Image
CN110009567A (en) * 2019-04-09 2019-07-12 三星电子(中国)研发中心 For fish-eye image split-joint method and device

Also Published As

Publication number Publication date
TW202240534A (en) 2022-10-16

Similar Documents

Publication Publication Date Title
CN110336987B (en) Projector distortion correction method and device and projector
WO2018214365A1 (en) Image correction method, apparatus, device, and system, camera device, and display device
TW201915944A (en) Image processing method, apparatus, and storage medium
WO2018077071A1 (en) Panoramic image generating method and apparatus
JPWO2018235163A1 (en) Calibration apparatus, calibration chart, chart pattern generation apparatus, and calibration method
TWI700000B (en) Image stabilization method and apparatus for panoramic video, and method for evaluating image stabilization algorithm
CN101132535A (en) Multi-projection large screen split-joint method based on rotating platform
WO2021208486A1 (en) Camera coordinate transformation method, terminal, and storage medium
WO2020232971A1 (en) Fisheye camera calibration system, method and apparatus, and electronic device and storage medium
CN111866523B (en) Panoramic video synthesis method and device, electronic equipment and computer storage medium
KR100614004B1 (en) An automated method for creating 360 degrees panoramic image
TWI615808B (en) Image processing method for immediately producing panoramic images
CN114549289A (en) Image processing method, image processing device, electronic equipment and computer storage medium
CN114004890B (en) Attitude determination method and apparatus, electronic device, and storage medium
CN113259642B (en) Film visual angle adjusting method and system
CN108765582B (en) Panoramic picture display method and device
CN111131801A (en) Projector correction system and method and projector
WO2023221969A1 (en) Method for capturing 3d picture, and 3d photographic system
TWI769782B (en) Method for optimizing image stitching and computer readable storage medium
Corke et al. Image Formation
CN111353945B (en) Fisheye image correction method, device and storage medium
CN110163922B (en) Fisheye camera calibration system, fisheye camera calibration method, fisheye camera calibration device, electronic equipment and storage medium
JP6901580B2 (en) Horizontal calibration method of panoramic image or video, system and mobile terminal
CN111131689B (en) Panoramic image restoration method and system
CN115147268A (en) Live view method, panoramic camera, and computer-readable storage medium