TWI778804B - Two-dimensional code and method for fast localization and robust decoding - Google Patents
Two-dimensional code and method for fast localization and robust decoding Download PDFInfo
- Publication number
- TWI778804B TWI778804B TW110135179A TW110135179A TWI778804B TW I778804 B TWI778804 B TW I778804B TW 110135179 A TW110135179 A TW 110135179A TW 110135179 A TW110135179 A TW 110135179A TW I778804 B TWI778804 B TW I778804B
- Authority
- TW
- Taiwan
- Prior art keywords
- code
- positioning pattern
- positioning
- data
- dimensional code
- Prior art date
Links
Images
Landscapes
- Image Processing (AREA)
- Error Detection And Correction (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
本發明涉及一種二維碼,尤其涉及一種可快速識別的二維碼,以及二維碼的快速識別方法。 The invention relates to a two-dimensional code, in particular to a two-dimensional code that can be quickly identified, and a rapid identification method of the two-dimensional code.
二維碼可記載大量的資訊,令掃描裝置在掃描了二維碼並解碼後,直接獲得原始資訊,例如文字、符號、指令及網址等,相當便利。 The two-dimensional code can record a large amount of information, so that after scanning the two-dimensional code and decoding it, the scanning device can directly obtain the original information, such as text, symbols, instructions and website addresses, which is quite convenient.
由於無法預測使用者會從什麼角度來掃描二維碼,因此二維碼中一般都會設置一個或一個以上的定位圖案。以QR碼為例,QR碼中設置有三個定位圖案。當QR碼中的所有定位圖案都被掃描到後,掃描裝置才能可靠地確認QR碼的方位。而在確認了方位後,掃描裝置才能對QR碼中的資料區塊進行定位,進而對二維碼的資料進行取樣。惟,上述對於二維碼的掃描與識別程序需要耗費較長的時間才能獲得足夠定位的定位圖案資訊,而無法被應用在特定領域(例如自駕車導航)。 Since it is impossible to predict from what angle the user will scan the two-dimensional code, one or more positioning patterns are generally set in the two-dimensional code. Taking a QR code as an example, three positioning patterns are set in the QR code. When all the positioning patterns in the QR code have been scanned, the scanning device can reliably confirm the orientation of the QR code. After the orientation is confirmed, the scanning device can locate the data block in the QR code, and then sample the data of the two-dimensional code. However, the above scanning and recognizing procedures for two-dimensional codes take a long time to obtain sufficient positioning pattern information, and cannot be applied in specific fields (eg, self-driving car navigation).
再者,以上述的QR碼為例,只要三個定位圖案的其中之一污損,掃描裝置就不易辨識QR碼的方位,進而難以讀取QR碼的資料。換句話說,現有二維碼的容錯率較低,強固性仍嫌不足,而不適用於上述領域。 Furthermore, taking the above-mentioned QR code as an example, as long as one of the three positioning patterns is defaced, it is difficult for the scanning device to identify the orientation of the QR code, and thus it is difficult to read the data of the QR code. In other words, the fault tolerance rate of the existing QR code is low, and the robustness is still insufficient, so it is not suitable for the above-mentioned fields.
本發明的主要目的,在於提供一種可快速定位與識別的高強固性二維碼及其定位與識別方法,係可提供快速識別的效果,並且具有極強的容錯率。 The main purpose of the present invention is to provide a high-strength two-dimensional code that can be quickly positioned and identified, and a positioning and identification method thereof, which can provide the effect of rapid identification and have a strong fault tolerance rate.
為了達成上述的目的,本發明二維碼包括:四個完全對稱的碼區域,其中各該碼區域分別包括:一定位圖案,設置於該碼區域的一角落;一間隔區塊,沿著該定位圖案的周緣設置,用以區隔該定位圖案與該碼區域中的其他區塊;一格式資訊區塊,沿著該間隔區塊的周緣設置,記錄該碼區域的資訊;及一資料區塊,沿著該格式資訊區塊的周緣設置,記錄該資料區塊所承載二維碼的資料。 In order to achieve the above-mentioned purpose, the two-dimensional code of the present invention includes: four completely symmetrical code areas, wherein each of the code areas respectively includes: a positioning pattern arranged at a corner of the code area; an interval block along the code area The perimeter of the positioning pattern is arranged to separate the positioning pattern from other blocks in the code area; a format information block is arranged along the perimeter of the spaced block to record the information of the code area; and a data area The block is arranged along the periphery of the format information block to record the data of the two-dimensional code carried by the data block.
為了達成上述目的,本發明的快速識別方法應用於如上所述的該二維碼,並且包括下列步驟:a)通過演算法在所擷取的影像上有序地安排一掃描線掃描該二維碼;b)於該步驟a)未從該二維碼上獲得一預設碼特徵時,再次執行該步驟a),其中該預設碼特徵由該二維碼上的任一該碼區域中的該定位圖案提供;c)於獲得該預設碼特徵時,對提供該預設碼特徵的該定位圖案進行定位並取得該定位圖案的編號; d)依據該定位圖案的位置、該編號及該定位圖案所揭露的一透視轉換(perspective transformation)資訊,估測該定位圖案相對於其他碼區域的該定位圖案的方位及距離;e)該步驟d)後,對其他碼區域的該定位圖案進行定位;f)依據各該定位圖案的位置分別計算各該碼區域的該資料區塊的位置;及g)取樣該些資料區塊並進行解碼,以對該二維碼進行解碼。 In order to achieve the above-mentioned purpose, the rapid identification method of the present invention is applied to the above-mentioned two-dimensional code, and includes the following steps: a) orderly arrange a scan line on the captured image through an algorithm to scan the two-dimensional code code; b) when the step a) does not obtain a preset code feature from the two-dimensional code, perform the step a) again, wherein the preset code feature is determined from any one of the code areas on the two-dimensional code. The positioning pattern provided by; c) when obtaining the preset code feature, locate the positioning pattern that provides the preset code feature and obtain the number of the positioning pattern; d) estimating the orientation and distance of the positioning pattern relative to the positioning patterns in other code areas according to the position of the positioning pattern, the serial number and a perspective transformation information disclosed by the positioning pattern; e) this step d) after that, the positioning patterns of other code regions are positioned; f) the positions of the data blocks of the code regions are respectively calculated according to the positions of the positioning patterns; and g) the data blocks are sampled and decoded , to decode the QR code.
相較於相關技術,本發明的二維碼可在任一個碼區域的定位圖案被掃描到後直接獲得所有碼區域的資料而逕行全碼解碼,藉此達到極快的識別速度。並且,藉由全對稱的四個碼區域來組成二維碼,使得任何一個或二個或甚至三個定位圖案的損失或被破壞,都仍然可以解碼,可大幅提升二維碼的容錯率。 Compared with the related art, the two-dimensional code of the present invention can directly obtain the data of all code areas after the positioning pattern of any code area is scanned, and then perform full code decoding, thereby achieving extremely fast recognition speed. In addition, the two-dimensional code is composed of four fully symmetrical code areas, so that any one, two or even three positioning patterns can be decoded if any one, two or even three positioning patterns are lost or damaged, which can greatly improve the fault tolerance rate of the two-dimensional code.
1:二維碼 1: QR code
10:碼區域 10: Code area
11:第零碼區域 11: Zeroth yard area
12:第一碼區域 12: The first yard area
13:第二碼區域 13: Second yard area
14:第三碼區域 14: The third yard area
2:定位圖案 2: Positioning pattern
21:黑框模組 21: Black frame module
22:白框模組 22: White frame module
23:黑矩形模組 23: Black Rectangle Module
24:中心點 24: Center Point
25:邊界點 25: Boundary point
3:間隔區塊 3: Interval block
4:格式資訊區塊 4: Format information block
41:定位圖案身份碼 41: Positioning pattern ID code
42:偵錯修正碼等級 42: Error correction code level
43:遮罩碼 43: Mask code
44:檢查碼 44: Check Code
5:資料區塊 5: Data block
51:位元組 51: bytes
61~64:掃描線 61~64: scan line
S10~S24:識別步驟 S10~S24: Identification steps
圖1 為本發明的二維碼的結構圖的第一具體實施例。 FIG. 1 is a first specific embodiment of a structural diagram of a two-dimensional code of the present invention.
圖2 為本發明的二維碼的部分的結構圖的第一具體實施例。 FIG. 2 is a first specific embodiment of a structural diagram of a part of a two-dimensional code of the present invention.
圖3 為本發明的格式資訊的示意圖的第一具體實施例。 FIG. 3 is a first specific embodiment of a schematic diagram of format information of the present invention.
圖4 為本發明的識別流程圖的第一具體實施例。 FIG. 4 is a first specific embodiment of the identification flowchart of the present invention.
圖5 為本發明的掃描示意圖的第一具體實施例。 FIG. 5 is a first specific embodiment of a scanning schematic diagram of the present invention.
圖6 為本發明的二維碼的示意圖的第一具體實施例。 FIG. 6 is a first specific embodiment of a schematic diagram of a two-dimensional code of the present invention.
茲就本發明之一較佳實施例,配合圖式,詳細說明如後。 Hereinafter, a preferred embodiment of the present invention will be described in detail in conjunction with the drawings.
本發明揭露了一種可快速定位與識別的高強固性二維碼(下面簡稱為二維碼),此二維碼具有上、下、左、右完全對稱的結構。掃描裝置只要掃描二維碼的一部分結構,就可以擴展至二維碼的其他部分,進而對整個二維碼進行取樣,而不需要完整掃描二維碼的所有結構。因此,本發明的二維碼可以在極短時間內被識別完成。於一實施例中,本發明的二維碼平均可在小於或等於50ms的時間內被識別並讀取完成,遠快於市場上其他形式的二維碼。具體地,上述數據為通過1GHz/32位元的嵌入式專用之微控制器進行實際掃描與識別所得之數據。 The present invention discloses a high-strength solid two-dimensional code (hereinafter referred to as two-dimensional code) that can be quickly positioned and identified. The two-dimensional code has a completely symmetrical structure of upper, lower, left and right. As long as the scanning device scans a part of the structure of the two-dimensional code, it can be extended to other parts of the two-dimensional code, thereby sampling the entire two-dimensional code, without scanning all the structures of the two-dimensional code completely. Therefore, the two-dimensional code of the present invention can be recognized and completed in a very short time. In one embodiment, the two-dimensional code of the present invention can be recognized and read in an average of less than or equal to 50ms, which is much faster than other forms of two-dimensional codes on the market. Specifically, the above data is the data obtained by actual scanning and identification by a 1GHz/32-bit embedded dedicated microcontroller.
基於上述優點,本發明的二維碼可以被黏貼於地面,用以為自駕車(Automated Guideed Vehicle,AGV)或機器人進行移動控制及導航。於一實施例中,本發明的二維碼基於所應用的上述領域,可被稱為NaviCode,而與現有的二維碼,如QRCode、Aztec Code、Maxicode、Hanxin Code等在結構上有明顯的區隔。如上所述,本發明的二維碼可以在極短的時間內被識別完成,故自駕車或機器人可以在經過二維碼的瞬間識別二維碼並可穩定地獲取二維碼所記載的資料,藉此進行移動或執行對應任務。 Based on the above advantages, the two-dimensional code of the present invention can be pasted on the ground for movement control and navigation for an Automated Guided Vehicle (AGV) or a robot. In an embodiment, the two-dimensional code of the present invention is based on the above-mentioned fields of application, and can be called NaviCode, and has obvious structural differences with existing two-dimensional codes, such as QRCode, Aztec Code, Maxicode, Hanxin Code, etc. division. As mentioned above, the two-dimensional code of the present invention can be recognized in a very short time, so the self-driving car or robot can recognize the two-dimensional code at the moment of passing the two-dimensional code and can obtain the data recorded in the two-dimensional code stably , to move or perform the corresponding task.
值得一提的是,若將二維碼黏貼於地面上,容易因為被踩踏而造成污損。然而,本發明的二維碼可提供極高的容錯率,因此適用於如上所述的自駕車/機器人導航領域(容後詳述)。 It is worth mentioning that if the QR code is pasted on the ground, it is easy to cause contamination due to being stepped on. However, the two-dimensional code of the present invention can provide a very high error-tolerance rate, so it is suitable for the field of self-driving/robot navigation as described above (described in detail later).
本發明的二維碼為一種矩陣式的二維碼,意即,由多個格子所構成的矩陣來表示此二維碼。針對所記載的資料不同,所述矩陣分別由多個黑格子與多個白格子所組成,每一個格子分別代表一個資料單位(即,一個資料位元)。 The two-dimensional code of the present invention is a matrix-type two-dimensional code, that is, the two-dimensional code is represented by a matrix formed by a plurality of grids. For different recorded data, the matrix is composed of a plurality of black grids and a plurality of white grids, and each grid represents a data unit (ie, a data bit).
首請參閱圖1,為本發明的二維碼的結構圖的第一具體實施例。如圖1所示,本發明的二維碼1由多個完全對稱的碼區域所組成。於圖1的實施例中,多個碼區域包括第零碼區域11、第一碼區域12、第二碼區域13及第三碼區域14。
First, please refer to FIG. 1 , which is a first specific embodiment of the structure diagram of the two-dimensional code of the present invention. As shown in FIG. 1 , the two-
本發明的技術特徵在於,四個碼區域11-14的結構完全相同,差異僅在於各個碼區域11-14排列的方向位置的不同。於圖1的實施例中,第零碼區域11位於第一碼區域12的左側且與第一碼區域12相差90度,第一碼區域12位於第二碼區域13的上方且與第二碼區域13相差90度,第二碼區域13位於第三碼區域14的右側且與第三碼區域14相差90度,第三碼區域14位於第零碼區域11的下方且與第零碼區域11相差90度。
The technical feature of the present invention is that the structures of the four code areas 11-14 are completely the same, and the difference only lies in the direction and position of the arrangement of the code areas 11-14. In the embodiment of FIG. 1 , the
如前文所述,二維碼1的多個碼區域11-14具有相同的結構,其中,各個碼區域11-14分別由定位圖案2、間隔區塊3、格式資訊區塊4及資料區塊5所組成。
As mentioned above, the plurality of code areas 11-14 of the two-
請同時參閱圖1及圖2,其中圖2為本發明的二維碼的部分的結構圖的第一具體實施例。圖2中以二維碼1中的第零碼區域11為例,進行碼區域的結構說明,其他碼區域12-14的結構與第零碼區域11的結構相同,僅碼區域11-14排列的方向位置不同,後面將不再贅述。為了簡潔,下面將統一以碼區域10來進行說明。
Please refer to FIG. 1 and FIG. 2 at the same time, wherein FIG. 2 is a first specific embodiment of a structural diagram of a part of a two-dimensional code of the present invention. In FIG. 2, the
如上所述,各個碼區域10分別由定位圖案2、間隔區塊3、格式資訊區塊4及資料區塊5所組成,並且定位圖案2、間隔區塊3、格式資訊區塊4及資料區塊5分別由多個格子(即,資料單位)所形成。
As mentioned above, each
如圖2所示,定位圖案2為一黑白相間的同心方,並且設置於碼區域10的角落。定位圖案2具有固定且特殊的結構(容後詳述),當掃描裝置(圖未標示)通過掃描線掃描到二維碼1中的任一個碼區域10的定位圖案2時,即可對這個碼區域10進行定位。本發明的其中一個技術特徵在於,二維碼1中的多個碼區域10是完全對稱的,因此掃描裝置在定位了其中一個碼區域10後,就可以基於結構來直接估測其他碼區域10的位置,而不需要再掃描剩餘的碼區域10。藉此,可以達到高速識別的主要目的。
As shown in FIG. 2 , the
間隔區塊3沿著定位圖案2的周緣設置,用以將定位圖案2與碼區域10中的其他區塊區隔開來。如圖2所示,本發明的二維碼1為矩形,定位圖案2亦為矩形,且定位圖案2設置於二維碼1的其中一個角落。意即,定位圖案2的其中兩個邊與二維碼1的其中兩個邊對齊。並且,間隔區塊3沿著定位圖案2的另外兩個邊的外緣設置。
The spacer blocks 3 are arranged along the periphery of the
於一實施例中,間隔區塊3的寬度為一個資料單位,並且間隔區塊3以多個白資料單位形成,但不以此為限。
In one embodiment, the width of the
格式資訊區塊4沿著間隔區塊3的周緣設置,並且用以記錄所屬的碼區域10的相關資訊。具體地,間隔區塊3的內側對齊定位圖案2的外側,並且格式資訊區塊4沿著間隔區塊3的外側而設置。
The
於圖2的實施例中,格式資訊區塊4由多個資料單位構成,包括d0、d1、d2、d3、d4、d5及f0、f1、f2、f3、f4、f5、f6、f7、f8、f9、f10、f11、f12、f13、f14等資料單位。於一實施中,格式資訊區塊4記錄了此定位圖案2的編號、此二維碼1的偵錯修正碼等級、此二維碼1的遮罩碼樣式等格式
資訊。其中,所述編號可被掃描裝置用來判斷此碼區域10在整個二維碼1中的相對位置。
In the embodiment of FIG. 2, the
於一實施例中,格式資訊區塊4的寬度為一個資料單位,並且視所記錄的資料而以多個白資料單位、多個黑資料單位或其結合形成,但不以此為限。
In one embodiment, the width of the
請同時參閱圖1至圖3,其中圖3為本發明的格式資訊的示意圖的第一具體實施例。如圖3所示,格式資訊區塊4至少記錄有定位圖案身份碼41。於圖3的實施例中,定位圖案身份碼41包含在d0至d5等六個資料單位,但不以此為限。所述定位圖案身份碼41用以記錄定位圖案2的編號,例如,以“010110”表示編號0,以“011001”表示編號1,以“100101”表示編號2,以“101010”表示編號3。惟,上述僅為本發明的其中一個具體實施範例,但不以此為限。
Please refer to FIG. 1 to FIG. 3 at the same time, wherein FIG. 3 is a first specific embodiment of a schematic diagram of the format information of the present invention. As shown in FIG. 3 , the format information block 4 records at least a positioning
並且,所述編號可對應至二維碼1中的多個碼區域10的數量。例如,若二維碼1由四個碼區域10構成,則所述編號可例如為編號0、編號1、編號2及編號3。
Moreover, the number may correspond to the number of the plurality of
舉例來說,於圖1所示的二維碼1中,位於左上方的碼區域10為第零碼區域11,並且第零碼區域11中的格式資訊區塊4可記錄定位圖案2的編號為0。位於二維碼1右上方的碼區域10為第一碼區域12,並且第一碼區域12中的格式資訊區塊4可記錄定位圖案2的編號為1。位於二維碼1右下方的碼區域10為第二碼區域13,並且第二碼區域13中的格式資訊區塊4可記錄定位圖案2的編號為2。位於二維碼1左下方的碼區域10為第三碼區域14,並且第三碼區域14中的格式資訊區塊4可記錄定位圖案2的編號為3。
For example, in the
本實施例中,所述編號還可被用來計算定位圖案2相對於其他碼區域10的定位圖案2的方位及距離。具體地,基於二維碼1的預設結構,掃描裝置只要取得一個定位圖案2的編號,就可以得知此定位圖案2屬於哪一個碼區域10,進而可得知這個碼區域10(這個定位圖案2)相對於其他碼區域10(其他定位圖案2)的方位。
In this embodiment, the number can also be used to calculate the azimuth and distance of the
如圖1所示,編號0的定位圖案2(屬於第零碼區域11)位於編號1的定位圖案2(屬於第一碼區域12)的左側。編號1的定位圖案2位於編號2的定位圖案2(屬於第二碼區域13)的上方。編號2的定位圖案2位於編號3的定位圖案2(屬於第三碼區域14)的右側。編號3的定位圖案2位於編號0的定位圖案2的下方。基於這個結構,掃描裝置可以在掃描到其中一個定位圖案2後,直接完成對所有碼區域10的定位動作。
As shown in FIG. 1 , the
回到圖3,所述格式資訊區塊4還記錄偵錯修正碼等級(Level of Error Correction Code,ECC)42、遮罩碼(Mask)43及檢查碼(Check-bits)44。其中,偵錯修正碼等級42的尺寸為三個資料單位,圖3中以f12-f14來表示;遮罩碼43的尺寸為兩個資料單位,圖3中以f10-f11來表示;檢查碼44的尺寸為十個資料單位,圖3中以f0-f9來表示。於一實施例中,所述偵錯修正碼等級42、遮罩碼43及檢查碼44主要可通過BCH碼(Bose-Chaudhuri-Hocquenghem codes)來實現,但不加以限定。
Returning to FIG. 3 , the
值得一提的是,所述偵錯修正碼等級的尺寸為三個資料單位,通過設定偵錯修正碼等級的內容,可為二維碼1設定八種不同的容錯等級(即,以二進制的000至111表示)。於一實施例中,二維碼1採用里德-所羅門碼(Reed-
Solomon error codes)來實現偵錯修正,基於偵錯修正碼等級,可達到最低8%至最高46%的容錯率。
It is worth mentioning that the size of the error detection correction code level is three data units. By setting the content of the error detection correction code level, eight different error tolerance levels can be set for the two-dimensional code 1 (that is, in binary format. 000 to 111 indicates). In one embodiment, the two-
上述Reed-Solomon error codes為編碼領域常用的技術手段,為了說明書的簡潔,於此不再贅述。 The above-mentioned Reed-Solomon error codes are commonly used technical means in the coding field, and are not repeated here for the sake of brevity of the description.
如前文所述,二維碼1主要需被黏貼在地面上,以對自駕車或機器人進行控制與導航。通過上述超高的容錯率,本發明的二維碼1即使污損嚴重,仍然有較高的機率可被自駕車/機器人正確識別,因此可以適用於自駕車或機器人的技術領域。
As mentioned above, the
回到圖2。所述資料區塊5沿著格式資訊區塊4的周緣設置,用以記錄二維碼1的一部或全部資料。具體地,格式資訊區塊4的內側對齊間隔區塊3的外側,並且資料區塊5沿著格式資訊區塊4的外側而設置。於圖2的實施例中,資料區塊5共包含十三組依據指定的位元次序進行編排的位元組51,其中各個位元組51分別包括八個資料單位,圖2中以b0至b7表示,但不加以限定。
Back to Figure 2. The data block 5 is arranged along the periphery of the
於一實施例中,資料區塊5可用以記錄純二進位資訊,例如數字(0-9)、文字(a-z、A-Z)或符號等。並且,基於所採用的偵錯修正碼等級的不同,最多可支持44位元組(bytes)的資料大小。若將本發明的二維碼1應用於自駕車或機器人領域,則所述資料區塊5可記錄當前的座標位置,以及相對於下一張二維碼1的黏貼位置的方向及距離等資料,但不以此為限。
In one embodiment, the data block 5 can be used to record pure binary information, such as numbers (0-9), characters (a-z, A-Z) or symbols. Moreover, depending on the level of error detection and correction code used, a data size of up to 44 bytes can be supported. If the two-
本發明的其中一個技術特徵在於,四個碼區域10的結構是完全對稱的,因此掃描裝置在掃描到任一個碼區域10的定位圖案2後,可以直接執行兩個動作:(1)對定位圖案2所屬的碼區域10的格式資訊區塊4及資料區塊5
進行定位,以對資料進行取樣;(2)對其他碼區域10的定位圖案2進行定位,以對其他碼區域10的資料進行取樣。換句話說,本發明的二維碼1中的各個碼區域10可以被各自取樣並共同參與解碼,掃描裝置不需要等到所有碼區域10的定位圖案2都被掃描到後才開始對二維碼1進行資料取樣與解碼,因此可獲得極快的識別速度。
One of the technical features of the present invention is that the structure of the four
為了令掃描裝置可以明確識別,本發明的二維碼1的定位圖案2具有一特定的結構。如圖2所示,所述定位圖案2由外而內可由一個黑框模組21、一個白框模組22及一個黑矩形模組23依序組成。由圖2可看出,所述黑框模組21是由多個黑格子組成,所述白框模組22是由多個白格子組成,所述黑矩形模組23是由多個黑格子組成。
In order to enable the scanning device to clearly identify, the
具體地,本案中的定位圖案2可稱為定位牛眼,其中,所述黑框模組21為定位牛眼的外環,白框模組22為定位牛眼的環內靜區,黑矩形模組23則為定位牛眼的瞳仁。
Specifically, the
如圖2所示,黑框模組21呈空心方框的形狀,並且黑框模組21的長度及寬度皆為九個黑資料單位(即,黑格子)。白框模組22設置於黑框模組21內部,呈空心方框的形狀,並且白框模組22的長度及寬度皆為七個白資料單位(即,白格子)。黑矩形模組23設置於白框模組22內部,呈實心矩形的形狀,並且黑矩形模組23的長度及寬度皆為五個黑資料單位(即,黑格子)。
As shown in FIG. 2 , the
基於上述定位圖案2的結構,當掃描裝置中的演算法藉由一條掃描線掃描定位圖案2時,可由外而內依序得到黑資料單位、白資料單位、黑資料單位、白資料單位及黑資料單位的資訊,並且其比例為1:1:5:1:1。
Based on the above-mentioned structure of the
本發明中,掃描裝置可將上述的排列與比例做為定位圖案2的碼特徵。當掃描裝置藉由掃描線獲得上述碼特徵時,即可識別出一個定位圖案2的存在。尤其,此一比例優於一般常用的快速響應碼(Quick Response,QR)的比例1:1:3:1:1。藉由此特徵,掃描裝置於掃描時擁有更高的定位圖案貫穿機率。具體地,一般掃描裝置對於QR碼的定位圖案的貫穿機率為~43%,而對於本發明的二維碼1的定位圖案的貫穿機率為~56%。相較於一般的QR碼,掃描裝置對於本發明的二維碼1可於更短的時間內找到定位圖案。
In the present invention, the scanning device can use the above arrangement and ratio as the code features of the
請同時參閱圖1至圖4,其中圖4為本發明的識別流程圖的第一具體實施例。圖4揭露了一種二維碼的定位與識別方法(下面將於說明書中簡稱為識別方法),所述識別方法結合圖1所示的二維碼1及圖2所示的碼區域10,說明掃描裝置如何掃描並識別本發明的二維碼1。
Please refer to FIG. 1 to FIG. 4 at the same time, wherein FIG. 4 is a first specific embodiment of the identification flowchart of the present invention. FIG. 4 discloses a method for positioning and identifying a two-dimensional code (hereinafter referred to as the identification method in the description), and the identification method is described in conjunction with the two-
所述掃描裝置為具有影像擷取器而可掃描二維碼的電子裝置,例如設置有相機的行動裝置或設置有掃描儀的雷射感測器等,不加以限定。於進行掃描時,掃描裝置擷取欲識別的二維碼的影像,接著通過演算法在所擷取的影像上有序地安排一條掃描線,以對二維碼1進行掃描(步驟S10)。基於演算法在掃描線上計算出的黑白間隔比例,掃描裝置可判斷是否獲得預設碼特徵(步驟S12)。所述演算法通過掃描線進行掃描的技術手段,為二維碼相關領域中的常用技術手段,於此不再贅述。 The scanning device is an electronic device having an image capture device capable of scanning a two-dimensional code, such as a mobile device provided with a camera or a laser sensor provided with a scanner, etc., which are not limited. During scanning, the scanning device captures the image of the two-dimensional code to be recognized, and then arranges a scan line in an orderly manner on the captured image through an algorithm to scan the two-dimensional code 1 (step S10 ). Based on the black and white interval ratio calculated by the algorithm on the scan line, the scanning device can determine whether to obtain the preset code feature (step S12 ). The technical means of scanning the algorithm through the scanning line is a common technical means in the related field of two-dimensional codes, and will not be repeated here.
具體地,所述預設碼特徵是由二維碼1中任一個碼區域10的定位圖案2來提供,意即,掃描裝置於步驟S10中是以掃描二維碼1上的任一碼區域10的定位圖案2為目標。於一實施例中,所述預設碼特徵為黑資料單位與白資料單位以1:1:5:1:1的順序與比例進行交錯排列。
Specifically, the preset code feature is provided by the
若掃描裝置沒有獲得所述預設碼特徵,則再次執行步驟S10,藉由演算法安排下一條掃描線以尋找二維碼1上的定位圖案2。若掃描裝置獲得預設碼特徵,則可判斷當前的掃描線貫穿了二維碼1上的任一個碼區域10中的定位圖案2。此時,掃描裝置對提供了所述預設碼特徵的定位圖案2進行定位(步驟S14),並且取得此定位圖案2的編號(步驟S16)。
If the scanning device does not obtain the preset code feature, step S10 is performed again, and the next scan line is arranged by an algorithm to find the
由於定位圖案2為矩形,因此無論掃描線以何種角度貫穿了定位圖案2,都可得到所述預設碼特徵。並且,將預設碼特徵設定為黑、白相間的1:1:5:1:1的比例配置,幾乎不可能在定位圖案2以外的其他區塊找到相同的特徵。如此一來,可以有效提高二維碼1的識別成功率及識別速度。
Since the
具體地,於步驟S14中,掃描裝置主要可在發現了定位圖案2後,基於掃描線上所取得的黑、白相間的1:1:5:1:1的位置來計算定位圖案2的中心點與四個邊界點(例如圖2所示的中心點24及四個邊界點25),並且藉由中心點24及四個邊界點25來對定位圖案2進行定位。於步驟S16中,掃描裝置可以基於中心點24、四個邊界點25以及定位圖案2本身的結構及尺寸,計算所屬的碼區域10中的格式資訊區塊4的位置,並從格式資訊區塊4中讀取定位圖案2的編號。
Specifically, in step S14, the scanning device may calculate the center point of the
具體地,本案中的定位圖案2可稱為定位牛眼,其中,所述中心點24為定位牛眼的中心點,所述四個邊界點25用以指出定位牛眼的固定之寬度比(於圖中為九個資料單位)。
Specifically, the
如前文所述,所述格式資訊區塊4的寬度為一個資料單位,並且可記錄有定位圖案身份碼41、偵錯修正碼等級42、遮罩碼43及檢查碼44。於步驟S16中,掃描裝置可讀取格式資訊區塊4中的定位圖案身份碼41,以獲
得定位圖案2的編號。通過定位後所得的位置以及所獲得的編號,掃描裝置可以進一步估測此定位圖案2相對於二維碼1中其他碼區域10的定位圖案2的方位及距離(步驟S18)。
As mentioned above, the width of the
更具體地,掃描裝置於步驟S18中主要是依據定位圖案2的位置、編號、以及定位圖案2所揭露的透視轉換(perspective transformation)資訊,估測此定位圖案2相對於二維碼1中其他碼區域10的定位圖案2的方位及距離。
More specifically, in step S18 , the scanning device mainly estimates the relative position of the
承上,所述透視轉換(或稱為透視失真)指的是在三維空間中因為拍攝傾角而造成的影像形變。掃描裝置的演算法需要先藉由透視轉換資訊來修正定位圖案2的所述形變,再依定位圖案2的方向、位置等資訊來決定定位圖案2的真實位置。在確定了一個定位圖案2的真實位置後,掃描裝置的演算法才能正確地估測此定位圖案2相對於其他定位圖案2的方位及距離。
On the basis of the above, the perspective transformation (or called perspective distortion) refers to the image deformation caused by the shooting inclination in the three-dimensional space. The algorithm of the scanning device needs to first correct the deformation of the
例如圖1的實施例所述,二維碼1可包含第零碼區域11(具有編號0的定位圖案2)、第一碼區域12(具有編號1的定位圖案2)、第二碼區域13(具有編號2的定位圖案2)及第三碼區域14(具有編號3的定位圖案2),各個碼區域12的資料排序角度與相鄰的碼區域12的資料排序角度相差90度。其中,編號0的定位圖案2位於編號1的定位圖案2的左側,編號1的定位圖案2位於編號2的定位圖案2的上方,編號2的定位圖案2位於編號3的定位圖案2的右側,編號3的定位圖案2位於編號0的定位圖案2的下方。
For example, as described in the embodiment of FIG. 1 , the two-
通過在步驟S16中取得的任一定位圖案2的位置及編號,掃描裝置在步驟S18中可以估測出此定位圖案2相對於其他定位圖案2的方向及距離,進而能夠對其他碼區域10的定位圖案2進行定位(步驟S20)。
Based on the position and number of any
具體地,掃描裝置在步驟S14中可獲得被掃描到的定位圖案2的中心點24及四個邊界點25。於步驟S20中,掃描裝置可依據此定位圖案2的中心點24及四個邊界點25來估測其他碼區域10的定位圖案2的中心點24及四個邊界點25,藉此對其他定位圖案2進行定位。
Specifically, the scanning device can obtain the
如前文所述,二維碼1上的多個碼區域10是完全對稱的。以圖1所示的二維碼1為例,第零碼區域11與第一碼區域12分別位於二維碼1的左上方及右上方。第零碼區域11的定位圖案2的右上方的邊界點25與第一碼區域11的定位圖案2的左上方的邊界點25間,距離水平的十二個資料單位。再例如,第零碼區域11與第三碼區域14分別位於二維碼1的左上方及左下方。第零碼區域11的定位圖案2的左下方的邊界點25與第三碼區域14的定位圖案2的左上方的邊界點25間,距離垂直的十二個資料單位。
As mentioned above, the plurality of
綜上所述,只要在步驟S14中確認了任一個定位圖案2的位置及編號,掃描裝置就可以快速地對二維碼1中的剩餘定位圖案2進行定位。換句話說,於本發明的識別方法中,掃描裝置只要有一條掃描線掃描到任一個定位圖案2,就可以完成對整個二維碼1的定位,而不需要掃描所有的定位圖案2。據此,可以實現本發明快速識別的主要目的。
To sum up, as long as the position and number of any
步驟S20後,掃描裝置即可依據二維碼1上各個定位圖案2的位置,分別計算各個碼區域10中的資料區塊5的位置(步驟S22),並且取樣這些資料區塊5並進行解碼(步驟S24),藉此對二維碼1進行識別。於一實施例中,各個資料區塊5分別包括了十三組依據指定的位元次序進行編排的位元組51,並且各個位元組51分別包括八個資料單位。
After step S20, the scanning device can calculate the positions of the data blocks 5 in each
具體地,掃描裝置取樣了各個碼區域10的資料區塊5後,還可對所取得的資料進行對稱碼字的檢索(Symmetric codewords retrieval),並且進行偵錯修正(例如通過上述的Reed-Solomon error codes進行偵錯修正),以對二維碼1的內容進行解碼。
Specifically, after sampling the data blocks 5 of each
本發明的二維碼1中的多個碼區域10完全對稱,即使部分的碼區域10污損,導致掃描裝置於步驟S20中無法對一或多個定位圖案2進行定位,掃描裝置仍可藉由已定位的一或多個定位圖案2的中心點24及邊界點25,定位出污損的碼區域10中的資料區塊5的位置。如此,仍可獲得二維碼1中未被污損部分的完整資料,再經由上述Reed-Solomon error codes將污損破壞的部分予以修正回來。藉此,可以達到本案極高容錯率的主要目的。
The plurality of
本發明藉由全對稱的四個碼區域10來組成二維碼1,即使任何一個或二個或甚至三個定位圖案2損失或被破壞,都仍然可以對二維碼1進行解碼(惟定位圖案2獲取越多,解碼成功機率相對越高),而可大幅提升二維碼的容錯率。
In the present invention, the two-
請同時參閱圖1至圖5,其中圖5為本發明的掃描示意圖的第一具體實施例。如圖5所示,在掃描二維碼1時,掃描裝置(圖未標示)的演算法可依序分析多條不同的位置掃描線61-64。
Please refer to FIG. 1 to FIG. 5 at the same time, wherein FIG. 5 is a first specific embodiment of a scanning schematic diagram of the present invention. As shown in FIG. 5 , when scanning the two-
於圖5的實施例中,掃描裝置首先分析掃描線61,但掃描線61並沒有落在二維碼1上。接著,掃描裝置分析掃描線62。掃描線62雖然落在二維碼1上,但是掃描裝置無法藉由掃描線62獲得所述預設碼特徵,即,黑、白資料單位相間的1:1:5:1:1的比例配置。接著,掃描裝置分析掃描線63。掃描線63雖然落在二維碼1上,但是掃描裝置仍然無法藉由掃描線63獲得所述
預設碼特徵。接著,掃描裝置分析掃描線64,並且藉由掃描線64獲得了預設碼特徵。據此,掃描裝置可判斷掃描線64貫穿了二維碼1上的任一定位圖案2,並可對定位圖案2進行定位。
In the embodiment of FIG. 5 , the scanning device first analyzes the
在對定位圖案2進行了定位後,掃描裝置可獲得定位圖案2的中心點24及四個邊界點25的位置,並且可由對應的格式資訊區塊4取得定位圖案2的編號。藉此,掃描裝置可以直接估測出二維碼1上其他三個定位圖案2的位置。並且,如圖5所示,基於完全對稱的結構,即使其中一個定位圖案2污損而無法被掃描,仍不會妨礙掃描裝置對二維碼1進行正確的識別。
After positioning the
藉由本發明的識別方法掃描本發明的二維碼1,掃描裝置只要掃描到二維碼1上的任一個定位圖案2,就可以計算出所有資料區塊5的位置並對資料區塊5進行取樣,藉此完成對二維碼1的識別。並且,所述識別方法可在小於或等於50ms的時間內完成,且具有高度的容錯率,因此可適用於自駕車或機器人的導引的特殊領域。
By scanning the two-
值得一提的是,通過四個定位圖案2的中心點24及邊界點25,可以定義出整個二維碼1的中心位置、水平基準線及垂直基準線。當自駕車或機器人經過二維碼1時,除了讀取二維碼1的資料外,還可基於所述中心位置、水平基準線及垂直基準線來判斷自身相對於二維碼1的位置、方向及角度。通過上述判斷的結果,自駕車/機器人可以調整自身的位置、角度及行進方向等參數。如此一來,可以有效提升自駕車/機器人的移動準確度。
It is worth mentioning that, through the
參閱圖6,為本發明的二維碼的示意圖的第一具體實施例。圖6揭示了本發明的二維碼1的其中一個實際範例。於圖6的實施例中,二維碼1的多個資料區塊5中分別記錄了數字及文字。這些數字及文字記錄了一組座標,
其內容為:“(X=325.79,Y=-101.23)”。惟,圖6的實施例僅為本發明的其中一組實施態樣,但不以此為限。
Referring to FIG. 6 , it is a first specific embodiment of a schematic diagram of a two-dimensional code of the present invention. FIG. 6 discloses one practical example of the two-
於上述圖4的實施例中,掃描裝置在掃描到一個定位圖案2後,先對所有定位圖案2進行定位,接著再對各個碼區域10的資料區塊5進行定位,並對各個資料區塊5進行取樣。然而如前文所述,本發明的二維碼1中的各個碼區域10是完全對稱且可被各自識別的。因此,掃描裝置亦可在不同時間點分別定位各個碼區域10的資料區塊5並且對各個資料區塊5進行取樣,而不以圖4所示的流程為限。
In the above-mentioned embodiment of FIG. 4 , after scanning a
本發明通過完全對稱的多個碼區域10來組成一個二維碼1,可以結合本發明的識別方法來達到極快的識別速度。並且,可藉由完全對稱的多個碼區域來提升二維碼的容錯率,以利二維碼被應用在特殊領域中。
In the present invention, a two-
以上所述僅為本發明之較佳具體實例,非因此即侷限本發明之專利範圍,故舉凡運用本發明內容所為之等效變化,均同理皆包含於本發明之範圍內,合予陳明。 The above description is only a preferred specific example of the present invention, and therefore does not limit the scope of the patent of the present invention. Therefore, all equivalent changes made by using the content of the present invention are all included in the scope of the present invention. Bright.
1:二維碼 1: QR code
11:第零碼區域 11: Zeroth yard area
12:第一碼區域 12: The first yard area
13:第二碼區域 13: Second yard area
14:第三碼區域 14: The third yard area
2:定位圖案 2: Positioning pattern
3:間隔區塊 3: Interval block
4:格式資訊區塊 4: Format information block
5:資料區塊 5: Data block
51:位元組 51: bytes
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110135179A TWI778804B (en) | 2021-09-22 | 2021-09-22 | Two-dimensional code and method for fast localization and robust decoding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110135179A TWI778804B (en) | 2021-09-22 | 2021-09-22 | Two-dimensional code and method for fast localization and robust decoding |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI778804B true TWI778804B (en) | 2022-09-21 |
TW202314595A TW202314595A (en) | 2023-04-01 |
Family
ID=84958224
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW110135179A TWI778804B (en) | 2021-09-22 | 2021-09-22 | Two-dimensional code and method for fast localization and robust decoding |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI778804B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103400059A (en) * | 2006-07-19 | 2013-11-20 | 先进追踪和寻踪公司 | Method and device for securing and authenticating document |
TW201428635A (en) * | 2012-11-13 | 2014-07-16 | Kyodo Printing Co Ltd | Two-dimensional code |
TW201432576A (en) * | 2012-11-13 | 2014-08-16 | Kyodo Printing Co Ltd | Two-dimensional code, system for creation of two-dimensional code, and analysis program |
CN105574572A (en) * | 2015-12-24 | 2016-05-11 | 上海师范大学 | Color quick response code and generation method thereof |
TW201830291A (en) * | 2017-02-14 | 2018-08-16 | 香港商阿里巴巴集團服務有限公司 | Two-dimensional code generation method and device and two-dimensional code recognition method and device |
CN109447216A (en) * | 2018-12-30 | 2019-03-08 | 尤尼泰克(嘉兴)信息技术有限公司 | A kind of two dimensional code quick and precisely identified |
US10410103B2 (en) * | 2016-02-06 | 2019-09-10 | Shenzhen Mpr Technology Co., Ltd | Two-dimensional dot matrix barcode encoding and identifying methods |
TW202025021A (en) * | 2018-11-28 | 2020-07-01 | 香港商阿里巴巴集團服務有限公司 | Method and device for providing and verifying two-dimensional code |
-
2021
- 2021-09-22 TW TW110135179A patent/TWI778804B/en active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103400059A (en) * | 2006-07-19 | 2013-11-20 | 先进追踪和寻踪公司 | Method and device for securing and authenticating document |
TW201428635A (en) * | 2012-11-13 | 2014-07-16 | Kyodo Printing Co Ltd | Two-dimensional code |
TW201432576A (en) * | 2012-11-13 | 2014-08-16 | Kyodo Printing Co Ltd | Two-dimensional code, system for creation of two-dimensional code, and analysis program |
CN105574572A (en) * | 2015-12-24 | 2016-05-11 | 上海师范大学 | Color quick response code and generation method thereof |
US10410103B2 (en) * | 2016-02-06 | 2019-09-10 | Shenzhen Mpr Technology Co., Ltd | Two-dimensional dot matrix barcode encoding and identifying methods |
TW201830291A (en) * | 2017-02-14 | 2018-08-16 | 香港商阿里巴巴集團服務有限公司 | Two-dimensional code generation method and device and two-dimensional code recognition method and device |
TW202025021A (en) * | 2018-11-28 | 2020-07-01 | 香港商阿里巴巴集團服務有限公司 | Method and device for providing and verifying two-dimensional code |
CN109447216A (en) * | 2018-12-30 | 2019-03-08 | 尤尼泰克(嘉兴)信息技术有限公司 | A kind of two dimensional code quick and precisely identified |
Also Published As
Publication number | Publication date |
---|---|
TW202314595A (en) | 2023-04-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6360948B1 (en) | Method of reading two-dimensional code and storage medium thereof | |
Hirzer | Marker detection for augmented reality applications | |
US5616905A (en) | Two-dimensional code recognition method | |
US9665759B2 (en) | Decoding method for matrix two-dimensional code | |
JP4801551B2 (en) | Image area detection method, program, and apparatus | |
CN101069189B (en) | Bar code scanner decoding | |
US9117103B2 (en) | Image information processing apparatus and method for controlling the same | |
CN110287854B (en) | Table extraction method and device, computer equipment and storage medium | |
JP2005267598A (en) | Two-dimensional bar code and sign decoding method | |
US20060118633A1 (en) | Bar code scanning decoding | |
WO2017041600A1 (en) | Chinese-sensitive code feature pattern detection method and system | |
JP6457971B2 (en) | System and method for pattern stitching and decoding using multiple captured images | |
US6941026B1 (en) | Method and apparatus using intensity gradients for visual identification of 2D matrix symbols | |
CN110020571B (en) | Two-dimensional code correction method, device and equipment | |
ES2616146B2 (en) | METHOD OF DETECTION AND RECOGNITION OF LONG REACH AND HIGH DENSITY VISUAL MARKERS | |
TWI778804B (en) | Two-dimensional code and method for fast localization and robust decoding | |
JP4865844B2 (en) | Two-dimensional code reading method, two-dimensional code for reading by the two-dimensional code reading method, and recording medium on which the two-dimensional code reading method is recorded | |
KR20030085511A (en) | 2d barcode card and its decoding method | |
CN104463156B (en) | Digital piano coding-decoding method | |
CN111126286A (en) | Vehicle dynamic detection method and device, computer equipment and storage medium | |
CN111523331A (en) | Two-dimensional code identification method and device | |
CN115879485A (en) | High-strength two-dimensional code capable of being quickly positioned and identified and positioning and identifying method thereof | |
JP5034693B2 (en) | Code reading apparatus and method | |
CN114444531A (en) | Method and system for collecting data for training Machine Learning (ML) models | |
CN113095104A (en) | Defective two-dimensional code positioning method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
GD4A | Issue of patent certificate for granted invention patent |