TWI779836B - Keyboard file verification method based on image processing - Google Patents

Keyboard file verification method based on image processing Download PDF

Info

Publication number
TWI779836B
TWI779836B TW110134474A TW110134474A TWI779836B TW I779836 B TWI779836 B TW I779836B TW 110134474 A TW110134474 A TW 110134474A TW 110134474 A TW110134474 A TW 110134474A TW I779836 B TWI779836 B TW I779836B
Authority
TW
Taiwan
Prior art keywords
keyboard
image
file
map
generate
Prior art date
Application number
TW110134474A
Other languages
Chinese (zh)
Other versions
TW202314637A (en
Inventor
李皓軒
陳佩君
洪孟佳
Original Assignee
英業達股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 英業達股份有限公司 filed Critical 英業達股份有限公司
Priority to TW110134474A priority Critical patent/TWI779836B/en
Application granted granted Critical
Publication of TWI779836B publication Critical patent/TWI779836B/en
Publication of TW202314637A publication Critical patent/TW202314637A/en

Links

Images

Abstract

A keyboard file verification method based on image processing includes controling a processor to perform following operations: obtaining a keyboard file; generating a search index and a structural image according to the keyboard file; obtaining a template image from a template database according to the search index; performing a calibration operation to generate a plurality of candidate images, wherein the calibration operation includes adjusting the resolution of the structural image according to the resolution of the template image and executing a shifting operation according to the structural image to generate a plurality of candidate images; and comparing a key block within each of the candidate images with a key block within the template image, to generate a difference map and a comparison result.

Description

基於影像處理的鍵盤檔案驗證方法Keyboard File Verification Method Based on Image Processing

本發明關於影像處理,特別是一種基於影像處理的鍵盤檔案驗證方法。The present invention relates to image processing, in particular to a keyboard file verification method based on image processing.

鍵盤是筆記型電腦的關鍵組件之一,在組裝筆記型電腦產品之前,需要確保規格書中的鍵盤設計以及實體鍵盤樣本經過驗證。無論是規格設計還是實體組件,異常或有缺陷的設計將在生產過程中增加不必要的成本。The keyboard is one of the key components of the notebook computer. Before assembling the notebook computer product, it is necessary to ensure that the keyboard design in the specification and the physical keyboard sample are verified. Whether it's a specification design or a physical component, an anomalous or flawed design will add unnecessary cost to the production process.

傳統上,供應商提供鍵盤檔案的驗證依賴於人工。品質管理人員需要用肉眼仔細檢查供應商提供的鍵盤檔案與資料庫中的參考鍵盤設計之間的差異。然而,產線上隨時有大量的鍵盤樣品需要檢查,當品質管理人員長時間地進行目檢時,容易因疏忽而降低其驗證的品質。Traditionally, verification of vendor-provided keyboard profiles has relied on manual labor. Quality control personnel need to visually inspect the discrepancies between the keyboard files provided by the suppliers and the reference keyboard designs in the database. However, there are a large number of keyboard samples to be inspected at any time on the production line. When the quality management personnel conduct visual inspection for a long time, it is easy to reduce the quality of the verification due to negligence.

有鑑於此,本發明提出一種基於影像處理的鍵盤檔案驗證方法,藉由多種影像處理的技術之組合來改善先前技術中品管人員目測檢查鍵盤缺陷的不便,同時能夠提升缺陷檢查的準確率,確保鍵盤檔案中的輸入鍵盤設計符合參考設計。In view of this, the present invention proposes a keyboard file verification method based on image processing. By combining multiple image processing technologies, the inconvenience of quality control personnel visually inspecting keyboard defects in the prior art can be improved, and the accuracy of defect inspection can be improved at the same time. Make sure the input keyboard design in the keyboard archive matches the reference design.

依據本發明一實施例的一種基於影像處理的鍵盤檔案驗證方法,包括控制一處理器進行以下操作:取得一鍵盤檔案;依據該鍵盤檔案產生一搜尋索引及一特徵影像;依據該搜尋索引自一模板資料庫取得一模板影像;依據該特徵影像執行一校正操作,其中該校正操作包括:依據該模板影像的解析度調整該特徵影像的解析度;以及依據該特徵影像執行一位移操作以產生多個候選影像;以及將每一該些候選影像中的按鍵區塊與該模板影像中的按鍵區塊進行比對,以產生一差異圖及一比對結果。According to an embodiment of the present invention, a keyboard file verification method based on image processing includes controlling a processor to perform the following operations: obtain a keyboard file; generate a search index and a feature image according to the keyboard file; The template database obtains a template image; performs a correction operation according to the feature image, wherein the correction operation includes: adjusting the resolution of the feature image according to the resolution of the template image; and performing a displacement operation according to the feature image to generate multiple candidate images; and comparing the button blocks in each of the candidate images with the button blocks in the template image to generate a difference map and a comparison result.

綜上所述,本發明提出一種基於影像處理的鍵盤檔案驗證方法,將鍵盤設計的原始文檔轉換為結構化的視覺特徵,並模仿人類視覺感知的過程,將鍵盤檔案的原始文檔與模板資料庫中的模板影像進行比對,最後標記出感知到的差異區域。In summary, the present invention proposes a keyboard file verification method based on image processing, which converts the original document of the keyboard design into a structured visual feature, and imitates the process of human visual perception, and combines the original document of the keyboard file with the template database Compare the template images in , and finally mark the perceived difference areas.

以上之關於本揭露內容之說明及以下之實施方式之說明係用以示範與解釋本發明之精神與原理,並且提供本發明之專利申請範圍更進一步之解釋。The above description of the disclosure and the following description of the implementation are used to demonstrate and explain the spirit and principle of the present invention, and provide a further explanation of the patent application scope of the present invention.

以下在實施方式中詳細敘述本發明之詳細特徵以及特點,其內容足以使任何熟習相關技藝者了解本發明之技術內容並據以實施,且根據本說明書所揭露之內容、申請專利範圍及圖式,任何熟習相關技藝者可輕易地理解本發明相關之構想及特點。以下之實施例係進一步詳細說明本發明之觀點,但非以任何觀點限制本發明之範疇。The detailed features and characteristics of the present invention are described in detail below in the implementation mode, and its content is enough to enable any person familiar with the relevant art to understand the technical content of the present invention and implement it accordingly, and according to the content disclosed in this specification, the scope of the patent application and the drawings , anyone who is familiar with the related art can easily understand the ideas and features related to the present invention. The following examples are to further describe the concept of the present invention in detail, but not to limit the scope of the present invention in any way.

圖1是本發明一實施例的基於影像處理的鍵盤檔案驗證方法的流程圖,所述方法適用於具有處理器的個人電腦或網路伺服器,且圖1中的各步驟主要由處理器執行。Fig. 1 is a flow chart of a keyboard file verification method based on image processing according to an embodiment of the present invention, the method is applicable to a personal computer or a network server with a processor, and each step in Fig. 1 is mainly executed by the processor .

步驟S1為「取得鍵盤檔案」,在一實施例中,處理器從儲存裝置中取得的鍵盤檔案為單頁的可攜式文件格式(portable document file,PDF),圖2是一範例中鍵盤檔案內容的示意圖。鍵盤檔案包括鍵盤影像及鍵盤資訊,鍵盤影像例如是攝影機拍攝鍵盤樣品所得到的灰階影像,或是鍵盤設計者以軟體繪製產生的數位圖檔。鍵盤資訊包括:專案名稱、廠牌、供應商、國別代碼、鍵盤尺寸、鍵盤類型(例如:大/中/小型鍵盤、是否為背光鍵盤、是否具有指向桿等)、製造年代中的至少一者。上述的鍵盤資訊可記錄於鍵盤檔案的內容、鍵盤檔案的檔案名稱及鍵盤檔案的儲存路徑中的至少一者,本發明並不限制鍵盤資訊記錄的位置。Step S1 is "obtaining the keyboard file". In one embodiment, the keyboard file obtained by the processor from the storage device is a single-page portable document file (PDF). Figure 2 is an example of a keyboard file A schematic diagram of the content. The keyboard file includes the keyboard image and keyboard information. The keyboard image is, for example, a grayscale image obtained by shooting a keyboard sample with a camera, or a digital image file drawn by a keyboard designer with software. Keyboard information includes: project name, brand, supplier, country code, keyboard size, keyboard type (for example: large/medium/small keyboard, whether it is a backlit keyboard, whether it has a pointing stick, etc.), at least one of the manufacturing years By. The above keyboard information can be recorded in at least one of the content of the keyboard file, the file name of the keyboard file, and the storage path of the keyboard file, and the present invention does not limit the location of the keyboard information recording.

步驟S2為「依據鍵盤檔案產生搜尋索引及特徵影像」,請參考圖3,其為圖1中步驟S2的細部流程圖。Step S2 is "generating search index and feature image according to the keyboard file", please refer to FIG. 3 , which is a detailed flow chart of step S2 in FIG. 1 .

步驟S21為「從鍵盤檔案中擷取文字部分及影像部分」,在一實施例中,處理器執行 Pymupdf 軟體以從PDF文件抽取出文字部分及影像部分,其中文字部分包含上述的鍵盤資訊,影像部分為PNG檔案格式的鍵盤影像。Step S21 is "extracting the text part and the image part from the keyboard file". In one embodiment, the processor executes the Pymupdf software to extract the text part and the image part from the PDF file, wherein the text part includes the above-mentioned keyboard information, image Some keyboard images are in PNG file format.

步驟S22為「依據文字部分產生搜尋索引」,詳言之,處理器執行程式以將文字部分中關聯於鍵盤資訊的內容設置為搜尋索引。Step S22 is "generating a search index according to the text part", in detail, the processor executes the program to set the content associated with the keyboard information in the text part as the search index.

步驟S22為「依據鍵盤影像執行多個影像處理程序以產生特徵影像」,處理器執行的這些影像處理程序係用於抽取鍵盤輪廓及定位鍵盤區域。所述的鍵盤輪廓包括鍵盤本體的外圍輪廓以及所有按鍵的格線。Step S22 is "executing a plurality of image processing programs according to the keyboard image to generate a feature image", these image processing programs executed by the processor are used to extract the outline of the keyboard and locate the keyboard area. The keyboard outline includes the outer outline of the keyboard body and the grid lines of all keys.

為了抽取鍵盤輪廓,處理器將鍵盤影像轉為灰階影像,再採用大津演算法(OTSU,或稱自動閾值分割法)將灰階影像退化為的二值化影像,圖4是一範例中對應鍵盤檔案的二值化影像的示意圖。針對二值化影像,處理器執行連通分量標記法(connected-component labeling,CCL)中的8鄰域連接(8-connectivity)以找出二值化影像中屬於鍵盤的區域。處理器更採用OpenCV中的函數FindContour取得概略的鍵盤輪廓。In order to extract the outline of the keyboard, the processor converts the keyboard image into a gray-scale image, and then uses the Otsu algorithm (OTSU, or automatic threshold segmentation method) to degenerate the gray-scale image into a binary image. Figure 4 is an example of the corresponding Schematic diagram of a binarized image of a keyboard file. For the binarized image, the processor performs 8-connectivity in connected-component labeling (CCL) to find out the region belonging to the keyboard in the binarized image. The processor uses the function FindContour in OpenCV to obtain a rough outline of the keyboard.

為了定位鍵盤區域,處理器依據鍵盤輪廓執行填充操作,針對閉合輪廓內部的像素點進行補白,藉此濾除非閉合的輪廓區域。處理器根據聯通區域面積、填充程度以及從鍵盤資訊中取得的鍵盤尺寸(其中可包含鍵盤的長寬比或面積)進行篩選,確認鍵盤輪廓所包圍的連通區域是否屬於鍵盤,並藉此調整二值化操作中的閾值。In order to locate the keyboard area, the processor performs a filling operation according to the outline of the keyboard, and fills in the pixels inside the closed outline, thereby filtering out the non-closed outline area. The processor screens the area of the connected area, the degree of filling, and the size of the keyboard obtained from the keyboard information (which may include the aspect ratio or area of the keyboard), confirms whether the connected area surrounded by the outline of the keyboard belongs to the keyboard, and adjusts the two Threshold in value operations.

此外,依據執行填充操作後的二值化影像,處理器更執行形態學處理中的open操作,藉此濾除原本的鍵盤影像中用於指示的引導線,圖5是一範例中鍵盤影像中的引導線的示意圖,引導線為圖5中位於鍵盤右方及下方的線條,其用於標示鍵盤的長度及寬度,但在鍵盤檔案的驗證中屬於不必要的資訊。In addition, according to the binarized image after the filling operation, the processor further executes the open operation in the morphological processing, thereby filtering out the guiding lines used for indication in the original keyboard image. FIG. 5 is an example of a keyboard image The schematic diagram of the guide line, the guide line is the line on the right and below the keyboard in Figure 5, which is used to mark the length and width of the keyboard, but it is unnecessary information in the verification of the keyboard file.

最後,處理器進行相鄰物件找尋,針對距離過近的填充鍵區域以迭代方式進行合併,最終在二值化影像中合併出屬於鍵盤的區域,並輸出填充格線圖。換言之,在相鄰物件找尋的步驟中,會有多個未群聚之區域,處理器將這些散佈的小區域合併後,選取其中最大的區域作為鍵盤區域。圖6是一範例中填充格線圖局部的示意圖。Finally, the processor searches for adjacent objects, iteratively merges the padding key areas that are too close to each other, and finally merges the area belonging to the keyboard in the binarized image, and outputs the padding grid map. In other words, in the step of finding adjacent objects, there will be multiple unclustered areas, and the processor will combine these scattered small areas, and select the largest area among them as the keyboard area. FIG. 6 is a schematic diagram of a part of a filled grid map in an example.

處理器計算填充格線圖中的按鍵數量,藉此確認鍵盤類型為大、中、小鍵盤中的哪一種類型,再將確認後的鍵盤類型設置為搜尋索引。上述舉例的鍵盤類型亦可在步驟S22中完成設置,本發明對此並不限制。The processor calculates the number of keys in the filled grid map, thereby confirming which type of keyboard is the large, medium and small keyboard, and then sets the confirmed keyboard type as the search index. The keyboard types exemplified above can also be set in step S22, which is not limited in the present invention.

處理器依據填充格線圖執行OpenCV中的Distance transform函數,計算出每個按鍵輪廓內緣的所有像素與按鍵輪廓內緣的距離以產生距離圖(distance map)。處理器針對計算出的多個距離值進行二值化操作,藉此分隔出輪廓與內文。處理器依據距離圖對填充格線圖執行內縮操作,在內縮過程中偵測是否碰到屬於按鍵內文的像素,並產生一個包圍按鍵內文的定界框(bounding box),最後處理器再依據定界框的內容產生內文圖。請參考圖7,其展示了兩個按鍵在上述流程中產生的兩組特徵影像,每組特徵影像包括:二值化影像、填充格線圖、距離圖、內縮操作後的二值化距離圖以及內文圖。The processor executes the Distance transform function in OpenCV according to the filled grid map, and calculates the distance between all the pixels on the inner edge of each key outline and the inner edge of the key outline to generate a distance map. The processor performs a binarization operation on the calculated multiple distance values, thereby separating the outline and the content. The processor performs a retraction operation on the filled grid map according to the distance map, detects whether a pixel belonging to the text of the button is encountered during the retraction process, and generates a bounding box (bounding box) surrounding the text of the button, and finally processes The device generates a context image according to the content of the bounding box. Please refer to Figure 7, which shows two sets of feature images generated by the two buttons in the above process. Each set of feature images includes: binarized image, filled grid map, distance map, and binarized distance after shrinking operation diagrams and text diagrams.

請參考圖1,步驟S3為「依據搜尋索引至模板資料庫取得模板影像」,步驟S4為「依據特徵影像執行校正操作」。Please refer to FIG. 1 , step S3 is "acquire the template image from the template database according to the search index", and step S4 is "perform correction operation according to the characteristic image".

在步驟S3中,處理器以廠牌、供應商及國別代碼等鍵盤資訊作為搜尋索引在模板資料庫中進行檢索,可找到一或多個模板影像作為後續比對時的標準,若找到二個以上的模板影像,則每個模板影像都會用於比對。在步驟S4中,校正操作包括解析度校正以及位移校正。解析度校正是調整特徵影像的解析度,使其與步驟S4取得的模板影像的解析度一致。另外,模板資料庫中的每一模板影像也是透過步驟S1、S2及S4的流程事先建立,因此所有模板影像的解析度皆具有一致的解析度。In step S3, the processor uses keyboard information such as brand, supplier, and country code as a search index to search in the template database, and can find one or more template images as a standard for subsequent comparisons. If two If there are more than one template image, each template image will be used for comparison. In step S4, the calibration operation includes resolution calibration and displacement calibration. Resolution correction is to adjust the resolution of the feature image to be consistent with the resolution of the template image obtained in step S4. In addition, each template image in the template database is also created in advance through the processes of steps S1 , S2 and S4 , so the resolutions of all template images have the same resolution.

在執行解析度校正後,位移操作是採用增強相關係數(Enhanced Correlation Coefficient,ECC)這個相似性衡量的標準來預測運動模型的參數,並採用OpenCV中的findTransformECC函數迭代產生特徵影像的運動模型,如單應性矩陣(Homography matrix)或仿射變換矩陣(affine matrix),並設定此迭代方法的容忍誤差,小於一定程度時表示影像可透過運動模型達到對齊影像的功能,藉此達到位移的效果。處理器可依據特徵影像及運動模型產生多個候選影像。After performing the resolution correction, the displacement operation is to use the enhanced correlation coefficient (Enhanced Correlation Coefficient, ECC) as a measure of similarity to predict the parameters of the motion model, and use the findTransformECC function in OpenCV to iteratively generate the motion model of the feature image, such as Homography matrix (Homography matrix) or affine transformation matrix (affine matrix), and set the tolerance error of this iterative method. When it is less than a certain level, it means that the image can achieve the function of aligning the image through the motion model, thereby achieving the effect of displacement. The processor can generate a plurality of candidate images according to the feature image and the motion model.

請參考圖1,步驟S5為「依據候選影像及模板影像執行區塊比對程序」。區塊比對程序是以按鍵為比對基礎(patch-wise)進行結構相似性(Structural Similarity Index Measure,SSIM)的比對,並在SSIM之前執行小波雜湊(wavelet hashing)演算法以彌補SSIM的不足之處,這是因為對於部分結構簡單的影像,當SSIM比對到全黑的影像時,可能會發生SSIM產生的分數無法反映差異的狀況。因此,處理器執行小波雜湊演算法將候選影像轉換到頻域並產生雜湊值,然後計算候選影像與模板影像之間的漢明距離(hamming distance)以反映原始的鍵盤影像與模板影像的差異程度,若差異程度過大則將該區域的誤差圖(error map) 反白,標示為異常區域供後續人為複判,若差異在容忍範圍內才繼續依據SSIM進行影像相似度檢查。Please refer to FIG. 1 , step S5 is "execute block comparison procedure based on the candidate image and the template image". The block comparison program is based on the key comparison (patch-wise) for structural similarity (Structural Similarity Index Measure, SSIM) comparison, and performs wavelet hashing (wavelet hashing) algorithm before SSIM to make up for the SSIM The disadvantage is that for some images with simple structure, when SSIM compares to a completely black image, it may happen that the score generated by SSIM cannot reflect the difference. Therefore, the processor executes the wavelet hash algorithm to convert the candidate image into the frequency domain and generates a hash value, and then calculates the Hamming distance between the candidate image and the template image to reflect the degree of difference between the original keyboard image and the template image , if the difference is too large, the error map of the area will be highlighted and marked as an abnormal area for subsequent human re-judgment. If the difference is within the tolerance range, the image similarity inspection will continue based on SSIM.

由於不同供應商製造的鍵盤樣品在按鍵之間的距離上可能有些許誤差,為了提升比對時的容錯性及穩定性,在依據SSIM進行影像相似度檢查的過程中,本發明額外導入位移操作,依據指定方向(向上、向下、向左及向右)及指定長度(例如小於等於5個像素長度)移動區塊尺度的特徵影像以產生多個位移影像。處理器基於區塊尺度執行位移操作產生多個位移影像,再以SSIM計算每個位移影像與模板影像之間的相似度,並選擇誤差值最小者對應的位移影像用於後續流程。換言之,處理器針對候選影像中的按鍵部分進行小幅度的位移,以找到與模板影像的按鍵部分具有最高對齊程度的一個位移影像。透過上述方式,本發明可減少因為解析度差異而產生的區域誤差。Since the keyboard samples manufactured by different suppliers may have slight errors in the distance between the keys, in order to improve the fault tolerance and stability of the comparison, in the process of image similarity inspection based on SSIM, the present invention additionally introduces a displacement operation , move the block-scale feature image according to a specified direction (upward, downward, leftward, and rightward) and a specified length (eg, less than or equal to 5 pixels in length) to generate multiple displaced images. The processor performs a displacement operation based on the block scale to generate multiple displacement images, and then uses SSIM to calculate the similarity between each displacement image and the template image, and selects the displacement image corresponding to the one with the smallest error value for the subsequent process. In other words, the processor performs a small shift on the button portion of the candidate image to find a shifted image with the highest degree of alignment with the button portion of the template image. Through the above method, the present invention can reduce the area error caused by the difference in resolution.

請參考圖1,步驟S6為「輸出差異圖及比對結果」。詳言之,在步驟S5完成後,處理器針對每一個候選影像與模板影像的比對過程產生一個候選誤差圖。候選誤差圖為一灰階影像,影像中的像素值可反映差異的程度。處理器依據每一候選誤差圖計算所有按鍵中的差異量總和,差異量總和最小者的候選誤差圖所對應的候選影像代表其與模板影像的對齊程度最好。處理器進一步判斷差異量總和是否大於一門檻值,若判斷結果「是」代表鍵盤影像與模板影像差異程度過大,須交由品管人員進一步確認。圖8是模板影像、從輸入的鍵盤檔案中取得的鍵盤影像以及誤差圖的示意圖,其中誤差圖的多個白色區塊代表鍵盤影像與模板影像的差異處。此外,處理器將輸出的比對結果包括下列檔案:說明檔、鍵盤影像、填充格線圖、內文圖、模板資料庫中與內文圖最相似的模板影像、誤差圖、判斷為差異的標記。在一實施例中,說明檔的檔案格式為逗號分隔值(Comma-Separated Values,CSV),其內容記載下列資訊:廠牌、專案名稱、供應商、鍵盤檔案的檔案名稱、鍵盤檔案的儲存路徑、國別代碼、鍵盤類型、模板影像的儲存位置、是否比對成功、差異按鍵數量及差異判斷理由等。Please refer to FIG. 1 , step S6 is "output difference map and comparison result". In detail, after step S5 is completed, the processor generates a candidate error map for each candidate image compared with the template image. The candidate error map is a grayscale image, and the pixel values in the image can reflect the degree of difference. The processor calculates the sum of differences in all keys according to each candidate error map, and the candidate image corresponding to the candidate error map with the smallest difference sum represents the best alignment with the template image. The processor further judges whether the sum of the differences is greater than a threshold value. If the judgment result is "Yes", it means that the difference between the keyboard image and the template image is too large, and it must be further confirmed by the quality control personnel. 8 is a schematic diagram of a template image, a keyboard image obtained from an input keyboard file, and an error map, wherein a plurality of white blocks in the error map represent differences between the keyboard image and the template image. In addition, the comparison result output by the processor includes the following files: description file, keyboard image, filled grid map, text map, template image most similar to the text map in the template database, error map, and mark. In one embodiment, the file format of the description file is Comma-Separated Values (CSV), and its content records the following information: brand, project name, supplier, file name of the keyboard file, and storage path of the keyboard file , country code, keyboard type, storage location of the template image, whether the comparison is successful, the number of different keys, and the reason for the difference, etc.

綜上所述,本發明提出一種基於影像處理的鍵盤檔案驗證方法,可將鍵盤設計的原始文檔轉換為結構化的視覺特徵,並模仿人類視覺感知的過程,將鍵盤檔案的原始文檔與模板資料庫中的模板影像進行比對,最後標示出(例如以圈選的方式)感知到的差異區域。In summary, the present invention proposes a keyboard file verification method based on image processing, which can convert the original document of the keyboard design into structured visual features, and imitate the process of human visual perception, and combine the original document of the keyboard file with the template data The template image in the library is compared, and finally the perceived difference area is marked (for example, by circle selection).

雖然本發明以前述之實施例揭露如上,然其並非用以限定本發明。在不脫離本發明之精神和範圍內,所為之更動與潤飾,均屬本發明之專利保護範圍。關於本發明所界定之保護範圍請參考所附之申請專利範圍。Although the present invention is disclosed by the aforementioned embodiments, they are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, all changes and modifications are within the scope of patent protection of the present invention. For the scope of protection defined by the present invention, please refer to the appended scope of patent application.

S1~S6, S21~S23:步驟S1~S6, S21~S23: steps

圖1是本發明一實施例的基於影像處理的鍵盤檔案驗證方法的流程圖; 圖2是一範例中鍵盤檔案內容的示意圖; 圖3是圖1中步驟的細部流程圖; 圖4是一範例中對應鍵盤檔案的二值化影像的示意圖; 圖5是一範例中鍵盤影像中的引導線的示意圖; 圖6是一範例中填充格線圖局部的示意圖; 圖7是一範例中兩組特徵影像的示意圖;以及 圖8是模板影像、鍵盤影像及誤差圖的示意圖。 Fig. 1 is the flow chart of the keyboard file verification method based on image processing of an embodiment of the present invention; Fig. 2 is a schematic diagram of the contents of a keyboard file in an example; Fig. 3 is the detailed flowchart of step among Fig. 1; 4 is a schematic diagram of a binarized image corresponding to a keyboard file in an example; FIG. 5 is a schematic diagram of guiding lines in an example keyboard image; Fig. 6 is a schematic diagram of a part of the filled grid map in an example; FIG. 7 is a schematic diagram of two sets of feature images in an example; and FIG. 8 is a schematic diagram of a template image, a keyboard image and an error map.

S1~S6:步驟 S1~S6: steps

Claims (7)

一種基於影像處理的鍵盤檔案驗證方法,包括控制一處理器進行以下操作:取得一鍵盤檔案;依據該鍵盤檔案產生一搜尋索引及一特徵影像;依據該搜尋索引自一模板資料庫取得一模板影像;依據該特徵影像執行一校正操作,其中該校正操作包括:依據該模板影像的解析度調整該特徵影像的解析度;以及依據該特徵影像執行一位移操作以產生多個候選影像;以及將每一該些候選影像中的按鍵區塊與該模板影像中的按鍵區塊進行比對,以產生一差異圖及一比對結果;其中依據該特徵影像執行該位移操作以產生該些候選影像包括:依據一增強相關係數產生一運動模型,其中該運動模型為單應性矩陣或仿射變換矩陣;以及依據該特徵影像及該運動模型產生該些候選影像。 A keyboard file verification method based on image processing, including controlling a processor to perform the following operations: obtain a keyboard file; generate a search index and a feature image according to the keyboard file; obtain a template image from a template database according to the search index ; performing a correction operation according to the feature image, wherein the correction operation includes: adjusting the resolution of the feature image according to the resolution of the template image; and performing a displacement operation according to the feature image to generate a plurality of candidate images; comparing the button blocks in the candidate images with the button blocks in the template image to generate a difference map and a comparison result; wherein performing the displacement operation according to the feature image to generate the candidate images includes : generating a motion model according to an enhanced correlation coefficient, wherein the motion model is a homography matrix or an affine transformation matrix; and generating the candidate images according to the feature image and the motion model. 如請求項1所述基於影像處理的鍵盤檔案驗證方法,其中該鍵盤檔案為可攜式文件格式,該鍵盤檔案包含一鍵盤資訊及一鍵盤影像,該鍵盤資訊關聯於該鍵盤檔案的內容、檔案名稱及儲存路徑中的至少一者。 The keyboard file verification method based on image processing as described in claim 1, wherein the keyboard file is in a portable file format, the keyboard file includes a keyboard information and a keyboard image, and the keyboard information is associated with the content and file of the keyboard file at least one of name and storage path. 如請求項2所述基於影像處理的鍵盤檔案驗證方法,其中依據該鍵盤檔案產生該特徵影像包括:將該鍵盤影像轉換為灰階影像;依據該灰階影像執行大津演算法以產生一二值化影像; 依據該二值化影像執行連通分量標記法以定位該二值化影像中的多個連通區域;依據每一該些連通區域取得一輪廓並依據該輪廓執行一填充操作;以及依據每一該些連通區域的面積、一填充程度及該鍵盤資訊中的一鍵盤尺寸進行篩選,以確認每一該連通區域是否屬於一鍵盤區域,並輸出一填充格線圖。 The keyboard file verification method based on image processing as described in claim 2, wherein generating the characteristic image according to the keyboard file includes: converting the keyboard image into a grayscale image; performing Otsu algorithm based on the grayscale image to generate a binary value image; performing a connected component labeling method according to the binarized image to locate a plurality of connected regions in the binarized image; obtaining a contour according to each of the connected regions and performing a filling operation according to the contour; and performing a filling operation according to each of the connected regions; The area of the connected region, a filling degree and a keyboard size in the keyboard information are screened to confirm whether each connected region belongs to a keyboard region, and a filled grid map is output. 如請求項3所述基於影像處理的鍵盤檔案驗證方法,其中依據該鍵盤檔案產生該特徵影像包括:依據該填充格線圖執行一距離轉換函數以產生一距離圖;依據該距離圖對該填充格線圖執行一內縮操作並產生一定界框,其中該定界框用於包圍一按鍵內文;以及依據該定界框產生一內文圖;其中,該特徵影像包括該二值化影像、該填充格線圖、該距離圖、該定界框及該內文圖。 The keyboard file verification method based on image processing as described in claim 3, wherein generating the characteristic image according to the keyboard file includes: performing a distance conversion function according to the filling grid map to generate a distance map; according to the distance map to the filling The grid map performs a shrinking operation and generates a certain bounding box, wherein the bounding box is used to enclose a button text; and generates a text map according to the bounding box; wherein, the feature image includes the binarized image , the filled grid map, the distance map, the bounding box and the text map. 如請求項4所述基於影像處理的鍵盤檔案驗證方法,更包括:計算該填充格線圖中的一按鍵數量;以及依據該按鍵數量確認一鍵盤類型,並該將該鍵盤類型設置為該搜尋索引。 The keyboard file verification method based on image processing as described in claim 4, further includes: calculating the number of a key in the filled grid map; and confirming a keyboard type according to the number of keys, and setting the keyboard type as the search index. 如請求項1所述基於影像處理的鍵盤檔案驗證方法,其中將每一該些候選影像中的按鍵區塊與該模板影像中的按鍵區塊進行比對,以產生該差異圖及該比對結果包括:執行小波雜湊演算法將每一該些候選影像轉換至頻域; 計算每一該些候選影像及該模板影像的結構相似性及漢明距離以產生多個候選差異圖;以及計算每一該些候選差異圖中的一差異量總和,其中該差異圖係為該些候選差異圖中具有最小差異量總和之一者。 The keyboard file verification method based on image processing as described in claim 1, wherein the key blocks in each of the candidate images are compared with the key blocks in the template image to generate the difference map and the comparison The results include: performing a wavelet hash algorithm to convert each of the candidate images into a frequency domain; calculating the structural similarity and Hamming distance of each of the candidate images and the template image to generate a plurality of candidate difference maps; and calculating a sum of difference quantities in each of the candidate difference maps, wherein the difference map is the One of the candidate difference maps with the smallest sum of difference amounts. 如請求項6所述基於影像處理的鍵盤檔案驗證方法,其中計算每一該些候選影像及該模板影像的結構相似性包括:依據每一該些候選影像、指定方向及指定長度移動該特徵影像以產生多個位移影像。 The keyboard file verification method based on image processing as described in claim 6, wherein calculating the structural similarity between each of the candidate images and the template image includes: moving the feature image according to each of the candidate images, a specified direction and a specified length to generate multiple displacement images.
TW110134474A 2021-09-15 2021-09-15 Keyboard file verification method based on image processing TWI779836B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW110134474A TWI779836B (en) 2021-09-15 2021-09-15 Keyboard file verification method based on image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110134474A TWI779836B (en) 2021-09-15 2021-09-15 Keyboard file verification method based on image processing

Publications (2)

Publication Number Publication Date
TWI779836B true TWI779836B (en) 2022-10-01
TW202314637A TW202314637A (en) 2023-04-01

Family

ID=85475777

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110134474A TWI779836B (en) 2021-09-15 2021-09-15 Keyboard file verification method based on image processing

Country Status (1)

Country Link
TW (1) TWI779836B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106354738A (en) * 2015-07-18 2017-01-25 严之鸿 Method and system of flat image inputting and matching
CN106570511A (en) * 2016-11-02 2017-04-19 上海大学 Keyboard character defect online detection system based on computer vision and keyboard character defect online detection method thereof
US20190162666A1 (en) * 2017-11-30 2019-05-30 Sysmex Corporation Image analysis apparatus and image analysis method
TWI719357B (en) * 2018-03-29 2021-02-21 日商三菱電機股份有限公司 Abnormality inspection device and abnormality inspection method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106354738A (en) * 2015-07-18 2017-01-25 严之鸿 Method and system of flat image inputting and matching
CN106570511A (en) * 2016-11-02 2017-04-19 上海大学 Keyboard character defect online detection system based on computer vision and keyboard character defect online detection method thereof
US20190162666A1 (en) * 2017-11-30 2019-05-30 Sysmex Corporation Image analysis apparatus and image analysis method
TWI719357B (en) * 2018-03-29 2021-02-21 日商三菱電機股份有限公司 Abnormality inspection device and abnormality inspection method

Also Published As

Publication number Publication date
TW202314637A (en) 2023-04-01

Similar Documents

Publication Publication Date Title
JP6573226B2 (en) DATA GENERATION DEVICE, DATA GENERATION METHOD, AND DATA GENERATION PROGRAM
JP4928310B2 (en) License plate recognition device, control method thereof, computer program
TWI748242B (en) Method and system for scanning wafer
JP2024509411A (en) Defect detection method, device and system
CN110502985B (en) Form identification method and device and form identification equipment
US20160379088A1 (en) Apparatus and method for creating an image recognizing program having high positional recognition accuracy
Tsai et al. Comprehensive, quantitative crack detection algorithm performance evaluation system
Qu et al. Concrete surface crack detection with the improved pre-extraction and the second percolation processing methods
Yu et al. An improved parameter estimation scheme for image modification detection based on DCT coefficient analysis
JP5246066B2 (en) Category determination rule creation method, apparatus, and computer program
JP4003465B2 (en) Specific pattern recognition method, specific pattern recognition program, specific pattern recognition program recording medium, and specific pattern recognition apparatus
JP5405245B2 (en) Image inspection method and image inspection apparatus
JP4230980B2 (en) Pattern matching method and program
Bianchi et al. Development of extendable open-source structural inspection datasets
TWI779836B (en) Keyboard file verification method based on image processing
JP5200786B2 (en) Difference extraction apparatus and difference extraction program
JP6980208B2 (en) Structure maintenance work support system
JP2022139174A (en) Apparatus, method, and program for classifying defects
US9378428B2 (en) Incomplete patterns
CN111145314A (en) Method for extracting place name symbol of scanning electronic map by combining place name labeling
US20230078035A1 (en) Keyboard file verification method based on image processing
CN113570524B (en) Repairing method for high reflection noise depth image
Wang et al. Fast Blur Detection Algorithm for UAV Crack Image Sets
JP4087191B2 (en) Image processing apparatus, image processing method, and image processing program
JP2011141664A (en) Device, method and program for comparing document

Legal Events

Date Code Title Description
GD4A Issue of patent certificate for granted invention patent