Method, device, computer equipment and storage medium for processing disconnection of detection line
By constructing an initial search line at the first endpoint of the detection line and determining the target search line under preset conditions, the problem of reduced detection line accuracy caused by holes or gaps is solved, and the continuity and accuracy of the detection line are improved.
Patent Information
- Application Number
- CN202211158448.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-09-22
AI Technical Summary
In the prior art, when the holes or gaps are large, the filling process of the detection lines results in reduced image detection accuracy.
By constructing an initial search line at the first end point of the detection line, if there is a target search point that meets the preset connection conditions, the target search line is determined to achieve the extension of the detection line.
The detection accuracy of the detection line in image detection is improved, and the continuity and accuracy of the detection line are improved.
Smart Images

Figure CN115511822B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of visual image technology, and in particular to a method, device, computer equipment and storage medium for processing a broken line of a detection line. Background Art
[0002] With the continuous development of intelligent manufacturing, it is necessary to perform image inspection on the products to be inspected. The strip track features such as scratches and glue lines in the products to be inspected can be detected through images, and the quality of the products to be inspected can be judged by the detected strip tracks.
[0003] In related technologies, taking the center line detection of the glue path as an example, if there are holes or gaps in the detection image, the detected center line (the center line is continuous as a whole) will be broken, and the broken line of the output detection line is usually filled with holes or gaps through morphological processing methods.
[0004] However, when the hole or gap is large, the fill line at the broken line position will be deformed, resulting in a decrease in the accuracy of the detection line detected by the image. Summary of the Invention
[0005] In order to solve the problem that the filling of broken lines leads to reduced accuracy of detection lines detected by image, the present application provides a method, device and storage medium for processing broken lines of detection.
[0006] The embodiment of the present application is implemented as follows:
[0007] A first aspect of an embodiment of the present application provides a method for processing a disconnection of a detection line, the method comprising the following steps:
[0008] Determining at least one detection line in the image to be tested;
[0009] determining an initial search line based on a first endpoint of the detection line and a first direction of the first endpoint;
[0010] If there is a target search point on the initial search line that meets the preset connection condition, a target search line is determined according to the first endpoint and the target search point, wherein the target search point is located on the connection line in the image to be measured.
[0011] In conjunction with the first aspect, in one possible implementation, determining a target search point that meets a preset connection condition includes:
[0012] Determining a judgment value based on the gradient of each initial search point and the direction of the initial search line;
[0013] When the initial search line is a bright line and there is an initial search point with a positive judgment value, the target search point is selected from the initial search points;
[0014] When the initial search line is a dark line and there is an initial search point with a negative judgment value, the target search point is screened out from the initial search points.
[0015] In conjunction with the first aspect, in one possible implementation, determining the initial search line includes:
[0016] Get the grayscale value of the initial search line;
[0017] When the grayscale value belongs to the first preset range, the initial search line is a bright line;
[0018] When the grayscale value belongs to the second preset range, the initial search line is a dark line.
[0019] In conjunction with the first aspect, in a possible implementation, after determining the target search line according to the first endpoint and the target search point, the method further includes:
[0020] When the connection line identifier corresponding to the target search point is the same as the detection line identifier corresponding to the first endpoint, the connection line and the detection line are collinear;
[0021] When the connection line identifier corresponding to the target search point is different from the detection line identifier corresponding to the first endpoint, the connection line and the detection line are not collinear.
[0022] In conjunction with the first aspect, in one possible implementation, determining an initial search line based on a first endpoint of a detection line and a first direction of the first endpoint includes:
[0023] determining, based on the detection line, a first endpoint of the detection line and a first direction of the first endpoint;
[0024] An initial search line is determined with the first endpoint as a starting point and along a first direction of the first endpoint, wherein the length of the initial search line is determined by a filtering parameter.
[0025] In conjunction with the first aspect, in a possible implementation, when the detection line is a center line, determining the detection line in the image to be detected includes:
[0026] Based on the second-order partial derivative of each pixel point after filtering the image to be tested, a curve model of each pixel point is constructed;
[0027] Determine the target center point of the image to be tested based on the curve model of each pixel point and the preset screening threshold;
[0028] Based on the target center point, determine the center line of the image to be measured.
[0029] In conjunction with the first aspect, in one possible implementation, when the preset screening threshold includes a preset upper threshold and a preset lower threshold, determining the target center point of the image to be measured based on the curve model of each pixel point and the preset screening threshold includes:
[0030] Determining an initial center point of the pixel based on the constructed first curve model;
[0031] When the characteristic value of the initial center point is greater than or equal to a preset low threshold, an alternative center point is selected from the initial center point; wherein, when the characteristic value of the alternative center point is greater than or equal to a preset high threshold, an alternative starting point is selected from the alternative center point; when the characteristic value of the alternative center point is less than the preset high threshold, an alternative connection point is selected from the alternative center point;
[0032] Determine the target starting point based on the characteristic values of the alternative starting points;
[0033] Determining at least two adjacent center points based on the tangent direction of the feature vector of the target starting point, where the adjacent center points include candidate connection points and / or candidate starting points;
[0034] When the distance between the adjacent center point and the target starting point is the smallest, and the angle difference between the adjacent center point and the target starting point is the smallest, the corresponding adjacent center point is determined to be the target connection point;
[0035] Based on the target start point and target connection point, determine the target center point.
[0036] A second aspect of the present application provides a device for processing a broken wire, comprising an acquisition module, a construction module, and an analysis module.
[0037] An acquisition module, configured to determine at least one detection line in the image to be detected;
[0038] A construction module is configured to determine an initial search line based on a first endpoint of the detection line and a first direction of the first endpoint;
[0039] The analysis module is configured to determine a target search line according to the first endpoint and the target search point if a target search point that meets a preset connection condition exists on the initial search line, wherein the target search point is located on the connection line in the image to be measured.
[0040] A third aspect of an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the line break processing method of the detection line in the first aspect of the invention are implemented.
[0041] A fourth aspect of an embodiment of the present application provides a computer storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processor executes the steps of the line break processing method of the detection line in the first aspect of the invention.
[0042] The beneficial effects of the present application include: determining at least one detection line from the image to be tested; determining an initial search line based on the first endpoint of the detection line and the first direction of the first endpoint; further, if a target search point that meets a preset connection condition exists on the initial search line, determining the target search line based on the first endpoint and the target search point on the connection line in the image to be tested. It can be seen that the embodiment of the present application constructs an initial search line at the first endpoint of the detection line, and if a target search point that meets the preset connection condition exists on the initial search line, the target search line can be determined to extend the detection line, thereby improving the detection accuracy of the detection line in image detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A schematic diagram of detecting the center line of the glue path in the related art is shown;
[0045] Figure 2 A schematic diagram of a process for processing a disconnection of a detection line according to an embodiment of the present application is shown;
[0046] Figure 3 A schematic diagram of a process for determining a detection line in an image to be detected in a method for processing a broken detection line is shown;
[0047] Figure 4 A schematic diagram illustrating a flow chart of determining a target search point that meets a preset connection condition in a method for processing a disconnection of a detection line according to an embodiment of the present application;
[0048] Figure 5 It shows an example schematic diagram of adding a target search line to a detection line in an embodiment of the present application;
[0049] Figure 6 Shown Figure 1 A schematic diagram illustrating a target search line according to a method for processing a broken line of a detection line according to an embodiment of the present application;
[0050] Figure 7 A schematic structural diagram of a detection line break processing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0051] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0052] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.
[0053] In the specification and claims of this application and the accompanying drawings, the terms "first," "second," "third," etc. are used to distinguish similar or similar objects or entities, and are not necessarily intended to limit a particular order or sequence, unless otherwise noted. It should be understood that the terms used in this manner are interchangeable under appropriate circumstances.
[0054] The terms "comprise," "include," and "have," and any variations thereof, are intended to cover but not exclude inclusion; for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0055] With the continuous development of intelligent manufacturing, it is necessary to perform image inspection on the products to be inspected. The strip track features such as scratches and glue lines in the products to be inspected can be detected through images, and the quality of the products to be inspected can be judged by the detected strip tracks.
[0056] In the detection of the bar track, the detection line such as the center line of the bar track or the edge line of the bar track can be detected, and the quality of the product to be detected can be judged by analyzing the detection line.
[0057] Taking the center line detection of the glue path as an example, if there are holes or gaps in the detection image, the detected center line will be broken. Figure 1 The schematic diagram of the center line of the glue path detected in the related art is shown in FIG. Figure 1 There are broken lines between the detected center lines. In related technologies, holes or gaps are usually filled through morphological processing methods. However, when the holes or gaps are large, the filling lines at the broken line positions will be deformed, resulting in reduced accuracy of the detection lines detected by the image.
[0058] In order to solve the problem that the filling of broken lines leads to a decrease in the accuracy of detection lines detected in an image, the present application provides a method, device, computer equipment and storage medium for processing broken lines of detection lines. The method for processing broken lines of detection lines determines at least one detection line from the image to be detected; by determining an initial search line based on the first endpoint of the detection line and the first direction of the first endpoint; further, if there is a target search point that meets the preset connection conditions on the initial search line, the target search line can be determined based on the first endpoint and the target search point on the connection line in the image to be detected. It can be seen that the embodiment of the present application constructs an initial search line at the first endpoint of the detection line. If there is a target search point that meets the preset connection conditions on the initial search line, the target search line can be determined to extend the detection line, thereby improving the detection accuracy of the detection line in image detection.
[0059] The following describes in detail the centerline deviation correction method, device and storage medium of the embodiments of the present application in conjunction with the accompanying drawings.
[0060] Figure 2 FIG. 1 shows a flow chart of a method for processing a disconnection of a detection line provided by an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a method for processing a broken line of a detection line.
[0061] The method for processing a broken line of the detection line comprises the following steps:
[0062] S110: Determine at least one detection line in the image to be detected.
[0063] Among them, the image to be tested is obtained, which is an image of the product to be tested taken by the visual inspection system, in which there may or may not be bar tracks. In an embodiment of the present application, there is at least one detection line in the image to be tested, and the detection line has an unconnected area.
[0064] It should be noted that the strip tracks described in the embodiments of the present application can be scratches, glue lines, or other detection methods that can determine the detection lines. Therefore, the application scenarios of the embodiments of the present application can be defect detection and quality inspection. The embodiments of the present application do not limit the application scenarios of the detection.
[0065] like Figure 1 In the image to be tested shown, there are four test lines, namely, test line M, test line N, test line O, and test line P; wherein, there are four areas A, B, C, and D where the lines may be broken.
[0066] The detection line may refer to a center line, an edge line, or other lines in image detection.
[0067] In some embodiments, when the detection line is the center line, Figure 3FIG. 1 shows a flow chart of determining a detection line in a detection image in a method for processing a broken detection line. Figure 3 As shown, determining the detection line in the image to be tested includes the following steps:
[0068] S111 . Constructing a curve model for each pixel based on the second-order partial derivative of each pixel after filtering the image to be measured.
[0069] Based on the second-order partial derivatives of each pixel in the filtered image, the eigenvalue and eigenvector of each pixel are determined, where the eigenvalues include at least two initial eigenvalues, and the eigenvectors include at least two initial eigenvectors. Based on the eigenvalues and eigenvectors of each pixel, a first curve model is constructed for each pixel. The initial eigenvalues of the pixel with the largest absolute value are selected as the target eigenvalue; the first curve model of the pixel is determined based on the target eigenvalue and the target eigenvector corresponding to the target eigenvalue.
[0070] It should be understood that the first curve model of the pixel point is a quadratic polynomial. By taking the derivative of the quadratic polynomial, when the derivative is 0, it corresponds to its extreme point.
[0071] S112 : Determine the target center point of the image to be measured based on the curve model of each pixel point and a preset screening threshold.
[0072] It should be understood that based on the constructed first curve module and the preset screening threshold, the center point is determined from the image to be tested, and the center line is further determined by determining the center point.
[0073] In some embodiments, the preset screening threshold may include a preset high threshold and a preset low threshold. In this case, determining the target center point of the image to be measured based on the curve model of each pixel point and the preset screening threshold includes the following steps:
[0074] Based on the constructed first curve model, an initial center point of the pixel is determined.
[0075] When the characteristic value of the initial center point is greater than or equal to a preset low threshold, an alternative center point is selected from the initial center point; wherein, when the characteristic value of the alternative center point is greater than or equal to a preset high threshold, an alternative starting point is selected from the alternative center point; when the characteristic value of the alternative center point is less than the preset high threshold, an alternative connection point is selected from the alternative center point;
[0076] The target starting point is determined based on the characteristic values of the candidate starting points. In some embodiments, after the candidate starting points are sorted by their characteristic values, the candidate starting point with the largest characteristic value is first selected as the target starting point. After the target center point of the bar track with the target starting point is determined, the next candidate starting point is selected as the target starting point by sorting the candidate starting points, and so on until all candidate starting points are connected.
[0077] At least two adjacent center points are determined based on the tangent direction of the feature vector of the target starting point. The adjacent center points include candidate connection points and / or candidate starting points. In some embodiments, at least two adjacent center points can also be determined based on the tangent direction of the feature vector of the target starting point and a preset direction region within which the tangent direction lies. The preset direction region can be divided into multiple regions, each centered at the target starting point.
[0078] In some embodiments, the adjacent center points may be all points greater than a preset low threshold, that is, the adjacent center points may be alternative connection points, alternative starting points, or both.
[0079] There are at least two adjacent center points, which are candidate center points close to the target starting point. For example, three adjacent center points may be found.
[0080] When the distance between the adjacent center point and the target starting point is the smallest, and the angle difference between the adjacent center point and the target starting point is the smallest, the corresponding adjacent center point is determined to be the target connection point.
[0081] Based on the target start point and target connection point, determine the target center point.
[0082] In some embodiments, when the preset screening threshold includes a preset high threshold and a preset low threshold, determining the target center point of the image to be measured can also be described as: screening the center points using the preset high threshold and the preset low threshold. Center points less than the preset low threshold are discarded; center points greater than or equal to the preset high threshold are used as candidate starting points; and center points less than the preset high threshold and greater than or equal to the preset low threshold are used as candidate connecting points to be connected into a line.
[0083] The candidate starting points are sorted according to their eigenvalues, and the sorted candidate starting points are used as the target starting points. Three adjacent pixel points are obtained according to the tangential direction of the target starting point.
[0084] In some embodiments, the three adjacent pixel points may be three adjacent center points. If the three center points are, the search range will be further narrowed.
[0085] When selecting the target starting point from the candidate starting points for the first time, the candidate starting point with the largest eigenvalue is selected as the target starting point. When selecting the target starting point from the candidate starting points for the Jth time, the Kth candidate starting point after sorting the eigenvalues is selected as the target starting point, where J and K are positive integers, and J is greater than 1, and K is greater than or equal to J.
[0086] In some embodiments, if a point among the candidate starting points is used as a connection point, when selecting the target starting point, the candidate starting point is removed before determining the target starting point.
[0087] In some embodiments, the candidate starting point is only used to determine the target starting point, and the candidate connection point is only used to determine the target connection point.
[0088] Determine whether there is a center point corresponding to three adjacent pixel points that is greater than or equal to a preset low threshold, and has the smallest distance and the smallest angle difference from the target starting point or the previous target connection point.
[0089] When the three adjacent pixel points are determined to correspond to the target starting point, it is determined whether there is a pixel point in the center point corresponding to the three pixel points that is greater than or equal to the preset low threshold and has the smallest distance and the smallest angle difference from the target starting point.
[0090] When the three adjacent pixel points are determined to correspond to the target connection point, it is determined whether there is a pixel point in the center point corresponding to the three pixel points that is greater than or equal to the preset low threshold and has the smallest distance and the smallest angle difference from the previous target connection point.
[0091] If there are pixels that meet the above judgment conditions, the center point corresponding to the pixel with the smallest distance and the smallest angle difference will be used as the target connection point, and the next target connection point of the updated target connection point will be repeated according to the tangential direction of the target starting point to obtain three adjacent pixel points.
[0092] If there is no pixel point that meets the above judgment conditions, the sorted candidate starting point is executed as the target starting point, a new target starting point is determined, and then a corresponding set of target connection points is determined based on the new target starting point.
[0093] Through the above process, the target center point of each bar track is determined.
[0094] like Figure 3 As shown, the method further includes: S113, determining the center line of the image to be measured based on the target center point. According to the target center point and the tangent direction of the target center point, each target center point is sequentially connected to determine the center line of the image to be measured, and the center line serves as the detection line of the embodiment of the present application.
[0095] like Figure 2As shown, S120, based on the first endpoint of the detection line and the first direction of the first endpoint, determine an initial search line.
[0096] First, based on the detection line, a first endpoint and a first direction of the first endpoint are determined.
[0097] For a detection line with two endpoints, determining the initial search line can be performed for each endpoint separately, or each endpoint can be preliminarily determined and the endpoint that meets the preliminarily determination is selected as the first endpoint for the next step of determination.
[0098] It should be understood that an initial search line is determined starting from the first endpoint and along a first direction of the first endpoint, wherein the length of the initial search line is determined by the filtering parameters. The first endpoint has a first direction and a second direction, wherein the first direction may be a tangent direction of the first endpoint, and the second direction may be a normal direction of the first endpoint.
[0099] In some embodiments, L times the filtering parameter may be used as the length of the initial search line.
[0100] The filtering parameter may be a smoothing parameter σ of a Gaussian filter function, which is a smoothing coefficient used to characterize the smoothing degree.
[0101] It should be understood that the width of the Gaussian filter determines the degree of smoothness; the degree of smoothness is characterized by the parameter σ, and the relationship between σ and the degree of smoothness is: the larger the parameter σ, the wider the frequency band of the Gaussian filter and the better the degree of smoothness.
[0102] In some embodiments, when the search line includes a first search line and a second search line, the length of the first search line or the second search line may be 1.5σ to 5σ; when there is only one search line, the length of the search line may be 3σ to 10σ.
[0103] For example, for the first endpoint, the first endpoint may be used as the starting point of the initial search line, the tangent direction of the first endpoint may be used as the direction of the initial search line, and 2.5 times the filtering parameter may be used as the length of the initial search line.
[0104] S130 : If there is a target search point on the initial search line that meets the preset connection condition, determine a target search line according to the first endpoint and the target search point, wherein the target search point is located on the connection line in the image to be measured.
[0105] Among them, the determination of whether the preset connection condition is met includes: determining a judgment value based on the gradient of each initial search point and the direction of the initial search line; when the initial search line is a bright line and there is an initial search point with a positive judgment value, or when the initial search line is a dark line and there is an initial search point with a negative judgment value, it can be considered that the corresponding initial search point meets the preset connection condition, that is, at this time, the target search point that meets the preset connection condition can be determined from the initial search points.
[0106] Figure 4 A schematic diagram showing a flow chart of determining a target search point that meets a preset connection condition in a method for processing a disconnection of a detection line according to an embodiment of the present application is shown. Figure 4 As shown, determining the target search point that meets the preset connection conditions includes the following steps:
[0107] S131 . Determine a judgment value based on the gradient of each initial search point and the direction of the initial search line.
[0108] The dot product of the gradient of the initial search point and the direction of the initial search line can be used as the judgment value. The gradient of the initial search point can be determined by a gradient image, wherein the gradient image is determined based on the first-order partial derivative of each pixel point after filtering the image to be tested.
[0109] For example, for the pixel point (x, y) of the image to be tested, the corresponding first-order partial derivative r is obtained by Gaussian function filtering. x 、r y , then the gradient image is determined based on the first-order partial derivative of each pixel after filtering the image to be tested. The expression of the gradient image e(x, y) is as follows:
[0110]
[0111] The gradient of the initial search point can be determined by the gradient image.
[0112] The direction of the initial search line is determined by the first direction of the first endpoint.
[0113] In some embodiments, the initial search line can be determined by the following methods, specifically including the following: obtaining the grayscale value of the initial search line; when the grayscale value belongs to the first preset range, the initial search line is a bright line; when the grayscale value belongs to the second preset range, the initial search line is a dark line.
[0114] The initial search line can be determined by obtaining the grayscale value of the initial search line; when the grayscale value is greater than a preset brightness threshold, the initial search line is a bright line; when the grayscale value is greater than the preset brightness threshold, the initial search line is a dark line.
[0115] S132: When the initial search line is a bright line and there is an initial search point with a positive judgment value, select a target search point from the initial search points.
[0116] It should be understood that when the initial search line is a bright line and the sign of the judgment value is positive, the corresponding initial search point is used as the target search point.
[0117] S133: When the initial search line is a dark line and there is an initial search point whose judgment value is a negative number, select a target search point from the initial search points.
[0118] It should be understood that when the initial search line is a dark line and the sign of the judgment value is negative, the corresponding initial search point is used as the target search point.
[0119] The determination of the initial search point in step 130 is performed by sequentially traversing the initial search points on the initial search line. If, after traversing all the initial search points, there is no target search point on the initial search line that meets the preset connection condition, then the detection line does not have an extended connection line.
[0120] Traverse in the order of the initial search points. If the initial search point does not meet the preset connection conditions, check whether all the initial search points on the search line have been traversed. If not, record the current initial search point to form a construction line segment and continue to traverse the next initial search point on the search line. Otherwise, the current detection line will not be extended.
[0121] Traverse in the order of the initial search points. If the initial search point meets the preset connection conditions and the current detection line has been extended to another detection line or the current detection line, you can add a target search line and a target search point on the detection line.
[0122] For example, Figure 5 FIG. 1 shows an example schematic diagram of adding a target search line to a detection line in an embodiment of the present application. Figure 5 As shown, based on the first endpoint E of the detection line S, the target search point F is determined, and the target search point F is on another detection line T.
[0123] Therefore, after step 130, the method further includes:
[0124] S140: When the connection line identifier corresponding to the target search point is the same as the detection line identifier corresponding to the first endpoint, the connection line and the detection line are collinear.
[0125] S150: When the connection line identifier corresponding to the target search point is different from the detection line identifier corresponding to the first endpoint, the connection line and the detection line are not collinear.
[0126] Each search line in the image to be tested may have its own identification number. By using the detection line identification corresponding to the first endpoint and the connection line identification corresponding to the target search point, it can be further determined whether the determined target search line extends to the same detection line or to another detection line.
[0127] Figure 6 Shown Figure 1 A schematic diagram of a target search line of a method for processing a broken line of a detection line according to an embodiment of the present application is given as an example. Figure 1 As shown in the example diagram, the corresponding target search line is determined by the detection line break processing method of the embodiment of the present application, and the following is obtained: Figure 6 Target search line shown.
[0128] Among them, the target search line corresponding to the detection line M is in the A′ area and is collinear with the detection line M; the target search line corresponding to the detection line O is in the B′ area and is connected to the detection line M; a target search line corresponding to the detection line N is in the C′ area and is connected to the detection line O, and another target search line corresponding to the detection line N is in the D′ area and is connected to the detection line P.
[0129] The embodiment of the present application provides a method for processing broken detection lines, which determines at least one detection line from an image to be tested; an initial search line can be determined based on a first endpoint of the detection line and a first direction of the first endpoint; further, if a target search point that meets a preset connection condition exists on the initial search line, the target search line can be determined based on the first endpoint and the target search point on the connection line in the image to be tested. Therefore, it can be seen that the embodiment of the present application constructs an initial search line at the first endpoint of the detection line, and if a target search point that meets the preset connection condition exists on the initial search line, the target search line can be determined to extend the detection line, thereby improving the detection accuracy of the detection line in image detection.
[0130] Figure 7 FIG. 1 shows a schematic structural diagram of a device for processing a broken wire of a detection line provided in an embodiment of the present application. Figure 7 As shown, the detection line break processing device 700 includes an acquisition module 710, a construction module 720 and an analysis module 730.
[0131] The acquisition module is used to determine at least one detection line in the image to be tested.
[0132] A construction module is provided to determine an initial search line based on a first endpoint of the detection line and a first direction of the first endpoint.
[0133] The analysis module is configured to determine a target search line according to the first endpoint and the target search point if a target search point that meets a preset connection condition exists on the initial search line, wherein the target search point is located on the connection line in the image to be measured.
[0134] In some embodiments, the determination of the target search point that meets the preset connection condition in the analysis module is further used to:
[0135] Based on the gradient of each initial search point and the direction of the initial search line, a judgment value is determined; when the initial search line is a bright line and there is an initial search point with a positive judgment value, the target search point is screened out from the initial search points; when the initial search line is a dark line and there is an initial search point with a negative judgment value, the target search point is screened out from the initial search points.
[0136] In some embodiments, the analysis module determines the initial search line and is further configured to:
[0137] The grayscale value of the initial search line is obtained; when the grayscale value belongs to a first preset range, the initial search line is a bright line; when the grayscale value belongs to a second preset range, the initial search line is a dark line.
[0138] In some embodiments, after determining the target search line according to the first endpoint and the target search point, the analysis module is further configured to:
[0139] When the connection line identifier corresponding to the target search point is the same as the detection line identifier corresponding to the first endpoint, the connection line and the detection line are collinear; when the connection line identifier corresponding to the target search point is different from the detection line identifier corresponding to the first endpoint, the connection line and the detection line are not collinear.
[0140] In some embodiments, the construction module determines an initial search line based on the first endpoint of the detection line and the first direction of the first endpoint, and is further configured to:
[0141] Based on the detection line, a first endpoint and a first direction of the detection line are determined; starting from the first endpoint and along the first direction of the first endpoint, an initial search line is determined, wherein the length of the initial search line is determined by the filtering parameter.
[0142] In some embodiments, when the detection line is a center line, the acquisition module determines the detection line in the image to be detected, and is further configured to:
[0143] Based on the second-order partial derivative of each pixel point after filtering the image to be tested, a curve model of each pixel point is constructed;
[0144] Determine the target center point of the image to be tested based on the curve model of each pixel point and the preset screening threshold;
[0145] Based on the target center point, determine the center line of the image to be measured.
[0146] In some embodiments, when the preset screening threshold includes a preset high threshold and a preset low threshold, the acquisition module determines the target center point of the image to be measured based on the curve model of each pixel point and the preset screening threshold, and is further used to:
[0147] Based on the constructed first curve model, the initial center point of the pixel point is determined; when the characteristic value of the initial center point is greater than or equal to the preset low threshold, the alternative center point is screened out from the initial center point; wherein, when the characteristic value of the alternative center point is greater than or equal to the preset high threshold, the alternative starting point is screened out from the alternative center point; when the characteristic value of the alternative center point is less than the preset high threshold, the alternative connection point is screened out from the alternative center point; based on the characteristic value of the alternative starting point, the target starting point is determined; based on the tangent direction of the characteristic vector of the target starting point, at least two adjacent center points are determined, and the adjacent center points include alternative connection points and / or alternative starting points; when the distance between the adjacent center point and the target starting point is the smallest, and the angle difference between the adjacent center point and the target starting point is the smallest, the corresponding adjacent center point is determined as the target connection point; based on the target starting point and the target connection point, the target center point is determined.
[0148] The embodiment of the present application provides a device for processing a broken line of a detection line, including an acquisition module, a construction module, and an analysis module, which determines at least one detection line from an image to be tested; an initial search line can be determined based on a first endpoint of the detection line and a first direction of the first endpoint; further, if a target search point that meets a preset connection condition exists on the initial search line, a target search line can be determined based on the first endpoint and the target search point on the connection line in the image to be tested. Therefore, it can be seen that the embodiment of the present application constructs an initial search line at the first endpoint of the detection line, and if a target search point that meets the preset connection condition exists on the initial search line, the target search line can be determined to extend the detection line, thereby improving the detection accuracy of the detection line in image detection.
[0149] The computer device also provided in the embodiment of the present application includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program. The computer program is used to implement the above-mentioned detection line break processing method. The implementation principle and technical effect are similar to those of the above-mentioned method embodiment and will not be repeated here.
[0150] The embodiment of the present application also provides a computer storage medium, on which a computer program is stored. The computer program is executed by a processor to execute the above-mentioned detection line break processing method. Its implementation principle and technical effects are similar to those of the above-mentioned method embodiment and will not be repeated here.
[0151] The following paragraphs will compare and list the Chinese terms involved in this application specification and their corresponding English terms to facilitate reading and understanding.
[0152] For ease of explanation, the above description has been made in conjunction with specific embodiments. However, the above discussion of some embodiments is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are intended to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
Claims
1. A method for processing a broken line of a detection line, characterized in that: include: Determining at least one detection line in the image to be tested; determining an initial search line based on a first endpoint of the detection line and a first direction of the first endpoint; If a target search point that meets a preset connection condition exists on the initial search line, determining a target search line according to the first endpoint and the target search point, wherein the target search point is located on a connection line in the image to be measured; Determination of target search points that meet preset connection conditions includes: determining a judgment value based on the gradient of each initial search point and the direction of the initial search line; When the initial search line is a bright line and there is an initial search point with a positive judgment value, screening out a target search point from the initial search points; When the initial search line is a dark line and there is an initial search point with a negative judgment value, the target search point is screened out from the initial search points.
2. The method for processing a broken line of a detection line according to claim 1, characterized in that: Determining the initial search line includes: Obtaining the grayscale value of the initial search line; When the grayscale value belongs to a first preset range, the initial search line is a bright line; When the grayscale value belongs to a second preset range, the initial search line is a dark line.
3. The method for processing a broken detection line according to claim 1, wherein: After determining the target search line according to the first endpoint and the target search point, the method further includes: When the connection line identifier corresponding to the target search point is the same as the detection line identifier corresponding to the first endpoint, the connection line and the detection line are collinear; When the connection line identifier corresponding to the target search point is different from the detection line identifier corresponding to the first endpoint, the connection line and the detection line are not collinear.
4. The method for processing a broken detection line according to claim 1, wherein: The determining of an initial search line based on the first endpoint of the detection line and the first direction of the first endpoint includes: determining, based on the detection line, a first endpoint of the detection line and a first direction of the first endpoint; An initial search line is determined with the first endpoint as a starting point and along a first direction of the first endpoint, wherein the length of the initial search line is determined by a filtering parameter.
5. The method for processing a broken detection line according to claim 1, wherein: When the detection line is a center line, determining the detection line in the image to be detected includes: Constructing a curve model of each pixel based on the second-order partial derivative of each pixel after filtering the image to be measured; Determine the target center point of the image to be measured based on the curve model of each pixel point and a preset screening threshold; Based on the target center point, a center line of the image to be measured is determined.
6. The method for processing a broken detection line according to claim 5, characterized in that: When the preset screening threshold includes a preset high threshold and a preset low threshold, determining the target center point of the image to be measured based on the curve model of each pixel point and the preset screening threshold includes: Determining an initial center point of the pixel based on the constructed first curve model; When the characteristic value of the initial center point is greater than or equal to a preset lower threshold, an alternative center point is selected from the initial center point; wherein, when the characteristic value of the alternative center point is greater than or equal to a preset upper threshold, an alternative starting point is selected from the alternative center point; when the characteristic value of the alternative center point is less than the preset upper threshold, an alternative connection point is selected from the alternative center point; Determining a target starting point based on the characteristic values of the candidate starting points; Determining at least two adjacent center points based on a tangent direction of a feature vector of the target starting point, wherein the adjacent center points include candidate connection points and / or candidate starting points; When the distance between the adjacent center point and the target starting point is the smallest, and the angle difference between the adjacent center point and the target starting point is the smallest, determining the corresponding adjacent center point as the target connection point; A target center point is determined based on the target starting point and the target connection point.
7. A device for processing a broken wire of a detection line, the device being applicable to the method according to any one of claims 1 to 6, characterized in that: include: An acquisition module, configured to determine at least one detection line in the image to be detected; a construction module, which determines an initial search line based on a first endpoint of the detection line and a first direction of the first endpoint; An analysis module is configured to determine a target search line according to the first endpoint and the target search point if a target search point that meets a preset connection condition exists on the initial search line, wherein the target search point is located on a connection line in the image to be measured.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for processing a disconnection of a detection line according to any one of claims 1 to 6 are implemented.
9. A computer storage medium, characterized in that The computer storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the method for processing a breakage of a detection line according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for closing fracture curve in image
CN106845495A
Road curve detection method, device and terminal
CN108197531A