TWI839241B - Image processing device and method for viewing angle conversion - Google Patents

Image processing device and method for viewing angle conversion Download PDF

Info

Publication number
TWI839241B
TWI839241B TW112121005A TW112121005A TWI839241B TW I839241 B TWI839241 B TW I839241B TW 112121005 A TW112121005 A TW 112121005A TW 112121005 A TW112121005 A TW 112121005A TW I839241 B TWI839241 B TW I839241B
Authority
TW
Taiwan
Prior art keywords
image
key point
point set
current image
current
Prior art date
Application number
TW112121005A
Other languages
Chinese (zh)
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 TW112121005A priority Critical patent/TWI839241B/en
Application granted granted Critical
Publication of TWI839241B publication Critical patent/TWI839241B/en

Links

Landscapes

  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

An image processing device for viewing angle conversion is provided, which comprises an image capturing circuit, a memory and a processor. The processor is configured for processing instructions to perform following operations: performing feature extraction on a previous image and a current image to calculate an optical flow information matrix from a first feature set of the previous image and a second feature set of the current image; estimating positions in the current image corresponding to a second key point set in the previous image by using the optical flow information matrix to store as a third key point set; calculating a current homography matrix between a first key point set and the third key point set; and projecting the target image to a corresponding position on the current image by using the current homography matrix.

Description

用於視角轉換的影像處理裝置以及方法Image processing device and method for perspective conversion

本揭示有關於一種影像處理裝置以及方法。具體而言,本發明係關於一種用於視角轉換的影像處理裝置以及方法。The present disclosure relates to an image processing device and method. Specifically, the present invention relates to an image processing device and method for perspective conversion.

在一般的針對視角轉換的影像處理中,要找到不同視角的影像之間的對應關係,在現行做法中有手動與自動的方式。In general image processing for perspective conversion, in order to find the correspondence between images of different perspectives, there are two current methods: manual and automatic.

然而,手動的方式需要人工對不同影像做預處理,但此方法有時會因人為的誤差(例如,使用者手抖)而造成不精確,且人工的方式也非常耗時且耗力。However, the manual method requires manual pre-processing of different images, which may sometimes be inaccurate due to human errors (eg, hand shaking of the user), and the manual method is also very time-consuming and labor-intensive.

另外,雖然自動的方式目前可使用電腦視覺與深度學習來得出單應性矩陣。然而,現行方式處理一張影像會非常耗時,且會耗費非常大量的運算資源。因為是利用深度學習的方式,將無法對內部參數做微調,進而導致在應用的場地的光影景色與訓練資料不相似時,可能會得出錯誤的單應性矩陣(homography matrix)。In addition, although the automatic method can currently use computer vision and deep learning to obtain the homography matrix. However, the current method is very time-consuming to process an image and consumes a lot of computing resources. Because it uses deep learning, it is impossible to fine-tune the internal parameters, which may result in an incorrect homography matrix when the light and shadow scenery of the application scene is not similar to the training data.

進一步而言,上述現行方法在拍攝位置可能改變的情況下往往需要從新的影像重新計算出視角轉換關係(即,新的單應性矩陣),這將消耗更大量的計算資源。Furthermore, the above conventional methods often need to recalculate the view angle transformation relationship (ie, a new homography matrix) from the new image when the shooting position may change, which consumes more computing resources.

因此,要如何大大降低在拍攝位置可能改變的情況下的運算量且解決視角快速變化的問題是本領域技術人員亟欲解決的問題。Therefore, how to greatly reduce the amount of calculation when the shooting position may change and solve the problem of rapid changes in viewing angle is a problem that technicians in this field are eager to solve.

本揭示提出一種用於視角轉換的影像處理裝置,包括影像擷取電路、記憶體以及處理器。影像擷取電路用以拍攝先前影像以及當前影像;記憶體用以儲存多個指令、場域模板中的目標影像以及場域模板中的第一關鍵點集;以及處理器用以處理多個指令以執行以下運作:對先前影像以及當前影像進行特徵提取運作,以從先前影像的第一特徵集以及當前影像的第二特徵集計算光流資訊矩陣;利用光流資訊矩陣推算先前影像中的第二關鍵點集在當前影像中的位置,以儲存為第三關鍵點集;計算第一關鍵點集以及第三關鍵點集之間的當前單應性矩陣;以及利用當前單應性矩陣將目標影像投影至當前影像上的對應位置。The present disclosure provides an image processing device for viewing angle conversion, including an image capture circuit, a memory and a processor. The image capture circuit is used to capture a previous image and a current image; the memory is used to store a plurality of instructions, a target image in a field template, and a first key point set in the field template; and the processor is used to process the plurality of instructions to execute the following operations: performing feature extraction operations on the previous image and the current image to calculate an optical flow information matrix from a first feature set of the previous image and a second feature set of the current image; using the optical flow information matrix to infer the position of the second key point set in the previous image in the current image to store it as a third key point set; calculating a current homography matrix between the first key point set and the third key point set; and using the current homography matrix to project the target image to a corresponding position on the current image.

本揭示亦提出一種用於視角轉換的影像方法,所述方法包括:拍攝先前影像以及當前影像,並儲存場域模板中的目標影像以及場域模板中的第一關鍵點集;對先前影像以及當前影像進行特徵提取運作,以從先前影像的第一特徵集以及當前影像的第二特徵集計算光流資訊矩陣;利用光流資訊矩陣推算先前影像中的第二關鍵點集在當前影像中的位置,以儲存為第三關鍵點集;計算第一關鍵點集以及第三關鍵點集之間的當前單應性矩陣;以及利用當前單應性矩陣將目標影像投影至當前影像上的對應位置。The present disclosure also proposes an image method for perspective conversion, which includes: shooting a previous image and a current image, and storing a target image in a field template and a first key point set in the field template; performing feature extraction operations on the previous image and the current image to calculate an optical flow information matrix from the first feature set of the previous image and the second feature set of the current image; using the optical flow information matrix to infer the position of the second key point set in the previous image in the current image to store it as a third key point set; calculating a current homography matrix between the first key point set and the third key point set; and using the current homography matrix to project the target image to a corresponding position on the current image.

基於上述,本揭示提供的視角轉換的影像裝置以及方法可利用光流法更新單應性矩陣,以大大降低重新產生單應性矩陣的運算量。此外,更可即時地在不同幀之間更新單應性矩陣,且這樣的做法大大增加在投影至連續的影像之後的流暢感。Based on the above, the image device and method for view angle conversion provided by the present disclosure can use the optical flow method to update the homography matrix, so as to greatly reduce the amount of calculation for regenerating the homography matrix. In addition, the homography matrix can be updated in real time between different frames, and this approach greatly increases the smoothness after projecting onto continuous images.

有鑑於目前一般的針對視角變換的影像處理,其可能因為需要大量人力進行預處理以造成大量人力消耗或是訓練參數無法即時微調。此外,由於要仰賴人力的判斷,這也常常造成經視角變換處理後的影像的誤差。In view of the current general image processing for perspective transformation, it may require a lot of manpower for pre-processing, resulting in a lot of manpower consumption or the training parameters cannot be fine-tuned in real time. In addition, since it relies on human judgment, it often causes errors in the image after perspective transformation processing.

為解決上述問題,本揭示內容提出一種影像處理裝置以及方法,透過色域轉換、找線處理、線段融合、角度差以及距離差的方法以及計算疊合以及未疊合的數量的方法,以大大增加所計算出的單應性矩陣的精準度且可即時對場地的變化進行微調。藉此,可將此高精確度的單應性矩陣用在各種視角變換的影像處理。上述本揭示內容的技術具體以下述實施例為例來進行說明。To solve the above problems, the present disclosure proposes an image processing device and method, which greatly increases the accuracy of the calculated homography matrix and can make fine adjustments to the scene changes in real time through color gamut conversion, line search processing, line segment fusion, angle difference and distance difference methods and methods for calculating the number of overlaps and non-overlaps. In this way, this high-precision homography matrix can be used in image processing with various viewing angle changes. The above-mentioned technology of the present disclosure is specifically described by taking the following embodiments as examples.

參照第1圖,第1圖繪示本揭示一些實施例中的影像處理裝置100的示意圖。如第1圖所示,影像處理裝置100包括影像擷取電路110、記憶體120以及處理器130。處理器130連接於影像擷取電路110以及記憶體120之間。Referring to FIG. 1 , FIG. 1 is a schematic diagram of an image processing device 100 in some embodiments of the present disclosure. As shown in FIG. 1 , the image processing device 100 includes an image capture circuit 110 , a memory 120 , and a processor 130 . The processor 130 is connected between the image capture circuit 110 and the memory 120 .

在一些實施例中,影像處理裝置100可以是任意具有影像處理器的裝置,或者是用以進行提供影像處理功能的裝置,例如可以為計算機、伺服器或處理中心等在此不設限。In some embodiments, the image processing device 100 may be any device having an image processor, or a device for providing image processing functions, such as a computer, a server, or a processing center, etc., which is not limited here.

在本實施例中,影像擷取電路110用以拍攝場域影像IMG1(例如,網球場或足球場的影像)。在一些實施例中,影像擷取電路110可以由各式的影像擷取器實現,例如攝影電路或感光電路等,用以於預設的拍攝範圍(field of view, FoV)內擷取任意場域(例如,網球場、足球場等)的影像。在一些實施例中,場域影像IMG1可以是RGB色彩空間的影像。在一些實施例中,影像擷取電路110可從特定拍攝角度拍攝場域(例如,網球場或足球場)以產生場域影像IMG1。In the present embodiment, the image capture circuit 110 is used to capture a field image IMG1 (e.g., an image of a tennis court or a football field). In some embodiments, the image capture circuit 110 can be implemented by various image capture devices, such as a photographic circuit or a photosensitive circuit, etc., to capture an image of any field (e.g., a tennis court, a football field, etc.) within a preset shooting range (field of view, FoV). In some embodiments, the field image IMG1 can be an image in an RGB color space. In some embodiments, the image capture circuit 110 can capture a field (e.g., a tennis court or a football field) from a specific shooting angle to generate the field image IMG1.

另外,在本實施例中,記憶體120用以儲存多個指令,其用以執行後續段落所描述的詳細步驟。在一些實施例中,這些指令可以是相應的軟體或韌體指令程序。在一些實施例中,記憶體120可以由記憶單元、快閃記憶體、唯讀記憶體、硬碟或任何具相等性的儲存組件等實現。In addition, in this embodiment, the memory 120 is used to store multiple instructions, which are used to execute the detailed steps described in the subsequent paragraphs. In some embodiments, these instructions can be corresponding software or firmware instruction programs. In some embodiments, the memory 120 can be implemented by a memory unit, a flash memory, a read-only memory, a hard disk, or any equivalent storage component.

另外,在本實施例中,處理器130用以處理這些指令並執行以下後續段落所描述的詳細步驟。在一些實施例中,處理器130可以由處理單元、中央處理單元或計算單元等實現。In addition, in this embodiment, the processor 130 is used to process these instructions and execute the detailed steps described in the following paragraphs. In some embodiments, the processor 130 can be implemented by a processing unit, a central processing unit, or a computing unit.

一併參照第2圖,第2圖繪示本揭示一些實施例中的影像處理方法的流程圖,此影像處理方法適用於電子裝置,此電子裝置可以是第1圖的影像處理裝置100,第1圖的影像處理裝置100中的元件用以執行影像處理方法中的步驟S210~S250。如第2圖所示,首先,於步驟S210中,由場域影像IMG1找出多個線段。Referring to FIG. 2, FIG. 2 is a flowchart of an image processing method in some embodiments of the present disclosure. The image processing method is applicable to an electronic device, which may be the image processing device 100 in FIG. 1. The components in the image processing device 100 in FIG. 1 are used to execute steps S210 to S250 in the image processing method. As shown in FIG. 2, first, in step S210, a plurality of line segments are found from the field image IMG1.

在一些實施例中,可將場域影像IMG1由RGB色彩空間轉換為HSV色彩空間的影像,並可根據多個色彩區間將HSV色彩空間的影像轉換為二元影像。接著,可對二元影像執行線偵測運算以產生多個線段。在一些實施例中,線偵測運算可以是霍夫變換或快速線檢測(即,openCV函式庫中的HoughLines函式或FastLineDetector函式)。In some embodiments, the field image IMG1 may be converted from an RGB color space to an image in an HSV color space, and the image in the HSV color space may be converted into a binary image according to a plurality of color intervals. Then, a line detection operation may be performed on the binary image to generate a plurality of line segments. In some embodiments, the line detection operation may be a Hough transform or a fast line detection (i.e., a HoughLines function or a FastLineDetector function in an openCV library).

在一些實施例中,多個色彩區間包括色相區間、飽和度區間以及明度區間。在一些實施例中,二元影像可以是黑白影像。在一些實施例中,更可對二元影像執行線偵測運算以產生多個線段各自的起點座標以及終點座標。在一些實施例中,可根據多個線段各自的起點座標以及終點座標將多個線段標示於場域影像IMG1上。In some embodiments, the plurality of color intervals include a hue interval, a saturation interval, and a brightness interval. In some embodiments, the binary image may be a black and white image. In some embodiments, a line detection operation may be performed on the binary image to generate the start point coordinates and the end point coordinates of the plurality of line segments. In some embodiments, the plurality of line segments may be marked on the field image IMG1 according to the start point coordinates and the end point coordinates of the plurality of line segments.

以下以實際例子說明二元影像的產生。一併參照第3圖,第3圖繪示本揭示一些實施例中的二元影像BIMG的產生的示意圖。如第3圖所示,假設色相區間為0~180,飽和度區間為0~100,以及明度區間為180~255,可先將場域影像IMG1從RGB色彩空間轉換至HSV色彩空間。The generation of a binary image is described below with an actual example. Referring to FIG. 3 , FIG. 3 is a schematic diagram showing the generation of a binary image BIMG in some embodiments of the present disclosure. As shown in FIG. 3 , assuming that the hue range is 0-180, the saturation range is 0-100, and the brightness range is 180-255, the field image IMG1 can be first converted from the RGB color space to the HSV color space.

當HSV色彩空間的影像中的像素的色相在0~180中,HSV色彩空間的影像中的像素的飽和度在0~100中,以及HSV色彩空間的影像中的像素的明度在180~255中時,可將HSV色彩空間的影像中的此像素設定為白色。When the hue of a pixel in the image in the HSV color space is in the range of 0 to 180, the saturation of the pixel in the image in the HSV color space is in the range of 0 to 100, and the lightness of the pixel in the image in the HSV color space is in the range of 180 to 255, the pixel in the image in the HSV color space may be set to white.

反之,當HSV色彩空間的影像中的像素的色相不在0~180中,或HSV色彩空間的影像中的像素的飽和度不在0~100中,或HSV色彩空間的影像中的像素的明度不在180~255中時,可將HSV色彩空間的影像中的此像素設定為黑色。藉此,可將HSV色彩空間的影像轉換為二元影像BIMG(即,黑白影像)。On the contrary, when the hue of a pixel in the HSV color space image is not in the range of 0 to 180, or the saturation of a pixel in the HSV color space image is not in the range of 0 to 100, or the brightness of a pixel in the HSV color space image is not in the range of 180 to 255, the pixel in the HSV color space image can be set to black. In this way, the image in the HSV color space can be converted into a binary image BIMG (i.e., a black and white image).

以下以實際例子說明場域影像IMG1上所產生的線段。一併參照第4圖,第4圖繪示本揭示一些實施例中的從場域影像IMG1產生多個線段LS1~LS12的示意圖。如第4圖所示,藉由上述線偵測運算從場域影像IMG1產生線段LS1~LS12,並將線段LS1~LS12標示於場域影像IMG1上。The following is an actual example to illustrate the line segments generated on the field image IMG1. Referring to FIG. 4, FIG. 4 is a schematic diagram showing the generation of multiple line segments LS1-LS12 from the field image IMG1 in some embodiments of the present disclosure. As shown in FIG. 4, the line segments LS1-LS12 are generated from the field image IMG1 by the above-mentioned line detection operation, and the line segments LS1-LS12 are marked on the field image IMG1.

再者,如第2圖所示,於步驟S220中,根據多個線段執行融合運算以產生多個融合線。Furthermore, as shown in FIG. 2 , in step S220 , a fusion operation is performed based on a plurality of line segments to generate a plurality of fused lines.

在一些實施例中,融合運算可包括:計算多個線段中的一者以及多個線段中的另一者之間的線段夾角以及最大距離。接著,可根據線段夾角以及最大距離決定多個線段中的一者以及多個線段中的另一者是否融合。In some embodiments, the fusion operation may include: calculating the segment angle and the maximum distance between one of the multiple line segments and another of the multiple line segments. Then, it may be determined whether the one of the multiple line segments and the other of the multiple line segments are fused according to the segment angle and the maximum distance.

在一些實施例中,可判斷是否線段夾角小於夾角閾值且最大距離小於距離閾值。當判斷線段夾角小於夾角閾值且最大距離小於距離閾值時,可將多個線段中的一者以及多個線段中的另一者融合為多個融合線中的一者。In some embodiments, it may be determined whether the line segment angle is less than the angle threshold and the maximum distance is less than the distance threshold. When it is determined that the line segment angle is less than the angle threshold and the maximum distance is less than the distance threshold, one of the multiple line segments and another of the multiple line segments may be merged into one of the multiple merged lines.

詳細而言,可任意挑選多個線段中的二者,並判斷兩個挑選的線段是否能融合。當可以融合時,可執行融合運算以計算出其中一融合線的直線方程式。以第4圖為例,可從線段LS1~LS12任意選出二者(例如選擇線段LS1、LS3)以判斷兩個挑選的線段是否能融合以計算出一個直線方程式。即,可對線段LS1~LS12進行66次選擇以判斷是否能融合以計算出多個直線方程式。Specifically, two of the multiple line segments can be randomly selected, and it is determined whether the two selected line segments can be merged. When they can be merged, a fusion operation can be performed to calculate the straight line equation of one of the merged lines. Taking FIG. 4 as an example, two of the line segments LS1 to LS12 can be randomly selected (for example, line segments LS1 and LS3 can be selected) to determine whether the two selected line segments can be merged to calculate a straight line equation. That is, 66 selections can be made on line segments LS1 to LS12 to determine whether they can be merged to calculate multiple straight line equations.

在一些實施例中,可利用任意的線段融合處理對多個線段中的一者以及多個線段中的另一者進行融合。在一些實施例中,線段融合處理可以是感知準確線段融合(perceptually accurate line segment merging)演算法、線性回歸(linear regression)演算法或線參數平均演算法(例如,計算兩個線段的起點座標(或終點座標)的平均值以及斜率的平均值以根據起點座標(或終點座標)的平均值以及斜率的平均值產生一個線方程式)等。In some embodiments, one of the multiple line segments and another of the multiple line segments may be fused using any line segment fusion process. In some embodiments, the line segment fusion process may be a perceptually accurate line segment merging algorithm, a linear regression algorithm, or a line parameter averaging algorithm (e.g., calculating the average of the starting point coordinates (or end point coordinates) and the average of the slopes of two line segments to generate a line equation according to the average of the starting point coordinates (or end point coordinates) and the average of the slopes), etc.

以下以實際的例子說明線段夾角以及最大距離。一併參照第5圖,第5圖繪示本揭示一些實施例中的線段夾角 的示意圖。如第5圖所示,假設挑選出線段L1~L2,線段L1的延伸線EL與線段L2之間存在線段夾角 。藉此,可判斷線段夾角 是否小於夾角閾值。 The following is an actual example to illustrate the line segment angle and the maximum distance. Referring to FIG. 5 , FIG. 5 shows the line segment angle in some embodiments of the present disclosure. As shown in Figure 5, assume that line segments L1 and L2 are selected, and there is a line segment angle between the extended line EL of line segment L1 and line segment L2. . In this way, the angle between line segments can be determined. Is it less than the angle threshold?

此外,為便於理解本揭露的最大距離如何計算,請一併參照第6圖。第6圖繪示本揭示一些實施例中的最大距離d的示意圖。須說明者,線段L2上任一點至線段L1均對應至一垂直距離,其中距離數值最大的垂直距離即定義為最大距離d。In addition, to facilitate understanding of how the maximum distance of the present disclosure is calculated, please refer to FIG. 6. FIG. 6 is a schematic diagram of the maximum distance d in some embodiments of the present disclosure. It should be noted that any point on the line segment L2 to the line segment L1 corresponds to a vertical distance, wherein the vertical distance with the largest distance value is defined as the maximum distance d.

於本範例中,假設處理器130挑選出線段L1~L2,如第6圖所示,線段L1與線段L2之間存在最大距離d。藉此,處理器130可判斷線段L1與線段L2之間存在的最大距離d是否小於距離閾值。In this example, it is assumed that the processor 130 selects line segments L1-L2, and as shown in FIG6, there is a maximum distance d between line segment L1 and line segment L2. Thus, the processor 130 can determine whether the maximum distance d between line segment L1 and line segment L2 is less than a distance threshold.

以下以實際的例子說明多個融合線。一併參照第7圖,第7圖繪示本揭示一些實施例中的場域影像IMG1中的多個融合線IL1~IL10的示意圖。如第7圖所示,可根據融合線IL1~IL10的直線方程式將融合線IL1~IL10標示於場域影像IMG1。The following describes multiple fusion lines using an actual example. Referring to FIG. 7 , FIG. 7 is a schematic diagram showing multiple fusion lines IL1 to IL10 in a field image IMG1 in some embodiments of the present disclosure. As shown in FIG. 7 , the fusion lines IL1 to IL10 can be marked on the field image IMG1 according to the straight line equations of the fusion lines IL1 to IL10.

再者,如第2圖所示,於步驟S230中,由多個融合線區分出第一群組及第二群組。Furthermore, as shown in FIG. 2 , in step S230 , a first group and a second group are distinguished by a plurality of fusion lines.

在一些實施例中,可根據斜率閾值由多個融合線區分出第一群組及第二群組。在一些實施例中,可將大於斜率閾值的融合線做為第一群組的融合線,並將不大於斜率閾值的融合線做為第二群組的融合線。In some embodiments, a first group and a second group may be distinguished by a plurality of blend lines according to a slope threshold. In some embodiments, a blend line greater than the slope threshold may be used as a blend line for the first group, and a blend line not greater than the slope threshold may be used as a blend line for the second group.

在一些實施例中,以場域影像IMG1的最左側的中間點為基準,可計算第一群組的多個融合線的最小距離,並根據第一群組的多個融合線的最小距離排序第一群組的多個融合線。在一些實施例中,以場域影像IMG1的最上側的中間點為基準,可計算第二群組的多個融合線的最小距離,並根據第二群組的多個融合線的最小距離排序第二群組的多個融合線。 以第7圖為例,如第7圖所示,可根據斜率閾值由融合線IL1~IL10辨識出大於斜率閾值的融合線IL1~IL5以及不大於斜率閾值的融合線IL6~IL10。藉此,可將融合線IL1~IL5做為第一群組,並將融合線IL6~IL10做為第二群組。In some embodiments, the minimum distance of the plurality of fused lines of the first group may be calculated based on the leftmost middle point of the field image IMG1, and the plurality of fused lines of the first group may be sorted according to the minimum distance of the plurality of fused lines of the first group. In some embodiments, the minimum distance of the plurality of fused lines of the second group may be calculated based on the uppermost middle point of the field image IMG1, and the plurality of fused lines of the second group may be sorted according to the minimum distance of the plurality of fused lines of the second group. Taking FIG. 7 as an example, as shown in FIG. 7, the fused lines IL1 to IL5 greater than the slope threshold and the fused lines IL6 to IL10 less than the slope threshold may be identified from the fused lines IL1 to IL10 according to the slope threshold. Thus, the fused lines IL1 to IL5 may be regarded as the first group, and the fused lines IL6 to IL10 may be regarded as the second group.

以下以實際的例子說明第一群組的排序以及第二群組的排序。一併參照第8圖,第8圖繪示本揭示一些實施例中的第一群組的排序的示意圖。如第8圖所示,以影像IMG2的最左側的中間點為基準點LO,計算第一群組的多個融合線VL1~VL5與基準點LO之間的多個最小距離LD1~LD5。藉此,可根據最小距離LD1~LD5依序由融合線VL1排列至融合線VL5。The following uses an actual example to illustrate the sorting of the first group and the sorting of the second group. Referring to FIG. 8 , FIG. 8 is a schematic diagram showing the sorting of the first group in some embodiments of the present disclosure. As shown in FIG. 8 , the leftmost middle point of the image IMG2 is used as the reference point LO, and the minimum distances LD1 to LD5 between the plurality of fusion lines VL1 to VL5 of the first group and the reference point LO are calculated. Thus, the fusion lines VL1 to VL5 can be arranged in sequence according to the minimum distances LD1 to LD5.

此外,一併參照第9圖,第9圖繪示本揭示一些實施例中的第二群組的排序的示意圖。如第9圖所示,以影像IMG3的最上側的中間點為基準點UO,計算第二群組的多個融合線HL1~HL5與基準點UO之間的多個最小距離UD1~UD5。藉此,可根據最小距離UD1~UD5依序由融合線HL1排列至融合線HL5。In addition, refer to FIG. 9, which is a schematic diagram showing the arrangement of the second group in some embodiments of the present disclosure. As shown in FIG. 9, the middle point of the uppermost side of the image IMG3 is used as the reference point UO, and the minimum distances UD1 to UD5 between the plurality of fusion lines HL1 to HL5 of the second group and the reference point UO are calculated. Thus, the fusion lines HL1 to HL5 can be arranged in sequence according to the minimum distances UD1 to UD5.

再者,如第2圖所示,於步驟S240中,從第一群組及第二群組中之融合線之間的多個交點,選擇出至少一第一交點集,並從場域模板,選擇出至少一第二交點集。在一些實施例中,場域模板可以是一個俯瞰場地的場地圖,也可以是以不同與場域影像IMG1的視角拍攝場域所產生的影像。Furthermore, as shown in FIG. 2, in step S240, at least one first intersection point set is selected from the plurality of intersection points between the fusion lines in the first group and the second group, and at least one second intersection point set is selected from the scene template. In some embodiments, the scene template may be a scene map overlooking the scene, or an image generated by photographing the scene at a different viewing angle from the scene image IMG1.

在一些實施例中,選擇出第一交點集以及第二交點集的步驟包括:隨機地選擇第一群組中的二者以及第二群組中的二者,並將第一群組中的二者以及第二群組中的二者之間的四個交點做為至少一第一交點集中的一者。接著,可隨機地從場域模板選擇多個水平場地線中的二者以及多個垂直場地線中的二者,並將多個水平場地線中的二者以及多個垂直場地線中的二者之間的四個交點做為至少一第二交點集中的一者。In some embodiments, the step of selecting the first intersection point set and the second intersection point set includes: randomly selecting two of the first group and two of the second group, and using four intersection points between the two of the first group and the two of the second group as one of at least one first intersection point set. Then, two of the plurality of horizontal field lines and two of the plurality of vertical field lines may be randomly selected from the field template, and using four intersection points between the two of the plurality of horizontal field lines and the two of the plurality of vertical field lines as one of at least one second intersection point set.

在一些實施例中,當先選擇出第一群組中的二者的其中一者時,可根據此其中一者的排序,從場域模板中選擇出其中一垂直場地線。而當先選擇出第二群組中的二者的其中一者時,可根據此其中一者的排序,從場域模板中選擇出其中一水平場地線。藉此,可大大減少後續選擇出第一交點及以及第二交點集的次數,以降低計算量。In some embodiments, when one of the two in the first group is selected first, one of the vertical field lines can be selected from the field template according to the ranking of the one. When one of the two in the second group is selected first, one of the horizontal field lines can be selected from the field template according to the ranking of the one. In this way, the number of times of selecting the first intersection point and the second intersection point set can be greatly reduced, so as to reduce the amount of calculation.

舉例而言,假設先選擇了第一群組中的其中一融合線,且其中一融合線的排序較為前面(即,較靠近場域影像IMG1最左側的中間點),此時,會選擇出靠近場域模板最左側的垂直場地線,而不會選擇靠近場域模板最右側的垂直場地線。反之,假設先選擇了第一群組中的其中另一融合線,且其中另一融合線的排序較為後面(即,較遠離場域影像IMG1最左側的中間點),此時,會選擇出較遠離場域模板最左側的垂直場地線,而不會選擇靠近場域模板最左側的垂直場地線。如此一來,將大大降低選擇的次數。For example, if one of the fusion lines in the first group is selected first, and the fusion line is ranked ahead (i.e., closer to the leftmost middle point of the field image IMG1), then the vertical field line close to the leftmost side of the field template will be selected, and the vertical field line close to the rightmost side of the field template will not be selected. On the contrary, if another fusion line in the first group is selected first, and the fusion line is ranked behind (i.e., farther from the leftmost middle point of the field image IMG1), then the vertical field line farther from the leftmost side of the field template will be selected, and the vertical field line close to the leftmost side of the field template will not be selected. In this way, the number of selections will be greatly reduced.

以下以實際的例子說明場域模板中的水平場地線以及垂直場地線。一併參照第10圖,第10圖繪示本揭示一些實施例中的場域模板TEM1的示意圖。如第10圖所示,場域模板TEM1為網球場的場地圖,場地圖上繪示了多個場地線。接著,可從場域模板TEM1中多個場地線計算出多個水平場地線TL1~TL4的直線方程式以及多個垂直場地線TL5~TL9的直線方程式,並可將場域模板TEM1的原點TO設定在場域模板TEM1的左上角,水平場地線TL1~TL4為多個場地線中的所有水平線,垂直場地線TL5~TL9為多個場地線中的所有垂直線。The horizontal field lines and vertical field lines in the field template are explained below with practical examples. Referring to FIG. 10, FIG. 10 is a schematic diagram of the field template TEM1 in some embodiments of the present disclosure. As shown in FIG. 10, the field template TEM1 is a field map of a tennis court, and a plurality of field lines are drawn on the field map. Then, the straight line equations of the plurality of horizontal field lines TL1~TL4 and the straight line equations of the plurality of vertical field lines TL5~TL9 can be calculated from the plurality of field lines in the field template TEM1, and the origin TO of the field template TEM1 can be set at the upper left corner of the field template TEM1, the horizontal field lines TL1~TL4 are all the horizontal lines in the plurality of field lines, and the vertical field lines TL5~TL9 are all the vertical lines in the plurality of field lines.

以下以實際的例子說明第一群組中的二融合線以及第二群組中的二融合線的選擇。一併參照第11圖,第11圖繪示本揭示一些實施例中的選擇多個融合線IL1、IL5、IL6、IL9的示意圖。如第11圖所述,接續第7圖的例子,可從第7圖中的第一群組中的融合線IL1~IL5隨機選出融合線IL1、IL5,並可從第二群組中的融合線IL6~IL10隨機選出融合線IL6、IL9。接著,可將融合線IL1、IL5以及融合線IL6、IL9之間的四個交點IP1~IP4做為其中一個第一交點集。The following is an actual example to illustrate the selection of two fusion lines in the first group and two fusion lines in the second group. Referring to FIG. 11, FIG. 11 is a schematic diagram showing the selection of multiple fusion lines IL1, IL5, IL6, and IL9 in some embodiments of the present disclosure. As described in FIG. 11, continuing the example of FIG. 7, fusion lines IL1 and IL5 can be randomly selected from fusion lines IL1 to IL5 in the first group in FIG. 7, and fusion lines IL6 and IL9 can be randomly selected from fusion lines IL6 to IL10 in the second group. Then, the four intersections IP1 to IP4 between fusion lines IL1 and IL5 and fusion lines IL6 and IL9 can be used as one of the first intersection sets.

以下以實際的例子說明兩條水平場地線以及兩條垂直場地線的選擇。一併參照第12圖,第12圖繪示本揭示一些實施例中的選擇兩條水平場地線TL1、TL4以及兩條垂直場地線TL5、TL6的示意圖。如第12圖所述,接續第10圖的例子,可從第10圖中的場域模板TEM1中的水平場地線TL1~TL4隨機選出水平場地線TL1、IL4,並可從垂直場地線TL5~TL9隨機選出垂直場地線TL5、TL6。接著,可將水平場地線TL1、IL4以及垂直場地線TL5、TL6之間的四個交點TP1~TP4做為其中一個第二交點集。The following is an actual example to illustrate the selection of two horizontal field lines and two vertical field lines. Referring to FIG. 12, FIG. 12 is a schematic diagram showing the selection of two horizontal field lines TL1, TL4 and two vertical field lines TL5, TL6 in some embodiments of the present disclosure. As described in FIG. 12, continuing the example of FIG. 10, horizontal field lines TL1, IL4 can be randomly selected from the horizontal field lines TL1~TL4 in the field template TEM1 in FIG. 10, and vertical field lines TL5, TL6 can be randomly selected from the vertical field lines TL5~TL9. Then, the four intersection points TP1~TP4 between the horizontal field lines TL1, IL4 and the vertical field lines TL5, TL6 can be used as one of the second intersection point sets.

換言之,藉由上述隨機地選擇第一群組中的二者以及第二群組中的二者且隨機地從場域模板選擇多個水平場地線中的二者以及多個垂直場地線中的二者的方法,以第7圖以及第10圖為例,可能產生6000種選擇結果。In other words, by the above method of randomly selecting two of the first group and two of the second group and randomly selecting two of the plurality of horizontal field lines and two of the plurality of vertical field lines from the field template, taking Figures 7 and 10 as examples, 6,000 selection results may be generated.

再者,如第2圖所示,於步驟S250中,計算至少一第一交點集以及至少一第二交點集之間的至少一單應性矩陣(homography matrix)。Furthermore, as shown in FIG. 2 , in step S250 , at least one homography matrix between at least one first intersection point set and at least one second intersection point set is calculated.

在一些實施例中,至少一單應性矩陣為用以由場域模板的座標轉換至場域影像IMG1的座標的單應性矩陣。舉例而言,場域影像IMG1可以是由電視轉播拍攝視角所拍攝的網球場的影像,場域模板可以是一個俯瞰網球場的場地圖,而單應性矩陣可以是此影像以及場地圖之間的轉換矩陣。此外,只要從此影像取出至少四個點(即,上述其中一第一交點集)以及從場地圖取出至少四個對應點(即,上述對應的其中一第二交點集)就能計算出此單應性矩陣。舉例而言,以第11圖以及第12圖為例,可根據場域影像IMG1中的交點IP1~IP4以及場域模板TEM1中的交點TP1~TP4計算出場域影像IMG1以及場域模板TEM1之間的單應性矩陣。In some embodiments, at least one homography matrix is a homography matrix used to convert the coordinates of the field template to the coordinates of the field image IMG1. For example, the field image IMG1 can be an image of a tennis court shot from a television broadcast shooting angle, the field template can be a field map overlooking the tennis court, and the homography matrix can be a conversion matrix between the image and the field map. In addition, the homography matrix can be calculated by taking at least four points from the image (i.e., one of the first intersection points mentioned above) and taking at least four corresponding points from the field map (i.e., one of the corresponding second intersection points mentioned above). For example, taking FIG. 11 and FIG. 12 as examples, the homography matrix between the field image IMG1 and the field template TEM1 can be calculated based on the intersection points IP1-IP4 in the field image IMG1 and the intersection points TP1-TP4 in the field template TEM1.

值得注意的是,單應性矩陣為本領域針對兩個不同視角拍攝同一場景所產生的兩個平面影像之間的轉換矩陣,因此,不再對單應性矩陣的計算加以贅述。It is worth noting that the homography matrix is a transformation matrix between two planar images generated by shooting the same scene from two different viewing angles in this field. Therefore, the calculation of the homography matrix will not be elaborated.

在一些實施例中,在計算單應性矩陣後,可對單應性矩陣執行準確度運算,以產生對應的轉換分數。接著,可利用具有最高的轉換分數的單應性矩陣將待疊合模板疊合於場域影像IMG1以產生疊合影像。在一些實施例中,也可利用複數個最高的轉換分數的單應性矩陣(例如,最高的10個轉換分數的單應性矩陣)將待疊合模板疊合於場域影像IMG1以產生多個疊合影像。In some embodiments, after calculating the homography matrix, the accuracy operation can be performed on the homography matrix to generate a corresponding conversion score. Then, the template to be superimposed can be superimposed on the field image IMG1 using the homography matrix with the highest conversion score to generate a superimposed image. In some embodiments, the template to be superimposed can also be superimposed on the field image IMG1 using a plurality of homography matrices with the highest conversion scores (e.g., homography matrices with the highest 10 conversion scores) to generate multiple superimposed images.

在一些實施例中,準確度運算可包括:針對單應性矩陣中的各者,執行以下步驟:可對第一群組以及第二群組進行視角轉換。接著,可計算轉換的第一群組的各者與場域模板中的對應的垂直場地線之間的第一角度差以及第一距離差,並根據多個第一角度差以及多個第一距離差,計算轉換的第一群組中的各者的第一分數。接著,可計算轉換的第二群組中的各者與場域模板中的對應的水平場地線之間的第二角度差以及第二距離差,並根據多個第二角度差以及多個第二距離差,計算轉換的第二群組中的各者的第二分數。接著,可根據多個第一分數以及多個第二分數計算出多個轉換分數中的一者。In some embodiments, the accuracy calculation may include: for each of the homography matrices, performing the following steps: a first group and a second group may be subjected to a perspective transformation. Then, a first angle difference and a first distance difference between each of the transformed first group and a corresponding vertical field line in the field template may be calculated, and a first score for each of the transformed first group may be calculated based on a plurality of first angle differences and a plurality of first distance differences. Then, a second angle difference and a second distance difference between each of the transformed second group and a corresponding horizontal field line in the field template may be calculated, and a second score for each of the transformed second group may be calculated based on a plurality of second angle differences and a plurality of second distance differences. Then, one of a plurality of transformation scores may be calculated based on the plurality of first scores and the plurality of second scores.

在一些實施例中,可計算其中一第一角度差與一個預設角度之間的商數,並計算其中一第一角度差的商數的雙曲正切函數。接著,可計算其中一第一距離差與一個預設距離之間的商數,並計算其中一第一距離差的商數的雙曲正切函數。接著,根據角度權重、距離權重、其中一第一角度差的商數的雙曲正切函數以及其中一第一距離差的多個商數的雙曲正切函數,計算出轉換的第一群組中的其中一者的第一分數。In some embodiments, a quotient between one of the first angle differences and a preset angle may be calculated, and a hyperbolic tangent function of the quotient of one of the first angle differences may be calculated. Then, a quotient between one of the first distance differences and a preset distance may be calculated, and a hyperbolic tangent function of the quotient of one of the first distance differences may be calculated. Then, a first score of one of the first groups of transformations may be calculated based on the angle weight, the distance weight, the hyperbolic tangent function of the quotient of one of the first angle differences, and the hyperbolic tangent functions of the multiple quotients of one of the first distance differences.

在一些實施例中,可計算其中一第二角度差與一個預設角度之間的商數,並計算其中一第二角度差的商數的雙曲正切函數。接著,可計算其中一第二距離差與一個預設距離之間的多個商數,並計算其中一第二距離差的商數的雙曲正切函數。接著,根據角度權重、距離權重、其中一第二角度差的多個商數的雙曲正切函數以及其中一第二距離差的多個商數的雙曲正切函數,計算出轉換的第二群組中的其中一者的第二分數。In some embodiments, a quotient between one of the second angle differences and a preset angle may be calculated, and a hyperbolic tangent function of the quotient of one of the second angle differences may be calculated. Then, multiple quotients between one of the second distance differences and a preset distance may be calculated, and a hyperbolic tangent function of the quotient of one of the second distance differences may be calculated. Then, a second score of one of the second groups of transformations may be calculated based on the angle weight, the distance weight, the hyperbolic tangent function of the multiple quotients of one of the second angle differences, and the hyperbolic tangent function of the multiple quotients of one of the second distance differences.

以下以實際的例子說明轉換分數的計算。一併參照第13圖,第13圖繪示本揭示一些實施例中的場域模板TEM1上的多個轉換線TSL1~TSL10的示意圖。如第7圖、第10圖以及第13圖所示,延續第11圖以及的12圖的例子,假設基於第11圖以及的12圖的選擇可計算出場域影像IMG1以及場域模板TEM1之間的單應性矩陣,可利用此單應性矩陣將場域影像IMG1中的融合線IL1~IL10轉換為場域模板TEM1上的轉換線TSL1~TSL10的直線方程式(即,進行上述的視角轉換),其中融合線IL6~IL10為第一群組的融合線,融合線IL1~IL5為第二群組的融合線,轉換線TSL6~TSL10為轉換的第一群組的轉換線,轉換線TSL1~TSL5為轉換的第二群組的轉換線。The calculation of the conversion score is described below with an actual example. Referring to FIG. 13 , FIG. 13 is a schematic diagram showing a plurality of conversion lines TSL1 - TSL10 on a field template TEM1 in some embodiments of the present disclosure. As shown in Figures 7, 10 and 13, continuing with the examples of Figures 11 and 12, assuming that the homography matrix between the field image IMG1 and the field template TEM1 can be calculated based on the selection of Figures 11 and 12, this homography matrix can be used to convert the fusion lines IL1~IL10 in the field image IMG1 into straight line equations of transformation lines TSL1~TSL10 on the field template TEM1 (i.e., perform the above-mentioned viewing angle conversion), wherein the fusion lines IL6~IL10 are the fusion lines of the first group, the fusion lines IL1~IL5 are the fusion lines of the second group, the transformation lines TSL6~TSL10 are the transformation lines of the transformed first group, and the transformation lines TSL1~TSL5 are the transformation lines of the transformed second group.

進一步而言,由於轉換線TSL1是由第二群組中的融合線IL1轉換而來的,可根據轉換線TSL1,從場域模板TEM1中的水平場地線TL1~TL4中找出對應的水平場地線。Furthermore, since the conversion line TSL1 is converted from the fusion line IL1 in the second group, the corresponding horizontal field line can be found from the horizontal field lines TL1~TL4 in the field template TEM1 according to the conversion line TSL1.

詳細而言,可計算水平場地線TL1~TL4與原點TO之間的最小距離做為多個場地線最小距離,並計算轉換線TSL1與原點TO之間的最小距離做為轉換線TSL1的轉換線最小距離。接著,可計算多個場地線最小距離與轉換線TSL1的轉換線最小距離之間的多個距離差,並選擇與最小的距離差對應的水平場地線做為上述對應的水平場地線。In detail, the minimum distance between the horizontal field lines TL1~TL4 and the origin TO can be calculated as a plurality of field line minimum distances, and the minimum distance between the conversion line TSL1 and the origin TO can be calculated as the conversion line minimum distance of the conversion line TSL1. Then, a plurality of distance differences between the plurality of field line minimum distances and the conversion line minimum distance of the conversion line TSL1 can be calculated, and the horizontal field line corresponding to the minimum distance difference can be selected as the above-mentioned corresponding horizontal field line.

在本實施例中,針對轉換線TSL1,可藉由上述計算,找出對應的水平場地線為水平場地線TL1。以此類推,藉由上述計算,也可以辨識出轉換線TSL2、TSL4~TSL10分別對應於水平場地線TL2~TL4以及垂直場地線TL5~TL9,並可以辨識出轉換線TSL3對應於水平場地線TL2。In this embodiment, for the conversion line TSL1, the corresponding horizontal field line can be found to be the horizontal field line TL1 through the above calculation. Similarly, through the above calculation, it can also be identified that the conversion lines TSL2 and TSL4 to TSL10 correspond to the horizontal field lines TL2 to TL4 and the vertical field lines TL5 to TL9, respectively, and it can be identified that the conversion line TSL3 corresponds to the horizontal field line TL2.

再者,可計算轉換線TSL1與水平場地線TL1之間的傾角的角度差以及最小距離,並將所計算出的傾角的角度差以及最小距離做為轉換線TSL1的第二角度差以及第二距離差。以此類推,藉由上述計算,也可以計算出轉換線TSL2~TSL5的第二角度差以及第二距離差,並計算出轉換線TSL6~TSL10的第一角度差以及第一距離差。Furthermore, the angle difference and the minimum distance between the conversion line TSL1 and the horizontal field line TL1 can be calculated, and the calculated angle difference and the minimum distance can be used as the second angle difference and the second distance difference of the conversion line TSL1. Similarly, through the above calculation, the second angle difference and the second distance difference of the conversion lines TSL2~TSL5 can also be calculated, and the first angle difference and the first distance difference of the conversion lines TSL6~TSL10 can be calculated.

再者,可計算轉換線TSL6的第一角度差與一個預設角度之間的商數,並計算轉換線TSL6的第一角度差的商數的雙曲正切函數。接著,可計算轉換線TSL6的第一距離差與一個預設距離之間的商數,並計算轉換線TSL6的第一距離差的商數的雙曲正切函數。接著,根據角度權重、距離權重、轉換線TSL6的第一角度差的商數的雙曲正切函數以及轉換線TSL6的第一距離差的多個商數的雙曲正切函數,計算出轉換線TSL6的第一分數。以此類推,也可藉由相同的計算,計算出轉換線TSL7~TSL10的第一分數。Furthermore, the quotient between the first angle difference of the conversion line TSL6 and a preset angle can be calculated, and the hyperbolic tangent function of the quotient of the first angle difference of the conversion line TSL6 can be calculated. Then, the quotient between the first distance difference of the conversion line TSL6 and a preset distance can be calculated, and the hyperbolic tangent function of the quotient of the first distance difference of the conversion line TSL6 can be calculated. Then, the first score of the conversion line TSL6 is calculated based on the angle weight, the distance weight, the hyperbolic tangent function of the quotient of the first angle difference of the conversion line TSL6, and the hyperbolic tangent functions of multiple quotients of the first distance differences of the conversion line TSL6. By analogy, the first scores of the conversion lines TSL7~TSL10 can also be calculated by the same calculation.

再者,可計算轉換線TSL1的第二角度差與一個預設角度之間的商數,並計算轉換線TSL1的第二角度差的商數的雙曲正切函數。接著,可計算轉換線TSL1的第二距離差與一個預設距離之間的商數,並計算轉換線TSL1的第二距離差的商數的雙曲正切函數。接著,根據角度權重、距離權重、轉換線TSL1的第二角度差的商數的雙曲正切函數以及轉換線TSL1的第二距離差的多個商數的雙曲正切函數,計算出轉換線TSL1的第二分數。以此類推,也可藉由相同的計算,計算出轉換線TSL2~TSL5的第二分數。Furthermore, the quotient between the second angle difference of the conversion line TSL1 and a preset angle can be calculated, and the hyperbolic tangent function of the quotient of the second angle difference of the conversion line TSL1 can be calculated. Then, the quotient between the second distance difference of the conversion line TSL1 and a preset distance can be calculated, and the hyperbolic tangent function of the quotient of the second distance difference of the conversion line TSL1 can be calculated. Then, the second score of the conversion line TSL1 is calculated based on the angle weight, the distance weight, the hyperbolic tangent function of the quotient of the second angle difference of the conversion line TSL1, and the hyperbolic tangent functions of multiple quotients of the second distance differences of the conversion line TSL1. By analogy, the second scores of the conversion lines TSL2~TSL5 can also be calculated by the same calculation.

在一些實施例中,上述角度差(即,第一角度差或第二角度差)的商數的雙曲正切函數如以下公式(1)所示。 …公式(1) In some embodiments, the hyperbolic tangent function of the quotient of the above-mentioned angle difference (ie, the first angle difference or the second angle difference) is as shown in the following formula (1). …Formula 1)

其中angleDiff為角度差的商數的雙曲正切函數,a1為其中一融合線的傾角,a2為場域模板TEM1中與此融合線對應的場地線(即,垂直場地線或水平場地線)的傾角,ā為預設角度(例如由使用者所設定)。Wherein angleDiff is the hyperbolic tangent function of the quotient of the angle difference, a1 is the inclination of one of the fusion lines, a2 is the inclination of the field line (ie, vertical field line or horizontal field line) corresponding to the fusion line in the field template TEM1, and ā is a preset angle (eg, set by the user).

在一些實施例中,上述距離差(即,第一距離差或第二距離差)的商數的雙曲正切函數如以下公式(2)所示。 …公式(2) In some embodiments, the hyperbolic tangent function of the quotient of the above distance difference (ie, the first distance difference or the second distance difference) is as shown in the following formula (2). …Formula (2)

其中originDiff為距離差與預設距離之間的商數的雙曲正切函數,d1為其中一融合線與場域模板TEM1的原點(即,原點TO)之間的最小距離,d2為場域模板中與此融合線對應的場地線(即,垂直場地線或水平場地線)與場域模板的原點之間的最小距離,đ為預設距離(例如由使用者所設定)。Wherein originDiff is the hyperbolic tangent function of the quotient between the distance difference and the preset distance, d1 is the minimum distance between one of the fusion lines and the origin of the field template TEM1 (i.e., the origin TO), d2 is the minimum distance between the field line (i.e., the vertical field line or the horizontal field line) corresponding to this fusion line in the field template and the origin of the field template, and đ is the preset distance (for example, set by the user).

在一些實施例中,上述第一分數如以下公式(3)所示。 …公式(3) In some embodiments, the first score is as shown in the following formula (3). …Formula (3)

其中SC1為第一分數,W1為角度權重,angleDiff1為轉換的第一群組中的其中一轉換線的第一角度差,W2為距離權重,originDiff1為此轉換線的第一距離差。Where SC1 is the first score, W1 is the angle weight, angleDiff1 is the first angle difference of one of the transformation lines in the first group of transformations, W2 is the distance weight, and originDiff1 is the first distance difference of this transformation line.

在一些實施例中,上述第二分數如以下公式(4)所示。 …公式(4) In some embodiments, the second score is as shown in the following formula (4). …Formula (4)

其中SC2為第二分數,angleDiff1為轉換的第二群組中的其中一轉換線的第二角度差,originDiff1為此轉換線的第二距離差。SC2 is the second score, angleDiff1 is the second angle difference of one of the conversion lines in the second group of conversions, and originDiff1 is the second distance difference of the conversion line.

再者,根據上述計算出的多個第一分數以及多個第二分數計算出多個轉換分數中的一者。在一些實施例中,上述轉換分數如以下公式(5)所示。 …公式(5) Furthermore, one of a plurality of conversion scores is calculated based on the plurality of first scores and the plurality of second scores calculated above. In some embodiments, the conversion score is as shown in the following formula (5). …Formula (5)

其中warpingScore為與此單應性矩陣對應的轉換分數, 為轉換的第一群組中的所有轉換線的第一分數的總和, 為轉換的第二群組中的所有轉換線的第二分數的總和。 Where warpingScore is the transformation score corresponding to this homography matrix. is the sum of the first scores of all conversion lines in the first group of conversions, is the sum of the second scores of all conversion lines in the second group of conversions.

值得注意的是,如第11圖以及第12圖所示,由於從場域影像IMG1所選擇的融合線IL1、IL5、IL6、IL9與從場域模板TEM1上選擇的場地線TL1、TL4、TL5、TL6沒有完全對應到(即,融合線IL9是在網球上的單打右邊線上,而場地線TL6是在網球上的單打左邊線上,並沒有對應到),因此,所計算出的單應性矩陣的轉換效果不佳(如第13圖所示,只有轉換線TSL1、TSL5、TSL6有對應到正確的場地線)。It is worth noting that, as shown in Figures 11 and 12, since the fusion lines IL1, IL5, IL6, and IL9 selected from the field image IMG1 do not completely correspond to the field lines TL1, TL4, TL5, and TL6 selected from the field template TEM1 (i.e., the fusion line IL9 is on the right singles line on the tennis ball, and the field line TL6 is on the left singles line on the tennis ball, and there is no correspondence), the conversion effect of the calculated homography matrix is not good (as shown in Figure 13, only the conversion lines TSL1, TSL5, and TSL6 correspond to the correct field lines).

以下以實際例子說明具有較高轉換分數的單應性矩陣。一併參照第14圖,第14圖繪示本揭示一些實施例中的選擇多個融合線IL1、IL5、IL6、IL10的示意圖。如第14圖所述,接續第7圖的例子,可從第7圖中的第一群組中的融合線IL1~IL5隨機選出融合線IL1、IL5,並可從第二群組中的融合線IL6~IL10隨機選出融合線IL6、IL10。接著,可將融合線IL1、IL5以及融合線IL6、IL10之間的四個交點IP1~IP4做為其中一個第一交點集。The following is an actual example to illustrate a homography matrix with a higher conversion score. Referring to FIG. 14, FIG. 14 is a schematic diagram showing the selection of multiple blend lines IL1, IL5, IL6, and IL10 in some embodiments of the present disclosure. As described in FIG. 14, continuing the example of FIG. 7, the blend lines IL1 and IL5 can be randomly selected from the blend lines IL1 to IL5 in the first group in FIG. 7, and the blend lines IL6 and IL10 can be randomly selected from the blend lines IL6 to IL10 in the second group. Then, the four intersection points IP1 to IP4 between the blend lines IL1 and IL5 and the blend lines IL6 and IL10 can be used as one of the first intersection points.

一併參照第15圖,第15圖繪示本揭示一些實施例中的選擇兩條水平場地線IL1、IL5以及兩條垂直場地線IL6、IL9的示意圖。如第15圖所述,接續第10圖的例子,可從第10圖中的場域模板TEM1中的水平場地線TL1~TL4隨機選出水平場地線TL1、IL5,並可從垂直場地線TL5~TL9隨機選出垂直場地線TL6、TL9。接著,可將水平場地線TL1、IL5以及垂直場地線TL6、TL9之間的四個交點TP1~TP4做為其中一個第二交點集。Referring to FIG. 15 , FIG. 15 is a schematic diagram showing the selection of two horizontal field lines IL1 and IL5 and two vertical field lines IL6 and IL9 in some embodiments of the present disclosure. As described in FIG. 15 , following the example of FIG. 10 , horizontal field lines TL1 and IL5 can be randomly selected from horizontal field lines TL1 to TL4 in field template TEM1 in FIG. 10 , and vertical field lines TL6 and TL9 can be randomly selected from vertical field lines TL5 to TL9. Then, four intersection points TP1 to TP4 between horizontal field lines TL1 and IL5 and vertical field lines TL6 and TL9 can be used as one of the second intersection point sets.

一併參照第16圖,第16圖繪示本揭示一些實施例中的場域模板TEM1上的多個轉換線TSL1~TSL10的示意圖。如第7圖、第10圖以及第13圖所示,延續第14圖以及的15圖的例子,假設基於第14圖以及的15圖的選擇可計算出場域影像IMG1以及場域模板TEM1之間的單應性矩陣,可利用此單應性矩陣將場域影像IMG1中的融合線IL1~IL10轉換為場域模板TEM1上的轉換線TSL1~TSL10的直線方程式(即,進行上述的視角轉換),其中融合線IL6~IL10為第一群組的融合線,融合線IL1~IL5為第二群組的融合線,轉換線TSL6~TSL10為轉換的第一群組的轉換線,轉換線TSL1~TSL5為轉換的第二群組的轉換線。Please refer to FIG. 16 , which is a schematic diagram of a plurality of switching lines TSL1 - TSL10 on a field template TEM1 in some embodiments of the present disclosure. As shown in Figures 7, 10 and 13, continuing with the examples of Figures 14 and 15, assuming that the homography matrix between the field image IMG1 and the field template TEM1 can be calculated based on the selection of Figures 14 and 15, this homography matrix can be used to convert the fusion lines IL1~IL10 in the field image IMG1 into straight line equations of transformation lines TSL1~TSL10 on the field template TEM1 (i.e., perform the above-mentioned viewing angle conversion), wherein the fusion lines IL6~IL10 are the fusion lines of the first group, the fusion lines IL1~IL5 are the fusion lines of the second group, the transformation lines TSL6~TSL10 are the transformation lines of the transformed first group, and the transformation lines TSL1~TSL5 are the transformation lines of the transformed second group.

再者,由第16圖可得知,此單應性轉換矩陣地轉換效果較佳(因為所有轉換線TSL1~TSL2、TSL4~TSL10都有對應到正確的場地線,只有轉換線TSL3沒辦法對應到場地線)。接著,可根據第11圖至第13圖的例子的計算方式計算出一個單應性矩陣以及此單應性矩陣的轉換分數。實際計算之後,可發現到此單應性矩陣的轉換分數會遠遠大於第11圖至第13圖的例子的轉換分數。基於上述步驟,本揭示更可以多次(可以是一個預設的次數或是所有可能的選擇的次數)從第一群組以及第二群組選擇出第一交點集,並多次從場域模板選擇出第二交點集,進而計算出多個單應性矩陣。藉此,可找到具有較高轉換分數的單應性矩陣做為最佳的單應性矩陣。Furthermore, it can be seen from FIG. 16 that the conversion effect of this homography conversion matrix is better (because all conversion lines TSL1~TSL2, TSL4~TSL10 correspond to the correct ground line, and only conversion line TSL3 cannot correspond to the ground line). Then, a homography matrix and the conversion score of this homography matrix can be calculated according to the calculation method of the examples in FIGS. 11 to 13. After actual calculation, it can be found that the conversion score of this homography matrix will be much greater than the conversion score of the examples in FIGS. 11 to 13. Based on the above steps, the present disclosure can select the first intersection set from the first group and the second group multiple times (which can be a preset number of times or all possible selection times), and select the second intersection set from the field template multiple times, and then calculate multiple homography matrices. In this way, the homography matrix with a higher conversion score can be found as the best homography matrix.

在一些實施例中,準確度運算也可包括:針對至少一單應性矩陣中的各者,執行以下步驟:可對多個垂直場地線上進行視角轉換,並計算多個轉換的垂直場地線上的多個第一疊合像素的數量以及多個第一未疊合像素的數量。接著,可對多個水平場地線上進行視角轉換,並計算多個轉換的水平場地線上的多個第二疊合像素的數量以及多個第二未疊合像素的數量。接著,可根據多個第一疊合像素的數量、多個第一未疊合像素的數量、多個第二疊合像素的數量以及多個第二未疊合像素的數量,計算出多個轉換分數中的一者。In some embodiments, the accuracy calculation may also include: for each of the at least one homography matrix, performing the following steps: a plurality of vertical field lines may be subjected to a perspective transformation, and a plurality of first overlapping pixels and a plurality of first non-overlapping pixels on the plurality of transformed vertical field lines may be calculated. Then, a plurality of horizontal field lines may be subjected to a perspective transformation, and a plurality of second overlapping pixels and a plurality of second non-overlapping pixels on the plurality of transformed horizontal field lines may be calculated. Then, one of a plurality of transformation scores may be calculated based on the plurality of first overlapping pixels, the plurality of first non-overlapping pixels, the plurality of second overlapping pixels, and the plurality of second non-overlapping pixels.

在一些實施例中,也可從上述利用角度差以及距離差的方法所計算出的至少一單應性矩陣中,選擇具有較高的轉換分數的多個單應性矩陣(例如,轉換分數較高的前十個單應性矩陣)執行上述計算疊合以及未疊合的數量的方法以計算出新的轉換分數。In some embodiments, multiple homography matrices with higher conversion scores (for example, the top ten homography matrices with higher conversion scores) may be selected from at least one homography matrix calculated by the above method using angle difference and distance difference to execute the above method of calculating the number of overlaps and non-overlaps to calculate a new conversion score.

以下以實際例子說明疊合像素以及為疊合像素。一併參照第17圖,第17圖繪示本揭示一些實施例中的場域模板TEM1上的場地線(包含水平場地線以及垂直場地線)的多個像素點P的示意圖。如第17圖所示,可從場域模板TEM1中的場地線擷取多個像素點P的座標。在一些實施例中,可在場域模板TEM1中的場地線上每間隔兩個像素進行一次擷取(或取樣)。The following uses actual examples to explain overlapping pixels and non-overlapping pixels. Referring to FIG. 17 , FIG. 17 is a schematic diagram showing a plurality of pixel points P of field lines (including horizontal field lines and vertical field lines) on a field template TEM1 in some embodiments of the present disclosure. As shown in FIG. 17 , the coordinates of the plurality of pixel points P can be captured from the field lines in the field template TEM1. In some embodiments, the capture (or sampling) can be performed every two pixels on the field lines in the field template TEM1.

接著,一併參照第18圖,第18圖繪示本揭示一些實施例中的場域影像IMG1上的多個轉換點TSP的示意圖。如第18圖所示,接續第17圖的例子,可利用上述計算出的一個單應性矩陣將場域模板TEM1上的場地線的多個像素點P的座標轉換為場域影像IMG1上的多個轉換點TSP的座標,並將這些轉換點TSP的座標標示在場域影像IMG1。接著,可判斷這些轉換點TSP是否位於上述所產生的黑白影像的白色像素上。當轉換點TSP位於上述所產生的黑白影像的白色像素上時,可辨識為疊合像素,其中由垂直場地線所轉換的疊合像素為第一疊合像素,由水平場地線所轉換的疊合像素為第二疊合像素。Next, refer to FIG. 18 , which is a schematic diagram of multiple transition points TSP on the field image IMG1 in some embodiments of the present disclosure. As shown in FIG. 18 , following the example of FIG. 17 , the coordinates of multiple pixel points P of the field lines on the field template TEM1 can be converted into the coordinates of multiple transition points TSP on the field image IMG1 using a homography matrix calculated as described above, and the coordinates of these transition points TSP are marked on the field image IMG1. Then, it can be determined whether these transition points TSP are located on the white pixels of the black and white image generated as described above. When the transition point TSP is located on the white pixels of the black and white image generated as described above, it can be identified as a superimposed pixel, wherein the superimposed pixel converted by the vertical field line is the first superimposed pixel, and the superimposed pixel converted by the horizontal field line is the second superimposed pixel.

反之,可辨識為未疊合像素(即,多個場地線段OG1~OG3上的像素),其中由垂直場地線所轉換的未疊合像素為第一未疊合像素,由水平場地線所轉換的未疊合像素為第二未疊合像素。最後,可根據這些第一疊合像素的數量、這些第一未疊合像素的數量、這些第二疊合像素的數量以及這些第二未疊合像素的數量,計算出多個轉換分數中的一者。On the contrary, non-overlapping pixels (i.e., pixels on a plurality of field line segments OG1-OG3) can be identified, wherein the non-overlapping pixels converted by the vertical field lines are first non-overlapping pixels, and the non-overlapping pixels converted by the horizontal field lines are second non-overlapping pixels. Finally, one of a plurality of conversion scores can be calculated according to the number of the first overlapping pixels, the number of the first non-overlapping pixels, the number of the second overlapping pixels, and the number of the second non-overlapping pixels.

在一些實施例中,上述轉換分數如以下公式(6)所示。 …公式(6) In some embodiments, the conversion score is as shown in the following formula (6). …Formula (6)

其中projectScore為轉換分數,sum(,)為總和計算函式,numSpoint為所有第一疊合像素的數量以及所有第二疊合像素的數量之總和,W3為未疊合權重,numUSpoint為所有第一未疊合像素的數量以及所有第二未疊合像素的數量之總和。Where projectScore is the conversion score, sum(,) is the sum calculation function, numSpoint is the sum of the number of all first overlapping pixels and the number of all second overlapping pixels, W3 is the unoverlapping weight, and numUSpoint is the sum of the number of all first unoverlapping pixels and the number of all second unoverlapping pixels.

值得注意的是,上述計算疊合以及未疊合的數量的方法可在執行角度差以及距離差的方法之後執行,也可直接在執行上述步驟S250之後執行,並沒有特別的限制。除此之外,這樣的計算疊合以及未疊合的數量的方法也可正確地追蹤出場域影像的場地上的邊界線(例如,應用於判斷場地上的球是否出界)。It is worth noting that the above method of calculating the number of overlaps and non-overlaps can be executed after executing the method of angle difference and distance difference, or can be executed directly after executing the above step S250, without any special restrictions. In addition, such a method of calculating the number of overlaps and non-overlaps can also correctly track the boundary line on the field of the field image (for example, it is used to determine whether the ball on the field is out of bounds).

在一些實施例中,在產生至少一單應性矩陣之後,可利用至少一單應性矩陣將待疊合模板轉換為至少一轉換圖,並將至少一轉換圖疊合於場域影像IMG1上。在一些實施例中,當需要將特定影像(例如,由廠商提供的廣告或圖形等)疊合於場域影像IMG1上時,可將特定影像覆蓋於場域模板TEM1上以產生待疊合模板。In some embodiments, after generating at least one homography matrix, the template to be superimposed may be converted into at least one transformation map using at least one homography matrix, and the at least one transformation map may be superimposed on the field image IMG1. In some embodiments, when a specific image (e.g., an advertisement or graphic provided by a manufacturer) needs to be superimposed on the field image IMG1, the specific image may be overlaid on the field template TEM1 to generate the template to be superimposed.

以下以實際的例子說明轉換圖的疊合。一併參照第19圖,第19圖繪示本揭示一些實施例中的待疊合模板TEM2的示意圖。如第19圖所示,待疊合模板TEM2具有一個廣告標記AD。藉此,可利用上述單應性矩陣對待疊合模板TEM2進行轉換以將所產生的轉換圖覆蓋於場域影像IMG1上。一併參照第20圖,第20圖繪示本揭示一些實施例中的疊合影像SIMG的示意圖。如第20圖所示,當將轉換圖覆蓋於場域影像上以產生疊合影像SIMG時,疊合影像SIMG上可以產生一個經過變形處理的廣告標記AD,經過變形處理的廣告標記AD可完全依照拍攝場域影像的變形。藉此,可讓使用者在觀看場域影像時,不會感覺到廣告標記AD的形狀怪異。換言之,本揭示的影像處理裝置以及方法可以把廣告標記AD放置在適當位置,降低廣告標記AD的突兀感、避免廣告標記AD變形。The following describes the superposition of the transformation graph using an actual example. Referring to FIG. 19, FIG. 19 is a schematic diagram of the template TEM2 to be superimposed in some embodiments of the present disclosure. As shown in FIG. 19, the template TEM2 to be superimposed has an advertising marker AD. Thus, the template TEM2 to be superimposed can be transformed using the homography matrix to overlay the generated transformation graph on the field image IMG1. Referring to FIG. 20, FIG. 20 is a schematic diagram of the superimposed image SIMG in some embodiments of the present disclosure. As shown in FIG. 20, when the transformation graph is overlaid on the field image to generate the superimposed image SIMG, a deformed advertising marker AD can be generated on the superimposed image SIMG, and the deformed advertising marker AD can be completely in accordance with the deformation of the captured field image. In this way, when viewing the scene image, the user will not feel that the shape of the advertisement mark AD is strange. In other words, the image processing device and method disclosed in the present invention can place the advertisement mark AD in a proper position, reduce the abruptness of the advertisement mark AD, and avoid deformation of the advertisement mark AD.

值得注意的是,於應用層面上,本揭示文件的影像處理裝置以及方法除了可以用在上述將廣告投放的應用,更可以用在各種具有機器視覺、圖像分類或是資料分類的領域,舉例而言,此影像處理裝置以及方法也可以用在將虛擬物件投放在場域影像上。另一方面,此影像處理裝置以及方法也可以用在判斷運動場上的球是否出界的辨識。此外,此影像處理裝置以及方法更可以用在全景影像的拍攝或是虛擬實境(擴增實境)的應用。It is worth noting that, in terms of application, the image processing device and method of the disclosed document can be used in various fields with machine vision, image classification or data classification in addition to the above-mentioned application of placing advertisements. For example, the image processing device and method can also be used to place virtual objects on field images. On the other hand, the image processing device and method can also be used to determine whether the ball on the sports field is out of bounds. In addition, the image processing device and method can also be used in the shooting of panoramic images or the application of virtual reality (augmented reality).

值得注意的是,當拍攝場域時,可能會改變拍攝位置(即,由第一拍攝位置移動至第二拍攝位置)。由於上述計算出來的單應性矩陣僅能對應至第一拍攝位置,這會導致上述計算出來的單應性矩陣失去準確性。因此,需要再利用上述計算方法進一步重新計算對應至第二拍攝位置的單應性矩陣。It is worth noting that when shooting a scene, the shooting position may change (i.e., moving from the first shooting position to the second shooting position). Since the homography matrix calculated above can only correspond to the first shooting position, this will cause the calculated homography matrix to lose accuracy. Therefore, it is necessary to use the above calculation method to further recalculate the homography matrix corresponding to the second shooting position.

有鑑於此,以下更提出節省上述基於新的影像重新計算對應至第二拍攝位置的單應性矩陣的計算量的方法。本揭示內容更提出一種用於視角轉換的影像處理裝置以及方法,從不同拍攝位置的不同幀產生光流圖,並利用光流圖計算第一拍攝位置與第二拍攝位置之間的像素移動趨勢,進而根據像素移動趨勢以及與第一拍攝位置對應的單應性矩陣,從場域模板中的關鍵點產生第二拍攝位置的影像中的關鍵點。如此一來,進一步從場域模板中的關鍵點以及第二拍攝位置的影像中的關鍵點計算出新的單應性矩陣。藉此,可進一步降低重新產生單應性矩陣的運算量,並即時地產生新的單應性矩陣。上述本揭示內容的技術具體以下述實施例為例來進行說明。In view of this, a method for saving the amount of calculation for recalculating the homography matrix corresponding to the second shooting position based on the new image is further proposed below. The present disclosure further proposes an image processing device and method for view angle conversion, generating an optical flow map from different frames of different shooting positions, and using the optical flow map to calculate the pixel movement trend between the first shooting position and the second shooting position, and then generating the key points in the image of the second shooting position from the key points in the field template according to the pixel movement trend and the homography matrix corresponding to the first shooting position. In this way, a new homography matrix is further calculated from the key points in the field template and the key points in the image of the second shooting position. In this way, the amount of calculation for regenerating the homography matrix can be further reduced, and a new homography matrix can be generated in real time. The above-mentioned technology of the present disclosure is specifically described by taking the following embodiments as examples.

一併參照第21圖,第21圖繪示本揭示一些實施例中的用於視角轉換的影像處理方法的流程圖,此用於視角轉換的影像處理方法適用於電子裝置,此電子裝置可以是第1圖的影像處理裝置100,第1圖的影像處理裝置100中的元件用以執行用於視角轉換的影像處理方法中的步驟S2110~S2150。如第21圖所示,首先,於步驟S2110中,拍攝先前影像以及當前影像。Referring to FIG. 21, FIG. 21 is a flowchart of an image processing method for perspective conversion in some embodiments of the present disclosure. The image processing method for perspective conversion is applicable to an electronic device, which may be the image processing device 100 of FIG. 1. The components in the image processing device 100 of FIG. 1 are used to execute steps S2110 to S2150 in the image processing method for perspective conversion. As shown in FIG. 21, first, in step S2110, a previous image and a current image are captured.

在一些實施例中,可藉由影像擷取電路110拍攝先前影像以及當前影像。在一些實施例中,先前影像可以是由影像擷取電路110連續拍攝的多個影像中的當前影像的前一幀。在一些實施例中,影像擷取電路110的拍攝位置可不斷改變。在一些實施例中,可在第一拍攝位置拍攝場域以產生先前影像,並在第二拍攝位置拍攝場域以產生當前影像。在一些實施例中,第一拍攝位置以及第二拍攝位置對應於不同的拍攝角度。In some embodiments, the image capture circuit 110 may capture a previous image and a current image. In some embodiments, the previous image may be a frame before the current image among a plurality of images continuously captured by the image capture circuit 110. In some embodiments, the capture position of the image capture circuit 110 may be continuously changed. In some embodiments, a scene may be captured at a first capture position to generate a previous image, and a scene may be captured at a second capture position to generate a current image. In some embodiments, the first capture position and the second capture position correspond to different capture angles.

於步驟S2120中,對先前影像以及當前影像進行特徵提取(feature extraction),以從先前影像的第一特徵集以及當前影像的第二特徵集計算光流資訊矩陣。In step S2120 , feature extraction is performed on the previous image and the current image to calculate an optical flow information matrix from a first feature set of the previous image and a second feature set of the current image.

在一些實施例中,對先前影像以及當前影像進行特徵提取的運作包括:可從先前影像以及當前影像分別檢測出多個第一候選特徵點以及多個第二候選特徵點。接著,可對多個第一候選特徵點以及多個第二候選特徵點進行特徵匹配運作以產生先前影像的第一特徵集以及當前影像的第二特徵集。In some embodiments, the feature extraction operation for the previous image and the current image includes: a plurality of first candidate feature points and a plurality of second candidate feature points may be detected from the previous image and the current image, respectively. Then, a feature matching operation may be performed on the plurality of first candidate feature points and the plurality of second candidate feature points to generate a first feature set of the previous image and a second feature set of the current image.

在一些實施例中,可利用角點偵測(corner detection)運作或邊緣偵測(edge detection)運作等,從先前影像以及當前影像分別檢測出多個第一候選特徵點以及多個第二候選特徵點。在一些實施例中,可利用SIFT(scale-invariant feature transform)演算法、SURF(speeded up robust features)演算法或ORB(oriented fast and rotated brief)演算法等,在多個第一候選特徵點以及多個第二候選特徵點之間進行特徵匹配(feature mapping)並刪除其中未匹配的第一候選特徵點以及其中未匹配的第二候選特徵點。In some embodiments, a plurality of first candidate feature points and a plurality of second candidate feature points may be detected from a previous image and a current image respectively by using a corner detection operation or an edge detection operation. In some embodiments, a SIFT (scale-invariant feature transform) algorithm, a SURF (speeded up robust features) algorithm, or an ORB (oriented fast and rotated brief) algorithm may be used to perform feature mapping between the plurality of first candidate feature points and the plurality of second candidate feature points and delete the unmatched first candidate feature points and the unmatched second candidate feature points.

在一些實施例中,在進行特徵匹配之後,更可對多個第一候選特徵點以及多個第二候選特徵點進行特徵過濾(feature filtering)運作以產生先前影像的第一特徵集以及當前影像的第二特徵集。在一些實施例中,特徵過濾運作可包括:可在多個匹配的第一候選特徵點以及多個匹配的第二候選特徵點之間計算出多個特徵向量(例如,以其中一匹配的第一候選特徵點做為起點,並以與其對應的匹配的第二候選特徵點做為終點,進而產生其中一特徵向量),並利用離群演算法過濾多個特徵向量。在一些實施例中,利用離群演算法過濾多個特徵向量的步驟可包括:利用離群演算法找出多個特徵向量中的至少一離群向量,進而刪除多個特徵向量中的至少一離群向量。在一些實施例中,離群演算法可以是區域性離群因子(local outlier factor, LOF)演算法或隨機分割森林(random cut forest, RCF)演算法等。In some embodiments, after feature matching, feature filtering may be performed on the plurality of first candidate feature points and the plurality of second candidate feature points to generate a first feature set of the previous image and a second feature set of the current image. In some embodiments, the feature filtering operation may include: calculating a plurality of feature vectors between the plurality of matched first candidate feature points and the plurality of matched second candidate feature points (for example, taking one of the matched first candidate feature points as a starting point and the corresponding matched second candidate feature point as an end point to generate one of the feature vectors), and filtering the plurality of feature vectors using an outlier algorithm. In some embodiments, the step of filtering the plurality of eigenvectors using an outlier algorithm may include: using an outlier algorithm to find at least one outlier vector from the plurality of eigenvectors, and then deleting at least one outlier vector from the plurality of eigenvectors. In some embodiments, the outlier algorithm may be a local outlier factor (LOF) algorithm or a random cut forest (RCF) algorithm.

在一些實施例中,從先前影像的第一特徵集以及當前影像的第二特徵集計算光流資訊矩陣的運作包括:可基於先前影像的第一特徵集以及當前影像的第二特徵集,產生光流(optical flow)圖。接著,可基於光流圖,計算光流資訊矩陣。在一些實施例中,可利用盧卡斯卡納德(Lucas-Kanade)演算法或稠密光流(Farneback)演算法,基於先前影像的第一特徵集以及當前影像的第二特徵集,產生光流圖。在一些實施例中,光流資訊矩陣指示先前影像與當前影像之間的像素移動趨勢。在一些實施例中,可利用仿射變換(affine transformation)運作從光流圖產生一個轉換矩陣(例如:光流資訊矩陣),此轉換矩陣指示先前影像的像素以及當前影像的像素之間的位置的改變趨勢。In some embodiments, the operation of calculating the optical flow information matrix from the first feature set of the previous image and the second feature set of the current image includes: an optical flow map can be generated based on the first feature set of the previous image and the second feature set of the current image. Then, the optical flow information matrix can be calculated based on the optical flow map. In some embodiments, the optical flow map can be generated based on the first feature set of the previous image and the second feature set of the current image using a Lucas-Kanade algorithm or a dense optical flow (Farneback) algorithm. In some embodiments, the optical flow information matrix indicates the pixel movement trend between the previous image and the current image. In some embodiments, an affine transformation operation may be used to generate a transformation matrix (eg, an optical flow information matrix) from the optical flow map, where the transformation matrix indicates the position change trend between pixels of a previous image and pixels of a current image.

以下以實際例子說明光流圖的產生。一併參照第22圖,第22圖繪示本揭示一些實施例中的光流圖OF_MAP的產生的示意圖。如第22圖所示,可利用角點偵測運作,對從先前影像P_IMG以及當前影像C_IMG分別檢測出多個第一候選特徵點以及多個第二候選特徵點。接著,可利用SIFT演算法以及區域性離群因子演算法從多個第一候選特徵點以及多個第二候選特徵點產生先前影像P_IMG的第一特徵集以及當前影像C_IMG的第二特徵集。接著,可基於先前影像P_IMG的第一特徵集以及當前影像C_IMG的第二特徵集,利用盧卡斯卡納德演算法產生光流圖OF_MAP。The generation of an optical flow map is described below using a practical example. Referring to FIG. 22 , FIG. 22 is a schematic diagram showing the generation of an optical flow map OF_MAP in some embodiments of the present disclosure. As shown in FIG. 22 , a corner detection operation can be used to detect a plurality of first candidate feature points and a plurality of second candidate feature points from a previous image P_IMG and a plurality of second candidate feature points, respectively. Then, a SIFT algorithm and a regional outlier factor algorithm can be used to generate a first feature set of the previous image P_IMG and a second feature set of the current image C_IMG from the plurality of first candidate feature points and the plurality of second candidate feature points. Then, based on the first feature set of the previous image P_IMG and the second feature set of the current image C_IMG, the Lucascanade algorithm can be used to generate an optical flow map OF_MAP.

再者,如第21圖所示,於步驟S2130中,利用光流資訊矩陣推算先前影像中的第二關鍵點集在當前影像中的位置,以儲存為第三關鍵點集。在一些實施例中,可利用先前單應性矩陣對場域模板中的第一關鍵點集進行視角轉換處理以產生先前影像中的第二關鍵點集。在一些實施例中,此先前單應性矩陣可以是由第2圖的步驟從場域模板以及先前影像所產生的單應性矩陣,也可以是預先儲存於記憶體120中的單應性矩陣,更可以是傳統計算方法所獲得的單應性矩陣。在一些實施例中,可利用光流資訊矩陣將先前影像中的第二關鍵點集轉換為當前影像中的第三關鍵點集。Furthermore, as shown in FIG. 21, in step S2130, the optical flow information matrix is used to infer the position of the second key point set in the previous image in the current image to store it as the third key point set. In some embodiments, the previous homography matrix can be used to perform a perspective conversion process on the first key point set in the field template to generate the second key point set in the previous image. In some embodiments, this previous homography matrix can be a homography matrix generated from the field template and the previous image by the step of FIG. 2, or a homography matrix pre-stored in the memory 120, or a homography matrix obtained by a traditional calculation method. In some embodiments, the optical flow information matrix may be used to transform the second keypoint set in the previous image into the third keypoint set in the current image.

在一些實施例中,場域模板可具有目標影像以及第一關鍵點集。在一些實施例中,目標影像可以是廣告標記(例如,上述第19圖的廣告標記AD)。在一些實施例中,第一關鍵點集中的多個關鍵點可以是預先設定在場域模板上的多個場地線之間的多個交點的標記點。在一些實施例中,這些標記點的數量可以是任意不小於4的正整數,並沒有特別的限制。In some embodiments, the scene template may have a target image and a first key point set. In some embodiments, the target image may be an advertisement marker (e.g., the advertisement marker AD in FIG. 19 above). In some embodiments, the multiple key points in the first key point set may be marking points of multiple intersections between multiple field lines pre-set on the scene template. In some embodiments, the number of these marking points may be any positive integer not less than 4, and there is no particular limitation.

以下以實際例子說明第一關鍵點集。一併參照第23圖,第23圖繪示本揭示另一些實施例中的場域模板TEM的示意圖。如第23圖所示,場域模板TEM具有多個場地線,這些場地線之間的多個交點上分別標記了多個關鍵點KP。The first set of key points is described below with an actual example. Referring to FIG. 23 , FIG. 23 is a schematic diagram of a field template TEM in some other embodiments of the present disclosure. As shown in FIG. 23 , the field template TEM has a plurality of field lines, and a plurality of key points KP are marked on a plurality of intersections between the field lines.

以下以實際例子說明第二關鍵點集以及第三關鍵點集。一併參照第24圖,第24圖繪示本揭示一些實施例中的第二關鍵點集以及第三關鍵點集的示意圖。如第24圖所示,可利用先前單應性矩陣將第23圖的場域模板TEM中的多個關鍵點KP轉換為先前影像P_IMG中的多個關鍵點KP做為第二關鍵點集,並利用光流資訊矩陣將先前影像P_IMG中的多個關鍵點KP轉換為當前影像C_IMG中的多個關鍵點KP做為第三關鍵點集。The second key point set and the third key point set are explained below with an actual example. Referring to FIG. 24, FIG. 24 is a schematic diagram showing the second key point set and the third key point set in some embodiments of the present disclosure. As shown in FIG. 24, the multiple key points KP in the field template TEM of FIG. 23 can be converted into multiple key points KP in the previous image P_IMG as the second key point set using the previous homography matrix, and the multiple key points KP in the previous image P_IMG can be converted into multiple key points KP in the current image C_IMG as the third key point set using the optical flow information matrix.

再者,如第21圖所示,於步驟S2140中,計算第一關鍵點集以及第三關鍵點集之間的當前單應性矩陣。Furthermore, as shown in FIG. 21 , in step S2140 , the current homography matrix between the first key point set and the third key point set is calculated.

在一些實施例中,可基於先前影像中的第二關鍵點集及基礎矩陣(fundamental matrix),更新當前影像中的第三關鍵點集,其中基礎矩陣指示先前影像與當前影像之間的對應視角轉換關係。在一些實施例中,可根據光流圖中的多個光流所指示的起點以及終點,計算出基礎矩陣。在一些實施例中,可基於先前影像的第一特徵集以及當前影像的該第二特徵集,計算出基礎矩陣。換言之,只要利用先前影像的特徵點以及當前影像的對應的特徵點(即,光流的起點以及終點)就能計算出基礎矩陣,且基礎矩陣的計算為本領域技術人員常用的計算,因此,在此不再加以贅述。In some embodiments, the third key point set in the current image may be updated based on the second key point set and the fundamental matrix in the previous image, wherein the fundamental matrix indicates the corresponding view angle conversion relationship between the previous image and the current image. In some embodiments, the fundamental matrix may be calculated based on the starting point and the end point indicated by the multiple optical flows in the optical flow map. In some embodiments, the fundamental matrix may be calculated based on the first feature set of the previous image and the second feature set of the current image. In other words, the fundamental matrix can be calculated by using the feature points of the previous image and the corresponding feature points of the current image (i.e., the starting point and the end point of the optical flow), and the calculation of the fundamental matrix is a calculation commonly used by technicians in this field, so it will not be repeated here.

在一些實施例中,更新第三關鍵點擊的步驟可包括:可利用基礎矩陣將先前影像中的第二關鍵點集,轉換為當前影像中的多個直線。接著,可基於多個直線,更新當前影像中的第三關鍵點集。In some embodiments, the step of updating the third key point may include: using a base matrix to convert the second key point set in the previous image into a plurality of straight lines in the current image. Then, based on the plurality of straight lines, the third key point set in the current image may be updated.

在一些實施例中,可判斷當前影像中的第三關鍵點集中的各者是否位於當前影像中的多個對應直線之一者上。接著,可將第三關鍵點集中的至少一雜訊關鍵點刪除以更新當前影像中的第三關鍵點集,其中至少一雜訊關鍵點中的各者不位於當前影像中的對應直線上。在一些實施例中,可將在第一關鍵點集中與至少一雜訊關鍵點對應的關鍵點刪除。In some embodiments, it may be determined whether each of the third key point set in the current image is located on one of a plurality of corresponding straight lines in the current image. Then, at least one noise key point in the third key point set may be deleted to update the third key point set in the current image, wherein each of the at least one noise key point is not located on a corresponding straight line in the current image. In some embodiments, the key points corresponding to the at least one noise key point in the first key point set may be deleted.

以下以實際例子說明基礎矩陣的原理。一併參照第25圖,第25圖繪示本揭示一些實施例中的視角轉換關係的示意圖。如第25圖所示,可從第一拍攝位置的光心O以及第二拍攝位置的光心O’分別拍攝場域以產生影像IMG_O以及影像IMG_O’。像素點x是藉由拍攝場域中的場域點X所產生的,然而,由於並不知道影像IMG_O的深度,因此,由光心O與像素點x延伸出去的射線r上的所有場域點X都可在影像IMG_O上形成像素點x。The principle of the basic matrix is explained below with an actual example. Referring to FIG. 25 , FIG. 25 is a schematic diagram showing the viewing angle conversion relationship in some embodiments of the present disclosure. As shown in FIG. 25 , the field can be photographed from the optical center O of the first shooting position and the optical center O’ of the second shooting position to generate image IMG_O and image IMG_O’. Pixel point x is generated by field point X in the shooting field. However, since the depth of image IMG_O is unknown, all field points X on the ray r extending from the optical center O and pixel point x can form pixel point x on image IMG_O.

接著,由於不確定是由哪個場域點X形成影像IMG_O上的像素點x,射線r可在影像IMG_O’形成一條對極線l’,且對極線l’上的所有像素點x’都有可能對應到像素點x,其中像素點x’以及像素點x都是拍攝同一個場域點X產生的。此外,光心O與光心O’之間的連線可在影像IMG_O以及影像IMG_O’上分別產生對極點e以及對極點e’。對極點e’位於對極線l’,對極點e與像素點x可形成另一條對極線l。而對極線l上所有的像素點都會對應到對極線l’上。換言之,對極線l上所有的像素點都可利用基礎矩陣轉換到對極線l’上的像素點,並可基於這些像素點之間的對應視角轉換關係計算出基礎矩陣。藉此,可利用基礎矩陣將影像IMG_O上的任意像素點轉換至影像IMG_O’上的對極線。如此一來,可利用相同方法將上述第二關線點集的關鍵點轉換至當前影像上的一條直線,並判斷此關鍵點在第三關鍵點集中的對應關鍵點是否在此直線上。當判斷不在此直線上時,就刪除此對應關鍵點。Next, since it is uncertain which field point X forms the pixel x on the image IMG_O, the ray r can form an antipolar line l’ on the image IMG_O’, and all the pixel points x’ on the antipolar line l’ may correspond to the pixel point x, wherein the pixel point x’ and the pixel point x are generated by photographing the same field point X. In addition, the line between the optical center O and the optical center O’ can generate the antipolar point e and the antipolar point e’ on the image IMG_O and the image IMG_O’, respectively. The antipolar point e’ is located on the antipolar line l’, and the antipolar point e and the pixel point x can form another antipolar line l. All the pixels on the antipolar line l will correspond to the antipolar line l’. In other words, all the pixels on the epipolar line l can be converted to the pixels on the epipolar line l' using the basic matrix, and the basic matrix can be calculated based on the corresponding view angle conversion relationship between these pixels. In this way, any pixel on the image IMG_O can be converted to the epipolar line on the image IMG_O' using the basic matrix. In this way, the key point of the second key point set can be converted to a straight line on the current image using the same method, and it is determined whether the corresponding key point of this key point in the third key point set is on this straight line. When it is determined that it is not on this straight line, the corresponding key point is deleted.

以下以實際例子說明更新的第三關鍵點集。一併參照第26圖,第26圖繪示本揭示一些實施例中的更新的第三關鍵點集的示意圖。如第26圖所示,可利用基礎矩陣以及第24圖中的先前影像P_IMG的多個關鍵點KP對第24圖中的當前影像C_IMG的多個關鍵點KP進行過濾,以產生當前影像C_IMG的多個過濾關鍵點FKP做為更新的第三關鍵點集。值得注意的是,由於第24圖中的當前影像C_IMG的一些關鍵點KP(即,球場中線上的關線點以及與人物重疊的關鍵點)已被過濾掉,此時當前影像C_IMG的多個過濾關鍵點FKP的數量少於第24圖中的當前影像C_IMG的多個關鍵點KP的數量。The updated third key point set is explained below with an actual example. Referring to FIG. 26, FIG. 26 is a schematic diagram of the updated third key point set in some embodiments of the present disclosure. As shown in FIG. 26, the multiple key points KP of the current image C_IMG in FIG. 24 can be filtered using the base matrix and the multiple key points KP of the previous image P_IMG in FIG. 24 to generate multiple filtered key points FKP of the current image C_IMG as the updated third key point set. It is worth noting that, since some key points KP of the current image C_IMG in FIG. 24 (i.e., key points on the center line of the court and key points overlapping with characters) have been filtered out, the number of multiple filtered key points FKP of the current image C_IMG is less than the number of multiple key points KP of the current image C_IMG in FIG. 24 .

再者,如第21圖所示,於步驟S2150中,利用當前單應性矩陣將目標影像投影至當前影像上的對應位置。舉例而言,可利用第19圖以及第20圖的方法將利用當前單應性矩陣將場域模板中的目標影像(例如,第19圖的廣告標記AD)的像素進行視角轉換以投影至當前影像上。Furthermore, as shown in FIG. 21, in step S2150, the target image is projected to the corresponding position on the current image using the current homography matrix. For example, the method of FIG. 19 and FIG. 20 can be used to transform the pixels of the target image (e.g., the advertisement mark AD in FIG. 19) in the field template using the current homography matrix to project them onto the current image.

藉由上述步驟,也可讓使用者在觀看場域影像時,不會感覺到廣告標記的形狀怪異。此外,這樣的做法僅僅利用了數學計算上的四則運算以及微分,且特徵點以及關鍵點的計算次數也不大。這樣的做法將大大降低運算量、提高追蹤即時性。而利用光流的運算也會使目標影像在投影至當前影像上時不會有卡頓感。Through the above steps, users will not feel that the shape of the advertising mark is strange when viewing the scene image. In addition, this approach only uses the four arithmetic operations and differentials in mathematical calculations, and the number of calculations of feature points and key points is not large. This approach will greatly reduce the amount of calculations and improve the real-time tracking. The use of optical flow calculations will also prevent the target image from being stuck when projected onto the current image.

綜上所述,本揭示所提出的用於視角轉換的影像處理裝置可利用光流法更新單應性矩陣,以大大降低重新產生單應性矩陣的運算量。此外,更可即時地在不同幀之間更新單應性矩陣。不論拍攝位置怎麼改變,都能立即計算出新的單應性矩陣。另一方面而言,藉由一般計算單應性矩陣的方法,將可能導致在目標影像投影到當前影像時產生卡頓感,而利用本揭示的用於視角轉換的影像處理裝置將可大大增加在投影至連續的影像之後的流暢感。In summary, the image processing device for perspective conversion proposed in the present disclosure can use the optical flow method to update the homography matrix to greatly reduce the amount of calculation required to regenerate the homography matrix. In addition, the homography matrix can be updated between different frames in real time. Regardless of how the shooting position changes, a new homography matrix can be calculated immediately. On the other hand, the general method of calculating the homography matrix may cause a sense of stuttering when the target image is projected onto the current image, while the image processing device for perspective conversion disclosed in the present disclosure can greatly increase the sense of smoothness after projecting onto continuous images.

雖然本揭示的特定實施例已經揭露有關上述實施例,此些實施例不意欲限制本揭示。各種替代及改良可藉由相關領域中的一般技術人員在本揭示中執行而沒有從本揭示的原理及精神背離。因此,本揭示的保護範圍由所附申請專利範圍確定。Although specific embodiments of the present disclosure have been disclosed with respect to the above-mentioned embodiments, these embodiments are not intended to limit the present disclosure. Various substitutions and improvements may be performed in the present disclosure by a person skilled in the art without departing from the principles and spirit of the present disclosure. Therefore, the scope of protection of the present disclosure is determined by the scope of the attached patent application.

100:影像處理裝置 110:影像擷取電路 120:記憶體 130:處理器 IMG1:場域影像 S210~S250、S2110~S2150:步驟 BIMG:二元影像 LS1~LS12:線段 L1、L2:線段 EL:延伸線 θ:線段夾角 d:最大距離 IL1~IL10、VL1~VL5、HL1~HL5:融合線 IMG2、IMG3:影像 LO、UO:基準點 LD1~LD5、UD1~UD5:最小距離 TEM1、TEM:場域模板 TO:原點 TL1~TL4:水平場地線 TL5~TL9:垂直場地線 IP1~IP4、TP1~TP4:交點 TSL1~TSL10:轉換線 P:像素點 TSP:轉換點 OG1~OG3:場地線段 TEM2:待疊合模板 AD:廣告標記 SIMG:疊合影像 C_IMG:當前影像 P_IMG:先前影像 OF_MAP:光流圖 KP:關鍵點 IMG_O、IMG_O’:影像 O、O’:光心 x、x’:像素點 X:場域點 r:射線 l、l’: 對極線 e、e’: 對極點 l、l’:對極線 FKP:過濾關鍵點100: Image processing device 110: Image acquisition circuit 120: Memory 130: Processor IMG1: Field image S210~S250, S2110~S2150: Steps BIMG: Binary image LS1~LS12: Line segment L1, L2: Line segment EL: Extension line θ: Line segment angle d: Maximum distance IL1~IL10, VL1~VL5, HL1~HL5: Fusion line IMG2, IMG3: Image LO, UO: Reference point LD1~LD5, UD1~UD5: Minimum distance TEM1, TEM: Field template TO: Origin TL1~TL4: Horizontal field line TL5~TL9: Vertical field line IP1~IP4, TP1~TP4: Intersection point TSL1~TSL10: Transition line P: Pixel point TSP: Transition point OG1~OG3: Field line segment TEM2: Template to be superimposed AD: Advertising marker SIMG: Superimposed image C_IMG: Current image P_IMG: Previous image OF_MAP: Optical flow map KP: Key point IMG_O, IMG_O’: Image O, O’: Optical center x, x’: Pixel point X: Field point r: Ray l, l’: Antipolar line e, e’: Antipolar point l, l’: Antipolar line FKP: Filter key point

第1圖繪示本揭示一些實施例中的影像處理裝置的示意圖。 第2圖繪示本揭示一些實施例中的影像處理方法的流程圖。 第3圖繪示本揭示一些實施例中的二元影像的產生的示意圖。 第4圖繪示本揭示一些實施例中的從場域影像產生多個線段的示意圖。 第5圖繪示本揭示一些實施例中的線段夾角的示意圖。 第6圖繪示本揭示一些實施例中的最大距離的示意圖。 第7圖繪示本揭示一些實施例中的場域影像中的多個融合線的示意圖。 第8圖繪示本揭示一些實施例中的第一群組的排序的示意圖。 第9圖繪示本揭示一些實施例中的第二群組的排序的示意圖。 第10圖繪示本揭示一些實施例中的場域模板的示意圖。 第11圖繪示本揭示一些實施例中的選擇多個融合線的示意圖。 第12圖繪示本揭示一些實施例中的選擇兩條水平場地線以及兩條垂直場地線的示意圖。 第13圖繪示本揭示一些實施例中的場域模板上的多個轉換線的示意圖。 第14圖繪示本揭示一些實施例中的選擇多個融合線的示意圖。 第15圖繪示本揭示一些實施例中的選擇兩條水平場地線以及兩條垂直場地線的示意圖。 第16圖繪示本揭示一些實施例中的場域模板上的多個轉換線的示意圖。 第17圖繪示本揭示一些實施例中的場域模板上的場地線的多個像素點的示意圖。 第18圖繪示本揭示一些實施例中的場域影像上的多個轉換點的示意圖。 第19圖繪示本揭示一些實施例中的疊合模板的示意圖。 第20圖繪示本揭示一些實施例中的疊合影像的示意圖。 第21圖繪示本揭示一些實施例中的用於視角轉換的影像處理方法的流程圖。 第22圖繪示本揭示一些實施例中的光流圖的產生的示意圖。 第23圖繪示本揭示另一些實施例中的場域模板的示意圖。 第24圖繪示本揭示一些實施例中的第二關鍵點集以及第三關鍵點集的示意圖。 第25圖繪示本揭示一些實施例中的視角轉換關係的示意圖。 第26圖繪示本揭示一些實施例中的更新的第三關鍵點集的示意圖。 FIG. 1 is a schematic diagram of an image processing device in some embodiments of the present disclosure. FIG. 2 is a flow chart of an image processing method in some embodiments of the present disclosure. FIG. 3 is a schematic diagram of the generation of a binary image in some embodiments of the present disclosure. FIG. 4 is a schematic diagram of generating multiple line segments from a field image in some embodiments of the present disclosure. FIG. 5 is a schematic diagram of the angle of a line segment in some embodiments of the present disclosure. FIG. 6 is a schematic diagram of the maximum distance in some embodiments of the present disclosure. FIG. 7 is a schematic diagram of multiple fusion lines in a field image in some embodiments of the present disclosure. FIG. 8 is a schematic diagram of the sorting of the first group in some embodiments of the present disclosure. FIG. 9 is a schematic diagram of the sorting of the second group in some embodiments of the present disclosure. FIG. 10 is a schematic diagram of a field template in some embodiments of the present disclosure. FIG. 11 is a schematic diagram of selecting multiple fusion lines in some embodiments of the present disclosure. FIG. 12 is a schematic diagram of selecting two horizontal field lines and two vertical field lines in some embodiments of the present disclosure. FIG. 13 is a schematic diagram of multiple conversion lines on a field template in some embodiments of the present disclosure. FIG. 14 is a schematic diagram of selecting multiple fusion lines in some embodiments of the present disclosure. FIG. 15 is a schematic diagram of selecting two horizontal field lines and two vertical field lines in some embodiments of the present disclosure. FIG. 16 is a schematic diagram of multiple conversion lines on a field template in some embodiments of the present disclosure. FIG. 17 is a schematic diagram of multiple pixel points of a field line on a field template in some embodiments of the present disclosure. FIG. 18 is a schematic diagram of multiple conversion points on a field image in some embodiments of the present disclosure. FIG. 19 is a schematic diagram of a superimposed template in some embodiments of the present disclosure. FIG. 20 is a schematic diagram of a superimposed image in some embodiments of the present disclosure. FIG. 21 is a flow chart of an image processing method for perspective conversion in some embodiments of the present disclosure. FIG. 22 is a schematic diagram of the generation of an optical flow map in some embodiments of the present disclosure. FIG. 23 is a schematic diagram of a field template in other embodiments of the present disclosure. FIG. 24 is a schematic diagram of a second key point set and a third key point set in some embodiments of the present disclosure. FIG. 25 is a schematic diagram of a perspective conversion relationship in some embodiments of the present disclosure. FIG. 26 is a schematic diagram of an updated third key point set in some embodiments of the present disclosure.

S2110~S2150:步驟 S2110~S2150: Steps

Claims (14)

一種用於視角轉換的影像處理裝置,包括: 一影像擷取電路,用以拍攝一先前影像以及一當前影像; 一記憶體,用以儲存多個指令、一場域模板中的一目標影像以及該場域模板中的一第一關鍵點集;以及 一處理器,用以處理該些指令以執行以下運作: 對該先前影像以及該當前影像進行一特徵提取運作,以從該先前影像的一第一特徵集以及該當前影像的一第二特徵集計算一光流資訊矩陣; 利用該光流資訊矩陣推算該先前影像中的一第二關鍵點集在該當前影像中的位置,以儲存為一第三關鍵點集; 計算該第一關鍵點集以及該第三關鍵點集之間的一當前單應性矩陣;以及 利用該當前單應性矩陣將該目標影像投影至該當前影像上的對應位置。 An image processing device for perspective conversion includes: an image capture circuit for capturing a previous image and a current image; a memory for storing a plurality of instructions, a target image in a field template, and a first key point set in the field template; and a processor for processing the instructions to perform the following operations: performing a feature extraction operation on the previous image and the current image to calculate an optical flow information matrix from a first feature set of the previous image and a second feature set of the current image; using the optical flow information matrix to infer the position of a second key point set in the previous image in the current image to store it as a third key point set; calculating a current homography matrix between the first key point set and the third key point set; and The target image is projected to the corresponding position on the current image using the current homography matrix. 如請求項1所述之視角轉換的影像處理裝置,其中該第二關鍵點集是藉由一先前單應性矩陣將該場域模板上的第一關鍵點集轉換而來。The image processing device for view angle conversion as described in claim 1, wherein the second key point set is converted from the first key point set on the scene template by a previous homography matrix. 如請求項1所述之視角轉換的影像處理裝置,其中該先前影像為該當前影像的前一幀,其中對該先前影像以及該當前影像進行該特徵提取運作的運作包括: 從該先前影像以及該當前影像分別檢測出多個第一候選特徵點以及多個第二候選特徵點;以及 對該些第一候選特徵點以及該些第二候選特徵點進行一特徵匹配運作以產生該先前影像的該第一特徵集以及該當前影像的該第二特徵集。 An image processing device for view angle conversion as described in claim 1, wherein the previous image is a previous frame of the current image, and the operation of performing the feature extraction operation on the previous image and the current image includes: Detecting a plurality of first candidate feature points and a plurality of second candidate feature points from the previous image and the current image respectively; and Performing a feature matching operation on the first candidate feature points and the second candidate feature points to generate the first feature set of the previous image and the second feature set of the current image. 如請求項3所述之視角轉換的影像處理裝置,其中該處理器更用以執行以下運作: 基於該先前影像中的該第二關鍵點集及一基礎矩陣,更新該當前影像中的該第三關鍵點集,其中該基礎矩陣指示該先前影像與該當前影像之間的一對應視角轉換關係。 The image processing device for view angle conversion as described in claim 3, wherein the processor is further used to perform the following operations: Based on the second key point set in the previous image and a base matrix, the third key point set in the current image is updated, wherein the base matrix indicates a corresponding view angle conversion relationship between the previous image and the current image. 如請求項4所述之視角轉換的影像處理裝置,其中該基礎矩陣系由以下運作產生: 基於該先前影像的該第一特徵集以及該當前影像的該第二特徵集,計算出該基礎矩陣。 The image processing device for view angle conversion as described in claim 4, wherein the base matrix is generated by the following operation: Based on the first feature set of the previous image and the second feature set of the current image, the base matrix is calculated. 如請求項4所述之視角轉換的影像處理裝置,其中更新該第三關鍵點集的運作包括: 利用該基礎矩陣將該先前影像中的該第二關鍵點集,轉換為該當前影像中的多個直線;以及 基於該些直線,更新該當前影像中的該第三關鍵點集。 The image processing device for view angle conversion as described in claim 4, wherein the operation of updating the third key point set includes: Using the base matrix to convert the second key point set in the previous image into a plurality of straight lines in the current image; and Based on the straight lines, updating the third key point set in the current image. 如請求項6所述之視角轉換的影像處理裝置,其中基於該些直線,更新該當前影像中的該第三關鍵點集的運作包括: 判斷該當前影像中的該第三關鍵點集中的各者是否位於該當前影像中的該等對應直線之一者上;以及 將該第三關鍵點集中的至少一雜訊關鍵點刪除以更新該當前影像中的該第三關鍵點集,其中該至少一雜訊關鍵點中的各者不位於當前影像中的該對應直線上。 The image processing device for view angle conversion as described in claim 6, wherein the operation of updating the third key point set in the current image based on the straight lines includes: Determining whether each of the third key point set in the current image is located on one of the corresponding straight lines in the current image; and Deleting at least one noise key point in the third key point set to update the third key point set in the current image, wherein each of the at least one noise key point is not located on the corresponding straight line in the current image. 一種用於視角轉換的影像處理方法,包括: 拍攝一先前影像以及一當前影像,並儲存一場域模板中的一目標影像及該場域模板中的一第一關鍵點集; 對該先前影像以及該當前影像進行一特徵提取運作,以從該先前影像的一第一特徵集以及該當前影像的一第二特徵集計算一光流資訊矩陣; 利用該光流資訊矩陣推算該先前影像中的一第二關鍵點集在該當前影像中的位置,以儲存為一第三關鍵點集; 計算該第一關鍵點集以及該第三關鍵點集之間的一當前單應性矩陣;以及 利用該當前單應性矩陣將該目標影像投影至該當前影像上的對應位置。 An image processing method for perspective conversion includes: Shooting a previous image and a current image, and storing a target image in a field template and a first key point set in the field template; Performing a feature extraction operation on the previous image and the current image to calculate an optical flow information matrix from a first feature set of the previous image and a second feature set of the current image; Using the optical flow information matrix to infer the position of a second key point set in the previous image in the current image to store it as a third key point set; Calculating a current homography matrix between the first key point set and the third key point set; and Using the current homography matrix to project the target image to a corresponding position on the current image. 如請求項8所述之視角轉換的影像處理方法,其中該第二關鍵點集是藉由一先前單應性矩陣將該場域模板上的第一關鍵點集轉換而來。The view-transformed image processing method as described in claim 8, wherein the second key point set is obtained by transforming the first key point set on the scene template by a prior homography matrix. 如請求項8所述之視角轉換的影像處理方法,其中該先前影像為該當前影像的前一幀,其中對該先前影像以及該當前影像進行該特徵提取的步驟包括: 從該先前影像以及該當前影像分別檢測出多個第一候選特徵點以及多個第二候選特徵點;以及 對該些第一候選特徵點以及該些第二候選特徵點進行一特徵匹配運作以產生該先前影像的該第一特徵集以及該當前影像的該第二特徵集。 The image processing method for view angle conversion as described in claim 8, wherein the previous image is the previous frame of the current image, and the step of extracting the feature of the previous image and the current image includes: Detecting a plurality of first candidate feature points and a plurality of second candidate feature points from the previous image and the current image respectively; and Performing a feature matching operation on the first candidate feature points and the second candidate feature points to generate the first feature set of the previous image and the second feature set of the current image. 如請求項10所述之視角轉換的影像處理方法,更包括: 基於該先前影像中的該第二關鍵點集及一基礎矩陣,更新該當前影像中的該第三關鍵點集,其中該基礎矩陣指示該先前影像與該當前影像之間的一對應視角轉換關係。 The image processing method for view angle conversion as described in claim 10 further includes: Updating the third key point set in the current image based on the second key point set in the previous image and a base matrix, wherein the base matrix indicates a corresponding view angle conversion relationship between the previous image and the current image. 如請求項11所述之視角轉換的影像處理方法,其中該基礎矩陣系由以下步驟產生: 基於該先前影像的該第一特徵集以及該當前影像的該第二特徵集,計算出該基礎矩陣。 The image processing method for view angle conversion as described in claim 11, wherein the base matrix is generated by the following steps: Based on the first feature set of the previous image and the second feature set of the current image, the base matrix is calculated. 如請求項11所述之視角轉換的影像處理方法,其中更新該第三關鍵點集的步驟包括: 利用該基礎矩陣將該先前影像中的該第二關鍵點集,轉換為該當前影像中的多個直線;以及 基於該些直線,更新該當前影像中的該第三關鍵點集。 The image processing method for view angle conversion as described in claim 11, wherein the step of updating the third key point set includes: Using the base matrix to convert the second key point set in the previous image into a plurality of straight lines in the current image; and Based on the straight lines, updating the third key point set in the current image. 如請求項13所述之視角轉換的影像處理方法,其中基於該些直線,更新該當前影像中的該第三關鍵點集的步驟包括: 判斷該當前影像中的該第三關鍵點集中的各者是否位於該當前影像中的該等對應直線之一者上;以及 將該第三關鍵點集中的至少一雜訊關鍵點刪除以更新該當前影像中的該第三關鍵點集,其中該至少一雜訊關鍵點中的各者不位於當前影像中的該對應直線上。 The image processing method for view angle conversion as described in claim 13, wherein the step of updating the third key point set in the current image based on the straight lines includes: Determining whether each of the third key point set in the current image is located on one of the corresponding straight lines in the current image; and Deleting at least one noise key point in the third key point set to update the third key point set in the current image, wherein each of the at least one noise key point is not located on the corresponding straight line in the current image.
TW112121005A 2023-06-06 2023-06-06 Image processing device and method for viewing angle conversion TWI839241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW112121005A TWI839241B (en) 2023-06-06 2023-06-06 Image processing device and method for viewing angle conversion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW112121005A TWI839241B (en) 2023-06-06 2023-06-06 Image processing device and method for viewing angle conversion

Publications (1)

Publication Number Publication Date
TWI839241B true TWI839241B (en) 2024-04-11

Family

ID=91618664

Family Applications (1)

Application Number Title Priority Date Filing Date
TW112121005A TWI839241B (en) 2023-06-06 2023-06-06 Image processing device and method for viewing angle conversion

Country Status (1)

Country Link
TW (1) TWI839241B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112734797A (en) * 2019-10-29 2021-04-30 浙江商汤科技开发有限公司 Image feature tracking method and device and electronic equipment
TWI740275B (en) * 2019-11-19 2021-09-21 國立臺北大學 Augmented reality object displaying device and augmented reality object displaying method
CN113902878A (en) * 2021-10-11 2022-01-07 浙江博采传媒有限公司 Image enhancement method and system for simulating any visual angle shooting of camera
US20220092797A1 (en) * 2019-07-08 2022-03-24 Zhongyuan University Of Technology Intelligent Vehicle Trajectory Measurement Method Based on Binocular Stereo Vision System

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220092797A1 (en) * 2019-07-08 2022-03-24 Zhongyuan University Of Technology Intelligent Vehicle Trajectory Measurement Method Based on Binocular Stereo Vision System
CN112734797A (en) * 2019-10-29 2021-04-30 浙江商汤科技开发有限公司 Image feature tracking method and device and electronic equipment
TWI740275B (en) * 2019-11-19 2021-09-21 國立臺北大學 Augmented reality object displaying device and augmented reality object displaying method
CN113902878A (en) * 2021-10-11 2022-01-07 浙江博采传媒有限公司 Image enhancement method and system for simulating any visual angle shooting of camera

Similar Documents

Publication Publication Date Title
Chen et al. Sports camera calibration via synthetic data
US11861888B2 (en) Logo recognition in images and videos
Yu et al. Trajectory-based ball detection and tracking in broadcast soccer video
CN109271937B (en) Sports ground marker identification method and system based on image processing
KR101469398B1 (en) Text-based 3d augmented reality
Botterill et al. Real-time aerial image mosaicing
Kluger et al. Deep learning for vanishing point detection using an inverse gnomonic projection
WO2020037881A1 (en) Motion trajectory drawing method and apparatus, and device and storage medium
CN103902953B (en) A kind of screen detecting system and method
KR102226845B1 (en) System and method for object recognition using local binarization
Fan et al. Matching slides to presentation videos using sift and scene background matching
Battikh et al. Camera calibration using court models for real-time augmenting soccer scenes
JP2018055367A (en) Image processing device, image processing method, and program
Mirkamali et al. Object removal by depth-wise image inpainting
TWI839241B (en) Image processing device and method for viewing angle conversion
Liu et al. Match selection and refinement for highly accurate two-view structure from motion
Chen et al. Player trajectory reconstruction for tactical analysis
TWI827516B (en) Image processing device and method
Delmas et al. Stereo camera visual odometry for moving urban environments
Wong et al. Markerless augmented advertising for sports videos
Manafifard A review on camera calibration in soccer videos
KR20080012463A (en) An intelligent video display method for multimedia mobile devices
Tengfeng Seamless stitching of panoramic image based on multiple homography matrix
Berjón et al. Soccer line mark segmentation and classification with stochastic watershed transform
Xu et al. Accurate registration of multitemporal UAV images based on detection of major changes