Screen configuration offline checking and identifying method based on pixel topological feature matching
Patent Information
- Application Number
- CN202611143355.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-27
AI Technical Summary
离线场景核查能力缺失,当网络不通、接口封堵、主机加固、无法登录时,无法自动获取配置内容,核查工作直接中断;
本发明提供的基于像素拓扑特征匹配的屏幕配置离线核查识别方法通过以无数据连接方式获取目标主机屏幕原始图像,并结合预处理、基于像素拓扑特征码的字符匹配识别、参数提取及策略比对的完整闭环,实现了在离线环境下对主机配置的自动化、非侵入式核查,不仅克服了传统远程登录核查在离线场景下的能力缺失和人工核查的可靠性低、效率低等缺陷,而且通过纯像素级特征匹配避免了复杂神经网络推理,显著降低了算力需求,提升了识别精度和核查结果的客观性、可追溯性,同时方案完全自主可控,不依赖外部OCR引擎或公开字符库,具有良好的离线部署适应性。
Smart Images

Figure CN122990715A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to an offline verification and recognition method for screen configuration based on pixel topological feature matching. Background Technology
[0002] Currently, the security configuration verification of power grid mainframes (including security-hardened mainframes, physically isolated mainframes, and service mainframes) mainly adopts two methods: (1) Remote login verification: Log in to the host through SSH, HTTPS, USB, serial port or other connection channels, read the configuration file and make compliance judgment.
[0003] (2) Manual on-site verification: The inspectors check the content displayed on the host screen on-site, manually compare it with the safety specifications and manually record the results.
[0004] The existing verification methods have the following technical problems: The offline scenario verification capability is lacking. When the network is down, the interface is blocked, the host is hardened, or login is impossible, the configuration content cannot be obtained automatically, and the verification work is directly interrupted. Manual identification has low reliability, relying on human eyes to identify text on the screen, which is prone to misreading, omissions, and errors. The authenticity, consistency, and traceability of the verification results cannot be guaranteed. Summary of the Invention
[0005] This invention provides an offline verification and identification method for screen configuration based on pixel topology feature matching, in order to overcome at least one of the above-mentioned technical problems existing in the prior art.
[0006] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: In a first aspect, the present invention provides a screen configuration offline verification and identification method based on pixel topological feature matching, comprising: Acquire the original image of the target host's screen display interface, wherein the acquisition is performed when the target host has no data connection; The original image is preprocessed and converted into a binary image; The binarized image is segmented into character pixel matrices, and each segmented character pixel matrix is matched and recognized based on a preset pixel topology feature library. The configuration text is then reassembled in row and column order. The pixel topology feature library stores pixel topology feature codes of standard characters, and the pixel topology feature codes are multidimensional feature vectors that characterize the topological structure of the character shape. Extract configuration parameters from the configuration text to generate a structured parameter dictionary; The parameter items in the structured parameter dictionary are compared with the standard parameters in the preset strategy library to generate a compliance determination result.
[0007] In one possible implementation of the first aspect, the character pixel matrix segmentation of the binarized image includes: The number of foreground pixels is counted column by column in the binarized image to generate a vertical projection curve. The single-line text region is segmented according to the first trough position of the vertical projection curve. For each single-line text region, the number of foreground pixels is counted line by line to generate a horizontal projection curve, and a single character pixel matrix is segmented according to the second trough position of the horizontal projection curve. The character pixel matrix is filtered according to its width to obtain a valid character pixel matrix.
[0008] In one possible implementation of the first aspect, the position of the first trough of the vertical projection curve is determined in the following manner: Calculate the first valley depth value of each first valley of the vertical projection curve, determine the first valley depth threshold based on the statistical characteristics of each first valley depth value, and take the first valley with the first valley depth value greater than the first valley depth threshold as the effective row segmentation position. The location of the second trough of the horizontal projection curve is determined in the following manner: Calculate the second valley depth value of each second valley of the horizontal projection curve, determine the character pixel matrix segmentation threshold based on the statistical characteristics of each second valley depth value, and take the second valley with a second valley depth value greater than the character pixel matrix segmentation threshold as the effective character pixel matrix segmentation position.
[0009] In one possible implementation of the first aspect, the multidimensional feature vector includes connected component features, skeleton features, and point-by-point binary pattern features of the foreground pixels of the standard character.
[0010] In one possible implementation of the first aspect, the connected component features are extracted in the following manner: The standard character's binary pixel matrix is labeled with connected components using 8-connectivity analysis to obtain the standard character's connected component information, which includes the total number of connected components, the area of each connected component, and the centroid coordinates. The skeleton features are extracted in the following manner: The Zhang-Suen parallel thinning algorithm is used to extract the skeleton of the standard character to obtain the skeleton information of the standard character. The skeleton information includes the number of skeleton branch nodes and the coordinates of each endpoint. The point-by-point binary pattern feature is a binary vector formed by expanding the binary pixel matrix of the standard character row by row.
[0011] In one possible implementation of the first aspect, the pixel topological feature library is constructed in the following manner: Collect multiple sample images of the target character set under the terminal's fixed-width font; Normalization processing is performed on each of the sample images, and they are uniformly scaled to a standard pixel matrix of a preset size; Extract the corresponding pixel topological feature code from each of the standard pixel matrices; Each of the standard characters is associated with and stored with its corresponding pixel topological feature code to establish an index.
[0012] In one possible implementation of the first aspect, the matching and recognition of each character pixel matrix obtained by segmentation based on a preset pixel topology feature library includes: The segmented character pixel matrix is normalized to the same preset size as the pixel topology feature library; Calculate the similarity between the normalized character pixel matrix and the pixel topological feature codes of each standard character in the pixel topological feature library; The standard character with the highest similarity is selected as the recognition result; If the highest similarity score is lower than a preset similarity threshold, the character pixel matrix is marked as an unknown character pixel matrix.
[0013] In one possible implementation of the first aspect, calculating the similarity between the normalized character pixel matrix and the pixel topological feature codes of each standard character in the pixel topological feature library includes: The normalized character pixel matrix is compared pixel by pixel with the point-by-point binary pattern features of each standard character. The number of pixels with the same pixel value between the character pixel matrix and the point-by-point binary pattern features is counted. The ratio of the counted number of pixels to the total number of pixels of the preset size is used as the similarity.
[0014] In one possible implementation of the first aspect, the step of extracting configuration parameters from the configuration text and generating a structured parameter dictionary includes: The configuration text is split into lines, and comment lines and blank lines are removed; Each line in the configuration text is matched with the standard configuration line corresponding to the target check point in the preset strategy library. Lines with a matching degree greater than or equal to the preset matching degree threshold are used as configuration lines. The configuration line is divided according to a preset delimiter, and each parameter item and its parameter value are parsed out to generate the structured parameter dictionary; If the configuration line contains a marker for an unknown character pixel matrix, then add a first state marker to the structured parameter dictionary; otherwise, add a second state marker.
[0015] In one possible implementation of the first aspect, generating the compliance determination result includes: If the structured parameter dictionary is empty, then output the result indicating non-compliance; If the structured parameter dictionary contains the first state flag, then the judgment result to be confirmed is output; If the structured parameter dictionary contains the second state flag, then each parameter item in the structured parameter dictionary is compared with the corresponding standard parameter in the preset strategy library item by item; For numerical parameters, perform an equality check or a range check. For switch-type parameters, perform an existence check; If all the parameters are met, output a result indicating compliance; otherwise, output a result indicating non-compliance and list the discrepancies.
[0016] Compared with the prior art, the present invention has at least the following beneficial effects: The offline screen configuration verification and recognition method based on pixel topology feature matching provided by this invention acquires the original image of the target host screen in a data-free manner and combines it with a complete closed loop of preprocessing, character matching and recognition based on pixel topology feature codes, parameter extraction and strategy comparison. This achieves automated and non-intrusive verification of host configuration in an offline environment. It not only overcomes the shortcomings of traditional remote login verification in offline scenarios and the low reliability and efficiency of manual verification, but also avoids complex neural network inference through pure pixel-level feature matching, significantly reducing computing power requirements and improving recognition accuracy and the objectivity and traceability of verification results. At the same time, the solution is completely autonomous and controllable, does not rely on external OCR engines or public character libraries, and has good offline deployment adaptability.
[0017] Secondly, the present invention provides an offline screen configuration verification and recognition system based on pixel topological feature matching, comprising: The image acquisition module is used to acquire the original image of the target host screen display interface, and the acquisition is performed when the target host has no data connection; An image preprocessing module is used to preprocess the original image and convert the original image into a binary image; The image recognition and reconstruction module is used to segment the binarized image into character pixel matrices, and to match and recognize each segmented character pixel matrix based on a preset pixel topology feature library, and to reconstruct and output configuration text in row and column order; wherein, the pixel topology feature library stores the pixel topology feature codes of standard characters, and the pixel topology feature codes are multi-dimensional feature vectors that characterize the topological structure of the character shape. The parameter extraction module is used to extract configuration parameters from the configuration text and generate a structured parameter dictionary; The compliance determination module is used to compare the parameter items in the structured parameter dictionary with the standard parameters in the preset strategy library to generate a compliance determination result.
[0018] Thirdly, the present invention provides an electronic device, comprising: at least one processor and at least one memory, wherein the memory stores computer-readable instructions; the computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the screen configuration offline verification and identification method based on pixel topological feature matching as in any implementation of the first aspect.
[0019] Fourthly, the present invention provides a storage medium having a computer-executable program stored thereon, the computer-executable program being used to cause a computer to execute a screen configuration offline verification and identification method based on pixel topological feature matching as in any implementation of the first aspect.
[0020] Understandably, the beneficial effects achieved by the system of the second aspect, the electronic device of the third aspect, and the storage medium of the fourth aspect provided above can be referred to in light of the beneficial effects of the first aspect and any of its possible design embodiments, which will not be repeated here. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention; Figure 2 This is a flowchart of a screen configuration offline verification and identification method based on pixel topological feature matching provided in an embodiment of the present invention; Figure 3 This is a structural block diagram of an offline screen configuration verification and recognition system based on pixel topological feature matching, provided in an embodiment of the present invention. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. In the description of the present invention, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. The "or" in the present invention is merely a description of the relationship between the related objects, indicating that three relationships can exist. For example, A or B can represent: A alone, A and B simultaneously, and B alone. A and B can be singular or plural. Furthermore, in the description of the present invention, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.
[0024] Furthermore, to facilitate a clear description of the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0025] In this embodiment of the invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this embodiment of the invention should not be construed as superior or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.
[0026] Currently, the security configuration verification of power grid mainframes (including security-hardened mainframes, physically isolated mainframes, and service mainframes) mainly adopts two methods: (1) Remote login verification: Log in to the host through SSH, HTTPS, USB, serial port or other connection channels, read the configuration file and make compliance judgment.
[0027] (2) Manual on-site verification: The inspectors check the content displayed on the host screen on-site, manually compare it with the safety specifications and manually record the results.
[0028] The existing verification methods have the following technical problems: The offline scenario verification capability is lacking. When the network is down, the interface is blocked, the host is hardened, or login is impossible, the configuration content cannot be obtained automatically, and the verification work is directly interrupted. Manual identification has low reliability, relying on human eyes to identify text on the screen, which is prone to misreading, omissions, and errors. The authenticity, consistency, and traceability of the verification results cannot be guaranteed.
[0029] In view of this, on the one hand, embodiments of the present invention provide an offline verification and recognition method for screen configuration based on pixel topology feature matching, comprising: acquiring an original image of the target host screen display interface, wherein the acquisition is performed when the target host has no data connection; preprocessing the original image and converting the original image into a binary image; segmenting the binary image into a character pixel matrix, and matching and recognizing each segmented character pixel matrix based on a preset pixel topology feature library, and recombining and outputting configuration text in row and column order; wherein the pixel topology feature library stores pixel topology feature codes of standard characters, and the pixel topology feature codes are multidimensional feature vectors characterizing the topological structure of character shapes; extracting configuration parameters from the configuration text to generate a structured parameter dictionary; comparing the parameter items in the structured parameter dictionary with standard parameters in a preset strategy library to generate a compliance judgment result.
[0030] This invention provides an offline screen configuration verification and recognition method based on pixel topology feature matching. By acquiring the original image of the target host screen in a data-free manner, and combining it with a complete closed loop of preprocessing, character matching and recognition based on pixel topology feature codes, parameter extraction, and strategy comparison, it achieves automated and non-intrusive verification of host configuration in an offline environment. This not only overcomes the shortcomings of traditional remote login verification in offline scenarios and the low reliability and efficiency of manual verification, but also avoids complex neural network inference through pure pixel-level feature matching, significantly reducing computing power requirements and improving recognition accuracy and the objectivity and traceability of verification results. At the same time, the solution is completely autonomous and controllable, does not rely on external OCR engines or public character libraries, and has good offline deployment adaptability.
[0031] In some embodiments, the screen configuration offline verification and identification method based on pixel topology feature matching provided by the present invention can be executed by any electronic device 20 with data processing capabilities, such as a general-purpose computer, personal computer, laptop computer, switch or tablet computer, etc. The specific implementation method of the electronic device 20 is not limited here.
[0032] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown. The electronic device 20 includes a processor 210, a memory 220, and a communication interface 230.
[0033] Processor 210 may include one or more processing cores. Processor 210 connects to various parts within electronic device 20 using various interfaces and lines, and performs various functions and processes data of electronic device 20 by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 may be implemented using at least one of the following hardware forms: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
[0034] The memory 220 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 220 may include a non-transitory computer-readable storage medium. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a program storage area. This program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc.
[0035] Communication interface 230 is used to communicate with other devices, equipment or communication networks, such as data storage devices, image processing devices or Ethernet, wireless access network (RAN), wireless local area network (WLAN), etc.
[0036] In terms of physical implementation, the aforementioned devices (such as processor 210, memory 220, and communication interface 230) can each be devices within the same device (such as a laptop computer). Alternatively, at least two of these devices can be located within the same device, i.e., as different devices within the same device, similar to the deployment of devices or components in a distributed system.
[0037] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 20. In other embodiments of the present invention, the electronic device 20 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0038] The following description, in conjunction with the accompanying drawings, illustrates an offline screen configuration verification and identification method based on pixel topological feature matching provided by an embodiment of the present invention.
[0039] like Figure 2 As shown in the embodiment of the present invention, an offline verification and identification method for screen configuration based on pixel topology feature matching is provided. This method may include, but is not limited to, the following: S1: Obtain the original image of the target host screen display interface, which is performed when the target host has no data connection.
[0040] This invention can, but is not limited to, acquire original images of the target host's screen display interface (the display interface has been switched to the configuration page to be verified) through a portable verification terminal (such as a mobile phone, tablet computer, etc.). For example, by calling the camera device of the portable terminal to take pictures of the target host's screen configuration interface, it supports the acquisition of up to 5 images and provides functions for taking pictures, retaking pictures, deleting pictures, and confirming pictures. Throughout the entire acquisition process, there is no data connection between the portable terminal and the target host, it does not log in to the target host's operating system, and it does not access any data communication interface of the target host.
[0041] S2: Preprocess the original image and convert it into a binary image.
[0042] Specifically, embodiments of the present invention may, but are not limited to, perform the following preprocessing on the original image in sequence: (1) Grayscale Conversion: In embodiments of the present invention, the original image may be converted to a grayscale image using, but is not limited to, a weighted average method. The weighting coefficients can be set according to the CCIR 601 standard, for example, to 0.299, 0.587, or 0.114. The grayscale value calculation formula is as follows: Gray=0.299×R+0.587×G+0.114×B.
[0043] In the formula, R, G, and B are the red, green, and blue channel values of the pixel, respectively.
[0044] By converting the original image to grayscale, the interference of color information on subsequent processing can be eliminated, while the amount of data can be compressed to one-third of the original, significantly reducing computational complexity.
[0045] (2) Gaussian Denoising: In this embodiment of the invention, a 3×3 Gaussian kernel can be used to filter the grayscale image, and the standard deviation σ can be selected from 0.8 to 1.0. Taking 0.8 as an example, under this parameter, the weight distribution of the 3×3 Gaussian kernel is as follows: Gaussian denoising effectively suppresses common reflective noise on terminal screens while preserving the edge details of text strokes to the maximum extent.
[0046] (3) Contrast enhancement: The embodiments of the present invention may employ, but are not limited to, the following contrast enhancement strategies: First, calculate the average brightness of the image, and then select the processing path accordingly: Normal lighting (average brightness 80~180): Directly perform histogram equalization. Histogram equalization transforms the grayscale histogram of the original image from a concentrated distribution to a uniform distribution, thus fully stretching the grayscale dynamic range of the image and improving the overall contrast.
[0047] Overall darkness (average brightness < 80): First, perform gamma correction (γ = 1.2~1.5) to brighten shadow details, then perform histogram equalization. The transformation formula for gamma correction is V... out =V in γ When γ > 1, the dark areas are stretched and the bright areas are compressed, which can effectively improve the visibility of the dark areas.
[0048] Overall brightness is too high (average brightness > 180): First, perform gamma correction (γ = 0.7~0.9) to reduce brightness and restore details in overexposed areas, then perform histogram equalization. When γ < 1, dark areas are compressed and bright areas are stretched, which can suppress saturation in overexposed areas.
[0049] This invention maximizes the grayscale difference between text strokes and the background by enhancing contrast, thus providing the best input state for subsequent adaptive binarization.
[0050] (4) Adaptive Binarization: Embodiments of this invention may, but are not limited to, employ a Gaussian weighted local thresholding method (ADAPTIVE_THRESH_GAUSSIAN_C). For each pixel in the image, a local window (blockSize × blockSize) is taken centered on it, and the Gaussian weighted average of all pixels within the window is calculated: pixels closer to the center have higher weights, and pixels farther away have lower weights. Subtracting a constant C from this weighted average yields the binarization threshold for that pixel location. .
[0051] If the grayscale value of the current pixel is greater than T(x, y), it is set as the foreground (white, value 1); otherwise, it is set as the background (black, value 0).
[0052] It should be noted that the size of the local window can be dynamically adjusted according to the image resolution, and its value can be 1.5 times the character height and an odd number. The value of the constant C can range from 0 to 5. In this embodiment of the invention, the size of the local window is blockSize = 15 × 15, and the constant C = 2.
[0053] Adaptive binarization can calculate the optimal threshold for different regions of an image, ensuring that text across the entire screen area can be correctly binarized.
[0054] (5) Tilt Correction: Embodiments of this invention may, but are not limited to, use the Hough Transform to detect straight lines in a binarized image, calculate the overall tilt angle, and perform rotation correction. The basic principle of the Hough Transform is to map straight lines in the image space to the parameter space (ρ-θ space in polar coordinates). By accumulating votes on all edge pixels, a straight line is determined to exist when the accumulated value reaches a preset threshold. Specific implementation parameters may be as follows: Distance resolution: 1 pixel; Angular resolution: 1°; Accumulator threshold: 100~150 (This threshold controls the detection sensitivity; the lower the threshold, the more lines are detected, and the higher the threshold, the more reliable the detected lines). Maximum permissible tilt angle: ±5°.
[0055] The correction process is as follows: Perform a Hough transform on the binarized image to detect all straight lines in the image; calculate the average angle of all detected straight lines as the overall tilt angle; if the absolute value of the tilt angle is ≤5°, perform reverse rotation correction on the image; if the absolute value of the tilt angle is >5°, prompt the user to retake the image. A tilt exceeding 5° will cause a severe shift in the trough position of the row and column projections, resulting in segmentation failure.
[0056] Handheld shooting inevitably results in slight tilt. This invention uses Hough transform to detect the text line direction and performs rotation correction to ensure that subsequent vertical and horizontal projections accurately align with the text line and column directions.
[0057] (6) Morphological Closing Operation: Morphological closing operation is a basic operation in mathematical morphology. In this embodiment of the invention, it is defined as performing a dilation operation on the binarized image first, followed by an erosion operation. Specifically, this embodiment of the invention uses a 5×5 rectangular structuring element and iterates once.
[0058] Rectangular structuring elements are suitable for handling terminal characters with regular rectangular arrangements: the text on the terminal screen is in a monospace font, and the characters are regularly arranged horizontally and vertically. Rectangular structuring elements can most effectively bridge small breaks in character strokes caused by lighting or photography (typically break widths of 1-3 pixels). A 5×5 structuring element size is sufficient to cover common stroke break widths. Break repair can be completed in one iteration; multiple iterations may cause different characters to stick together.
[0059] The embodiments of the present invention output a high-quality binarized image through the above six preprocessing steps.
[0060] S3: Perform character pixel matrix segmentation on the binarized image, and match and recognize each segmented character pixel matrix based on a preset pixel topology feature library, and reassemble and output configuration text in row and column order; wherein, the pixel topology feature library stores pixel topology feature codes of standard characters, and the pixel topology feature code is a multi-dimensional feature vector characterizing the topological structure of the character shape.
[0061] In this embodiment of the invention, the purpose of performing character pixel matrix segmentation on the binarized image is to decompose the binarized image layer by layer and finally output an ordered sequence of individual character pixel matrices.
[0062] In one feasible implementation, embodiments of the present invention may, but are not limited to, employ a row and column projection segmentation algorithm to segment the binarized image, with the specific segmentation steps as follows: (1) Vertical projection – row segmentation: The number of foreground pixels (white pixels, value 1) is counted column by column along the horizontal direction of the binarized image, generating a vertical projection curve with the horizontal position x as the abscissa and the total number of foreground pixels in that column as the ordinate. In the binarized image, there are horizontal blank spaces (line spacing) between text lines. When the projection scan passes through the blank areas between lines, the number of foreground pixels in that column drops to a very low value, forming the first trough on the projection curve. The essence of line segmentation is to detect the position of these first troughs and use them as the boundaries between lines.
[0063] The formula for calculating the vertical projection value is as follows: ; In the formula, I(x, y) is the value of the binarized image at pixel position (x, y) (1 for foreground and 0 for background), and H is the image height (number of pixels). This is the vertical projection value of the x-th column, which is the total number of foreground pixels in the x-th column.
[0064] In the specific implementation process, the key to row segmentation lies in determining the valley depth threshold. This embodiment of the invention employs a dynamic calculation method, the specific process of which is as follows: Calculate the vertical projection curve V proj The global maximum value V of [x] max and global minimum value V min ; Traverse the projected curve along the x-direction and identify all local minima (i.e., the first trough): satisfying V proj [x-1]>V proj [x]and V proj[x] <V proj The x-position of [x+1]; For each detected first trough, calculate its first trough depth: first depth = min(adjacent peak height - trough height), where adjacent peaks are the nearest local maxima on the left and right sides of the trough; Calculate the average of all first-wave valley depth values: AvgValleyDepth; Calculate the first valley depth threshold T row : T row =max(AvgValleyDepth×0.5, CharHeight×0.08, 3); CharHeight is an estimated value of the character height in the current image (which can be obtained by statistically analyzing the peak width of the global projection curve). The first valley depth value is greater than T row The first valley is taken as the effective line segmentation position. The binarized image is horizontally cut along the effective line segmentation position to segment out independent single-line text regions.
[0065] This invention employs a dynamic thresholding mechanism. The AvgValleyDepth×0.5 term reflects the overall valley distribution characteristics of the current image, the CharHeight×0.08 term correlates the first valley depth threshold with the actual character size of the image, and the 3-pixel absolute lower limit prevents over-segmentation in extremely small fonts or extremely low-resolution scenes. The maximum value of these three parameters ensures that the threshold is within a reasonable range in any scenario.
[0066] (2) Horizontal projection – character segmentation: The number of foreground pixels is counted line by line along the vertical direction for the single-line text region, generating a horizontal projection curve with the vertical position y as the abscissa and the total number of foreground pixels in that line as the ordinate. In a monospaced font terminal (the terminal involved in this embodiment is a command-line interface running the Linux operating system, which uses a monospaced font to render all characters), there are vertical white spaces (character spacing) between characters. When the projection scan passes through the white space between characters, the number of foreground pixels in that line drops to a very low value, forming a second trough on the projection curve. The essence of character segmentation is to detect the position of these second troughs and use them as the boundaries between characters.
[0067] The formula for calculating the horizontal projection value is as follows: ; In the formula, W is the width of a single-line text area.
[0068] This embodiment of the invention also employs a dynamic threshold strategy to determine the location of the second trough, as detailed below: Calculate the horizontal projection curve for each single-line text region. ; Identify all local minima (second troughs), excluding the beginning of the row (near y=0) and the end of the row (y=H). line The boundary trough (near -1); Calculate the second trough depth value for each valid second trough; Calculate the average of all valid second-wave valley depth values: AvgCharValleyDepth; Calculate the character pixel matrix segmentation threshold T char : T char =max(AvgCharValleyDepth×0.6, CharWidth×0.06, 2); CharWidth is an estimated value of the character width in the current line of text (which can be obtained by dividing the total width of the line of text by the number of characters in the line).
[0069] The second trough depth value is greater than T char The troughs are used as effective character pixel matrix segmentation positions. The single line of text is vertically cut along the effective character pixel matrix segmentation positions to segment out individual character pixel matrices.
[0070] The candidate character blocks output by the row and column projection segmentation algorithm may contain non-character interference (such as cursors, reflective noise, and tiny fragments of punctuation marks). Based on the inherent characteristics of fixed-width fonts in Linux terminals (all characters within the same line have the same physical width), this invention designs the following rule-based filtering mechanism: Estimated expected character width: ExpectedWidth=TotalLineWidth / CharCountInLine Where TotalLineWidth is the total width (in pixels) of the current line of text, and CharCountInLine is the number of characters in the line. This ratio is based on the core feature of terminal monospace fonts: "all characters are the same width".
[0071] Width filtering threshold: Lower bound: LowerBound = max(ExpectedWidth × 0.3, 1) Upper bound: UpperBound = ExpectedWidth × 2.8 Filtering rules: If the width of the candidate character pixel matrix is less than LowerBound, it is judged as noise (such as small fragments left when the cursor blinks, reflective points, or tiny parts of punctuation marks) and filtered directly. If the width of the candidate character pixel matrix is greater than UpperBound, it is determined to be a contiguous character (two or more characters are not correctly segmented), the position is marked and re-segmentation is triggered (adjusting the valley detection parameters of the horizontal projection). Normal character widths within the range of [LowerBound, UpperBound] are reserved.
[0072] Specifically, in addition to absolute width detection, embodiments of the present invention can also utilize the global consistency feature of monospaced fonts: the standard deviation of the width of all normal characters in the same line should be less than 15% of ExpectedWidth. If the standard deviation exceeds this range, it indicates that there is a segmentation anomaly, triggering the overall re-segmentation process.
[0073] In this embodiment of the invention, the pixel topological feature code refers to a multi-dimensional feature vector extracted from the binary pixel matrix of a single standard character, used to uniquely characterize the shape and topological structure of that standard character. The multi-dimensional feature vector includes at least the following three dimensions of features: (1) Connectivity Component Feature A connected domain refers to a region formed by connected adjacent foreground pixels in a binarized image of a standard character, which reflects the connected structure constituted by the strokes of the standard character. The embodiments of the present invention adopt 8-connectivity analysis, that is, the neighborhood of a foreground pixel includes a total of 8 adjacent pixels in the up, down, left, right and four diagonal directions. Compared with 4-connectivity (only up, down, left and right), 8-connectivity can more accurately reflect the real topological structure of the strokes of a standard character, and is especially more accurate for the connectivity judgment of diagonal strokes (such as the diagonal of "pie", "yi" and "x").
[0074] The extraction step of the connected domain feature can be understood as follows: Input a 32×32 binarized character pixel matrix (foreground=1, background=0); Scan the pixel matrix row by row, and check for each foreground pixel whether there is a marked foreground pixel in its 8-neighborhood; If it exists, merge the current pixel into the same connected domain (the Union-Find data structure is used to process the merging of equivalent labels); If it does not exist, create a new connected domain and assign a new label number; Record for each connected domain: pixel coordinate set, area (number of foreground pixels), centroid coordinate (first moment of area moment); Statistical output: total number N of connected domains, area ratio of each connected domain (area / total number of foreground pixels of the character), normalized centroid coordinate of each connected domain (position in the 32×32 grid), and maximum connected domain area ratio.
[0075] (2) Skeleton Feature The skeleton, also known as "central axis" or "thinning result", refers to a line structure obtained by thinning the strokes of a standard character to a single-pixel width, which retains the topological morphology of the standard character and eliminates the variation in stroke thickness. The skeleton feature reflects the structural information of the standard character, including the trend of branches, the position of endpoints, and the closure of loops.
[0076] The embodiments of the present invention adopt the Zhang-Suen Thinning Algorithm to extract the skeleton of the standard character. The process of the Zhang-Suen Thinning Algorithm is as follows: Input: a 32×32 binarized pixel matrix (foreground pixel P1=1, background=0), where P1 is the target pixel, and its 8-neighborhood is marked as: Sub-iteration 1 (delete southeast boundary points): traverse all foreground pixels, and mark pixels that satisfy all of the following conditions as to-be-deleted: P1 is the foreground pixel (value is 1); The number of foreground pixels in the 8-neighborhood is between 2 and 6 (to ensure that deleting the pixel will not completely eliminate isolated points or destroy endpoints). The number of 0→1 patterns in the 8-neighborhood in the order (P2, P3, P4, P5, P6, P7, P8, P9, P2) is equal to 1 (to ensure that the connectivity of the skeleton is not destroyed after deletion). The condition is satisfied that P2×P4×P6=0 or P4×P6×P8=0 (the southeast boundary point is deleted).
[0077] Sub-iteration 2 (delete the northwest boundary point): Traverse all foreground pixels and mark pixels that simultaneously meet the following conditions as to be deleted: P1 is the foreground pixel (value is 1); The number of foreground pixels in an 8-neighborhood is between 2 and 6; The number of 0→1 patterns in an 8-neighborhood is equal to 1; The condition P2×P4×P8=0 or P2×P6×P8=0 is satisfied (the northwest boundary point is deleted). The two sub-iterations are executed alternately. After each iteration, all pixels marked as to be deleted are set to background (0). When no pixels are deleted in a complete iteration (sub-iteration 1 + sub-iteration 2), the algorithm terminates, and the remaining foreground pixels are the skeleton of the standard character.
[0078] Then, identify the endpoints (skeleton points with 1 foreground pixel in 8 neighborhoods) and branch nodes (skeleton points with ≥3 foreground pixels in 8 neighborhoods) in the skeleton, and record the number of skeleton branch nodes, the normalized coordinates of each endpoint (position in a 32×32 grid), and the length of each branch (number of pixels).
[0079] (3) Pointwise Binary Pattern Feature The point-by-point binary pattern feature is the most direct character shape feature: the character binary pixel matrix normalized to 32×32 is expanded row by row to form a 1024-dimensional binary vector. Each dimension corresponds to a pixel position, with a value of 1 indicating that the position is foreground (character stroke) and a value of 0 indicating that the position is background.
[0080] In this embodiment of the invention, the complete 1024-dimensional features are retained without dimensionality reduction to ensure the accuracy of subsequent recognition.
[0081] Finally, the three-dimensional features are fused into a one-dimensional feature vector using feature concatenation: Feature Vector =[Connected Component Features] [Skeletal Features] [Point-by-point binary pattern features].
[0082] in, This indicates a vector concatenation operation.
[0083] The specific data structure of the feature vector is as follows: Connected component features (1+N×3 dimensions) include the total number of connected components N, the area ratio of each connected component (N-dimensional), the X-coordinate of the centroid of each connected component (N-dimensional), the Y-coordinate of the centroid of each connected component (N-dimensional), and the maximum area ratio of the connected component (1-dimensional); the data type is integer / floating-point number.
[0084] Skeleton features (1+K×2+L dimensions) include the number of branch nodes (1 dimension), K endpoint coordinates (K×2 dimensions), and L branch lengths (L dimensions); the data type is integer.
[0085] The point-by-point binary pattern feature (1024 dimensions) consists of a 32×32 binary pixel matrix expanded row by row (1024 dimensions), and the data type is integer (0 or 1).
[0086] Where N is the number of connected components of the current character, which is usually ≤5 for terminal characters; K is the number of endpoints, usually 2~5; and L is the number of branches, usually 2~6. The feature vector dimension varies with the character structure, and alignment processing is required during matching (missing dimensions are padded with 0).
[0087] In this embodiment of the invention, the pixel topology feature library is a dedicated character library independently built for power Linux terminal operation and maintenance configuration scenarios, without relying on any third-party OCR engine or public character library. The character set covers all printable characters from ASCII code 33 to 126, a total of 94 characters. In addition, commonly used Chinese characters in power operation and maintenance (approximately 50-100 characters) can be added as needed according to actual business scenarios.
[0088] In this embodiment of the invention, multiple (at least three) sample images are collected for each standard character, each corresponding to different shooting conditions, for example: Sample 1: Standard lighting conditions, shot directly vertically, used as a reference template; Sample 2: Slight tilt (±3°) or slight lighting changes, covering common shooting deviations; Sample 3: Font rendering on different terminals (such as differences in the implementation of monospace fonts on different Linux distribution terminals), covering minor font variations.
[0089] By collecting multiple sample images, the generalization ability of the feature library can be enhanced, enabling the feature library to cover various quality fluctuations that may be encountered in actual shooting and improving matching robustness.
[0090] The process for building the pixel topology feature library in this embodiment of the invention may include, but is not limited to: Perform the S2 preprocessing procedure on the three sample images of each character to output a binarized image; Perform bilinear interpolation normalization on each binarized character image, and uniformly scale it to a preset size (e.g., 32×32 pixels). The binarization threshold is uniformly set to 128. For each normalized character pixel matrix, extract the three-dimensional pixel topological feature code (connected component feature, skeleton feature, point-by-point binary pattern feature) using the aforementioned method, and fuse them into a one-dimensional feature vector; A hash table index structure is constructed using the Unicode code points of the characters as keys and the feature vector list of each sample as values.
[0091] Finally, the pixel topology feature library is stored in JSON format on the terminal's local file system, with a file size of approximately 2-5 MB. Upon system startup, the JSON file is loaded into memory and the hash table index is rebuilt. During matching, access and calculation are performed directly in memory, eliminating the need for disk I / O.
[0092] In this embodiment of the invention, the matching and recognition of each character pixel matrix obtained by segmentation based on a preset pixel topology feature library can be understood, but is not limited to, as follows: The segmented character pixel matrix is normalized to the same preset size as the pixel topology feature library. For example, bilinear interpolation is used to uniformly scale it to 32×32 pixels, consistent with the size of standard characters in the feature library, and the binarization threshold is uniformly set to 128.
[0093] Calculate the similarity between the normalized character pixel matrix and the pixel topological feature codes of each standard character in the pixel topological feature library.
[0094] Specifically, the binarized values of the character to be identified and the standard character at the same position (i, j) can be compared pixel by pixel. The number of pixels with the same binarized value (both are 0 or both are 1) is counted and divided by the total number of pixels (32×32=1024) to obtain the overlap rate, which is the similarity.
[0095] The standard character with the highest similarity is selected as the recognition result.
[0096] If the highest similarity score is lower than a preset similarity threshold, the character pixel matrix is marked as an unknown character pixel matrix.
[0097] Specifically, the preset similarity threshold in this embodiment of the invention can be set to any value between 0.80 and 0.9. Taking 0.85 as an example, if the highest similarity is ≥0.85, the corresponding standard character is output; if the highest similarity is <0.85, it means that the matching degree between the character to be identified and any standard character in the feature library is insufficient. In this case, the character is marked as an "unknown character" and can be represented by a "?" placeholder in the output text.
[0098] The embodiments of the present invention employ a pixel-by-pixel overlap rate matching method, which can capture all local details of the character shape, thereby ensuring high-precision recognition.
[0099] After recognition is completed, this embodiment of the invention maps and splices the character recognition results according to the row and column order determined by the row and column projection segmentation, and outputs a well-organized configuration text that is completely consistent with the original screen display content.
[0100] S4: Extract configuration parameters from the configuration text and generate a structured parameter dictionary.
[0101] In one feasible implementation, the step of extracting configuration parameters from the configuration text and generating a structured parameter dictionary in this embodiment of the invention may include, but is not limited to: The configuration text is split into lines, and comment lines and blank lines are removed.
[0102] Specifically, in this embodiment of the invention, the configuration text output by S3 can be split into independent line strings according to newline characters, with each line corresponding to a record in the configuration file. If the length of a line after removing leading and trailing whitespace characters is zero, it is determined to be an empty line and is discarded. Empty lines do not contain any configuration parameters and do not contribute to parameter extraction. Then, the first character of each line (after removing leading whitespace) is checked. If it is a comment marker (usually # in Linux configuration files), the line is determined to be a comment line and is discarded.
[0103] Comment lines and blank lines represent invalid configuration content in the configuration file. If they are not removed, the matching calculation for each subsequent line will introduce unnecessary computational overhead and may result in invalid matches (such as misjudging text in comments as target configuration lines). After removal, only valid configuration lines are retained for the matching stage, which improves computational efficiency and eliminates the risk of mismatches.
[0104] After removing comment lines and blank lines, the matching degree of each line in the configuration text is calculated with the standard configuration line corresponding to the target check point in the preset strategy library. Lines with a matching degree greater than or equal to the preset matching degree threshold are taken as configuration lines.
[0105] Specifically, the matching degree is defined as the ratio of the number of identical characters between the two lines to the total number of characters in the standard configuration line: .
[0106] Where Count matched Length represents the number of characters in the same position between the line to be recognized and the standard configuration line. standard The total number of characters in the standard configuration line.
[0107] The preset matching threshold can be set to 0.9. When the matching degree is ≥0.9, the line is determined to be the target configuration line; when the matching degree is <0.9, it is determined to be a non-target line and is skipped.
[0108] After obtaining the configuration line, the configuration line is divided according to the preset delimiter, and each parameter item and its parameter value are parsed out to generate the structured parameter dictionary.
[0109] Specifically, in Linux system configuration files, the most common parameter format is "parameter name=parameter value" or "parameter name parameter value". In this embodiment of the invention, the preset separator may include, but is not limited to, spaces and equal signs, and is parsed according to the following process: Use spaces as the first-level delimiter to split the configuration line into multiple tokens. For each token, check if it contains an equals sign; If an equals sign is included, the equals sign will be used as a second-level separator, with the parameter name on the left and the parameter value on the right. If the equals sign is not included, the token itself is the parameter name, and its parameter value needs to be determined based on the context (usually the next token is taken as the parameter value).
[0110] Finally, a structured parameter dictionary is generated.
[0111] Since unknown characters cannot be accurately identified, and the characters at their corresponding positions are unreliable, it is necessary to retain this information state throughout the entire processing chain until the final determination. Therefore, if the configuration line contains a marker for the unknown character pixel matrix, this embodiment adds a first state marker to the structured parameter dictionary; otherwise, it adds a second state marker. By marking whether the current configuration line contains unknown characters, a branching basis is provided for the subsequent comparison and determination module.
[0112] S5: Compare the parameter items in the structured parameter dictionary with the standard parameters in the preset strategy library to generate a compliance judgment result.
[0113] In this embodiment of the invention, the structured parameter dictionary includes parameter items and parameter values, and a state flag. This embodiment of the invention can generate compliance determination results in, but is not limited to, the following ways: (1) If the structured parameter dictionary is empty, it means that no target configuration line was found in the configuration text. At this time, the system directly generates a judgment result of "does not match", and the difference item is recorded as: "no target configuration line found".
[0114] (2) If the state status is marked as “0” (first mark), it means that there is an unknown character “?” in the configuration line. At this time, the system does not perform parameter comparison, directly terminates the judgment process and records the log: “Unknown character (?) exists in the recognition result, automatically judged as pending confirmation”, generates the judgment result of “pending confirmation”, and lists the specific parameter items containing “?”, which are then transferred to manual review.
[0115] (3) When the state is marked as "1" (second mark), it means that no unknown character "?" appears in the configuration line, and all characters have been successfully recognized by the pixel topology feature library. At this time, each parameter item in the structured parameter dictionary is compared with the corresponding standard parameter in the preset strategy library item by item.
[0116] For numerical parameters, this embodiment of the invention performs an equivalence determination or a range determination.
[0117] Specifically, the parameter values consist of numbers and optional symbols. In this embodiment of the invention, operators (≥, ≤, >, <, =; if no optional operator is available, = is used by default) and standard numerical values are parsed from the standard value string. Then, the actual parameter string is converted to an integer type using a type conversion function (such as int()), and the corresponding numerical comparison operations are performed. For equality determination, a strict equality comparison is performed; for range determination, comparisons are performed according to the operator type, using greater than, less than, greater than or equal to, and less than or equal to. The comparison results determine whether each parameter meets the requirements.
[0118] For switch-type parameters, the embodiments of the present invention perform an existence determination.
[0119] Specifically, if the parameter has a value of null in the structured parameter dictionary (None in Python, null in JSON), it means that the parameter exists as a switch and does not need to be assigned a value.
[0120] Finally, if all the parameters are met, the system outputs a result indicating compliance; otherwise, it outputs a result indicating non-compliance and lists the discrepancies.
[0121] It should be noted that the built-in policy library in this embodiment of the invention is stored in the local storage medium of the portable verification terminal in JSON file format, and can be organized in a three-level directory structure of "operating system - verification item - verification point". When the system starts, the JSON file is loaded into memory and parsed into a dictionary object (HashMap structure), using the combination key of "operating system + verification item + verification point" as the index. During comparison and judgment, the query is performed directly through the combination key in O(1) time complexity, without disk I / O.
[0122] The screen configuration offline verification and recognition method based on pixel topology feature matching provided in this invention acquires the original image of the target host screen in a data-free manner and combines it with a complete closed loop of preprocessing, character matching and recognition based on pixel topology feature codes, parameter extraction and strategy comparison. This achieves automated and non-intrusive verification of host configuration in an offline environment. It not only overcomes the shortcomings of traditional remote login verification in offline scenarios and the low reliability and efficiency of manual verification, but also avoids complex neural network reasoning through pure pixel-level feature matching, significantly reducing computing power requirements and improving recognition accuracy and the objectivity and traceability of verification results. At the same time, the solution is completely autonomous and controllable, does not rely on external OCR engines or public character libraries, and has good offline deployment adaptability.
[0123] Based on the aforementioned offline screen configuration verification and recognition method based on pixel topology feature matching provided in the first aspect, this embodiment of the invention provides an offline screen configuration verification and recognition system based on pixel topology feature matching, such as... Figure 3 As shown, the screen configuration offline verification and recognition system based on pixel topology feature matching includes: The image acquisition module 110 is used to acquire the original image of the target host screen display interface, and the acquisition is performed when the target host has no data connection; Image preprocessing module 120 is used to preprocess the original image and convert the original image into a binary image; The image recognition and recombination module 130 is used to segment the binarized image into character pixel matrices, and to match and recognize each segmented character pixel matrix based on a preset pixel topology feature library, and to reconstruct and output configuration text in row and column order; wherein, the pixel topology feature library stores the pixel topology feature codes of standard characters, and the pixel topology feature codes are multi-dimensional feature vectors that characterize the topological structure of the character shape. Parameter extraction module 140 is used to extract configuration parameters from the configuration text and generate a structured parameter dictionary; The compliance determination module 150 is used to compare the parameter items in the structured parameter dictionary with the standard parameters in the preset strategy library to generate a compliance determination result.
[0124] Based on the aforementioned offline screen configuration verification and identification method based on pixel topological feature matching provided in the first aspect, this embodiment of the invention also provides a storage medium storing a computer-executable program. The computer-executable program is used to cause a computer to execute the offline screen configuration verification and identification method based on pixel topological feature matching as described in any implementation of the first aspect. Explanations of the relevant content and descriptions of the beneficial effects of any of the computer-readable storage media provided above can be found in the corresponding embodiments described above, and will not be repeated here.
[0125] Those skilled in the art will understand that the program for implementing all or part of the steps of the above embodiments, which can be executed by a program instructing related hardware, can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
[0126] This invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.
[0127] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present invention, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory. Those skilled in the art should recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers.
[0128] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A screen configuration offline verification and identification method based on pixel topological feature matching, characterized in that, include: Acquire the original image of the target host's screen display interface, wherein the acquisition is performed when the target host has no data connection; The original image is preprocessed and converted into a binary image; The binarized image is segmented into character pixel matrices, and the segmented character pixel matrices are matched and recognized based on a preset pixel topology feature library. The configuration text is then reassembled in row and column order. The pixel topology feature library stores pixel topology feature codes of standard characters, and the pixel topology feature codes are multidimensional feature vectors that characterize the topological structure of the character shape. Extract configuration parameters from the configuration text to generate a structured parameter dictionary; The parameter items in the structured parameter dictionary are compared with the standard parameters in the preset strategy library to generate a compliance determination result.
2. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 1, characterized in that, The step of segmenting the binarized image into a character pixel matrix includes: The number of foreground pixels is counted column by column in the binarized image to generate a vertical projection curve. The single-line text region is segmented according to the first trough position of the vertical projection curve. For each single-line text region, the number of foreground pixels is counted line by line to generate a horizontal projection curve, and a single character pixel matrix is segmented according to the second trough position of the horizontal projection curve. The character pixel matrix is filtered according to its width to obtain a valid character pixel matrix.
3. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 2, characterized in that, The location of the first trough of the vertical projection curve is determined in the following way: Calculate the first valley depth value of each first valley of the vertical projection curve, determine the first valley depth threshold based on the statistical characteristics of each first valley depth value, and take the first valley with the first valley depth value greater than the first valley depth threshold as the effective row segmentation position. The location of the second trough of the horizontal projection curve is determined in the following manner: Calculate the second valley depth value of each second valley of the horizontal projection curve, determine the character pixel matrix segmentation threshold based on the statistical characteristics of each second valley depth value, and take the second valley with a second valley depth value greater than the character pixel matrix segmentation threshold as the effective character pixel matrix segmentation position.
4. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 1, characterized in that, The multidimensional feature vector includes the connected component features, skeleton features, and point-by-point binary pattern features of the foreground pixels of the standard character.
5. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 4, characterized in that, The connected component features are extracted in the following way: The standard character's binary pixel matrix is labeled with connected components using 8-connectivity analysis to obtain the standard character's connected component information, which includes the total number of connected components, the area of each connected component, and the centroid coordinates. The skeleton features are extracted in the following manner: The Zhang-Suen parallel thinning algorithm is used to extract the skeleton of the standard character to obtain the skeleton information of the standard character. The skeleton information includes the number of skeleton branch nodes and the coordinates of each endpoint. The point-by-point binary pattern feature is a binary vector formed by expanding the binary pixel matrix of the standard character row by row.
6. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 1, characterized in that, The pixel topology feature library is constructed in the following manner: Collect multiple sample images of the target character set under the terminal's fixed-width font; Normalization processing is performed on each of the sample images, and they are uniformly scaled to a standard pixel matrix of a preset size; Extract the corresponding pixel topological feature code from each of the standard pixel matrices; Each of the standard characters is associated with and stored with its corresponding pixel topological feature code to establish an index.
7. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 1, characterized in that, The matching and recognition of each character pixel matrix obtained by segmentation based on a preset pixel topology feature library includes: The segmented character pixel matrix is normalized to the same preset size as the pixel topology feature library; Calculate the similarity between the normalized character pixel matrix and the pixel topological feature codes of each standard character in the pixel topological feature library; The standard character with the highest similarity is selected as the recognition result; If the highest similarity score is lower than a preset similarity threshold, the character pixel matrix is marked as an unknown character pixel matrix.
8. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 7, characterized in that, The calculation of the similarity between the normalized character pixel matrix and the pixel topological feature codes of each standard character in the pixel topological feature library includes: The normalized character pixel matrix is compared pixel by pixel with the point-by-point binary pattern features of each standard character. The number of pixels with the same pixel value between the character pixel matrix and the point-by-point binary pattern features is counted. The ratio of the counted number of pixels to the total number of pixels of the preset size is used as the similarity.
9. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 1, characterized in that, The step of extracting configuration parameters from the configuration text and generating a structured parameter dictionary includes: The configuration text is split into lines, and comment lines and blank lines are removed; Each line in the configuration text is matched with the standard configuration line corresponding to the target check point in the preset strategy library. Lines with a matching degree greater than or equal to the preset matching degree threshold are used as configuration lines. The configuration line is divided according to a preset delimiter, and each parameter item and its parameter value are parsed out to generate the structured parameter dictionary; If the configuration line contains a marker for an unknown character pixel matrix, then add a first state marker to the structured parameter dictionary; otherwise, add a second state marker.
10. The offline verification and identification method for screen configuration based on pixel topological feature matching according to claim 9, characterized in that, The generation of compliance determination results includes: If the structured parameter dictionary is empty, then output the result indicating non-compliance; If the structured parameter dictionary contains the first state flag, then the judgment result to be confirmed is output; If the structured parameter dictionary contains the second state flag, then each parameter item in the structured parameter dictionary is compared with the corresponding standard parameter in the preset strategy library item by item; For numerical parameters, perform an equality check or a range check. For switch-type parameters, perform an existence check; If all the parameters are met, output a result indicating compliance; otherwise, output a result indicating non-compliance and list the discrepancies.