A control identification method and device

By adding an extended area and binarization processing to the poster image, the control rounded edges in the poster image are identified, which solves the problem of large recognition errors in the existing technology and improves the accuracy of control rounded corner recognition.

CN112529923BActive Publication Date: 2024-09-03BEIJING IQIYI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011477741.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-15
Publication Date
2024-09-03
Estimated Expiration
2040-12-15

AI Technical Summary

Technical Problem

The existing technology is prone to false edges and noise interference when identifying the rounded corners and radii of controls in poster images, resulting in large recognition errors. Especially when the content of the poster image has multiple edges, it is difficult to accurately determine the position of the rounded corners of the controls.

Method used

By adding an extension area outside the target control area of ​​the poster image, taking advantage of the high color consistency of the extension area, the starting point is selected to fill the poster area and the extension area, the mask data is generated, and the image vertices are processed and intercepted through binarization The target image at the location determines the fillet edge point of the control, and then calculates the fillet radius.

Benefits of technology

The accuracy of the rounded corner recognition of poster control is improved, the recognition error is reduced, and the accuracy of the rounded corner and radius of poster control is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112529923B
    Figure CN112529923B
Patent Text Reader

Abstract

The embodiment of the present invention provides a control identification method and device, which relates to the field of computer technology. The method locates the position of the target control in the poster area corresponding to the poster image, determines the extended area of ​​the target control according to preset rules; determines the starting point in the extended area, and fills the poster area and the extended area corresponding to the target control according to the starting point to determine the mask data; binarizes the mask data to generate a corresponding binary image; intercepts the target image containing the vertices of the binary image; determines the multiple pixel points corresponding to the rounded edge based on the target image; determines the rounded radius corresponding to the rounded edge of the target control based on the multiple pixel points. The invention solves the technical problem that the rounded edge and radius are determined by edge detection or edge contour determination, resulting in the inability to identify the rounded corner and radius of the control corresponding to the poster image or large identification error, and improves the rounded corner recognition accuracy of the target control corresponding to the poster image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a control identification method and device. Background Art

[0002] With the development of technology, the industry has begun to research the direct conversion of design drafts into code. Design drafts usually include control rounding, so it is necessary to effectively identify the control rounding and corner radius.

[0003] At present, in the prior art, edge detection (Edge-Detection) based on the Canny algorithm is usually used to obtain the edge information corresponding to the control to calculate the fillet radius of the control. In addition, there is also a method of obtaining the fillet radius of the control by determining the outline of the design draft and then fitting the circle. However, Canny edge detection may cause false edges, and its noise reduction may also cause pixel errors. When the design draft is a poster image, there are also many edges in the content corresponding to the poster image, which will confuse the edges of the poster image. Among them, determining the outline of the poster image often faces interference and noise brought by the poster image, so that the edge position of the poster cannot be determined. As a result, the fillet and radius of the control corresponding to the poster image cannot be recognized, or the recognition error is large. Summary of the invention

[0004] The purpose of the embodiment of the present invention is to provide a control recognition method and device to improve the accuracy of identifying the rounded corners of controls corresponding to a poster image. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a control identification method is provided, which is applied to a poster image processing process. The method comprises:

[0006] Locate the position of the target control in the poster area corresponding to the poster image, and determine the extended area of ​​the target control according to a preset rule, wherein the extended area surrounds the poster area;

[0007] Determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data;

[0008] Binarizing the mask data to generate a corresponding binary image;

[0009] intercepting a target image including vertices of the binary image, wherein the target image at least includes a rounded edge of the target control;

[0010] Determine, according to the target image, a plurality of pixel points corresponding to the rounded edge;

[0011] The fillet radius corresponding to the fillet edge of the target control is determined according to the multiple pixel points.

[0012] Optionally, determining a starting point in the extended area, and filling the poster area and the extended area according to the starting point to determine mask data includes:

[0013] Taking the vertex of the extended area as a starting point;

[0014] Determine the interest pixel points of the starting point in the poster area and the extended area, and determine mask data according to the interest pixel points.

[0015] Optionally, determining the interest pixel points of the starting point in the poster area and the extended area, and determining mask data according to the interest pixel points, includes:

[0016] Taking the starting point as a reference point, determining adjacent pixel points of the reference point in the poster area and the extended area, and judging whether the adjacent pixel points are interest pixels of the reference point;

[0017] In the case where the adjacent pixel point is an interest pixel point, taking the adjacent pixel point as a reference point, and continuing to determine the interest pixel point of the reference point;

[0018] The interest pixel is determined as a first mask value, and the pixel points other than the interest pixel in the poster area and the extended area are determined as second mask values ​​to obtain the mask data.

[0019] Optionally, the determining whether the adjacent pixel point is an interest pixel point of the reference point includes:

[0020] Determine the difference between the pixel value of the reference point and the pixel value of the adjacent pixel point;

[0021] If the difference does not exceed a preset threshold, the adjacent pixel point is determined to be a pixel of interest of the reference point.

[0022] Optionally, determining, based on the target image, a plurality of pixel points corresponding to the rounded edge includes:

[0023] Determine position information of pixel points at the end of each row in the target image except for the pixel points of interest to form a first set;

[0024] Acquire position information of pixel points at the end of each column in the target image except the pixel points of interest to form a second set;

[0025] According to the intersection of the first set and the second set, a plurality of interest pixels corresponding to the rounded edge are obtained.

[0026] Optionally, determining a fillet radius corresponding to a fillet edge of the target control according to the plurality of pixel points includes:

[0027] Determine the number of a plurality of interest pixels corresponding to the rounded edge;

[0028] If the number of the interest pixels is not greater than a preset limit value, the fillet radius corresponding to the fillet edge of the target control is matched through a mapping table;

[0029] If the number of pixels is greater than a limit value, the fillet radius corresponding to the fillet edge of the target control is determined according to the least squares method.

[0030] Optionally, the method further includes:

[0031] The fillet radius is corrected, and the fillet radius is updated after the correction.

[0032] Optionally, the method further includes:

[0033] According to the binary image, determining the number of pixels in each row and each column in the poster area and the extended area other than the pixels of interest;

[0034] If the number of pixels other than the pixel of interest is less than a preset number, the pixel values ​​of all pixels in the corresponding row or column are replaced with the pixel values ​​corresponding to the pixel of interest, and the binary image is updated.

[0035] Optionally, intercepting the target image containing the vertices of the binary image includes:

[0036] Detecting the number of pixels corresponding to the rows and columns of the binary image to determine shape information of the binary image;

[0037] Determine, according to the shape information, a cut-off area containing vertices in the binary image;

[0038] The binary image is intercepted according to the interception area to obtain a corresponding target image.

[0039] In a second aspect of the present invention, a control identification device is provided, the device comprising:

[0040] A control positioning module, used to locate the position of a target control in the poster area corresponding to the poster image, and determine an extended area of ​​the target control according to a preset rule, wherein the extended area surrounds the poster area;

[0041] A mask determination module, used to determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data;

[0042] A binarization processing module, used for performing binarization processing on the mask data to generate a corresponding binarized image;

[0043] An image capture module, used to capture a target image containing vertices of the binary image, wherein the target image at least includes a rounded edge of the target control;

[0044] A pixel point determination module, used to determine a plurality of pixel points corresponding to the rounded edge according to the target image;

[0045] The data calculation module is used to determine the fillet radius corresponding to the fillet edge of the target control based on the multiple pixel points.

[0046] Optionally, the mask determination module includes:

[0047] A starting point determination submodule, used for taking the vertex of the extension area as the starting point;

[0048] The mask data generating submodule is used to determine the interest pixel points of the starting point in the poster area and the extended area, and determine the mask data according to the interest pixel points.

[0049] Optionally, the mask data generation submodule includes:

[0050] An interest pixel determination unit, configured to use the starting point as a reference point, determine adjacent pixels of the reference point in the poster area and the extended area, and determine whether the adjacent pixels are interest pixels of the reference point;

[0051] In the case where the adjacent pixel point is an interest pixel point, taking the adjacent pixel point as a reference point, and continuing to determine the interest pixel point of the reference point;

[0052] The mask data generating unit is used to determine the interest pixel as a first mask value, and determine the pixel points other than the interest pixel in the poster area and the extended area as a second mask value, so as to obtain the mask data.

[0053] Optionally, the interest pixel determination unit is further used to:

[0054] Determine the difference between the pixel value of the reference point and the pixel value of the adjacent pixel point;

[0055] If the difference does not exceed a preset threshold, the adjacent pixel point is determined to be a pixel of interest of the reference point.

[0056] Optionally, the pixel point determination module includes:

[0057] A first position submodule, used to determine the position information of the pixel points at the end of each row in the target image except the pixel points of interest, to form a first set;

[0058] A second position submodule is used to obtain position information of pixel points at the end of each column in the target image except the pixel points of interest to form a second set;

[0059] The pixel point acquisition submodule is used to obtain a plurality of interest pixels corresponding to the rounded edge according to the intersection of the first set and the second set.

[0060] Optionally, the data calculation module includes:

[0061] A number calculation module, used to determine the number of multiple interest pixels corresponding to the rounded edge;

[0062] A radius calculation module, used for matching the fillet radius corresponding to the fillet edge of the target control through a mapping table if the number of the interest pixels is not greater than a preset limit value;

[0063] If the number of pixels is greater than a limit value, the fillet radius corresponding to the fillet edge of the target control is determined according to the least squares method.

[0064] Optionally, the device further comprises:

[0065] The radius correction module is used to correct the fillet radius and update the fillet radius after correction.

[0066] Optionally, the device further comprises:

[0067] A first calculation module is used to determine the number of pixels in each row and each column in the poster area and the extended area other than the pixels of interest according to the binary image;

[0068] The second calculation module is used to replace the pixel values ​​of all the pixels in the corresponding row or column with the pixel values ​​corresponding to the pixel of interest if the number of the pixels other than the pixel of interest is less than a preset number, so as to update the binary image.

[0069] Optionally, the image capture module includes:

[0070] An image detection submodule, used to detect the number of pixels corresponding to the rows and columns of the binary image, and determine the shape information of the binary image;

[0071] A clipping region determination submodule, used to determine a clipping region containing vertices in the binary image according to the shape information;

[0072] The target image acquisition submodule is used to intercept the binary image according to the interception area to obtain the corresponding target image.

[0073] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any of the control identification methods described above.

[0074] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned control identification methods.

[0075] The present invention provides a control recognition method and device, which locates the position of the target control, adds an extended area outside the poster area corresponding to the target control, and uses the high color consistency of the extended area to select a starting point in the extended area, fill the poster area and the extended area according to the starting point, and form mask data that characterizes the edge structure characteristics corresponding to the target control. Subsequently, the mask data is converted into a binary image, and the edge contour of the target control can be highlighted. By intercepting a target image including a rounded edge of the target control at the vertex of the binary image, the target image can be used to detect the pixel coordinates and pixel values ​​in the target image to determine multiple pixel points corresponding to the rounded edge, and then determine the rounded radius corresponding to the rounded edge based on the relevant information of the multiple pixel points. The invention can solve the technical problem that the rounded edge and radius of the control corresponding to the poster image cannot be identified or the identification error is large due to the determination of the rounded edge and radius by edge detection or determination of the edge contour, and thus can improve the accuracy of identifying the rounded corners of the control corresponding to the poster image. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0077] Figure 1 A flowchart of a control identification method provided in an embodiment of the present invention;

[0078] Figure 2 A flowchart of another control identification method provided in an embodiment of the present invention;

[0079] Figure 3 A flowchart of a method for determining mask data provided in an embodiment of the present invention;

[0080] Figure 4 A flowchart of a method for determining a fillet radius provided in an embodiment of the present invention;

[0081] Figure 5 A block diagram of a control identification device provided in an embodiment of the present invention;

[0082] Figure 6 The present invention is an architecture diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0083] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0084] Reference Figure 1 , shows a control identification method, which is applied in the poster image processing process, and the method may include:

[0085] Step 101: locate the position of a target control in the poster area corresponding to the poster image, and determine an extended area of ​​the target control according to a preset rule.

[0086] The extended area surrounds the poster area.

[0087] In the embodiment of the present invention, the design of rounded corners for the vertices based on the poster image has become a standard configuration. Therefore, the target control can be understood as an operable unit for making the vertices of the poster image rounded when designing the poster image. For example, the target control can be a rectangular box with rounded corners. In the process of drawing the poster image, the border of the corresponding poster image can be formed by inserting the target control. The area contained in the target control corresponding to the poster image can be determined as the poster area. In the subsequent poster image processing process, the extended area can be determined by locating the position of the target control, thereby forming an enclosure for the poster area.

[0088] Specifically, the background color of the poster image is stable and consistent, and the background area of ​​the poster image is selected to assist in the rounded corner recognition of the target control. For example, after locating the position of the target control based on edge detection and other methods, an extended area is added outside the poster area corresponding to the target control according to preset rules, wherein the extended area surrounds the poster area.

[0089] In one example, determining the extended area of ​​the target control according to preset rules may specifically include: after detecting the edge position corresponding to the target control, expanding the edge position outward by N pixels, for example, 5 pixels, etc., thereby determining the extended area corresponding to the target control.

[0090] Specifically, since the background color of the extended area is highly consistent, it is possible to avoid directly identifying the target control through edge detection or contour detection of the poster image, which is beneficial to improving the recognition accuracy of the rounded corners corresponding to the target control.

[0091] Step 102: determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data.

[0092] In an embodiment of the present invention, the position information and pixel value corresponding to any pixel in the poster area and the extended area corresponding to the target control can be obtained. Since the background of the poster image is a solid color, it can be understood that the color consistency in the extended area is high, and a pixel point can be selected in the extended area as the starting point. Based on the starting point, a preset detection algorithm is used to detect the pixels in the control area and the extended area, so that the edge corresponding to the target control is depicted by the detected pixels. For example, the preset detection algorithm can be understood as determining the pixel points with the same pixel value as the initial point based on the diffusion of the initial point to the adjacent pixel points.

[0093] In addition, in order to extract the edge structure features of the poster area, a mask image with the same specifications as the poster area and the extended area can be generated. Therefore, according to the position information of the detected pixel points, the corresponding pixel points in the mask image can be filled with the first mask value in sequence, and the pixel points other than the detected pixel points can be filled with the second mask value. Specifically, the first mask value can be 1, and the second mask value can be 0. Therefore, the data set composed of the first mask value and the second mask value can be determined as the mask data, and based on the mask data, the edge structure features corresponding to the target control can be determined in the mask image.

[0094] Step 103: binarize the mask data to generate a corresponding binary image.

[0095] In the embodiment of the present invention, the binarization process refers to setting the pixel value corresponding to the pixel point on the image to 0 or 255. The image after the binarization process will show an obvious black and white effect. Therefore, by binarizing the mask data, the mask image can be converted into a binary image, thereby highlighting the edge contour of the target control. For example, the pixel value of the pixel point corresponding to the first mask value can be set to a first gray value, such as 0, and the pixel value of the pixel point corresponding to the second mask value can be set to a second gray value, such as 255.

[0096] Step 104: intercepting a target image including vertices of the binary image, wherein the target image at least includes the rounded edges of the target control.

[0097] In an embodiment of the present invention, the binary image can clearly highlight the edge contour of the target control. In order to further identify the rounded corners corresponding to the target control, it is necessary to intercept the image including the rounded corner edges of the target control. Exemplarily, the area containing the vertices of the binary image can be selectively intercepted according to the shape information of the binary image, and the corresponding intercepted image only needs to include the rounded corner edges corresponding to the target control. Therefore, the intercepted image is used as the target image to facilitate subsequent related operations.

[0098] Step 105: Determine a plurality of pixel points corresponding to the rounded edge according to the target image.

[0099] In an embodiment of the present invention, the target image includes a rounded edge corresponding to the target control, and may also include a straight edge corresponding to the target control. Since the color difference of the target image is clear, the pixel value of the coordinates of the pixel points corresponding to the target image can be detected based on the target image, and a number of pixel points corresponding to the edge of the target control can be determined through the pixel values. Among them, according to the position of the target image intercepted on the binary image and the coordinates of the several pixel points corresponding to the edge of the target control, a number of pixel points can be screened to determine the multiple pixel points corresponding to the rounded edge.

[0100] In one example, when the target image is captured from the upper left corner of the binary image, the rows of the target image can be scanned from left to right to determine the coordinates of the pixel points whose first pixel value is the second grayscale value, thereby forming a first set; the columns of the target image can be scanned from top to bottom to determine the coordinates of the pixel points whose first pixel value is the second grayscale value, thereby forming a second set; the first set and the second set are intersected to determine multiple pixel points corresponding to the rounded edge.

[0101] In another example, when the target image is captured from the upper right corner of the binary image, the rows of the target image can be scanned from left to right to determine the coordinates of the pixel point whose last pixel value is the second grayscale value, thereby forming a first set; the columns of the target image can be scanned from top to bottom to determine the coordinates of the pixel point whose first pixel value is the second grayscale value, thereby forming a second set; the first set and the second set are intersected to determine multiple pixel points corresponding to the rounded edge.

[0102] In another example, when the target image is captured from the lower left corner of the binary image, the rows of the target image can be scanned from left to right to determine the coordinates of the pixel point whose first pixel value is the second grayscale value, thereby forming a first set; the columns of the target image can be scanned from top to bottom to determine the coordinates of the pixel point whose last pixel value is the second grayscale value, thereby forming a second set; the first set and the second set are intersected to determine multiple pixel points corresponding to the rounded edge.

[0103] In another example, when the target image is captured from the lower right corner of the binary image, the rows of the target image can be scanned from left to right to determine the coordinates of the pixel point whose last pixel value is the second grayscale value, thereby forming a first set; the columns of the target image can be scanned from top to bottom to determine the coordinates of the pixel point whose last pixel value is the second grayscale value, thereby forming a second set; the first set and the second set are intersected to determine multiple pixel points corresponding to the rounded edge.

[0104] Step 106: Determine the fillet radius corresponding to the fillet edge of the target control based on the multiple pixel points.

[0105] In an embodiment of the present invention, the fillet radius corresponding to the fillet edge of the target control can be determined based on the obtained coordinates of the multiple pixel points located on the fillet edge. Exemplarily, the fillet radius is obtained by fitting a circle to the coordinates of the multiple pixel points. In another example, when the number of corresponding pixel points is small, the fillet radius can be directly determined by querying a preset mapping table.

[0106] In summary, by locating the position of the target control, an extended area is added outside the poster area corresponding to the target control, and the color consistency of the extended area is high. A starting point can be selected in the extended area, and the poster area and the extended area are filled according to the starting point to form mask data that characterizes the edge structure characteristics corresponding to the target control. Subsequently, the mask data is converted into a binary image, and the edge contour of the target control can be highlighted. By intercepting a target image including a rounded edge of the target control at the vertex of the binary image, the target image can be used to detect the pixel coordinates and pixel values ​​in the target image to determine the multiple pixel points corresponding to the rounded edge, and then determine the fillet radius corresponding to the rounded edge based on the relevant information of the multiple pixel points. This invention can solve the technical problem that the fillet edge and radius are determined by edge detection or edge contour determination, resulting in the inability to identify the fillet and radius of the control corresponding to the poster image or large identification errors, thereby improving the accuracy of rounded corner recognition of the target control corresponding to the poster image.

[0107] Reference Figure 2 , shows another control identification method, which is applied to the poster image processing process, and the method may include:

[0108] Step 201: locate the position of a target control in the poster area corresponding to the poster image, and determine an extended area of ​​the target control according to a preset rule.

[0109] The extended area surrounds the poster area.

[0110] In the embodiment of the present invention, the description of step 201 may refer to the description of step 101 .

[0111] Determine a starting point in the extended area, fill the poster area and the extended area according to the starting point, and determine mask data; including: step 202-step 203.

[0112] Step 202: Use the vertex of the extended area as a starting point.

[0113] In an embodiment of the present invention, the position information and pixel value corresponding to any pixel point in the poster area and the extended area corresponding to the target control can be obtained. Since the color consistency in the extended area is high, a pixel point can be selected in the extended area as the starting point. For example, in order to facilitate the execution of the operation, the vertex of the extended area can be used as the starting point, for example, the vertex in the upper left corner of the extended area is determined as the starting point.

[0114] Step 203: Determine the interest pixel points of the starting point in the poster area and the extended area, and determine mask data according to the interest pixel points.

[0115] In the embodiment of the present invention, based on the starting point, the pixels in the control area and the extended area can be detected according to a preset detection algorithm, and the detected pixels are used as interest pixels of the starting point, so as to depict the edge corresponding to the target control through the interest pixels. For example, the preset detection algorithm can be understood as a method of diffusing the initial point to the adjacent pixels, and determining the detected pixels with the same pixel value as the initial point as interest pixels.

[0116] In addition, in order to extract the edge structure features of the poster area, a mask image with the same specifications as the poster area and the extended area can be generated. Therefore, according to the position information of a number of pixels of interest, the corresponding pixels in the mask image can be filled with the first mask value in sequence, and the pixels other than the pixels of interest can be filled with the second mask value. Specifically, the first mask value can be 1, and the second mask value can be 0. Therefore, the data set composed of the first mask value and the second mask value can be determined as the mask data, and based on the mask data, the edge structure features corresponding to the target control can be determined in the mask image.

[0117] An optional embodiment, referring to Figure 3 , step 203 may include the following sub-steps: sub-step S31-sub-step S37.

[0118] Sub-step S31, taking the starting point as a reference point.

[0119] Sub-step S32: determining adjacent pixel points of the reference point in the poster area and the extended area.

[0120] Sub-step S33: determining whether the adjacent pixel point is an interest pixel point of the reference point.

[0121] The step of determining whether the adjacent pixel point is an interest pixel point of the reference point includes:

[0122] The difference between the pixel value of the reference point and the pixel value of the adjacent pixel point is determined.

[0123] If the difference does not exceed a preset threshold, the adjacent pixel point is determined to be a pixel of interest of the reference point.

[0124] In the embodiment of the present invention, the initial point is used as the reference point, and the adjacent pixels of the reference point are determined in the poster area and the extended area. Exemplarily, the adjacent pixels of the reference point are found with the coordinate information corresponding to the reference point. Then, it is determined whether the adjacent pixel is an interest pixel of the reference point, wherein the interest pixel can be understood as a pixel with the same pixel value as the reference point.

[0125] For example, the coordinate information corresponding to the reference point can be used to determine the adjacent pixels of the reference point, and then further determine whether the adjacent pixels are the interest pixels of the reference point. At the same time, in order to optimize the robust performance, a difference threshold is pre-set when determining the interest pixels, such as 20.

[0126] Therefore, after the adjacent pixel point is determined, the pixel value of the adjacent pixel point and the pixel value of the reference point are obtained, so that the difference between the pixel value of the reference point and the pixel value of the adjacent pixel point can be determined. If the difference does not exceed a preset threshold, it can be determined that the pixel value of the adjacent pixel point is the same as the pixel value of the reference point. Thus, the adjacent pixel point can be determined as a pixel of interest.

[0127] If the adjacent pixel is a pixel of interest, execute sub-step S34; otherwise, execute sub-step S36.

[0128] Sub-step S34: taking the adjacent pixel point as a reference point.

[0129] After executing sub-step S34, sub-step S35 and sub-step S32 may be executed simultaneously to continue determining the pixel of interest of the reference point.

[0130] Sub-step S35: determining the interest pixel as a first mask value.

[0131] Sub-step S36: determining the pixel points other than the pixel points of interest in the poster area and the extended area as the second mask value.

[0132] Sub-step S37, obtaining the mask data according to the first mask value and the second mask value.

[0133] Optionally, the method steps of sub-step S31 to sub-step S37 may be used as a preset detection algorithm.

[0134] In the embodiment of the present invention, after determining that the adjacent pixel point is the pixel point of interest, the adjacent pixel point may be used as a new reference point, and the process returns to executing sub-step S32 to continue determining the pixel point of interest corresponding to the reference point.

[0135] In addition, in order to extract the edge structure features of the poster area, a mask image with the same specifications as the poster area and the extended area can be generated. Therefore, according to the position information of a plurality of pixels of interest, the corresponding pixels in the mask image can be filled with the first mask value.

[0136] After determining that the adjacent pixel is not a pixel of interest, the pixel points other than the pixel of interest in the corresponding poster area and the extended area can be filled with the second mask value, and the data set generated according to the first mask value and the second mask value can be determined as mask data. For example, the first mask value can be 1, and the second mask value can be 0, so the edge structure features corresponding to the target control are determined in the mask image through the mask data.

[0137] Step 204: binarize the mask data to generate a corresponding binary image.

[0138] In the embodiment of the present invention, the binarization process refers to setting the pixel value corresponding to the pixel point on the image to 0 or 255. The image after the binarization process will show an obvious black and white effect. Therefore, by binarizing the mask data, the mask image can be converted into a binary image, thereby highlighting the edge contour of the target control. For example, the pixel value of the pixel point corresponding to the first mask value can be set to a first gray value, such as 0, and the pixel value of the pixel point corresponding to the second mask value can be set to a second gray value, such as 255.

[0139] Step 205: Determine the number of pixels in each row and column in the poster area and the extended area other than the pixels of interest based on the binary image.

[0140] Step 206: If the number of pixels other than the interest pixel is less than a preset number, the pixel values ​​of all pixels in the corresponding row or column are replaced with the pixel values ​​corresponding to the interest pixel, and the binary image is updated.

[0141] In an embodiment of the present invention, by determining the number of pixels in each row and column other than the pixel of interest in the poster area and the extended area, it can be determined whether the corresponding row or column has noise pollution. Exemplarily, the pixel points whose pixel values ​​in each row or column are the second grayscale value can be counted based on the projection of the binary image in the vertical and horizontal directions. If the number of pixel points whose pixel values ​​in a row or column are the second grayscale value is less than the preset number set according to the total number of pixels in the row or column, for example, the preset number is 1 / 4 of the total number of pixels in the row or column, it can be determined that the row or column has noise pollution, and then the pixel values ​​of the corresponding rows or columns are all charged to the first grayscale value to eliminate the influence of noise pollution and improve the anti-interference performance of the invention.

[0142] Step 207: intercepting a target image including vertices of the binary image, wherein the target image at least includes the rounded edges of the target control.

[0143] In an optional embodiment, step 207 may further include the following steps:

[0144] The number of pixels corresponding to the rows and columns of the binary image is detected to determine the shape information of the binary image.

[0145] A cut-off area including vertices in the binary image is determined according to the shape information.

[0146] The binary image is intercepted according to the interception area to obtain a corresponding target image.

[0147] In the embodiment of the present invention, the binary image can clearly highlight the edge contour of the target control. In order to further identify the rounded corners corresponding to the target control, it is necessary to intercept the image including the rounded corner edges of the target control. Exemplarily, the area including the vertices of the binary image can be selectively intercepted according to the shape information of the binary image, and the corresponding intercepted image only needs to include the rounded corner edges corresponding to the target control.

[0148] Exemplarily, the shape information of the binary image can be determined by detecting the number of row pixels and the number of column pixels corresponding to the binary image, wherein the shape information may include a square and a rectangle. According to the shape information, the interception area of ​​the target image on the binary image can be determined. For example, when the binary image is a square, an image of a 1 / 4 image area in the lower right of the binary image containing the vertices of the binary image can be intercepted as the target image. When the binary image is a rectangle, an image of a 1 / 16 image area in the lower right of the binary image containing the vertices of the binary image can be intercepted as the target image. Among them, the target image can be a square.

[0149] Step 208: Determine a plurality of pixel points corresponding to the rounded edge according to the target image.

[0150] In an optional embodiment, step 208 may further include the following steps:

[0151] The position information of the pixel points at the end of each row in the target image, except the pixel points of interest, is determined to form a first set.

[0152] The position information of the pixel points at the end of each column in the target image, except the pixel points of interest, is obtained to form a second set.

[0153] According to the intersection of the first set and the second set, a plurality of interest pixels corresponding to the rounded edge are obtained.

[0154] In an embodiment of the present invention, the target image includes a rounded edge corresponding to the target control, and may also include a straight edge corresponding to the target control. Since the color difference of the target image is clear, the pixel value of the coordinates of the pixel points corresponding to the target image can be detected based on the target image, and a number of pixel points corresponding to the edge of the target control can be determined through the pixel values. Among them, according to the position of the target image intercepted on the binary image and the coordinates of the several pixel points corresponding to the edge of the target control, a number of pixel points can be screened to determine the multiple pixel points corresponding to the rounded edge.

[0155] In order to facilitate the execution of the steps, it can be determined that each captured target image is captured from the lower right corner of the binary image. Therefore, the target image rows can be scanned from left to right to determine the coordinates of the pixels at the end except the pixels of interest, forming a first set; the target image columns can be scanned from top to bottom to determine the coordinates of the pixels at the end except the pixels of interest, forming a second set, and the first set and the second set are intersected to determine the coordinates of multiple pixels corresponding to the rounded edge.

[0156] Step 209: Determine the fillet radius corresponding to the fillet edge of the target control based on the multiple pixel points.

[0157] An optional embodiment, referring to Figure 4 , step 209 may also include the following steps: sub-step S41-sub-step S44.

[0158] Sub-step S41: determining the number of a plurality of interest pixels corresponding to the rounded edge.

[0159] Sub-step S42: determining whether the number of the interest pixels is greater than a preset limit value.

[0160] If the number of the interest pixels is not greater than the preset limit value, sub-step S43 is executed.

[0161] If the number of pixels is greater than the limit value, execute sub-step S44.

[0162] Sub-step S43: Match the fillet radius of the fillet edge of the target control through a mapping table.

[0163] Sub-step S44, determining the fillet radius corresponding to the fillet edge of the target control according to the least squares method.

[0164] In an embodiment of the present invention, the number of pixels of interest can be determined based on the multiple pixels of interest corresponding to the obtained rounded edge. In order to facilitate the execution of the steps and simplify the operation, the number of pixels of interest can be judged first. Exemplarily, when the number of pixels of interest is greater than a preset limit value, for example, the number of pixels of interest is greater than 5, the corresponding fillet radius can be fitted based on the coordinates of the multiple pixels of interest using methods such as the least squares method. When the number of pixels of interest is not greater than the preset limit value, since the number of pixels is small, a mapping table corresponding to the fillet radius can be formed in advance based on the coordinates of the multiple pixels. Therefore, when there are fewer pixels of interest, the fillet radius corresponding to the rounded edge of the target control can be quickly matched by querying the mapping table.

[0165] In an optional embodiment, the method further includes:

[0166] Step 210: correct the fillet radius, and update the fillet radius after correction.

[0167] In the embodiment of the present invention, in order to reduce the calculation error of the fillet radius of the rounded edge of the target control, for example, if the fillet radius is large, the calculated fillet radius causes the edge of the target control to be semicircular. The width corresponding to the poster area can be determined by detecting the number of pixels in the rows and columns of the poster area, and the fillet radius can be detected based on the width.

[0168] Among them, detecting the fillet radius based on the length and width may include the following steps: sub-step S45-sub-step S46.

[0169] Sub-step S45, determining whether the fillet radius is close to half of the width.

[0170] If yes, execute sub-step S46; if no, execute sub-step S47.

[0171] Sub-step S46, taking the smaller half of the width as the fillet radius.

[0172] Sub-step S47, keeping the fillet radius consistent with that before correction.

[0173] Specifically, when the poster area is a square, its corresponding width is the side length; when the poster area is a rectangle, its corresponding width is the length of the shorter side of the rectangle. If the difference between the fillet radius and half of the width is less than the pixel threshold, for example, the pixel threshold is 4 pixels, it can be determined that the fillet radius is close to half of the width. In order to avoid causing the edge of the target control to be semicircular, the width can be reduced according to the actual situation, and half of the width can be taken as the fillet radius, and the fillet radius value can be corrected and updated. Otherwise, the updated fillet radius is consistent with the fillet radius before correction.

[0174] In summary, by locating the position of the target control, an extended area is added outside the poster area corresponding to the target control, and the color consistency of the extended area is high. A starting point can be selected in the extended area, and the poster area and the extended area are filled according to the starting point to form mask data that characterizes the edge structure characteristics corresponding to the target control. Subsequently, the mask data is converted into a binary image, and the edge contour of the target control can be highlighted. By intercepting a target image including a rounded edge of the target control at the vertex of the binary image, the target image can be used to detect the pixel coordinates and pixel values ​​in the target image to determine the multiple pixel points corresponding to the rounded edge, and then determine the fillet radius corresponding to the rounded edge based on the relevant information of the multiple pixel points. This invention can solve the technical problem that the fillet edge and radius are determined by edge detection or edge contour determination, resulting in the inability to identify the fillet and radius of the control corresponding to the poster image or large identification errors, and thus can improve the accuracy of rounded corner recognition of the target control corresponding to the poster image, and has good versatility.

[0175] Reference Figure 5 , shows a control identification device, which may include:

[0176] The control positioning module 501 is used to locate the position of the target control in the poster area corresponding to the poster image, and determine the extended area of ​​the target control according to a preset rule, wherein the extended area surrounds the poster area.

[0177] The mask determination module 502 is used to determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data.

[0178] The binarization processing module 503 is used to perform binarization processing on the mask data to generate a corresponding binarized image.

[0179] The image capture module 504 is used to capture a target image including vertices of the binary image, wherein the target image at least includes the rounded edges of the target control.

[0180] The pixel point determination module 505 is used to determine a plurality of pixel points corresponding to the rounded edge according to the target image.

[0181] The data calculation module 506 is used to determine the fillet radius corresponding to the fillet edge of the target control according to the multiple pixel points.

[0182] In an optional embodiment, the mask determination module may include:

[0183] The starting point determination submodule is used to take the vertex of the extension area as the starting point.

[0184] The mask data generating submodule is used to determine the interest pixel points of the starting point in the poster area and the extended area, and determine the mask data according to the interest pixel points.

[0185] In an optional embodiment, the mask data generation submodule may include:

[0186] The interest pixel determination unit is used to determine the neighboring pixels of the reference point in the poster area and the extended area with the starting point as the reference point, and judge whether the neighboring pixels are the interest pixels of the reference point.

[0187] In the case that the adjacent pixel point is an interest pixel point, the adjacent pixel point is used as a reference point to continue to determine the interest pixel point of the reference point.

[0188] The mask data generating unit is used to determine the interest pixel as a first mask value, and determine the pixel points other than the interest pixel in the poster area and the extended area as a second mask value, so as to obtain the mask data.

[0189] In an optional embodiment, the interest pixel determination unit is further configured to:

[0190] The difference between the pixel value of the reference point and the pixel value of the adjacent pixel point is determined.

[0191] If the difference does not exceed a preset threshold, the adjacent pixel point is determined to be a pixel of interest of the reference point.

[0192] In an optional embodiment, the pixel point determination module may include:

[0193] The first position submodule is used to determine the position information of the pixel points at the end of each row in the target image except the pixel points of interest to form a first set.

[0194] The second position submodule is used to obtain the position information of the pixel points at the end of each column in the target image except the pixel points of interest to form a second set.

[0195] The pixel point acquisition submodule is used to obtain a plurality of interest pixels corresponding to the rounded edge according to the intersection of the first set and the second set.

[0196] In an optional embodiment, the data calculation module may include:

[0197] The number calculation module is used to determine the number of multiple interest pixels corresponding to the rounded edge.

[0198] The radius calculation module is used to match the rounded corner radius corresponding to the rounded corner edge of the target control through a mapping table if the number of the interest pixels is not greater than a preset limit value.

[0199] If the number of pixels is greater than a limit value, the fillet radius corresponding to the fillet edge of the target control is determined according to the least squares method.

[0200] In an optional embodiment, the device may further include:

[0201] The radius correction module is used to correct the fillet radius and update the fillet radius after correction.

[0202] In an optional embodiment, the device may further include:

[0203] The first calculation module is used to determine the number of pixels in each row and each column in the poster area and the extended area other than the pixels of interest according to the binary image.

[0204] The second calculation module is used to replace the pixel values ​​of all the pixels in the corresponding row or column with the pixel values ​​corresponding to the pixel of interest if the number of the pixels other than the pixel of interest is less than a preset number, so as to update the binary image.

[0205] In an optional embodiment, the image capture module may include:

[0206] The image detection submodule is used to detect the number of pixels corresponding to the rows and columns of the binary image and determine the shape information of the binary image.

[0207] The clipping region determination submodule is used to determine the clipping region containing vertices in the binary image according to the shape information.

[0208] The target image acquisition submodule is used to intercept the binary image according to the interception area to obtain the corresponding target image.

[0209] In summary, by locating the position of the target control, an extended area is added outside the poster area corresponding to the target control, and the color consistency of the extended area is high. A starting point can be selected in the extended area, and the poster area and the extended area are filled according to the starting point to form mask data that characterizes the edge structure characteristics corresponding to the target control. Subsequently, the mask data is converted into a binary image, and the edge contour of the target control can be highlighted. By intercepting a target image including a rounded edge of the target control at the vertex of the binary image, the target image can be used to detect the pixel coordinates and pixel values ​​in the target image to determine the multiple pixel points corresponding to the rounded edge, and then determine the fillet radius corresponding to the rounded edge based on the relevant information of the multiple pixel points. This invention can solve the technical problem that the fillet edge and radius are determined by edge detection or edge contour determination, resulting in the inability to identify the fillet and radius of the control corresponding to the poster image or large identification errors, thereby improving the rounded corner recognition accuracy of the target control corresponding to the poster image, and has good versatility.

[0210] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.

[0211] Memory 603, used for storing computer programs;

[0212] The processor 601 is used to execute the program stored in the memory 603 to implement the following steps:

[0213] The position of the target control in the poster area corresponding to the poster image is located, and the extended area of ​​the target control is determined according to a preset rule, wherein the extended area surrounds the poster area.

[0214] A starting point is determined in the extended area, and the poster area and the extended area are filled according to the starting point to determine mask data.

[0215] The mask data is binarized to generate a corresponding binarized image.

[0216] A target image including vertices of the binary image is intercepted, wherein the target image at least includes a rounded edge of the target control.

[0217] A plurality of pixel points corresponding to the rounded edge are determined according to the target image.

[0218] The fillet radius corresponding to the fillet edge of the target control is determined according to the multiple pixel points.

[0219] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0220] The communication interface is used for communication between the above terminal and other devices.

[0221] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0222] The above-mentioned processor 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 gate or transistor logic devices, discrete hardware components.

[0223] In another embodiment of the present invention, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the control identification method described in any of the above embodiments.

[0224] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the control identification methods described in the above embodiments.

[0225] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0226] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0227] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0228] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A control identification method, characterized in that: Applied in the poster image processing process, the method includes: Locate the position of the target control in the poster area corresponding to the poster image, and determine the extended area of ​​the target control according to a preset rule, wherein the extended area surrounds the poster area; Determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data; Binarizing the mask data to generate a corresponding binary image; intercepting a target image including vertices of the binary image, wherein the target image at least includes a rounded edge of the target control; Determine, according to the target image, a plurality of pixel points corresponding to the rounded edge; The fillet radius corresponding to the fillet edge of the target control is determined according to the multiple pixel points.

2. The method according to claim 1, characterized in that The step of determining a starting point in the extended area, filling the poster area and the extended area according to the starting point, and determining mask data includes: Taking the vertex of the extended area as a starting point; Determine the interest pixel points of the starting point in the poster area and the extended area, and determine mask data according to the interest pixel points.

3. The method according to claim 2, characterized in that The step of determining the pixel of interest of the starting point in the poster area and the extended area, and determining mask data according to the pixel of interest includes: Taking the starting point as a reference point, determining adjacent pixel points of the reference point in the poster area and the extended area, and judging whether the adjacent pixel points are interest pixels of the reference point; In the case where the adjacent pixel point is an interest pixel point, taking the adjacent pixel point as a reference point, and continuing to determine the interest pixel point of the reference point; The interest pixel is determined as a first mask value, and the pixel points other than the interest pixel in the poster area and the extended area are determined as second mask values ​​to obtain the mask data.

4. The method according to claim 3, characterized in that The determining whether the adjacent pixel point is an interest pixel point of the reference point includes: Determine the difference between the pixel value of the reference point and the pixel value of the adjacent pixel point; If the difference does not exceed a preset threshold, the adjacent pixel point is determined to be a pixel of interest of the reference point.

5. The method according to claim 2, characterized in that: The step of determining a plurality of pixel points corresponding to the rounded edge according to the target image includes: Determine position information of pixel points at the end of each row in the target image except for the pixel points of interest to form a first set; Acquire position information of pixel points at the end of each column in the target image except the pixel points of interest to form a second set; According to the intersection of the first set and the second set, a plurality of interest pixels corresponding to the rounded edge are obtained.

6. The method according to claim 5, characterized in that The determining, based on the plurality of pixel points, a corresponding rounded radius of the rounded edge of the target control includes: Determine the number of a plurality of interest pixels corresponding to the rounded edge; If the number of the interest pixels is not greater than a preset limit value, the fillet radius corresponding to the fillet edge of the target control is matched through a mapping table; If the number of pixels is greater than a limit value, the fillet radius corresponding to the fillet edge of the target control is determined according to the least squares method.

7. The method according to claim 6, characterized in that The method further comprises: The fillet radius is corrected, and the fillet radius is updated after the correction.

8. The method according to claim 2, characterized in that: The method further comprises: According to the binary image, determining the number of pixels in each row and each column in the poster area and the extended area other than the pixels of interest; If the number of pixels other than the pixel of interest is less than a preset number, the pixel values ​​of all pixels in the corresponding row or column are replaced with the pixel values ​​corresponding to the pixel of interest, and the binary image is updated.

9. The method according to claim 1, characterized in that: The step of intercepting a target image including vertices of the binary image comprises: Detecting the number of pixels corresponding to the rows and columns of the binary image to determine shape information of the binary image; Determine, according to the shape information, a cut-off area containing vertices in the binary image; The binary image is intercepted according to the interception area to obtain a corresponding target image.

10. A control identification device, characterized in that: The device is applied to a poster image processing process, and the device comprises: A control positioning module, used to locate the position of a target control in a poster area corresponding to the poster image, and determine an extended area of ​​the target control according to a preset rule, wherein the extended area surrounds the poster area; A mask determination module, used to determine a starting point in the extended area, and fill the poster area and the extended area according to the starting point to determine mask data; A binarization processing module, used for performing binarization processing on the mask data to generate a corresponding binarized image; An image capture module, used to capture a target image containing vertices of the binary image, wherein the target image at least includes a rounded edge of the target control; A pixel point determination module, used to determine a plurality of pixel points corresponding to the rounded edge according to the target image; The data calculation module is used to determine the fillet radius corresponding to the fillet edge of the target control based on the multiple pixel points.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 9 when executing a program stored in a memory.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.