A method and system for recognizing the character length of a password field in online banking automation
Patent Information
- Application Number
- CN202611296262.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]本发明提供一种面向网银自动化的密码框字符长度识别方法及系统,解决现有技术抗干扰能力弱、成本高的问题
1.通过投影变换,将二维图像中密码字符的检测问题转化为一维投影信号中波峰的检测与计数问题,实现了对问题本质的简化和计算维度的降维,整个方法流程仅涉及数组求和、排序、中值计算、峰值检测等基础数学运算,无需进行卷积、矩阵乘法等计算密集型操作,计算复杂度从二维图像处理的O(M×N)降低至一维信号处理的O(N),显著提升了处理速度,能够在普通办公计算机(仅依赖CPU)上实时运行。
Smart Images

Figure CN122990708A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and in particular relates to a method and system for recognizing the character length of a password field for online banking automation. Background Technology
[0002] With the rapid development of fintech, enterprises' demand for automation and intelligence in their online banking services is growing. In building robotic process automation (RPA) processes such as automatic login, automatic payment, and automatic reconciliation, programmatically simulating manual password input is an indispensable key technology. However, due to stringent account security design considerations, most online banking systems employ character masking measures at their password input interfaces. This means that each character entered by the user is briefly displayed before being immediately replaced with a uniform masking symbol (e.g., "..."). Furthermore, online banking systems do not expose any application programming interfaces (APIs) or parsable interface state parameters used to query the number of characters entered. This means that after an automated program completes the password string input by simulating a keyboard, it cannot accurately determine in a programmatic way whether the password has been completely received by the input box, and therefore cannot decide whether to trigger subsequent operations such as "confirm" or "login". While ensuring the security of the online banking system, real-time and accurate identification of the number of characters entered in the obscured password box is of crucial practical significance and industrial value for ensuring the operational stability and business success rate of online banking automation processes.
[0003] Currently, in online banking automation processes, common methods for identifying the length of masked passwords or similar character counts include: One approach relies on image template matching or optical character recognition (OCR) to identify the number of asterisks or dots from a password box image. However, the shape, size, and pixel-level appearance of the password masking characters vary greatly across different operating systems, display resolutions, and font rendering engines. This results in a cumbersome template library design and maintenance process, and low matching accuracy. Furthermore, these methods are highly susceptible to interference from dynamic elements in graphical user interfaces (GUIs), especially the ubiquitous periodically blinking input cursor. Due to its prominent brightness or color characteristics, the cursor is often misidentified as a password character by existing algorithms, directly leading to counting errors.
[0004] Secondly, there are object detection methods based on deep learning models. These methods utilize deep learning models such as convolutional neural networks (CNNs) to train an end-to-end detector to identify and count occluded characters in images. However, in real-world production environments, the inference process of deep learning models requires high-performance graphics processing units (GPUs) and a large amount of video memory. Large-scale deployment of such high-configuration hardware would result in unacceptably high hardware and maintenance costs. Furthermore, in scenarios with high security levels, such as banking and securities, the production environment of client PCs is subject to strict security policies. To avoid introducing potential security vulnerabilities or system instability, the installation of large-scale, complex deep learning frameworks is usually strictly prohibited. Summary of the Invention
[0005] This invention provides a method and system for recognizing the character length of a password field for online banking automation, solving the problems of weak anti-interference capability and high cost in existing technologies.
[0006] This invention provides a basic solution: a method for recognizing the character length of a password field for online banking automation, comprising the following steps: S1: Obtain the screen image area of the target password input box, preprocess the image area to generate a single-channel grayscale image; perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly collect the one-dimensional projection signal several times within a preset time window; apply statistical filtering operation to the collected one-dimensional projection signal at each coordinate position to generate a stable projection signal. S2: Based on the stable projection signal, the peak detection algorithm is used to extract local maxima points that meet the preset peak conditions, which are used as initial candidate feature points to form the initial candidate feature point set; S3: Perform statistical analysis on the signal amplitudes of all feature points in the initial candidate feature point set to identify abnormal feature points and determine the dynamic range of abnormal feature points on the stable projection signal; perform local suppression processing on the signal values of the stable projection signal within the dynamic range to generate a clean projection signal, and remove abnormal feature points from the initial candidate feature point set to obtain a clean candidate feature point set; S4: The pure candidate feature point set is double-filtered by the preset position association rules and amplitude association rules to obtain the final feature point set; S5: Calculate the number of feature points in the final feature point set, use the number as the length of the recognized password character, and output it.
[0007] Preferably, in step S1, when performing projection transformation, a vertical projection transformation is performed on the grayscale image to obtain a one-dimensional horizontal projection signal; when performing statistical filtering, a statistical filtering operation is performed on each horizontal coordinate position of the acquired signal.
[0008] Preferably, in step S1, the statistical filtering uses median filtering.
[0009] Preferably, in step S3, when identifying anomalous feature points, a robust outlier detection algorithm based on the absolute deviation of the median is used, specifically as follows: Calculate the median amplitude and MAD value of all feature points in the initial candidate feature point set; Calculate the corrected Z-score for each feature point based on the median and MAD value; Feature points whose Z-score values exceed a preset outlier threshold are identified as anomalous feature points.
[0010] More preferably, in step S3, the method for determining the dynamic effective range is as follows: Starting from the peak position of the abnormal feature point, iterative search is performed on the left and right sides of the stable projection signal respectively. The position where the signal amplitude drops from the peak and returns to the preset baseline level for the first time is determined as the boundary of the dynamic action range.
[0011] Preferably, in step S4, the location association rule is specifically as follows: Calculate the horizontal interval between all adjacent feature points in the pure candidate feature point set, and use the mode of the horizontal interval as the baseline step size. Using the baseline step size as a template, feature points that conform to the equidistant arrangement rule are selected from the pure candidate feature point set.
[0012] More preferably, in step S4, the amplitude association rule is specifically as follows: Calculate the mean and standard deviation of the signal amplitude of the feature point set after filtering by location association rules; The normal amplitude range is set based on the mean and standard deviation, and feature points whose signal amplitude exceeds the normal amplitude range are eliminated.
[0013] More preferably, the strategy for setting the normal amplitude range is as follows: using the mean as the center and the standard deviation of a preset multiple as the radius, the amplitude confidence interval is determined as the normal amplitude range.
[0014] Another basic solution provided by this invention: a password box character length recognition system for online banking automation, comprising: The image acquisition and preprocessing module is used to acquire the screen image area of the target password input box and preprocess the image area to generate a single-channel grayscale image. The signal generation module is used to perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly acquire the one-dimensional projection signal several times within a preset time window. Statistical filtering is applied to the acquired signals to generate a stable projection signal. The candidate feature extraction module is used to perform a peak detection algorithm on the stable projection signal, extract all local maxima points that meet the preset peak conditions as initial candidate feature points, and form an initial candidate feature point set; The candidate feature point optimization module is used to perform statistical analysis on the signal amplitude of all feature points in the initial candidate feature point set to identify abnormal feature points, determine the dynamic range of abnormal feature points on the stable projection signal, perform local suppression processing on the signal value of the stable projection signal within the dynamic range to generate a clean projection signal, and remove abnormal feature points from the initial candidate feature point set to obtain a clean candidate feature point set. The feature point refinement module is used to perform dual filtering of the pure candidate feature point set through position association rules and amplitude association rules to obtain the final feature point set; The counting and output module is used to calculate the number of feature points in the final feature point set and output the number as the length of the recognized password character.
[0015] Preferably, the location association rule is as follows: Calculate the horizontal interval between all adjacent feature points in the pure candidate feature point set, and use the mode of the horizontal interval as the baseline step size. Using the baseline step size as a template, feature points that conform to the equally spaced arrangement rule are selected from the pure candidate feature point set; the amplitude correlation rule is specifically as follows: Calculate the mean and standard deviation of the signal amplitude of the feature point set after filtering by location association rules; The normal amplitude range is set based on the mean and standard deviation, and feature points whose signal amplitude exceeds the normal amplitude range are eliminated.
[0016] The principles and advantages of this invention are as follows: 1. By using projection transformation, the problem of detecting password characters in a two-dimensional image is transformed into the problem of detecting and counting peaks in a one-dimensional projected signal. This simplifies the essence of the problem and reduces the dimensionality of the computation. The entire method involves only basic mathematical operations such as array summation, sorting, median calculation, and peak detection. It does not require computationally intensive operations such as convolution and matrix multiplication. The computational complexity is reduced from O(M×N) for two-dimensional image processing to O(N) for one-dimensional signal processing, which significantly improves the processing speed and enables real-time operation on ordinary office computers (relying only on the CPU).
[0017] 2. A robust outlier detection algorithm based on median absolute deviation is used to identify anomalous feature points. By analyzing the statistical distribution characteristics of the signal itself, it locates and removes anomalous peaks generated by the input cursor. It does not rely on the prior morphological features of the cursor (such as width, shape, and color), and does not require any preset cursor templates or training samples. It can adaptively handle input cursors of different shapes (vertical line, square, and highlighted) in different bank online banking systems and has good generalization ability.
[0018] 3. Candidate feature points are dual-filtered using positional association rules and amplitude association rules. The positional association rule utilizes the structural prior of equally spaced password characters to eliminate noise points with irregular positions; the amplitude association rule utilizes the consistent visual shape of characters within the same password frame to eliminate false peaks with abnormal amplitudes. The combined application of these two rules greatly improves recognition accuracy and effectively resists various residual interferences introduced by factors such as image compression, anti-aliasing, and interface noise.
[0019] Preferably, the dynamic effective range is determined by iteratively searching from the peak position to both sides for the signal to return to the baseline level, which can adaptively determine the suppression range according to the actual width of the interference signal. When the cursor is wider, the dynamic effective range expands accordingly; when the cursor is narrower, the range shrinks accordingly, achieving precise and non-destructive removal of the interference signal. Attached Figure Description
[0020] Figure 1 This is a flowchart of the present invention; Figure 2 This is a flowchart of Embodiment 1 of the present invention; Figure 3 This is a panoramic analysis diagram of the original image area and signal processing of the password frame to be identified in Embodiment 1 of the present invention. Detailed Implementation
[0021] The following detailed description illustrates the specific implementation method: The specific implementation process is as follows: Example 1 See Figures 1 to 3 A method for recognizing the character length of a password field for online banking automation includes the following steps: S1: Obtain the screen image area of the target password input box, preprocess the image area to generate a single-channel grayscale image; perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly collect the one-dimensional projection signal several times within a preset time window. Apply statistical filtering operation to the collected one-dimensional projection signals at each coordinate position to generate a stable projection signal.
[0022] In step S1, when performing projection transformation, a vertical projection transformation is performed on the grayscale image to obtain a one-dimensional horizontal projection signal; when performing statistical filtering, a statistical filtering operation is performed on each horizontal coordinate position of the acquired signal.
[0023] In step S1, median filtering is used for statistical filtering.
[0024] Step S1 converts a two-dimensional, time-varying graphical user interface (GUI) image into a one-dimensional, robust, and analyzable digital signal. Specifically, firstly, based on preset screen coordinate parameters, a digital image I of the rectangular region R of the target password input box in the screen coordinate system is obtained. The preset screen coordinate parameters define the position and size of the target password box on the screen, and are preset and saved according to the user's actual online banking interface layout.
[0025] Then, the acquired digital image I is preprocessed, which includes sequential grayscale transformation and color inversion transformation to generate a single-channel grayscale image. The grayscale transformation converts a color image to a grayscale image, with grayscale values ranging from 0 to 255. The inverse transformation inverts the pixel values of the grayscale image, i.e., the new pixel value = 255 - the original pixel value, thus masking characters (such as asterisks) in the original image. Foreground elements such as "or dots" and the input cursor appear as high-brightness values in the grayscale image, while the background area appears as low-brightness values. Through preprocessing, the pixel areas corresponding to the password characters have high brightness values in the image, providing a good signal foundation for subsequent projection transformation and peak detection.
[0026] Subsequently, the preprocessed grayscale image Perform a projection transformation on the grayscale image. The pixel brightness values are accumulated along its vertical direction, that is, the pixel brightness values of each column of the image are summed along the horizontal direction to obtain a one-dimensional horizontal projection signal. Where p represents the horizontal coordinate position (i.e., pixel column index) and t represents the sampling time. Each value of the one-dimensional horizontal projection signal corresponds to the sum of the brightness of a column of pixels in the original image. When a password character (such as an asterisk) exists within a certain horizontal coordinate interval, the brightness values of each column within that interval are relatively high. After accumulation, a local peak is formed at the corresponding position in that interval. Therefore, each local peak in the one-dimensional horizontal projection signal theoretically corresponds to the horizontal position of a password character. Through projection transformation, the two-dimensional image data is reduced to a one-dimensional signal, significantly reducing the computational complexity of subsequent data processing.
[0027] Next, considering the transient characteristics of elements in a graphical user interface, especially the periodic blinking phenomenon commonly found in input cursors (typically alternating between bright and dark states with a period of approximately 500 milliseconds), the signal acquired at a single moment... It may contain significant impulse noise, and when the sampling time happens to fall within the lit state of the cursor, an additional anomalous peak will form in the projected signal. To construct a time-insensitive stable signal, a time-series multiple sampling and statistical filtering strategy is adopted, within a preset observation time window. Within a certain timeframe (e.g., 500 milliseconds), K projection signals are continuously acquired at a specific sampling frequency to obtain K one-dimensional projection signal samples. Wherein, K is an odd number greater than or equal to 3, preferably K=3. The choice of K value takes into account both the statistical filtering effect and the real-time requirements: if K is too small (such as K=1), effective filtering cannot be achieved, and if K is too large, it will increase the sampling time and affect the overall execution efficiency of the automated process.
[0028] Finally, statistical filtering is applied to the K acquired one-dimensional projection signal samples at each horizontal coordinate position p to generate the final stable projection signal. The statistical filtering employed is median filtering, meaning that for each horizontal coordinate position p, the median of the signal values from K samples at that position is taken as the median. At this position, median filtering is a nonlinear filtering method. Its basic principle is to sort all values in the neighborhood of a point by size and take the median value as the output value of that point. The blinking of the input cursor manifests as isolated bright pulses appearing at random moments, which is a typical impulse noise. Median filtering is extremely effective in eliminating this type of impulse noise. When there are a few high values among the K sampled values due to the cursor's bright state, these high values are located at one end of the sequence after sorting and will not affect the median value, so they can be effectively filtered out. At the same time, median filtering can preserve the edge features of the signal to the maximum extent, ensuring that the peak shape corresponding to the password character is not destroyed and avoiding a decrease in peak amplitude or position shift. After step S1, a stable projection signal with a high signal-to-noise ratio that accurately reflects the static spatial distribution of the password character can be obtained. Each cipher character in the signal corresponds to a stable peak.
[0029] S2: Based on the stable projection signal, the peak detection algorithm is used to extract the local maxima points that meet the preset peak conditions, which are used as initial candidate feature points to form the initial candidate feature point set.
[0030] The preset peak condition includes the following two conditions: a. Amplitude condition: The signal amplitude at this point is higher than the preset minimum hardware threshold; the minimum hardware threshold is used to filter out background baseline noise, and its value can be preset according to the actual application scenario. For example, it can be set to the maximum value of the background noise amplitude in the stable projection signal, or it can be set to a fixed value (such as a certain percentile of the grayscale accumulation value) based on experience. In this embodiment, the minimum hardware threshold is set to the maximum value of the background noise amplitude in the stable projection signal. b. Neighborhood Condition: The signal amplitude of this point is greater than the signal amplitude of all other points within the specified neighborhood range to ensure that this point is the maximum value of its local area. The specified neighborhood range is determined based on the expected width of the password character in the projected signal, that is, the neighborhood radius is determined based on the horizontal pixel width occupied by the password character in the screen image. This ensures that the neighborhood range can cover the peak width corresponding to a single password character, but is not too large to include the peaks of adjacent characters in the same neighborhood. In this embodiment, the specified neighborhood range is 2 pixels wide on both the left and right sides.
[0031] Specifically, for stable projection signals A peak detection algorithm is executed to scan the signal array to find all local maxima that satisfy the preset peak conditions. All local maxima that satisfy the preset peak conditions, along with their corresponding signal amplitude values and horizontal coordinate positions, constitute an initial candidate feature point set. In this initial candidate feature point set, each feature point contains two attributes: horizontal coordinate position. and signal amplitude (i represents the index of the feature point). This initial set of candidate feature points contains peaks representing the real password characters, and may also contain interference peaks introduced by the input cursor or other interface elements (such as interface borders, noise, etc.).
[0032] S3: Perform statistical analysis on the signal amplitudes of all feature points in the initial candidate feature point set to identify abnormal feature points and determine the dynamic range of the abnormal feature points on the stable projection signal; perform local suppression processing on the signal values of the stable projection signal within the dynamic range to generate a clean projection signal, and remove the abnormal feature points from the initial candidate feature point set to obtain a clean candidate feature point set.
[0033] In step S3, when identifying anomalous feature points, a robust outlier detection algorithm based on the absolute deviation of the median is used, specifically as follows: Calculate the median and MAD (median absolute deviation) values of the amplitudes of all feature points in the initial candidate feature point set; calculate the corrected Z-score value for each feature point based on the median and MAD values. Feature points whose Z-score values exceed a preset outlier threshold are identified as anomalous feature points.
[0034] The preset outlier threshold is set to a fixed threshold of 3.5 based on statistical principles. This threshold corresponds to an event with a corrected Z-score value exceeding 3.5 under a normal distribution having a probability of less than 0.05%, which can effectively identify anomalous feature points while controlling the false positive rate. In other embodiments, the preset outlier threshold can also be adjusted according to the sensitivity requirements in the actual scenario. The smaller the threshold, the more sensitive the judgment, and the larger the threshold, the more conservative the judgment.
[0035] In step S3, the method for determining the dynamic effective range is as follows: Starting from the peak position of the abnormal feature point, iterative search is performed on the left and right sides of the stable projection signal respectively. The position where the signal amplitude drops from the peak and returns to the preset baseline level for the first time is determined as the boundary of the dynamic action range.
[0036] Specifically, firstly, for the initial candidate feature point set Statistical analysis is performed on the signal amplitudes of all feature points to identify at least one anomalous feature point whose amplitude significantly deviates from the normal range of most other feature points. As mentioned earlier, the peak amplitude formed by the input cursor in the projected signal usually far exceeds that of normal password characters; therefore, the feature point corresponding to the cursor is the anomalous feature point to be identified. A robust outlier detection algorithm based on the absolute deviation of the median is used to identify anomalous feature points. This algorithm is far less sensitive to extreme values than traditional outlier detection methods based on the mean and standard deviation, and can more reliably locate the abnormally high peaks generated by the cursor. The specific identification process is as follows: First, calculate the initial candidate feature point set. The median M and MAD values of the amplitudes of all feature points are given, where the MAD value is calculated using the formula: MAD = median(| - M|), where, The MAD value represents the signal amplitude of the i-th feature point, and `median` indicates the median operation. The MAD value measures the dispersion of the amplitudes of all feature points relative to their median. Unlike the standard deviation, the MAD value is not significantly inflated by the presence of a large outlier, thus it can stably reflect the fluctuation range of normal data (i.e., feature points corresponding to actual password characters).
[0037] Then, based on the median M and MAD values, the initial candidate feature point set is calculated. The corrected Z-score value for each feature point. The formula for calculating the corrected Z-score value is: Corrected Z-score = 0.6745 × ( - M) / MAD; where the constant 0.6745 is a normalization coefficient, which makes the modified Z-score comparable to the classic Z-score on a numerical scale when the data follows a normal distribution. When the MAD value can stably represent the dispersion of normal data, the deviation between outliers (i.e., the giant peaks of the cursor) and the median ( - M) is very large, while MAD is very small, so the correction Z-score for outliers will be a very large positive number; while the amplitude value of normal feature points is close to the median, and the absolute value of their correction Z-score is small.
[0038] Finally, feature points whose corrected Z-score exceeds a preset outlier threshold are identified as anomalous feature points. In this embodiment, the preset outlier threshold is preferably 3.5. This threshold is an empirical value set based on statistical principles: under the assumption of a normal distribution, the probability of points with a corrected Z-score exceeding 3.5 is extremely low, so they can be reasonably identified as outliers. This threshold can be adjusted according to the sensitivity requirements of the actual application scenario; a larger threshold results in a more conservative judgment (potential for missed detections); a smaller threshold results in a more sensitive judgment (potential for false positives).
[0039] After anomaly points are identified, it is necessary to accurately define the position of these anomaly points within the stable projection signal. The dynamic effective range (i.e., the range of influence) is determined to accurately eliminate interfering signals while avoiding damage to adjacent normal signals. The method for determining the dynamic effective range is based on the peak position of the abnormal feature point. Starting from the stable projection signal, respectively Iterative search is performed on both the left and right sides, that is, from... Starting from the current position, move gradually to the left (in the direction of decreasing p) and to the right (in the direction of increasing p), comparing the signal amplitude at each position with the preset baseline level. The signal amplitude will decrease from its peak and return to the preset baseline level for the first time. The location is determined as the boundary of the dynamic action range. That is, when searching to the left, when a certain location is found... The signal amplitude at that location dropped for the first time. The following (or equal to) ),but The left boundary is determined; when searching to the right, when a certain position is found... The signal amplitude at that location dropped for the first time. The following (or equal to) ),but It was determined to be the right boundary. The preset baseline level... Preferably, it is the minimum hardware threshold mentioned in step S2. This value represents the level of the background signal; a signal amplitude returning to this level indicates that the energy of the interference signal has attenuated to a negligible degree. This dynamic definition method ensures the adaptability of the suppression range, perfectly matching the interference signals generated by cursors of different shapes and widths (the thickness and shape of cursors may differ in different bank online banking systems). When the cursor is wider, the searched dynamic effective range is correspondingly larger; when the cursor is narrower, the range is correspondingly smaller, avoiding the problems of "insufficient suppression" (too small a range, interference residue) or "false positives" (too large a range, cutting off adjacent password character peaks) caused by fixed-width suppression.
[0040] After determining the dynamic range of action [ , After that, the original stable projection signal The signal values within this range are locally suppressed to generate a clean projection signal with abnormal interference eliminated. In this embodiment, the local suppression process involves resetting all signal values within the dynamic range to zero, i.e., for p ∈ [ , ], = 0; For positions outside the interval, = Simultaneously, from the initial candidate feature point set Remove the identified anomalous feature points to obtain a clean set of candidate feature points. After step S3, the abnormal "peaks" generated by the input cursor are completely and cleanly eliminated, while the other "peaks" representing the real password characters are completely preserved, laying a solid foundation for subsequent accurate counting without interference.
[0041] S4: The pure candidate feature point set is double-filtered by the preset position association rules and amplitude association rules to obtain the final feature point set.
[0042] In step S4, the location association rules are as follows: Calculate the horizontal interval between all adjacent feature points in the pure candidate feature point set, and use the mode of the horizontal interval as the baseline step size. Using the baseline step size as a template, feature points that conform to the equidistant arrangement rule are selected from the pure candidate feature point set.
[0043] In step S4, the amplitude association rule is specifically as follows: Calculate the mean and standard deviation of the signal amplitude of the feature point set after filtering by location association rules; The normal amplitude range is set based on the mean and standard deviation, and feature points whose signal amplitude exceeds the normal amplitude range are eliminated.
[0044] The strategy for setting the normal amplitude range is as follows: using the mean as the center and the standard deviation of a preset multiple as the radius, the amplitude confidence interval is determined as the normal amplitude range.
[0045] Specifically, from the pure candidate feature point set In this process, the inherent structural patterns of the password characters are used to further filter out the true password character feature points. Although step S3 has already eliminated the cursor as the main source of interference, a clean set of candidate feature points is still needed. There may still be some residual noise points (such as weak "pseudo-peaks" caused by image compression artifacts, anti-aliasing effects, or interface background textures), which need to be further refined and filtered through association rules. Specifically, this includes two sub-steps: position association rule filtering and amplitude association rule filtering. The two sub-steps are executed in sequence.
[0046] Location association rule filtering: This rule is based on a strong prior knowledge: in most graphical user interfaces (GUIs), password masking characters are physically arranged with approximately equal spacing. This is because password boxes typically use monospaced fonts (each character occupies the same horizontal width), and the spacing between characters is uniformly controlled by the system font rendering engine.
[0047] First, calculate the pure candidate feature point set. The horizontal interval between all adjacent feature points in the sorted candidate feature points is calculated as the difference in horizontal coordinates between any two adjacent points. .
[0048] Then, count all horizontal intervals. The mode (i.e., the interval value that appears most frequently) is used as the reference step size. The baseline step size represents the standard physical spacing (in pixels) between password characters. When a candidate feature point contains multiple real password characters, the spacing between these adjacent points is ideally exactly equal. In reality, it fluctuates within a certain range due to image sampling and rendering errors, but the mode statistics can reliably extract the most frequently occurring standard spacing from all interval values.
[0049] Finally, using the reference step size As a template, in the pure candidate feature point set Feature points that conform to the equally spaced arrangement rule are selected from the candidate point set. The specific selection method is as follows: Find the longest continuous feature point subsequence from the candidate point set that satisfies the following conditions: the horizontal interval between any two adjacent feature points in the subsequence is equal to the baseline step size. The absolute value of the difference does not exceed a preset tolerance range. This tolerance range is used to accommodate minor positional deviations caused by factors such as font rendering, anti-aliasing, and screen scaling, and is typically set to a width of 2-3 pixels. Feature points that do not meet the above conditions (i.e., whose distance from their preceding and following adjacent points deviates from the reference step size by more than the tolerance range) are considered irregular noise points and are discarded. Through the filtering of positional association rules, irregular noise points can be effectively eliminated, retaining feature points whose spatial positions conform to the arrangement rules of password characters.
[0050] Amplitude correlation rule filtering: This rule is based on another prior knowledge: normal password masking characters have a visually consistent shape, so their peak amplitude in the projected signal should also fluctuate within a certain range. This is because password characters in the same password box are rendered with the same font, the same font size, and the same color, and their pixel-level appearance is basically the same.
[0051] First, calculate the mean and standard deviation of the signal amplitude of the feature point set after location association rule filtering. Let the number of feature points retained after location filtering be... Its amplitude value , , …, Then the mean μ = (1 / N') × Σ Standard deviation σ = sqrt((1 / N') × Σ( - μ)²).
[0052] Then, a normal amplitude range is set based on the mean and the standard deviation. In this embodiment, the strategy for setting the normal amplitude range is as follows: taking the mean μ as the center and the standard deviation σ as a preset multiple as the radius, the amplitude confidence interval is determined as the normal amplitude range. That is, the normal amplitude range is [μ - α×σ, μ + α×σ], where α is a preset multiple. The preset multiple is preferably 1.5. The selection of this value is based on statistical principles: under the assumption of normal distribution, the range of mean ± 1.5 times the standard deviation covers approximately 86.6% of the data, which can retain the vast majority of normal feature points while eliminating outliers with significantly deviated amplitudes. This multiple can be adjusted according to the sensitivity requirements in the actual scenario: the smaller the α value, the stricter the screening (may eliminate marginal normal points); the larger the α value, the looser the screening (may miss out on outliers).
[0053] Finally, feature points whose signal amplitude exceeds the normal range are removed, and feature points whose signal amplitude is within the normal range are retained, resulting in the final feature point set. By employing a "double-insurance" screening mechanism that combines position and amplitude correlation rules, weak "false peaks" caused by background noise and anti-aliasing effects can be effectively filtered out, ensuring that every feature point retained is a genuine password character, thus greatly improving the accuracy and reliability of the final count.
[0054] S5: Calculate the number of feature points in the final feature point set, use the number as the length of the recognized password character, and output it.
[0055] Specifically, obtaining the final feature point set The size, i.e., the calculation The number of elements contained in the set is used as the identified password length L. This count value L is the final output of the method of this invention, used by the upper-level automated process. For example, the automated program can compare this count value with a preset password length. If they match, it is determined that the password has been entered completely, and subsequent operations such as clicking the "Confirm" or "Login" button are executed; if they do not match, a retry mechanism or alarm prompt can be triggered. In this embodiment, as shown... Figure 3 As shown, this method identifies the screen image area of the target password input box and finds that the password is 8 characters long.
[0056] Example 2 A password field character length recognition system for online banking automation, used to run the above method, includes: The image acquisition and preprocessing module is used to acquire the screen image area of the target password input box and preprocess the image area to generate a single-channel grayscale image.
[0057] The signal generation module is used to perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly acquire the one-dimensional projection signal several times within a preset time window. Statistical filtering is applied to the acquired signals to generate a stable projection signal.
[0058] The candidate feature extraction module is used to perform peak detection algorithm on the stable projection signal, extract all local maxima points that meet the preset peak conditions as initial candidate feature points, and form an initial candidate feature point set.
[0059] The candidate feature point optimization module is used to perform statistical analysis on the signal amplitude of all feature points in the initial candidate feature point set to identify abnormal feature points, determine the dynamic range of abnormal feature points on the stable projection signal, perform local suppression processing on the signal value of the stable projection signal within the dynamic range to generate a clean projection signal, and remove abnormal feature points from the initial candidate feature point set to obtain a clean candidate feature point set.
[0060] The feature point refinement module is used to perform dual filtering of the pure candidate feature point set through position association rules and amplitude association rules to obtain the final feature point set; The location association rule specifically involves: calculating the horizontal interval between all adjacent feature points in the pure candidate feature point set, and using the mode of the horizontal interval as the baseline step size; using the baseline step size as a template, selecting feature points that conform to the equal spacing arrangement rule from the pure candidate feature point set; the amplitude association rule specifically involves: calculating the mean and standard deviation of the signal amplitude of the feature point set after being filtered by the location association rule; setting a normal amplitude range based on the mean and standard deviation, and removing feature points whose signal amplitude exceeds the normal amplitude range.
[0061] The counting and output module is used to calculate the number of feature points in the final feature point set and output the number as the length of the recognized password character.
[0062] The above are merely embodiments of the present invention. Commonly known structures and characteristics are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A method for recognizing the character length of a password field for online banking automation, characterized in that, Includes the following steps: S1: Obtain the screen image area of the target password input box, preprocess the image area to generate a single-channel grayscale image; perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly collect the one-dimensional projection signal several times within a preset time window; apply statistical filtering operation to the collected one-dimensional projection signal at each coordinate position to generate a stable projection signal. S2: Based on the stable projection signal, the peak detection algorithm is used to extract local maxima points that meet the preset peak conditions, which are used as initial candidate feature points to form the initial candidate feature point set; S3: Perform statistical analysis on the signal amplitudes of all feature points in the initial candidate feature point set to identify abnormal feature points and determine the dynamic range of abnormal feature points on the stable projection signal. Local suppression processing is performed on the signal value of the stable projection signal within the dynamic range to generate a clean projection signal, and abnormal feature points are removed from the initial candidate feature point set to obtain a clean candidate feature point set. S4: The pure candidate feature point set is double-filtered by the preset position association rules and amplitude association rules to obtain the final feature point set; S5: Calculate the number of feature points in the final feature point set, use the number as the length of the recognized password character, and output it.
2. The method for recognizing the character length of a password field for online banking automation according to claim 1, characterized in that: In step S1, when performing projection transformation, a vertical projection transformation is performed on the grayscale image to obtain a one-dimensional horizontal projection signal; when performing statistical filtering, a statistical filtering operation is performed on each horizontal coordinate position of the acquired signal.
3. The method for recognizing the character length of a password field for online banking automation according to claim 1 or 2, characterized in that: In step S1, median filtering is used for statistical filtering.
4. The method for recognizing the character length of a password field for online banking automation according to claim 1, characterized in that: In step S3, when identifying anomalous feature points, a robust outlier detection algorithm based on the absolute deviation of the median is used, specifically as follows: Calculate the median amplitude and MAD value of all feature points in the initial candidate feature point set; Calculate the corrected Z-score for each feature point based on the median and MAD value; Feature points whose Z-score values exceed a preset outlier threshold are identified as anomalous feature points.
5. The method for recognizing the character length of a password field for online banking automation according to claim 4, characterized in that: In step S3, the method for determining the dynamic effective range is as follows: Starting from the peak position of the abnormal feature point, iterative search is performed on the left and right sides of the stable projection signal respectively. The position where the signal amplitude drops from the peak and returns to the preset baseline level for the first time is determined as the boundary of the dynamic action range.
6. The method for recognizing the character length of a password field for online banking automation according to claim 1, characterized in that: In step S4, the location association rules are as follows: Calculate the horizontal interval between all adjacent feature points in the pure candidate feature point set, and use the mode of the horizontal interval as the baseline step size. Using the baseline step size as a template, feature points that conform to the equidistant arrangement rule are selected from the pure candidate feature point set.
7. The method for recognizing the character length of a password field for online banking automation according to claim 6, characterized in that: In step S4, the amplitude association rule is specifically as follows: Calculate the mean and standard deviation of the signal amplitude of the feature point set after filtering by location association rules; The normal amplitude range is set based on the mean and standard deviation, and feature points whose signal amplitude exceeds the normal amplitude range are eliminated.
8. The method for recognizing the character length of a password field for online banking automation according to claim 7, characterized in that: The strategy for setting the normal amplitude range is as follows: using the mean as the center and the standard deviation of a preset multiple as the radius, the amplitude confidence interval is determined as the normal amplitude range.
9. A password box character length recognition system for online banking automation, characterized in that, include: The image acquisition and preprocessing module is used to acquire the screen image area of the target password input box and preprocess the image area to generate a single-channel grayscale image. The signal generation module is used to perform projection transformation on the grayscale image to obtain a one-dimensional projection signal, and repeatedly acquire the one-dimensional projection signal several times within a preset time window. Statistical filtering is applied to the acquired signals to generate a stable projection signal. The candidate feature extraction module is used to perform a peak detection algorithm on the stable projection signal, extract all local maxima points that meet the preset peak conditions as initial candidate feature points, and form an initial candidate feature point set; The candidate feature point optimization module is used to perform statistical analysis on the signal amplitude of all feature points in the initial candidate feature point set to identify abnormal feature points, determine the dynamic range of abnormal feature points on the stable projection signal, perform local suppression processing on the signal value of the stable projection signal within the dynamic range to generate a clean projection signal, and remove abnormal feature points from the initial candidate feature point set to obtain a clean candidate feature point set. The feature point refinement module is used to perform dual filtering of the pure candidate feature point set through position association rules and amplitude association rules to obtain the final feature point set; The counting and output module is used to calculate the number of feature points in the final feature point set and output the number as the length of the recognized password character.
10. The password box character length recognition system for online banking automation according to claim 9, characterized in that: The location association rule is specifically as follows: Calculate the horizontal interval between all adjacent feature points in the pure candidate feature point set, and use the mode of the horizontal interval as the baseline step size. Using the baseline step size as a template, feature points that conform to the equally spaced arrangement rule are selected from the pure candidate feature point set; the amplitude correlation rule is specifically as follows: Calculate the mean and standard deviation of the signal amplitude of the feature point set after filtering by location association rules; The normal amplitude range is set based on the mean and standard deviation, and feature points whose signal amplitude exceeds the normal amplitude range are eliminated.