Method and device for identifying position of notch area of sliding block and electronic equipment

By constructing the brightness matrix of the slider verification code and using standard convolution kernel to calculate the brightness mean square difference value of the slider gap area, identifying the slider gap position, solving the slow recognition speed and low accuracy of the slider verification code in the prior art The problem of efficient slide notch area positioning is achieved.

CN119130887APending Publication Date: 2024-12-13SHANGHAI WEIWENJIA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310694436.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-12
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the slider gap position recognition of slider verification codes, machine learning algorithms require a lot of labeling and training, resulting in slow recognition speed; image recognition algorithms require edge detection, and the recognition accuracy is low when the calculation is large and complex graphics is complex. .

Method used

By obtaining the image of the slider verification code, a matrix is ​​constructed based on the brightness value of the pixel point, and using a predefined standard convolution kernel for convolution calculation, the mean square difference value of the brightness is calculated to determine the position of the slider gap area, simplifying the calculation amount and reduce the impact of complex graphics.

Benefits of technology

The calculation amount is greatly reduced, the recognition speed and accuracy of the slider notch area are improved, and redundant calculations of deep learning models and edge detection are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119130887A_ABST
    Figure CN119130887A_ABST
Patent Text Reader

Abstract

The invention provides a position identification method and device of a sliding block gap area and electronic equipment. The method comprises the steps of determining a first matrix according to a pixel position and a brightness value of each pixel point in a first image comprising the sliding block gap area; a plurality of first convolution kernels are selected from the first matrix from left to right and from top to bottom in sequence based on a standard convolution kernel determined by the width and height of a predefined sliding block notch area, convolution calculation is carried out on each first convolution kernel, and a second matrix is obtained; and determining the position of the notch area of the sliding block based on the position of the upper left corner point of the first convolution kernel corresponding to the lightness mean square deviation value with the minimum numerical value in the second matrix. According to the mode, the lightness mean square error of each first convolution kernel in the first image is calculated according to the standard convolution kernel and the lightness value of the pixel point at each position in the first image, so that the position of the notch area of the sliding block is identified, the calculation amount can be greatly reduced, the influence caused by a complex graph is reduced, and the identification speed and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of position recognition of a notch area of ​​a slider, and in particular to a method, a device and an electronic device for position recognition of a notch area of ​​a slider. Background Art

[0002] The slider verification code is a behavioral verification code that requires interaction with the user. In the field of automated testing, it is generally necessary to automatically identify such verification codes. Currently, there are two ways to identify the slider gap position of the slider verification code: machine learning algorithm or image recognition algorithm. Among them, the machine learning algorithm needs to train a large number of images with gap positions marked to obtain a training model, and then use the training model to identify the slider gap position in the image. Due to the need for a large amount of annotation and training, the recognition speed is slow and the recognition accuracy is low; the image recognition algorithm needs to obtain the background image and the slider image at the same time, perform edge detection on the background image and the slider image, and then find the part similar to the slider edge in the background image as the slider gap position. Since downloading pictures and calculations require a large amount of network resources and time costs, when the graphics are complex, a large amount of redundant data will appear in the edge detection results, resulting in a relatively slow recognition speed and low recognition accuracy. Summary of the invention

[0003] The purpose of the present invention is to provide a method, device and electronic equipment for identifying the position of a slider notch area, which can significantly reduce the amount of calculation, reduce the impact of complex graphics, and improve the recognition speed and accuracy.

[0004] The present invention provides a method for identifying a position of a notch area of ​​a slider, the method comprising:

[0005] Acquire a first image of the slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code;

[0006] Determine a first matrix according to the pixel position and brightness value of each pixel point in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel point at the corresponding position;

[0007] A standard convolution kernel is determined based on the width and height of the predefined slider gap area, and multiple first convolution kernels are selected from the first matrix from left to right and from top to bottom based on the standard convolution kernel, and convolution calculation is performed on each first convolution kernel to obtain a second matrix; wherein the value of each element in the second matrix is ​​the brightness mean square error value corresponding to each first convolution kernel; and the index of each brightness mean square error value is the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square error value;

[0008] The position of the slider gap area is determined based on the index of the brightness mean square difference value with the smallest value in the second matrix.

[0009] Furthermore, the step of obtaining the first image of the slider verification code includes:

[0010] Get the original image of the slider verification code;

[0011] The original image is reduced by a preset multiple to obtain a first image.

[0012] Furthermore, the step of determining the first matrix according to the pixel position and brightness value of each pixel in the first image includes:

[0013] Determine a third matrix according to the pixel position and HSV value of each pixel point in the first image; wherein the value of each element in the third matrix is ​​the HSV value of the pixel point at the corresponding position, and each HSV value includes: hue value, saturation value and lightness value;

[0014] The brightness value in each HSV value in the third matrix is ​​extracted, and the first matrix is ​​determined according to each brightness value.

[0015] Further, a standard convolution kernel is determined based on the width and height of the predefined slider gap area, a plurality of first convolution kernels are selected from left to right and from top to bottom of the first matrix based on the standard convolution kernel, and convolution calculation is performed on each first convolution kernel to obtain the second matrix, the step includes:

[0016] Determine a standard convolution kernel based on a predefined width and height of a slider gap region; wherein the width of the standard convolution kernel is the same as the width of the slider gap region, and the height of the standard convolution kernel is the same as the height of the slider gap region;

[0017] Based on the width and height of the standard convolution kernel, multiple first convolution kernels are selected from the first matrix from left to right and from top to bottom.

[0018] For each first convolution kernel, calculate the average value of all brightness values ​​in the first convolution kernel to obtain the brightness average value corresponding to the convolution kernel;

[0019] Determine a fourth matrix based on the average brightness value corresponding to each first convolution kernel;

[0020] Determine a brightness mean square error value corresponding to each first convolution kernel based on the fourth matrix and all brightness values ​​in each first convolution kernel;

[0021] A second matrix is ​​determined based on the brightness mean square error value corresponding to each first convolution kernel.

[0022] Furthermore, the first convolution kernel is a rectangular area including an upper left corner point, an upper right corner point, a lower left corner point and a lower right corner point; wherein the position of the upper left corner point of each first convolution kernel serves as an index of the brightness average value of the first convolution kernel and an index of the brightness mean square error value of the first convolution kernel.

[0023] Furthermore, the step of determining the position of the slider gap area based on the index of the brightness mean square difference value with the smallest value in the second matrix includes:

[0024] Based on a preset first threshold range, obtaining at least one target brightness average value satisfying the first threshold range from the fourth matrix;

[0025] Obtain a target index of each target brightness average value, and obtain a target brightness mean square error value corresponding to each target index from the second matrix;

[0026] Obtaining a minimum target brightness mean square error value, and magnifying a target index of the minimum target brightness mean square error value by a preset multiple to obtain a first target index;

[0027] Based on the first target index and the width and height of the slider gap area, a position of the slider gap area is obtained.

[0028] The present invention provides a device for identifying the position of a notch area of ​​a slider, the device comprising:

[0029] An acquisition module is used to acquire a first image of the slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code;

[0030] A first determination module is used to determine a first matrix according to the pixel position and brightness value of each pixel point in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel point at the corresponding position;

[0031] A calculation module, used for determining a convolution kernel based on a predefined width and height of a slider gap area, and performing convolution calculations on the first matrix from left to right and from top to bottom based on the convolution kernel to obtain a second matrix; wherein the value of each element in the second matrix is ​​a brightness mean square error value corresponding to each convolution kernel; and the index of each brightness mean square error value is the position of the upper left corner point of the convolution kernel corresponding to the brightness mean square error value;

[0032] The second determination module is used to determine the position of the slider gap area based on the index of the brightness mean square error value with the smallest value in the second matrix.

[0033] Furthermore, the calculation module is also used for:

[0034] Determine a standard convolution kernel based on a predefined width and height of a slider gap region; wherein the width of the standard convolution kernel is the same as the width of the slider gap region, and the height of the standard convolution kernel is the same as the height of the slider gap region;

[0035] Based on the width and height of the standard convolution kernel, multiple convolution kernels are selected from the first matrix from left to right and from top to bottom.

[0036] For each convolution kernel, calculate the average value of all brightness values ​​in the convolution kernel to obtain the average brightness value corresponding to the convolution kernel;

[0037] Determine a fourth matrix based on the average brightness value corresponding to each convolution kernel;

[0038] Based on the fourth matrix and all brightness values ​​in each convolution kernel, determine the brightness mean square error value corresponding to each convolution kernel;

[0039] The second matrix is ​​determined based on the brightness mean square error value corresponding to each convolution kernel.

[0040] An electronic device provided by the present invention is characterized in that it includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement any of the above-mentioned methods for identifying the position of a notch area of ​​a slider.

[0041] The present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement any of the above-mentioned methods for identifying the position of a notch area of ​​a slider.

[0042] The present invention provides a method, device and electronic device for identifying the position of a slider gap area. The method includes determining a first matrix according to the pixel position and brightness value of each pixel point in a first image including the slider gap area; selecting multiple first convolution kernels from left to right and from top to bottom from the first matrix in turn based on a standard convolution kernel determined based on the width and height of the slider gap area defined in advance, and performing convolution calculation on each first convolution kernel to obtain a second matrix; determining the position of the slider gap area based on the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square error value with the smallest value in the second matrix. This method calculates the brightness mean square error of each first convolution kernel in the first image according to the brightness value of the pixel points at each position in the first image, and then identifies the position of the slider gap area, which can greatly reduce the amount of calculation, reduce the impact of complex graphics, and improve the recognition speed and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1A flowchart of a method for identifying a position of a notch area of ​​a slider provided by an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of a first image of a slider notch area including a slider verification code provided by an embodiment of the present invention;

[0046] Figure 3 A flow chart of another method for identifying the position of a notch area of ​​a slider provided by an embodiment of the present invention;

[0047] Figure 4 A schematic diagram of the structure of a device for identifying a position of a notch area of ​​a slider provided by an embodiment of the present invention;

[0048] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The slider verification code is a network security verification code and a behavioral verification code that requires interaction with the user. This type of verification code is widely used in scenarios such as website login, data security verification, and human-machine detection due to its simple operation, good user experience, and strong security performance. At present, in the field of automated testing, it is necessary to automatically identify this type of verification code. Generally, the slider gap area position of the slider verification code is identified through machine learning training models or image recognition algorithms, so as to automatically pass the slider verification code security verification. Specifically, the machine learning algorithm needs to train a large number of images with gap positions marked to obtain a training model, so as to use the training model to identify the slider gap position in the image. The calculation amount of this method is very large, requiring a lot of time and computer resources, resulting in a slow recognition speed; the image recognition algorithm generally performs edge detection on the background image and the slider image, and then finds the part similar to the slider edge in the background image as the position of the slider gap area. The implementation of this method requires obtaining the background image and the slider image at the same time, and performing edge detection on the background image and the slider image. The processing time will be long, and when the graphics are complex, a large amount of redundant data will appear in the edge detection results, resulting in a slow recognition speed and low recognition accuracy.

[0051] Based on this, the embodiments of the present invention provide a method, device and electronic device for identifying the position of a slider notch area. The technology can be applied to applications that need to identify the position of a slider notch area of ​​a slider verification code in a background image.

[0052] To facilitate understanding of this embodiment, a method for identifying the position of a notch area of ​​a slider disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method includes:

[0053] Step S102, obtaining a first image of the slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code.

[0054] The above-mentioned slider verification code is a network security verification code, which is a behavioral verification code that needs to interact with the user. It usually includes two parts: a background image and a slider image (equivalent to the slider area). The above-mentioned first image can be understood as an image obtained only after preprocessing the background image (such as reducing or enlarging the background image by a certain multiple, etc.), wherein the background image includes a slider gap area, so the first image also includes the slider gap area of ​​the slider verification code. Under normal circumstances, the slider gap area is consistent with the size and shape of the slider area. In this embodiment, the above-mentioned slider gap area is generally set to a rectangle.

[0055] In the specific implementation process, in order to identify the position of the slider notch area of ​​the slider verification code, the first image of the slider verification code can be obtained first. Figure 2 , this figure is a first image of a slider gap area including a slider verification code provided in this embodiment. From this figure, it can be seen that there is an obvious color difference between the inner side and the outer side of the edge of the slider gap area.

[0056] Step S104, determining a first matrix according to the pixel position and brightness value of each pixel in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel at the corresponding position.

[0057] The first image is composed of neatly arranged pixels. To clarify the pixel position of each pixel, a coordinate system can be established with the upper left corner of the first image as the origin, the right as the positive direction of the horizontal coordinate, and the downward as the positive direction of the vertical coordinate.

[0058] The above brightness value can represent the color depth of each pixel. The larger the value, the more white the pixel is, and the smaller the value, the more black the pixel is. Usually, the value range of the brightness value is: 0-255.

[0059] In the specific implementation process, the slider gap area in the above-mentioned first image is generally set to gray (a darker color), while other areas are generally set to light gray. Therefore, there is an obvious difference in the brightness value of the slider gap area in the first image and the brightness value of other areas. The difference in brightness can be used to determine the position of the slider gap area later.

[0060] Specifically, assuming that the above-mentioned first image is a picture with a width of 250 pixels and a height of 95 pixels, after the above-mentioned coordinate system is established, the pixel position (equivalent to the coordinate position) of each pixel in the first image and the brightness value of each pixel can be obtained, and the first image can be converted into a first matrix with a size of 250*95. The value of each element in the first matrix can be the brightness value of the pixel at the corresponding position. For example, the value of the first element in the first matrix (that is, the value of both the first row and the first column position in the first matrix) is actually the brightness value of the pixel at the coordinate position (0,0), then the position corresponding to the value of the first element in the first matrix is ​​(0,0).

[0061] Step S106, determine the standard convolution kernel based on the predefined width and height of the slider gap area, select multiple first convolution kernels from the first matrix from left to right and from top to bottom based on the standard convolution kernel, and perform convolution calculation on each first convolution kernel to obtain a second matrix; wherein the value of each element in the second matrix is ​​the brightness mean square error value corresponding to each first convolution kernel; the index of each brightness mean square error value is the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square error value.

[0062] The slider gap area can be predefined as a rectangular area with a width and height of 30, that is, the slider gap area is a picture with a size of 30 pixels * 30 pixels. In actual implementation, a standard convolution kernel with the same size as the slider gap area can be defined according to the width and height of the slider gap area. When the width and height of the slider gap area are both defined as 30, the standard convolution kernel is also a rectangular area with a width and height of 60.

[0063] In the specific implementation process, after the standard convolution kernel is determined (equivalent to knowing the size of the selected area each time), multiple first convolution kernels of the same size as the standard convolution kernel can be selected from the first matrix from left to right and from top to bottom. Specifically, each time a 30*30 rectangular area (equivalent to the above-mentioned first convolution kernel) can be selected from the first matrix in the above-mentioned selection order. Assuming that the first image is a picture with a width of 250 pixels and a height of 95 pixels, the rectangular area (equivalent to the first convolution kernel) obtained by the first selection is The upper left corner is the (0,0) position of the first matrix, the upper right corner is the (30,0) position of the first matrix, the lower left corner is the (0,30) position of the first matrix; the lower right corner is the (30,30) position of the first matrix; when selecting for the second time, the upper left corner of the rectangular area selected in the above selection order is the (1,0) position of the first matrix, the upper right corner is the (31,0) position of the first matrix, the lower left corner is the (1,30) position of the first matrix; the lower right corner is the (31,30) position of the first matrix.

[0064] By analogy, when the 221st selection is made, the upper left corner position of the obtained rectangular area is the (220,0) position of the first matrix, the upper right corner position is the (250,0) position of the first matrix, and the lower left corner is the (220,30) position of the first matrix; the lower right corner is the (250,30) position of the first matrix; when the 222nd selection is made, the upper left corner position of the obtained rectangular area is the (0,1) position of the first matrix, the upper right corner position is the (30,1) position of the first matrix, the lower left corner is the (0,31) position of the first matrix, and the lower right corner is the (30,31) position of the first matrix; and so on, until the upper left corner position of the selected rectangular area is the (220,65) position of the first matrix, the upper right corner position is the (250,65) position of the first matrix, the lower left corner is the (220,95) position of the first matrix, and the lower right corner is the (250,95) position of the first matrix, the selection operation is stopped.

[0065] In actual implementation, each time the first convolution kernel is selected, it is equivalent to taking the brightness value of the 30*30 rectangular area from the first matrix, that is, each selected first convolution kernel includes the brightness value of the 30*30 rectangular area, and the brightness mean square error value of the rectangular area can be calculated through the brightness value of each 30*30 rectangular area, which is equivalent to calculating the brightness mean square error value corresponding to each first convolution kernel; then, the position of the upper left corner point of each 30*30 rectangular area can be used as an index to write each brightness mean square error value into a second matrix of size 221*66, and the value of each element in the second matrix is ​​the brightness mean square error value corresponding to each first convolution kernel (that is, the 30*30 rectangular area), so the index of each brightness mean square error value is the position of the upper left corner point of the 30*30 rectangular area corresponding to the brightness mean square error value.

[0066] Step S108: determining the position of the slider gap area based on the index of the brightness mean square error value with the smallest value in the second matrix.

[0067] In the specific implementation process, the slider gap area may also include four corner points, namely, the upper left corner point, the upper right corner point, the lower right corner point and the lower right corner point. When the index of the brightness mean square error value with the smallest value in the second matrix is ​​obtained, it is equivalent to obtaining the coordinates of the upper left corner point of the slider gap area. According to the coordinates of the upper left corner point of the slider gap area and the pre-defined width and height of the slider gap area, the coordinates of the four corner points of the slider gap area can be obtained, thereby determining the position of the slider gap area.

[0068] The above-mentioned method for identifying the position of the slider gap area includes determining a first matrix based on the pixel position and brightness value of each pixel point in the first image including the slider gap area; selecting multiple first convolution kernels from left to right and from top to bottom from the first matrix in turn based on the standard convolution kernel determined by the width and height of the predefined slider gap area, and performing convolution calculation on each first convolution kernel to obtain a second matrix; determining the position of the slider gap area based on the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square difference value with the smallest value in the second matrix. This method calculates the brightness mean square difference of each first convolution kernel in the first image based on the brightness value of the pixel points at each position in the first image, and then identifies the position of the slider gap area, which can greatly reduce the amount of calculation, reduce the impact of complex graphics, and improve the recognition speed and accuracy.

[0069] The embodiment of the present invention further provides another method for identifying the position of a notch area of ​​a slider, which is implemented on the basis of the method of the above embodiment; Figure 3 As shown, the method comprises the following steps:

[0070] Step S202, obtaining the original image of the slider verification code.

[0071] Step S204, reducing the original image by a preset multiple to obtain a first image.

[0072] The above original image may be stored in the server in advance.

[0073] The above preset multiples can also be determined according to actual needs, for example, it can be 2 times, 3 times, etc.

[0074] In the specific implementation process, in order to identify the position of the slider gap area of ​​the slider verification code, the original image of the slider verification code can be first obtained from the server. The original image contains the original slider gap area. Specifically, the size of the original image (original picture) and the original slider gap area can be determined according to actual needs. The slider gap area in the original image is generally a rectangle.

[0075] In actual implementation, image scaling has no effect on the actual result. The original image of the slider verification code can be proportionally reduced to 1 / 2 of the original image (that is, the original image is reduced by 2 times). In this embodiment, if the size of the original image is 500 pixels * 190 pixels, the size of the slider gap area in the original image is 60 pixels * 60 pixels. When the original image is reduced to 1 / 2 of the original image, the size of the original image becomes 250 pixels * 95 pixels, and the size of the slider gap area in the original image becomes 30 pixels * 30 pixels, and the first image is obtained. The number of pixels in the first image is reduced, which is 1 / 4 less than the number of pixels in the original image (that is, the number of pixels in the first image is 1 / 4 of the original image). Therefore, in the subsequent calculation process, the reduction in the number of pixels can reduce the amount of calculation, greatly improve the calculation speed, and thus improve the recognition speed.

[0076] Step S206, determining a third matrix according to the pixel position and HSV value of each pixel in the first image; wherein the value of each element in the third matrix is ​​the HSV value of the pixel at the corresponding position, and each HSV value includes: hue value, saturation value and lightness value.

[0077] Every picture is made up of neatly arranged pixels, and each pixel is made up of the three primary colors RGB (red, green, and blue). RGB (red, green, and blue) is a form of image data representation. In addition to RGB (red, green, and blue), there is also the HSV form, H: hue, S: saturation, V: brightness. The RGB value of each pixel can be losslessly converted into the corresponding HSV value.

[0078] In the specific implementation process, the color value of each pixel in the first image (equivalent to RGB value, including R value, G value and B value) can be converted into HSV value corresponding to each pixel; then the first image can be opened in HSV format, and the above HSV value can be converted into a 3D array [H, S, V]. Then, the pixel position of each pixel in the first image can be obtained through a pre-established coordinate system, and a third matrix is ​​determined according to the pixel position of each pixel and the [H, S, V] of each pixel. Each element value in the third matrix is ​​the [H, S, V] (that is, the HSV value) of the pixel at the corresponding position.

[0079] Specifically, assuming that the original image is reduced by a preset multiple to obtain a first image with a size of 250 pixels * 95 pixels, the first image can be converted into a third matrix with a size of 250 * 95 in the form of HSV values, and the value of each element in the third matrix is ​​[H, S, V] of the pixel at the corresponding position, where H is the hue value of the pixel at the corresponding position, S is the saturation value of the pixel at the corresponding position, and V is the brightness value of the pixel at the corresponding position.

[0080] Step S208, extracting the brightness value in each HSV value in the third matrix, and determining the first matrix according to each brightness value.

[0081] In the specific implementation process, it can be found that the slider gap area in the first image is darker in color, darker than other areas (non-slider gap areas), so there is a large difference in the brightness value of the slider gap area and the brightness value of the non-slider gap area in the first image. Therefore, for each [H, S, V] value in the third matrix, only the brightness value in the [H, S, V] three-dimensional array can be extracted to obtain a new matrix, that is, the first matrix, and the value of each element in the first matrix is ​​the brightness value of the corresponding position.

[0082] Since the value of each element in the first matrix has only one parameter value, namely the brightness value, and the value of each element in the third matrix has three parameter values ​​(actually a three-dimensional array), including hue value, saturation value and brightness value; therefore, the first matrix reduces the amount of data by 1 / 3 compared with the third matrix, which can reduce the amount of subsequent calculation of the average brightness value and the mean square error of the flatness, greatly improving the calculation speed, thereby improving the recognition speed.

[0083] Step S210, determining a standard convolution kernel based on the predefined width and height of the slider gap area; wherein the width of the standard convolution kernel is the same as the width of the slider gap area, and the height of the standard convolution kernel is the same as the height of the slider gap area.

[0084] The width and height of the slider gap area can be obtained according to the width and height of the original slider gap area in the original image and a preset reduction multiple.

[0085] In the specific implementation process, a standard convolution kernel can be defined according to the width and height of the slider gap area. The size of the standard convolution kernel is the same as the size of the slider gap area, that is, the width of the standard convolution kernel is the same as the width of the slider gap area, and the height of the standard convolution kernel is also the same as the height of the slider gap area.

[0086] Step S212: Based on the width and height of the standard convolution kernel, multiple first convolution kernels are selected from the first matrix from left to right and from top to bottom.

[0087] In the specific implementation process, assuming that the width and height of the slider gap area are both 30, and the size of the slider gap area is 30*30, then the size of the standard convolution kernel is also 30*30; therefore, the size of the slider gap area 30*30 can be used as the size of the standard convolution kernel, and a 30*30 image is intercepted from left to right and from top to bottom in the background image as the first convolution kernel.

[0088] Step S214: for each first convolution kernel, calculate the average value of all brightness values ​​in the first convolution kernel to obtain the brightness average value corresponding to the convolution kernel.

[0089] In the specific implementation process, after intercepting multiple 30*30 images (equivalent to the first convolution kernel), the mean square error and the average value of the brightness in each 30*30 image can be calculated. The mean square error can reflect the intensity of the change of the brightness within the interception range (the brightness of the intercepted 30*30 image), and the average value can reflect the brightness within the interception range.

[0090] Step S216: determine a fourth matrix based on the average brightness value corresponding to each first convolution kernel.

[0091] In the specific implementation process, a fourth matrix can be defined to store the average value obtained by convolution calculation of each first convolution kernel intercepted from the first matrix, and a second matrix can also be defined to store the mean square error obtained by convolution calculation of each first convolution kernel intercepted from the first matrix.

[0092] Specifically, when each 30*30 image is intercepted from the first matrix, it is equivalent to obtaining the data of each 30*30 rectangular area from the first matrix (including the brightness value of each pixel in the 30*30 rectangular area). For the data of each 30*30 rectangular area, the average brightness value in the area can be calculated. Specifically, the brightness value of each pixel in the area can be summed to obtain the sum result, and then divided by the total number of pixels in the area to obtain the average brightness value in the area, thereby calculating the brightness average corresponding to each first convolution kernel.

[0093] In actual implementation, the first convolution is a rectangular area including the upper left corner, the upper right corner, the lower left corner and the lower right corner; after calculating the average brightness value corresponding to each 30*30 rectangular area, the pixel position (coordinate position) of the pixel point where the upper left corner of each rectangular area is located can be used as an index, and the brightness average calculated for the corresponding rectangular area can be used as a value and written into the fourth matrix, which is equivalent to establishing a mapping relationship between the pixel position of the pixel point where the upper left corner of each rectangular area is located and the brightness average of the corresponding rectangular area, where the fourth matrix records the average brightness value of each pixel point in each 30*30 range intercepted from the first matrix.

[0094] Specifically, assuming that the size of the rectangular area (the first convolution kernel) is 30*30, if the pixel position of the pixel where the upper left corner of the rectangular area is located is (0,0), (0,0) can be used as the index to write the average brightness of the rectangular area when the pixel position of the upper left corner is (0,0) and the pixel position of the pixel where the lower right corner is located is (30,30) into the fourth matrix as an element value in the fourth matrix.

[0095] Step S218: Determine the brightness mean square error value corresponding to each first convolution kernel based on the fourth matrix and all brightness values ​​in each first convolution kernel.

[0096] In the specific implementation process, after the fourth matrix is ​​determined by the above step S216, the brightness mean square error value of the brightness value in each 30*30 rectangular area obtained from the first matrix can be calculated. Specifically, the data of each 30*30 rectangular area can be understood as the brightness value of each pixel in the 30*30 rectangular area. After the average brightness value of the rectangular area is obtained, the brightness mean square error value corresponding to the rectangular area can be calculated based on the brightness mean value and the brightness value of each pixel in the rectangular area. Similarly, the brightness mean square error value corresponding to each first convolution kernel can be calculated.

[0097] Step S220: Determine a second matrix based on the brightness mean square error value corresponding to each first convolution kernel.

[0098] In the specific implementation process, after calculating the brightness mean square error value corresponding to each 30*30 rectangular area, the pixel position of the pixel point where the upper left corner point of each rectangular area is located can still be used as the index, and the brightness mean square error value calculated for the corresponding rectangular area can be used as the value and written into the second matrix, which is equivalent to establishing a mapping relationship between the pixel position of the pixel point where the upper left corner point of each rectangular area is located and the mean square error value of the corresponding rectangular area, wherein the fourth matrix records the brightness mean square error value of the brightness values ​​of all pixel points within each 30*30 range intercepted from the first matrix.

[0099] Step S222: based on a preset first threshold range, obtaining at least one target brightness average value satisfying the first threshold range from the fourth matrix.

[0100] The above brightness mean square error value can reflect the intensity of brightness change in the corresponding first convolution kernel. Usually, the brightness values ​​of all pixels in the slider gap area change to a small extent, and the numerical value of each brightness value is relatively constant. In the specific implementation process, the value range of the brightness average value (equivalent to the first threshold range) can be pre-defined. Taking the first threshold range of (50, 110) as an example, when the first threshold range is (50, 110), data whose values ​​are not within the predetermined first threshold range (areas that are too bright or too dark in the first image) can be filtered out from the fourth matrix, and values ​​within the range of 50<brightness average value<110 are retained, that is, brightness average values ​​greater than 110 and brightness average values ​​less than 50 are filtered out, and brightness average values ​​greater than 50 and less than 100 are retained as brightness average values ​​that meet the above first threshold range.

[0101] Step S224, obtaining the target index of each target brightness average value, and obtaining the target brightness mean square error value corresponding to each target index from the second matrix.

[0102] Step S226, obtaining the minimum target brightness mean square error value, and magnifying the target index of the minimum target brightness mean square error value by a preset multiple to obtain a first target index.

[0103] In the specific implementation process, after obtaining the target brightness average value that meets the preset first threshold range, the target index of each target brightness average value can be obtained according to the mapping relationship, and then the target brightness mean square error value corresponding to each target index can be obtained from the second matrix. When the numerical value of each brightness value is relatively constant, the rectangular area with the smallest brightness value change can usually be identified as the slider gap area. Therefore, the brightness mean square error value with the smallest numerical value can be selected from the obtained target brightness average values; the target index corresponding to this minimum brightness mean square error value is magnified by a preset multiple to obtain a first target index, and the first target index corresponds to the coordinate position of the upper left corner point of the original slider gap area to be identified in the original image.

[0104] It should be noted that the preset magnification factor is determined according to the preset reduction factor and is generally considered to be equal. For example, if the original image is reduced by 2 times to obtain the first image, the target index of the minimum target brightness mean square error value should also be magnified by 2 times to obtain the first target index.

[0105] Step S228, obtaining the position of the slider notch area based on the first target index and the width and height of the slider notch area.

[0106] In the specific implementation process, the height and width of the slider notch area are determined, so after determining the upper left corner point of the slider notch area, the position of the slider notch area can be determined. Specifically, since the width and height of the slider notch area are known, the coordinates of the upper left corner point of the slider notch area are added to the width and height of the slider notch area to obtain the coordinates of the other three corner points of the slider notch area, and obtain the position of the slider notch area.

[0107] In addition, when verifying the slider verification code, the user generally needs to drag the slider area to overlap with the slider gap area in the background image to complete the security authentication process. If the slider area is parallel to the position of the slider missing area, and the horizontal coordinates of the upper left corner point and the lower left corner point of the slider area are both 0, then, after determining the upper left corner point of the original slider gap area, the horizontal coordinate of the upper left corner point of the original slider missing area can be used as the distance between the upper left corner point of the slider area and the upper left corner point of the original slider gap area, that is, the sliding distance. Then, the mouse can be controlled or a simulated gesture can be used to drag the slider area to move the above sliding distance to the original slider gap area to complete the verification of the slider verification code.

[0108] The above-mentioned method for identifying the position of the slider gap area calculates the average brightness value of each pixel point in each first convolution kernel in the first image, and the brightness mean square error value to finally determine the position of the upper left corner point of the slider gap area, and then finally determines the position of the slider gap area. It utilizes image pixels and uses a segmented calculation method to calculate the brightness average value and the brightness mean square error. It does not need to be identified through a deep learning model or edge detection, thereby reducing the amount of recognition calculations and improving the recognition speed and recognition accuracy.

[0109] Furthermore, the above-mentioned method for identifying the position of the slider gap area also reduces the background image proportionally before calculation, then performs calculation, and finally enlarges the calculation result to a multiple before reduction. This greatly reduces the amount of calculation and improves the recognition speed without affecting the result.

[0110] Furthermore, in the prior art, edge detection technology is often used for recognition. When there are many graphic elements in the picture and the graphics are complex, a large amount of redundant data will appear in the edge detection results, resulting in a low success rate. The position recognition method of the slider gap area proposed in this application recognizes by calculating the mean square error of the pixels of each first convolution kernel (equivalent to the target area), which greatly reduces the impact of complex graphics and thus improves the recognition accuracy.

[0111] Furthermore, in the existing technical solutions, the edge detection technology is used, and it is necessary to simultaneously obtain the background image and the slider image for identifying the slider verification code, and calculate the two images to obtain the slider sliding distance. The present invention only needs the background image of the slider verification code to calculate the slider sliding distance, and the source consumption is low, which avoids the disadvantage of the conventional recognition method that requires the background image and the slider image to be calculated simultaneously.

[0112] The embodiment of the present invention also provides a device for identifying the position of a notch area of ​​a slider, such as Figure 4 As shown, the device includes: an acquisition module 40, which is used to acquire a first image of a slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code; a first determination module 41, which is used to determine a first matrix according to the pixel position and brightness value of each pixel point in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel point at the corresponding position; a calculation module 42, which is used to determine a convolution kernel based on a predefined width and height of the slider gap area, and perform convolution calculation on the first matrix from left to right and from top to bottom based on the convolution kernel to obtain a second matrix; wherein the value of each element in the second matrix is ​​a brightness mean square difference value corresponding to each convolution kernel; the index of each brightness mean square difference value is the position of the upper left corner point of the convolution kernel corresponding to the brightness mean square difference value; a second determination module 43, which is used to determine the position of the slider gap area based on the index of the brightness mean square difference value with the smallest value in the second matrix.

[0113] The above-mentioned device for identifying the position of the slider gap area includes determining a first matrix according to the pixel position and brightness value of each pixel point in the first image including the slider gap area; selecting multiple first convolution kernels from left to right and from top to bottom from the first matrix in turn based on the standard convolution kernel determined by the width and height of the predefined slider gap area, and performing convolution calculation on each first convolution kernel to obtain a second matrix; determining the position of the slider gap area based on the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square difference value with the smallest value in the second matrix. The device calculates the brightness mean square difference of each first convolution kernel in the first image according to the standard convolution kernel and the brightness value of the pixel points at each position in the first image, and then identifies the position of the slider gap area, which can greatly reduce the amount of calculation, reduce the impact of complex graphics, and improve the recognition speed and accuracy.

[0114] Furthermore, the acquisition module is also used to:

[0115] Get the original image of the slider verification code;

[0116] The original image is reduced by a preset multiple to obtain a first image.

[0117] Furthermore, the first determining module is further used for:

[0118] Determine a third matrix according to the pixel position and HSV value of each pixel point in the first image; wherein the value of each element in the third matrix is ​​the HSV value of the pixel point at the corresponding position, and each HSV value includes: hue value, saturation value and lightness value;

[0119] The brightness value in each HSV value in the third matrix is ​​extracted, and the first matrix is ​​determined according to each brightness value.

[0120] Furthermore, the calculation module is also used for:

[0121] Determine a standard convolution kernel based on a predefined width and height of a slider gap region; wherein the width of the standard convolution kernel is the same as the width of the slider gap region, and the height of the standard convolution kernel is the same as the height of the slider gap region;

[0122] Based on the width and height of the standard convolution kernel, multiple first convolution kernels are selected from the first matrix from left to right and from top to bottom.

[0123] For each first convolution kernel, calculate the average value of all brightness values ​​in the first convolution kernel to obtain the brightness average value corresponding to the convolution kernel;

[0124] Determine a fourth matrix based on the average brightness value corresponding to each first convolution kernel;

[0125] Determine a brightness mean square error value corresponding to each first convolution kernel based on the fourth matrix and all brightness values ​​in each first convolution kernel;

[0126] A second matrix is ​​determined based on the brightness mean square error value corresponding to each first convolution kernel.

[0127] Furthermore, the first convolution kernel is a rectangular area including an upper left corner point, an upper right corner point, a lower left corner point and a lower right corner point; wherein the position of the upper left corner point of each first convolution kernel serves as an index of the brightness average value of the first convolution kernel and an index of the brightness mean square error value of the first convolution kernel.

[0128] Furthermore, the second determining module is also used for:

[0129] Based on a preset first threshold range, obtaining at least one target brightness average value satisfying the first threshold range from the fourth matrix;

[0130] Obtain a target index of each target brightness average value, and obtain a target brightness mean square error value corresponding to each target index from the second matrix;

[0131] Obtaining a minimum target brightness mean square error value, and magnifying a target index of the minimum target brightness mean square error value by a preset multiple to obtain a first target index;

[0132] Based on the first target index and the width and height of the slider gap area, a position of the slider gap area is obtained.

[0133] The device for identifying the position of a slider notch area provided in an embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned embodiment of the method for identifying the position of a slider notch area. For the embodiment of the device for identifying the position of a slider notch area, reference may be made to the corresponding contents of the aforementioned embodiment of the method for identifying the position of a slider notch area.

[0134] The embodiment of the present invention further provides an electronic device, see Figure 5 As shown, the electronic device includes a processor 130 and a memory 131 . The memory 131 stores machine executable instructions that can be executed by the processor 130 . The processor 130 executes the machine executable instructions to implement the above-mentioned method for identifying the position of the notch area of ​​the slider.

[0135] Further, Figure 5 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .

[0136] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0137] The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.

[0138] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned slider notch area position identification method. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0139] The method, device and electronic device for identifying the position of the notch area of ​​the slider provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.

[0140] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying the position of a slider notch area, characterized in that: The method comprises: Acquire a first image of a slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code; Determine a first matrix according to the pixel position and brightness value of each pixel point in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel point at the corresponding position; A standard convolution kernel is determined based on the width and height of the predefined slider gap area, and multiple first convolution kernels are selected from the first matrix from left to right and from top to bottom based on the standard convolution kernel, and convolution calculation is performed on each of the first convolution kernels to obtain a second matrix; wherein the value of each element in the second matrix is ​​the brightness mean square error value corresponding to each of the first convolution kernels; and the index of each of the brightness mean square error value is the position of the upper left corner point of the first convolution kernel corresponding to the brightness mean square error value; The position of the slider gap area is determined based on the index of the brightness mean square error value with the smallest value in the second matrix.

2. The method according to claim 1, characterized in that The steps of obtaining the first image of the slider verification code include: Get the original image of the slider verification code; The original image is reduced by a preset multiple to obtain the first image.

3. The method according to claim 2, characterized in that The step of determining a first matrix according to the pixel position and brightness value of each pixel in the first image comprises: Determine a third matrix according to the pixel position and HSV value of each pixel point in the first image; wherein the value of each element in the third matrix is ​​the HSV value of the pixel point at the corresponding position, and each HSV value includes: hue value, saturation value and lightness value; A brightness value in each HSV value in the third matrix is ​​extracted, and a first matrix is ​​determined according to each of the brightness values.

4. The method according to claim 1, characterized in that: The step of determining a standard convolution kernel based on the width and height of the predefined slider gap area, selecting a plurality of first convolution kernels from left to right and from top to bottom of the first matrix based on the standard convolution kernel, and performing convolution calculation on each of the first convolution kernels to obtain the second matrix includes: Determining a standard convolution kernel based on a predefined width and height of the slider notch area; wherein the width of the standard convolution kernel is the same as the width of the slider notch area, and the height of the standard convolution kernel is the same as the height of the slider notch area; Based on the width and height of the standard convolution kernel, select a plurality of first convolution kernels from the first matrix from left to right and from top to bottom; For each of the first convolution kernels, calculating the average value of all brightness values ​​in the first convolution kernel to obtain the brightness average value corresponding to the convolution kernel; Determine a fourth matrix based on the brightness average value corresponding to each first convolution kernel; Based on the fourth matrix and all brightness values ​​in each first convolution kernel, determine a brightness mean square error value corresponding to each first convolution kernel; A second matrix is ​​determined based on the brightness mean square error value corresponding to each first convolution kernel.

5. The method according to claim 4, characterized in that The first convolution kernel is a rectangular area including an upper left corner point, an upper right corner point, a lower left corner point and a lower right corner point; wherein the position of the upper left corner point of each first convolution kernel serves as an index of the brightness average value of the first convolution kernel and an index of the brightness mean square error value of the first convolution kernel.

6. The method according to claim 5, characterized in that The step of determining the position of the slider gap area based on the index of the brightness mean square difference value with the smallest value in the second matrix comprises: Based on a preset first threshold range, obtaining at least one target brightness average value satisfying the first threshold range from the fourth matrix; Obtaining a target index of each target brightness average value, and obtaining a target brightness mean square error value corresponding to each target index from the second matrix; Obtaining a minimum target brightness mean square error value, and amplifying a target index of the minimum target brightness mean square error value by a preset multiple to obtain a first target index; The position of the slider notch area is obtained based on the first target index and the width and height of the slider notch area.

7. A device for identifying the position of a notch area of ​​a slider, characterized in that: The device comprises: An acquisition module, used to acquire a first image of a slider verification code; wherein the first image includes a slider gap area of ​​the slider verification code; A first determination module, configured to determine a first matrix according to the pixel position and brightness value of each pixel point in the first image; wherein the value of each element in the first matrix is ​​the brightness value of the pixel point at the corresponding position; A calculation module, configured to determine a convolution kernel based on a predefined width and height of a slider gap area, and perform convolution calculations on the first matrix from left to right and from top to bottom based on the convolution kernel to obtain a second matrix; wherein the value of each element in the second matrix is ​​a brightness mean square error value corresponding to each of the convolution kernels; and the index of each of the brightness mean square error values ​​is the position of the upper left corner point of the convolution kernel corresponding to the brightness mean square error value; The second determination module is used to determine the position of the slider gap area based on the index of the brightness mean square error value with the smallest value in the second matrix.

8. The device according to claim 7, characterized in that The calculation module is also used for: Determining a standard convolution kernel based on a predefined width and height of the slider notch area; wherein the width of the standard convolution kernel is the same as the width of the slider notch area, and the height of the standard convolution kernel is the same as the height of the slider notch area; Based on the width and height of the standard convolution kernel, select multiple convolution kernels from the first matrix from left to right and from top to bottom; For each of the convolution kernels, calculating the average value of all brightness values ​​in the convolution kernel to obtain the brightness average value corresponding to the convolution kernel; Determine a fourth matrix based on the brightness average value corresponding to each convolution kernel; Based on the fourth matrix and all brightness values ​​in each convolution kernel, determine a brightness mean square error value corresponding to each convolution kernel; A second matrix is ​​determined based on the brightness mean square error value corresponding to each convolution kernel.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for identifying the position of the notch area of ​​the slider according to any one of claims 1 to 6.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the method for identifying the position of the notch area of ​​the slider according to any one of claims 1 to 6.