TWI790761B - Image correction method and processor - Google Patents
Image correction method and processor Download PDFInfo
- Publication number
- TWI790761B TWI790761B TW110135993A TW110135993A TWI790761B TW I790761 B TWI790761 B TW I790761B TW 110135993 A TW110135993 A TW 110135993A TW 110135993 A TW110135993 A TW 110135993A TW I790761 B TWI790761 B TW I790761B
- Authority
- TW
- Taiwan
- Prior art keywords
- image
- sub
- feature points
- quick response
- response matrix
- Prior art date
Links
Images
Landscapes
- Image Analysis (AREA)
- Apparatus For Radiation Diagnosis (AREA)
- Image Processing (AREA)
Abstract
Description
本申請涉及影像處理技術領域,具體涉及一種圖像校正方法及處理器。 The present application relates to the technical field of image processing, in particular to an image correction method and a processor.
快速回應矩陣碼作為一種常用的矩陣式二維碼,不僅可以應用於平面印刷品,還可以應用於各種形狀物體的表面等。比如,可以將包含空調相關資訊的快速回應矩陣碼粘貼在空調表面,供解碼設備(如手機、平板電腦等)拍攝解碼得到空調相關資訊。然而,快速回應矩陣碼自身變形(distortion)或者解碼設備的拍攝能力不足,均可能導致解碼設備拍攝到變形的快速回應矩陣碼圖像。為實現對變形的快速回應矩陣碼圖像的解碼,就需要對其進行校正。 Quick response matrix code, as a commonly used matrix two-dimensional code, can be applied not only to flat prints, but also to the surface of objects of various shapes. For example, a quick-response matrix code containing air-conditioner-related information can be pasted on the surface of the air-conditioner for decoding devices (such as mobile phones, tablets, etc.) to capture and decode to obtain air-conditioner-related information. However, distortion of the quick response matrix code itself or insufficient shooting capability of the decoding device may cause the decoding device to capture a deformed quick response matrix code image. In order to realize the decoding of the deformed fast response matrix code image, it needs to be corrected.
本申請提供了一種圖像校正方法及處理器,能夠校正快速回應矩陣碼圖像的變形。 The present application provides an image correction method and a processor, which can correct the deformation of the fast response matrix code image.
本申請提供一種圖像校正方法,包括:對一快速回應矩陣碼圖像進行特徵點搜索,確定出快速回應矩陣碼圖像中的多個特徵點;根據確定出的多個特徵點,將快速回應矩陣碼圖像的編碼區域劃分為多個子區域;以及根 據每一子區域對應的特徵點,確定每一子區域的一補償向量,並根據每一子區域的補償向量對每一子區域進行補償校正,得到一校正後的圖像。 The present application provides an image correction method, which includes: searching for feature points on a quick response matrix code image to determine multiple feature points in the quick response matrix code image; according to the determined multiple feature points, quickly The encoding region of the response matrix code image is divided into a plurality of subregions; and the root A compensation vector for each sub-region is determined according to the feature points corresponding to each sub-region, and compensation and correction are performed for each sub-region according to the compensation vector for each sub-region to obtain a corrected image.
本申請提供一種處理器,所述處理器執行一電腦程式以實施一圖像校正方法,其中,所述圖像校正方法包括:對一快速回應矩陣碼圖像進行特徵點搜索,確定出所述快速回應矩陣碼圖像中的多個特徵點;根據所述多個特徵點,將所述快速回應矩陣碼圖像的一編碼區域劃分為多個子區域;以及,根據每一所述子區域對應的特徵點,確定每一所述子區域的一補償向量,並根據每一所述子區域的所述補償向量對每一所述子區域進行補償校正,得到一校正後的圖像。 The present application provides a processor, the processor executes a computer program to implement an image correction method, wherein the image correction method includes: performing feature point search on a fast response matrix code image, and determining the A plurality of feature points in the quick response matrix code image; according to the plurality of feature points, a coding area of the quick response matrix code image is divided into a plurality of sub-areas; and, according to each of the sub-areas corresponding feature points, determine a compensation vector for each of the sub-regions, and perform compensation and correction on each of the sub-regions according to the compensation vector of each of the sub-regions to obtain a corrected image.
本申請透過對快速回應矩陣碼圖像採用分區域的向量補償方式進行校正,能夠避免不同子區域間的干擾,從而更準確地校正快速回應矩陣碼圖像的變形。 The present application corrects the quick response matrix code image by adopting a sub-area vector compensation method, which can avoid interference between different sub-areas, thereby more accurately correcting the deformation of the quick response matrix code image.
S110,S120,S130:步驟 S110, S120, S130: steps
p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12:特徵點 p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12: feature points
A1,A2,A3:中心點 A1,A2,A3: center point
B1,B2,B3:外邊緣點 B1, B2, B3: Outer edge points
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17:子區域 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17: sub-regions
01:電子設備 01:Electronic equipment
10:晶片 10: Wafer
20:記憶體 20: Memory
30:相機 30: camera
100:處理器 100: Processor
200:介面電路 200: interface circuit
為了更清楚地說明本申請實施例中的技術方案,下面將對實施例描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本申請的一些實施例,對於本領域技術人員來講,在不付出創造性勞動的前提下,還可以根據這些附圖獲得其他的附圖。 In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.
圖1為本申請提供的圖像校正方法的流程示意圖。 FIG. 1 is a schematic flow chart of the image correction method provided by the present application.
圖2為本申請中對快速回應矩陣碼圖像進行分區域的向量補償校正得到校正後的圖像的示例圖。 FIG. 2 is an example diagram of a corrected image obtained by performing region-by-area vector compensation correction on the fast response matrix code image in the present application.
圖3為本申請中搜索出的特徵點的示例圖。 FIG. 3 is an example diagram of feature points searched in this application.
圖4是本申請中搜索出圖3所示特徵點過程中搜索的尋像圖形(finder pattern)的中心點和外邊緣點的示例圖。 FIG. 4 is an example diagram of the central point and outer edge points of the finder pattern searched during the process of searching for the feature points shown in FIG. 3 in the present application.
圖5是本申請中對編碼區域中同一部分的三種不同區域劃分方式的示例圖。 Fig. 5 is an example diagram of three different regions division methods for the same part of the coding region in this application.
圖6是本申請中將編碼區域劃分為17個子區域的示例圖。 Fig. 6 is an example diagram of dividing the coding area into 17 sub-areas in this application.
圖7是本申請實施例提供的電子設備01的方塊示意圖。 FIG. 7 is a schematic block diagram of an electronic device 01 provided by an embodiment of the present application.
應當說明的是,本申請的原理是以實施在一適當的應用環境中來舉例說明。以下的說明是透過所例示的本申請具體實施例,其不應被視為限制本申請未在此詳述的其它具體實施例。 It should be noted that the principles of the present application are implemented in an appropriate application environment for illustration. The following descriptions are based on illustrated specific embodiments of the present application, which should not be construed as limiting other specific embodiments of the present application that are not described in detail here.
本申請實施例提供的方案涉及影像處理技術領域,具體涉及快速回應矩陣碼圖像的校正,透過下文中的實施例進行說明。請參照圖1,圖1為本申請實施例提供的圖像校正方法流程示意圖,如圖1所示,該方法可以包括: The solutions provided by the embodiments of the present application relate to the field of image processing technology, and specifically relate to the correction of images of fast response matrix codes, which will be described through the following embodiments. Please refer to FIG. 1. FIG. 1 is a schematic flow chart of the image correction method provided in the embodiment of the present application. As shown in FIG. 1, the method may include:
步驟S110,對一快速回應矩陣碼圖像進行特徵點搜索,確定出快速回應矩陣碼圖像中的多個特徵點。 In step S110, a feature point search is performed on a quick response matrix code image to determine a plurality of feature points in the quick response matrix code image.
以下以圖像校正方法實施於一電子設備為例進行說明。此處對電子設備的實體展現形式不作具體限制,可以是智慧手機、平板電腦等移動式電子設備。 The following takes the image correction method implemented in an electronic device as an example for illustration. Here, there is no specific limitation on the physical display form of the electronic device, which may be mobile electronic devices such as smart phones and tablet computers.
本實施例中,電子設備包括一處理器,其藉由執行一電腦程式來實施本發明的圖像校正方法,處理器可以按照配置的特徵點搜索策略,對一 快速回應矩陣碼圖像進行特徵點搜索,從而確定出快速回應矩陣碼圖像中的多個特徵點。應當說明的是,本實施例中對於特徵點搜索策略的配置不作具體限制,可由本領域具有通常知識者根據實際需要進行配置。比如,處理器可以透過角點檢測演算法,從快速回應矩陣碼圖像中搜索出具有角點(角點就是極值點,即某方面屬性特別突出的點)特徵的點作為特徵點。其中,角點檢測演算法包括但不限於哈裡斯(Harris)演算法、尺度不變特徵變換(Scale-invariant feature transform,SIFT)演算法、加速穩健特徵(Speeded Up Robust Features,SURF)演算法以及帶旋轉的二元特徵(Oriented FAST and Rotated BRIEF,ORB)演算法等。 In this embodiment, the electronic device includes a processor, which implements the image correction method of the present invention by executing a computer program, and the processor can perform a search on a The quick response matrix code image is searched for feature points, so as to determine multiple feature points in the quick response matrix code image. It should be noted that there is no specific limitation on the configuration of the feature point search strategy in this embodiment, and it can be configured by those skilled in the art according to actual needs. For example, the processor can use the corner detection algorithm to search for points with corner points (corner points are extreme points, that is, points with particularly prominent attributes) from the QRC image as feature points. Among them, the corner detection algorithm includes but not limited to Harris (Harris) algorithm, scale-invariant feature transform (Scale-invariant feature transform, SIFT) algorithm, accelerated robust features (Speeded Up Robust Features, SURF) algorithm and Binary feature with rotation (Oriented FAST and Rotated BRIEF, ORB) algorithm, etc.
此外,本實施例中對於以上快速回應矩陣碼圖像的來源不作具體限制,比如,當電子設備配置有相機時,電子設備可以透過配置相機對快速回應矩陣碼進行拍攝得到,也可由該電子設備從網路獲取等。 In addition, in this embodiment, there is no specific limitation on the source of the above quick response matrix code image. For example, when the electronic device is equipped with a camera, the electronic device can obtain the quick response matrix code by photographing the quick response matrix code through the configuration of the camera, or it can be obtained by the electronic device Obtained from the Internet, etc.
步驟S120,根據多個特徵點,將快速回應矩陣碼圖像的一編碼區域劃分為多個子區域。 Step S120: Divide a coding area of the quick response matrix code image into multiple sub-areas according to multiple feature points.
其中,處理器根據配置的區域劃分策略,以確定出的多個特徵點為根據,將快速回應矩陣碼圖像的一編碼區域劃分為多個子區域。此處對區域劃分策略的配置不作具體限制,可由本領域技術人員根據實際需要進行配置。 Wherein, the processor divides a coded area of the quick response matrix code image into multiple sub-areas according to the configured area division strategy and based on the determined multiple feature points. There is no specific limitation on the configuration of the area division policy here, and it can be configured by those skilled in the art according to actual needs.
步驟S130,根據每一子區域對應的特徵點,確定每一子區域的一補償向量,並根據每一子區域的補償向量對每一子區域進行補償校正,得到一校正後的圖像。 Step S130, determine a compensation vector for each sub-region according to the feature points corresponding to each sub-region, and perform compensation and correction for each sub-region according to the compensation vector for each sub-region to obtain a corrected image.
其中,處理器針對編碼區域的每一子區域,透過確定的補償向 量對變形導致的偏移進行補償,最終得到一用於解碼的校正後的圖像。比如,請參照圖2,處理器對一變形的快速回應矩陣碼圖像進行分區域的向量補償校正後,得到補償了碼元偏移的校正後的圖像。 Among them, the processor, for each sub-region of the coding region, through the determined compensation to The amount compensates for the offset caused by the deformation, and finally obtains a corrected image for decoding. For example, please refer to FIG. 2 , after the processor performs region-by-region vector compensation correction on a deformed fast response matrix code image, a corrected image in which the symbol offset is compensated is obtained.
在一實施例中,搜索快速回應矩陣碼圖像中的多個尋像圖形;以及根據多個尋像圖形搜索確定出多個特徵點。 In an embodiment, searching for a plurality of finding patterns in the quick response matrix code image; and searching and determining a plurality of feature points according to the searching of the plurality of finding patterns.
尋像圖形(又稱位置探測圖形、探測圖形等)用於對快速回應矩陣碼圖像進行定位。目前的快速回應矩陣碼通常包括三個尋像圖形,分別位於快速回應矩陣碼的三個角上,即快速回應矩陣碼的左下角、左上角和右上角。比如,請參照圖2,其中三個“回”型圖形即為尋像圖形。 Image-finding graphics (also known as position detection graphics, detection graphics, etc.) are used to locate the quick response matrix code image. The current quick response matrix code usually includes three image finding patterns, which are respectively located on the three corners of the quick response matrix code, ie, the lower left corner, the upper left corner and the upper right corner of the quick response matrix code. For example, please refer to Fig. 2, in which three "back"-shaped graphics are image-finding graphics.
應當說明的是,尋像圖形的黑白像素之寬度比例為1:1:3:1:1,根據該特點,處理器可以搜索到快速回應矩陣碼圖像中的三個尋像圖形。 It should be noted that the width ratio of the black and white pixels of the image finding pattern is 1:1:3:1:1. According to this feature, the processor can search for the three image finding patterns in the quick response matrix code image.
示例性地,為了實現對快速回應矩陣碼圖像中尋像圖形的搜索,處理器首先建立坐標系,比如,以快速回應矩陣碼圖像的左上角頂點為原點,建立像素坐標系。然後,處理器根據尋像圖形的黑白像素之寬度比例為1:1:3:1:1的特點,對快速回應矩陣碼圖像進行掃描,從而得到其中的三個尋像圖形。比如,處理器可以對快速回應矩陣碼圖像進行逐行掃描,也可以對快速回應矩陣碼圖像進行隔行掃描。其中,行指的是快速回應矩陣碼圖像的一行像素,此處對隔行的行數不作具體限制,可由本領域具有通常知識者根據實際需要進行配置,比如,可以每隔3行對快速回應矩陣碼圖像進行掃描,以快速搜索出其中的三個尋像圖形。 Exemplarily, in order to realize the search for the image finding pattern in the quick response matrix code image, the processor first establishes a coordinate system, for example, establishes a pixel coordinate system with the upper left corner vertex of the quick response matrix code image as the origin. Then, the processor scans the quick response matrix code image according to the feature that the width ratio of the black and white pixels of the finding pattern is 1:1:3:1:1, so as to obtain three finding patterns. For example, the processor can perform progressive scanning on the quick response matrix code image, and can also perform interlaced scanning on the quick response matrix code image. Among them, the row refers to a row of pixels of the quick response matrix code image. There is no specific limit to the number of interlaced rows here, and it can be configured by those skilled in the art according to actual needs. For example, the quick response can be paired every 3 rows. Scan the matrix code image to quickly search out the three image-finding graphics.
在一實施例中,在搜索多個特徵點時,處理器以搜索確定出的多個尋像圖形為根據,進一步搜索確定出多個特徵點。比如,當搜索確定出三 個尋像圖形時,處理器以三個尋像圖形為搜索物件,搜索確定出多個特徵點。 In an embodiment, when searching for a plurality of feature points, the processor further searches and determines a plurality of feature points based on the plurality of imaging patterns determined by searching. For example, when the search identifies three When there are three image-finding graphics, the processor uses the three image-finding graphics as search objects to search and determine a plurality of feature points.
在一實施例中,在搜索確定出多個尋像圖形之後,處理器並不立即根據搜索出的多個圖像圖形搜索特徵點,而是先根據多個尋像圖形對快速回應矩陣碼圖像進行解碼。比如,處理器可以採用透視變換的方式對快速回應矩陣碼圖像進行解碼,若解碼成功,則相應得到解碼結果。若解碼失敗時,處理器判定快速回應矩陣碼圖像存在變形,此時再根據多個尋像圖形搜索確定出多個特徵點,以用於對快速回應矩陣碼圖像的變形校正。 In one embodiment, after searching and determining a plurality of image-finding patterns, the processor does not immediately search for feature points according to the searched-out plurality of image patterns, but first responds quickly to the matrix code image according to the plurality of image-finding patterns like decoding. For example, the processor may decode the quick response matrix code image in a perspective transformation manner, and if the decoding is successful, correspondingly obtain a decoding result. If the decoding fails, the processor determines that the image of the quick response matrix code is deformed, and at this time searches and determines a plurality of feature points according to a plurality of imaging patterns for correcting the deformation of the image of the quick response matrix code.
在一實施例中,對校正後的圖像進行解碼,得到解碼結果。 In an embodiment, the corrected image is decoded to obtain a decoding result.
比如,處理器對圖2所示的校正後的圖像進行解碼,可以得到解碼結果“20210113二維碼1”。
For example, the processor decodes the corrected image shown in FIG. 2 to obtain the decoding result "20210113
在一實施例中,在根據多個尋像圖形搜索確定出多個特徵點時,處理器可以搜索每一尋像圖形靠近編碼區域的多個頂點確定作為特徵點,以及搜索快速回應矩陣碼圖像中一校正參考圖形的一中心點確定作為特徵點。校正參考圖形類似於尋像圖形,也是黑白相間的矩形塊,但其黑白像素比例為1:1:1:1:1,根據該特點,處理器可以搜索到快速回應矩陣碼圖像中的校正參考圖形,以及搜索到該校正參考圖形的中心點。 In one embodiment, when a plurality of feature points are determined according to multiple image-finding patterns, the processor can search for multiple vertices of each image-finding pattern close to the coding area to determine as feature points, and search for the quick response matrix code map A center point of a calibration reference pattern in the image is determined as a feature point. The correction reference pattern is similar to the image finding pattern, which is also a black and white rectangular block, but its black and white pixel ratio is 1:1:1:1:1. According to this feature, the processor can search for the correction in the fast response matrix code image Reference graphic, and search for the center point of the calibration reference graphic.
比如,請參照圖3,處理器搜索到圖示快速回應矩陣碼圖像中左上角尋像圖形靠近編碼區域的右上角頂點p1、右下角頂點p4、左下角頂點p3,右上角尋像圖形靠近編碼區域的左上角頂點p2、左下角頂點p5、右下角頂點p6,左下角尋像圖形靠近編碼區域的左上角頂點p7、右上角頂點p8、右下角頂點p10,以及右下角校正參考圖形的中心點p9,並將p1、p2、p3、p4、p5、p6、p7、p8、p9以及p10作為特徵點。 For example, please refer to Fig. 3, the processor finds that in the quick response matrix code image shown in the illustration, the image-seeking figure in the upper-left corner is close to the upper-right vertex p1, the lower-right vertex p4, and the lower-left vertex p3 of the coding area, and the image-seeking figure in the upper right corner is close to The upper left vertex p2, the lower left vertex p5, the lower right vertex p6 of the encoding area, the image finding figure in the lower left corner is close to the upper left vertex p7, the upper right vertex p8, the lower right vertex p10 of the encoding area, and the center of the correction reference graphic in the lower right corner Point p9, and use p1, p2, p3, p4, p5, p6, p7, p8, p9 and p10 as feature points.
應當說明的是,本實施例對於如何進行頂點搜索不作具體限制,可由本領域技術人員根據實際需要配置頂點搜索方式,比如,處理器可以透過形態學腐蝕膨脹,邊緣檢測和霍夫(Hough)變換來搜索出每一尋像圖形靠近編碼區域的多個頂點,還可以透過對每一尋像圖形的邊緣進行定位,計算邊界方程推算出每一尋像圖形靠近編碼區域的多個頂點等。 It should be noted that this embodiment does not make specific restrictions on how to perform vertex search, and the vertex search method can be configured by those skilled in the art according to actual needs. For example, the processor can use morphological erosion and expansion, edge detection and Hough (Hough) transform To search out multiple vertices of each image-seeking pattern close to the coding area, and by locating the edge of each image-seeking pattern, calculate the boundary equation to deduce the multiple vertices of each image-finding pattern close to the coding area, etc.
在一實施例中,在搜索每一尋像圖形靠近編碼區域的多個頂點確定作為特徵點時,處理器可以每一尋像圖形的中心點為起始點,沿一搜索方向搜索確定每一尋像圖形的一外邊緣點,並以每一尋像圖形的外邊緣點為起始點,沿每一尋像圖形的外邊緣搜索確定出多個頂點。 In one embodiment, when searching for multiple vertices of each imaging pattern close to the coding area to determine as feature points, the processor can use the center point of each imaging pattern as a starting point to search along a search direction to determine each Find an outer edge point of the image-finding graphic, and start from the outer edge point of each image-finding graphic, and search along the outer edge of each image-finding graphic to determine a plurality of vertices.
實施上,搜索方向可由本領域技術人員根據實際需要進行配置,比如,可以配置x軸方向或y軸方向中任一方向作為搜索方向。 In practice, the search direction can be configured by those skilled in the art according to actual needs, for example, either the x-axis direction or the y-axis direction can be configured as the search direction.
比如,請參照圖4,以x軸方向作為搜索方向為例,針對快速回應矩陣碼圖像中的左上角尋像圖形,處理器以該尋像圖形的中心點A1為起始點,向負x軸方向搜索,確定一外邊緣點B1,然後以該外邊緣點B1為起始點,沿該尋像圖形的外邊緣搜索確定該尋像圖形靠近編碼區域的頂點p1、p4和p3;針對快速回應矩陣碼圖像中的右上角尋像圖形,處理器以該尋像圖形的中心點A2為起始點,向負x軸方向搜索,確定一外邊緣點B2,然後以該外邊緣點B2為起始點,沿該尋像圖形的外邊緣搜索確定該尋像圖形靠近編碼區域的頂點p2、p5和p6;針對快速回應矩陣碼圖像中的左下角尋像圖形,處理器以該尋像圖形的中心點A3為起始點,向負x軸方向搜索,確定一外邊緣點B3,然後以該外邊緣點B3為起始點,沿該尋像圖形的外邊緣搜索確定該尋像圖形靠近編碼區域的頂點p7、p8和p10。 For example, please refer to Fig. 4, taking the x-axis direction as an example for the search direction, for the image-seeking pattern in the upper left corner of the quick response matrix code image, the processor takes the center point A1 of the image-seeking pattern as the starting point, and moves toward the negative Search in the x-axis direction, determine an outer edge point B1, then use the outer edge point B1 as a starting point, search along the outer edge of the image finding pattern to determine that the image finding pattern is close to the vertices p1, p4 and p3 of the coding area; for Quickly respond to the image-seeking pattern in the upper right corner of the matrix code image, the processor takes the central point A2 of the image-seeking pattern as the starting point, searches in the direction of the negative x-axis, determines an outer edge point B2, and then uses the outer edge point B2 is the starting point, search along the outer edge of the image-finding graph to determine that the image-finding graph is close to the vertices p2, p5 and p6 of the coding area; The center point A3 of the image-seeking pattern is the starting point, search toward the negative x-axis direction, determine an outer edge point B3, and then use the outer edge point B3 as the starting point, search along the outer edge of the image-seeking pattern to determine the Like graph vertices p7, p8 and p10 near the coding region.
在一實施例中,在以每一尋像圖形的外邊緣點為起始點,沿每一尋像圖形的外邊緣搜索確定出多個頂點時,處理器以每一尋像圖形的外邊緣點為起始點,透過8鄰域邊緣追蹤演算法(Eight neighborhood contour tracking algorithm)沿每一尋像圖形的外邊緣搜索確定出多個頂點。 In one embodiment, when a plurality of vertices are searched and determined along the outer edge of each image-seeking pattern with the outer edge point of each image-finding pattern as the starting point, the processor uses the outer edge of each image-finding pattern Point is the starting point, and a plurality of vertices are determined by searching along the outer edge of each image-finding graph through an eight-neighborhood contour tracking algorithm.
其中,8鄰域邊緣追蹤演算法也稱8鄰域邊界追蹤演算法、摩爾鄰域跟蹤演算法(Moore neighborhood tracking algorithm)等。本實施例透過採用8鄰域邊緣追蹤演算法來跟蹤每一尋像圖形的外邊緣實現對前述多個頂點的搜索,能夠降低搜索所需的計算量。 Among them, the 8-neighborhood edge tracking algorithm is also called 8-neighborhood boundary tracking algorithm, Moore neighborhood tracking algorithm (Moore neighborhood tracking algorithm) and so on. In this embodiment, the search for the aforesaid multiple vertices is achieved by using an 8-neighborhood edge tracking algorithm to track the outer edges of each image-finding pattern, which can reduce the amount of computation required for the search.
在一實施例中,多個尋像圖形包括左下角尋像圖形、左上角尋像圖形和右上角尋像圖形,在搜索校正參考圖形失敗時,根據左下角尋像圖形的右上角頂點、左上角尋像圖形的右下角頂點和右上角尋像圖形的左下角頂點,搜索一定位點確定作為特徵點,其中,定位點與右上角頂點、右下角頂點和左下角頂點連接構成一矩形。 In one embodiment, the multiple image-finding patterns include the image-finding pattern in the lower left corner, the image-finding pattern in the upper-left corner, and the image-finding pattern in the upper right corner. The lower right corner vertex of the corner image-seeking figure and the lower-left corner vertex of the upper right corner image-finding figure are searched for an anchor point to determine as a feature point, wherein the anchor point is connected with the upper right corner vertex, the lower right corner vertex and the lower left corner vertex to form a rectangle.
需要說明的是,快速回應矩陣碼目前包括40個版本,從21碼元*21碼元(版本1)到177碼元*177碼元(版本40),其中後一版本的快速回應矩陣碼相較於前一版本的快速回應矩陣碼在每邊增加4個碼元,比如,圖2示出的快速回應矩陣碼圖像對應版本2的快速回應矩陣碼,其為25碼元*25碼元。然而,並不是所有版本的快速回應矩陣碼均具有校正參考圖形,比如,版本1的快速回應矩陣碼就不具備校正參考圖形。因此,特徵點搜索單元110在搜索校正參考圖形時,可能搜索成功,也可能搜索失敗。
It should be noted that the Quick Response Matrix Code currently includes 40 versions, from 21 symbols*21 symbols (version 1) to 177 symbols*177 symbols (version 40), wherein the latter version of the Quick Response Matrix Code phase Compared with the previous version of the quick response matrix code, 4 symbols are added on each side. For example, the image of the quick response matrix code shown in Figure 2 corresponds to the
本實施例中,處理器在搜索校正參考圖形失敗時,可進一步根據左下角尋像圖形的右上角頂點、左上角尋像圖形的右下角頂點和右上角尋像 圖形的左下角頂點,搜索一定位點確定作為特徵點。其中,定位點與右上角頂點、右下角頂點和左下角頂點連接構成一矩形。 In this embodiment, when the processor fails to search and correct the reference pattern, it can further search for the image according to the upper right vertex of the image finding pattern in the lower left corner, the lower right vertex of the image finding pattern in the upper left corner, and the upper right corner vertex of the image finding pattern in the upper left corner. For the vertex at the lower left corner of the graph, search for a certain point and determine it as a feature point. Wherein, the anchor point is connected with the upper right vertex, the lower right vertex and the lower left vertex to form a rectangle.
在一實施例中,在將快速回應矩陣碼圖像的一編碼區域劃分為多個子區域時,處理器以至少一特徵點作為一子區域的頂點為約束條件,根據多個特徵點將編碼區域劃分為多個子區域。此處對子區域的劃分方式不作具體限制,可由本領域具有通常知識者根據實際需要進行配置。比如,請參照圖5,示出了三種不同的劃分方式,根據特徵點p4、p5、p8以及p9,處理器可以將編碼區域的中間部分劃分為一個子區域(劃分方式1),也可以將編碼區域的中間部分劃分為兩個子區域(劃分方式2),還可以將編碼區域的中間部分劃分為四個子區域(劃分方式3)。 In one embodiment, when dividing a coded area of the quick response matrix code image into multiple sub-areas, the processor takes at least one feature point as a vertex of a sub-area as a constraint condition, and divides the coded area according to multiple feature points for multiple subregions. Here, there is no specific limitation on the way of dividing the sub-regions, which can be configured by those skilled in the art according to actual needs. For example, please refer to FIG. 5, which shows three different division methods. According to the feature points p4, p5, p8 and p9, the processor can divide the middle part of the coding region into a sub-region (division method 1), and can also divide The middle part of the coding region is divided into two sub-regions (division method 2), and the middle part of the coding region can also be divided into four sub-regions (division method 3).
在一實施例中,在根據每一子區域對應的特徵點,確定每一子區域的一補償向量,並根據每一子區域的補償向量對每一子區域進行補償校正時,處理器根據每一子區域對應的特徵點,確定每一子區域在一水平方向的一水平單位補償向量,在一垂直方向的一垂直單位補償向量;以及根據每一子區域的水平單位補償向量和垂直單位補償向量,對每一子區域進行補償校正。 In one embodiment, when determining a compensation vector for each sub-region according to the feature points corresponding to each sub-region, and performing compensation and correction for each sub-region according to the compensation vector for each sub-region, the processor A feature point corresponding to a sub-region, determine a horizontal unit compensation vector of each sub-region in a horizontal direction, a vertical unit compensation vector in a vertical direction; and according to the horizontal unit compensation vector and vertical unit compensation of each sub-region A vector to perform compensation corrections for each subregion.
比如,針對一子區域,處理器將該子區域在水平方向對應的兩個特徵點的座標向量除以這兩個特徵點之間的碼元數量,得到水平單位補償向量,及將該子區域在垂直方向對應的兩個特徵點的座標向量除以這兩個特徵點之間的碼元數量,得到垂直單位補償向量。 For example, for a sub-area, the processor divides the coordinate vectors of the two feature points corresponding to the sub-area in the horizontal direction by the number of symbols between the two feature points to obtain a horizontal unit compensation vector, and the sub-area The vertical unit compensation vector is obtained by dividing the coordinate vectors of the two corresponding feature points in the vertical direction by the number of symbols between the two feature points.
在一實施例中,在根據每一子區域的水平單位補償向量和垂直單位補償向量,對每一子區域進行補償校正時,處理器可以獲取對應快速回應矩陣碼圖像的一匹配模板,並以每一子區域包括的特徵點為起始點,根據水平 單位補償向量和垂直單位補償向量,搜索子區域中的每一碼元,並將搜索到的每一碼元的像素值映射至匹配模板,得到校正後的圖像。 In an embodiment, when performing compensation and correction on each sub-region according to the horizontal unit compensation vector and the vertical unit compensation vector of each sub-region, the processor can obtain a matching template corresponding to the QRM code image, and Taking the feature points included in each sub-area as the starting point, according to the level The unit compensation vector and the vertical unit compensation vector search each symbol in the sub-region, and map the searched pixel value of each symbol to a matching template to obtain a corrected image.
其中,處理器可以識別快速回應矩陣碼圖像對應的快速回應矩陣碼的版本號,然後根據該版本號取得對應的匹配模板。比如,請參照圖4,處理器可以根據尋像圖形計算出一個碼元的邊長佔用的像素數量,再透過尋像圖形的中心點A1、A2和A3的座標計算出圖4所示快速回應矩陣碼的版本號,表示為:V=(((A1A2+A1A3)/2+7)/s-17)/4;其中,V表示版本號,A1A2表示A1到A2的座標距離,A1A3表示A1到A3的座標距離,s表示一個碼元的邊長佔用的像素數量。 Wherein, the processor can identify the version number of the quick response matrix code corresponding to the quick response matrix code image, and then obtain the corresponding matching template according to the version number. For example, please refer to Figure 4, the processor can calculate the number of pixels occupied by the side length of a symbol according to the image-finding pattern, and then calculate the quick response shown in Figure 4 through the coordinates of the center points A1, A2, and A3 of the image-finding pattern The version number of the matrix code is expressed as: V=(((A1A2+A1A3)/2+7)/s-17)/4; wherein, V represents the version number, A1A2 represents the coordinate distance from A1 to A2, and A1A3 represents A1 The coordinate distance to A3, s represents the number of pixels occupied by the side length of a symbol.
本實施例中,處理器以每一子區域包括的特徵點為起始點,根據水平單位補償向量和垂直單位補償向量,搜索子區域中的每一碼元,並將搜索到的每一碼元的像素值映射至匹配模板,得到校正後的圖像。 In this embodiment, the processor takes the feature points included in each sub-area as the starting point, searches each symbol in the sub-area according to the horizontal unit compensation vector and the vertical unit compensation vector, and converts each code element found The pixel value of the element is mapped to the matching template to obtain the corrected image.
以下以圖6所示的子區域劃分方式為例,對本申請提供的向量補償校正方式進行說明。 The vector compensation and correction method provided by the present application will be described below by taking the sub-region division method shown in FIG. 6 as an example.
如圖6所示的版本2的快速回應矩陣碼圖像,共搜索出10個特徵點,分別為p1、p2、p3、p4、p5、p6、p7、p8、p9以及p10。其中,利用p1、p2、p4以及p5將編碼區域的中上部分劃分為4個子區域,分別為子區域1、子區域2、子區域3和子區域4;利用p3、p4、p7以及p8將編碼區域的左中部分劃分為4個子區域,分別為子區域5、子區域6、子區域10以及子區域11;利用p4、p5、p8以及p9將編碼區域的中心部分劃分為4個子區域,分別為子區域7、子區域8、子區域12以及子區域13;利用p5、p6、p8以及p9將
編碼區域的右中部分劃分為2個子區域,分別為子區域9和子區域14;利用p5、p8、p9以及p10將編碼區域的下中部分劃分為2個子區域,分別為子區域15和子區域16;利用p5、p8以及p9將編碼區域的右下部分劃分為1個子區域,即子區域17。
As shown in FIG. 6 , the quick response matrix code image of
以下對子區域7的向量補償為例進行說明:首先,計算子區域7的水平單位補償向量和垂直單位補償向量,其中,子區域7在水平方向(即x軸方向)對應的特徵點為p4和p5,p4和p5之間共有11個碼元,在垂直方向(即y軸方向)對應的特徵點為p4和p8,p4和p8之間共有11個碼元,則可以按照如下公式計算得到子區域7的水平單位補償向量和垂直單位補償向量:
以p4為起始點,根據水平單位補償向量和垂直單位補償向
量搜索水平方向和垂直方向上的第一個碼元spt7,可以表示為:
如上,每次搜索到ept7後,將ept7對應的像素值映射至版本2的匹配模板中,直至完成對子區域7中所有碼元的校正。
As above, after each search of ept 7 , the pixel value corresponding to ept 7 is mapped to the matching template of
以下對子區域12的向量補償為例進行說明:類似於子區域7,區別在於不能直接根據p8和p9確定水平單位補償向量,而是需要先確定與P9幾何對應的新的特徵點p11,p11可以理解為P8所在塊的中心點,可以透過p4、p7和p8進行搜索,表示為:
以p8為起始點,根據水平單位補償向量和垂直單位補償向
量搜索水平方向和垂直方向上的第一個碼元spt12,可以表示為:
如上,每次搜索到ept12後,將ept12對應的像素值映射至版本2的匹配模板中,直至完成對子區域12中所有碼元的校正。
As above, each time ept 12 is found, the pixel value corresponding to ept 12 is mapped to the matching template of
以下對子區域17的向量補償為例進行說明:類似於子區域12,同樣不能直接根據子區域17在水平方向對應的特徵點p8和p9確定水平單位補償向量,也不能根據子區域17在垂直方向對應的特徵點p5和p9確定垂直單位補償向量,而是需要先確定水平方向上與P9幾何對應的新的特徵點p11,以及確定垂直方向上與P9幾何對應的新的特徵點p12。
The following explains the vector compensation of
p12可以理解為P5所在塊的中心點,可以透過p2、p5和p6進行搜索,表示為:
將p9作為第一個碼元,將p9對應的像素值映射至版本2的匹配模板中,之後繼續搜索子區域17中的其它碼元ept17,可以表示為:
如上,每次搜索到ept17後,將ept17對應的像素值映射至版本2的匹配模板中,直至完成對子區域17中所有碼元的校正。
As above, each time ept 17 is found, the pixel value corresponding to ept 17 is mapped to the matching template of
如上,示出了針對不同類型子區域的具體向量補償方式,對於其它子區域,可參照以上對應類型子區域的向量補償方式相應實施,此處不再贅述。 As above, specific vector compensation methods for different types of sub-regions are shown. For other sub-regions, reference may be made to the above-mentioned vector compensation methods for corresponding types of sub-regions, and details will not be repeated here.
應當說明的是,由於尋像圖形的位置是固定的,可以直接在匹配模板中的對應填入尋像圖形的像素值,最終得到完整的校正後的圖像。 It should be noted that since the position of the image finding pattern is fixed, the corresponding pixel values of the image finding pattern can be directly filled in the matching template, and finally a complete corrected image can be obtained.
請參照圖7,本申請還提供一種電子設備01,包括一晶片10和一記憶體20和一相機30,其中,相機30至少包括一鏡頭和圖像感測器,其中鏡頭用於將外界的光訊號投射至圖像感測器,圖像感測器用於將鏡頭投射的光訊號進行光電轉換,將光訊號轉換為可用的電訊號,得到數位化的的圖像。相機30可用於對任一快速回應矩陣碼進行拍攝得到的快速回應矩陣碼圖像。
Please refer to FIG. 7 , the present application also provides an electronic device 01, including a
晶片10,包括介面電路200和處理器100。介面電路200用於獲取相機30拍攝的快速回應矩陣碼圖像,可為移動產業處理器介面(Mobile Industry Processor Interface,MIPI)。處理器100可藉由執行記憶體20中的電腦程式以實施本發明的圖像校正方法,將介面電路200電路獲取的快速回應矩陣碼圖像的編碼區域劃分為多個子區域進行補償校正,得到校正後的圖像。
The
記憶體20可以為高速隨機存取記憶體,還可以為非揮發性記憶 體,比如至少一個磁片儲存裝置、快閃記憶體裝置、或其他揮發性固態儲存裝置等。 The memory 20 can be a high-speed random access memory, or a non-volatile memory body, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
本領域技術人員可以理解的是,上述實施例的各種方法中的全部或部分步驟可以透過電腦程式或指令來完成,或透過指令控制相關的硬體來完成,該電腦程式或指令可以儲存於一電腦可讀儲存媒介中,並由晶片進行載入和執行。 Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed through computer programs or instructions, or through instructions to control related hardware. The computer programs or instructions can be stored in a stored in a computer-readable storage medium, and loaded and executed by a chip.
以上對本申請實施例提供的圖像校正方法及處理器進行了詳細介紹。本文中應用了具體個例對本申請的原理及實施方式進行了闡述,以上實施例的說明只是用於幫助理解本申請。同時,對於本領域的技術人員,依據本申請的思想,在具體實施方式及應用範圍上均會有改變之處,綜上所述,本說明書內容不應理解為對本申請的限制。 The image correction method and the processor provided in the embodiments of the present application have been introduced in detail above. In this paper, specific examples are used to illustrate the principles and implementation methods of the present application, and the descriptions of the above embodiments are only used to help understand the present application. At the same time, for those skilled in the art, based on the idea of this application, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as limiting the application.
S110,S120,S130:步驟 S110, S120, S130: steps
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW110135993A TWI790761B (en) | 2021-09-28 | 2021-09-28 | Image correction method and processor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW110135993A TWI790761B (en) | 2021-09-28 | 2021-09-28 | Image correction method and processor |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TWI790761B true TWI790761B (en) | 2023-01-21 |
| TW202314586A TW202314586A (en) | 2023-04-01 |
Family
ID=86670147
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW110135993A TWI790761B (en) | 2021-09-28 | 2021-09-28 | Image correction method and processor |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI790761B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI880842B (en) * | 2024-08-26 | 2025-04-11 | 大陸商星宸科技股份有限公司 | Image distortion correction device and image distortion correction method able to increase processing efficiency |
-
2021
- 2021-09-28 TW TW110135993A patent/TWI790761B/en active
Non-Patent Citations (1)
| Title |
|---|
| 期刊 Wang, Hao, and Yanming Zou. "2D Bar codes reading: solutions for camera phones." International Journal of Signal Processing 3.3 (2006) World Academy of Science, Engineering and Technology 2006 pages 164-170 |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202314586A (en) | 2023-04-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8781207B2 (en) | Computing device and image correction method | |
| CN109543489B (en) | Positioning method and device based on two-dimensional code and storage medium | |
| US10187546B2 (en) | Method and device for correcting document image captured by image pick-up device | |
| JP6152821B2 (en) | Image processing apparatus and computer program | |
| CN109784250B (en) | Positioning method and device of automatic guide trolley | |
| CN111428707B (en) | Method and device for identifying pattern identification code, storage medium and electronic equipment | |
| JP5468824B2 (en) | Method and apparatus for determining shape match in three dimensions | |
| CN110189322A (en) | Flatness detection method, device, equipment, storage medium and system | |
| CN111260574B (en) | A seal photo correction method, terminal and computer-readable storage medium | |
| US9131193B2 (en) | Image-processing device removing encircling lines for identifying sub-regions of image | |
| CN113850100B (en) | Method and electronic device for calibrating two-dimensional code | |
| CN113920525A (en) | Text correction method, device, equipment and storage medium | |
| CN113744307A (en) | Image feature point tracking method and system based on threshold dynamic adjustment | |
| TWI790761B (en) | Image correction method and processor | |
| CN106327503A (en) | Image registration method and image registration equipment | |
| JP2009301181A (en) | Image processing apparatus, image processing program, image processing method and electronic device | |
| CN111260729B (en) | Method and device for calibrating fisheye lens in vehicle-mounted all-round system | |
| US11908108B2 (en) | Image correction method and processor | |
| JP4020093B2 (en) | Edge detection method and apparatus, program, storage medium, and frame detection method, apparatus, program, and storage medium | |
| CN110245674B (en) | Template matching method, device, equipment and computer storage medium | |
| CN114998347A (en) | Semiconductor panel corner positioning method and device | |
| JP2009302731A (en) | Image processing apparatus, image processing program, image processing method, and electronic device | |
| CN110543798B (en) | Two-dimensional code recognition method and device | |
| US20240320852A1 (en) | Image signal processor and method for processing image signal | |
| CN115631245B (en) | A calibration method, terminal device and storage medium |