CN117764961A - Method and device for processing disconnection scratch connection, electronic equipment and storage medium - Google Patents

Method and device for processing disconnection scratch connection, electronic equipment and storage medium Download PDF

Info

Publication number
CN117764961A
CN117764961A CN202311807935.6A CN202311807935A CN117764961A CN 117764961 A CN117764961 A CN 117764961A CN 202311807935 A CN202311807935 A CN 202311807935A CN 117764961 A CN117764961 A CN 117764961A
Authority
CN
China
Prior art keywords
target
starting point
scratch
connected domain
processed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311807935.6A
Other languages
Chinese (zh)
Inventor
张广顺
许江华
韩雪超
沈伟亮
卢天华
倪军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou AIMS Intelligent Technology Co Ltd
Original Assignee
Hangzhou AIMS Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou AIMS Intelligent Technology Co Ltd filed Critical Hangzhou AIMS Intelligent Technology Co Ltd
Priority to CN202311807935.6A priority Critical patent/CN117764961A/en
Publication of CN117764961A publication Critical patent/CN117764961A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention discloses a disconnection scratch connection processing method, a device, electronic equipment and a storage medium, which comprise the following steps: carrying out dynamic binarization processing on the picture to be processed comprising the break scratches to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; calculating an initial connected domain according to the dynamic binarization response graph, and filtering the initial connected domain to obtain a target connected domain matched with the to-be-processed break scratch; extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton; carrying out gradient quantization processing on a starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point; determining a starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point; and carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch. The technical scheme of the embodiment of the invention can improve the efficiency and the accuracy of the disconnection scratch connection processing.

Description

Method and device for processing disconnection scratch connection, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical fields of image processing, computer vision, quality detection and the like, in particular to a method and a device for processing disconnection scratch connection, electronic equipment and a storage medium.
Background
With the development of intelligent manufacturing industry, the industrial production efficiency is greatly improved, and the high-speed production line is not suitable for defect detection by using an inefficient visual inspection mode of workers. Meanwhile, with the development of artificial intelligence technologies such as computer vision technology, the AOI (Automated Optical Inspection, automatic optical inspection) technology is widely applied to the defect inspection field of products.
Currently, in the field of image algorithms for defect detection, morphological closing operations are generally employed for broken scratches. The morphological closing operation is a morphological processing method which can make the boundary disappear and the image become smoother and more continuous by expanding and then contracting the shape. The closing operation is typically used to eliminate small objects, fill voids, and join two separate objects.
The inventors have found that the following drawbacks exist in the prior art in the process of implementing the present invention: the method of morphological closing operation to deal with break scratches is generally applicable only to scenes between break scratches that are very close, and a large connection coefficient needs to be set for the break scratches that are large in distance. However, the larger the connection coefficient, the more time consuming the closing operation is generally, and the larger connection coefficient also easily causes erroneous scored connections.
Disclosure of Invention
The embodiment of the invention provides a disconnection scratch connection processing method, a device, electronic equipment and a storage medium, which can improve the efficiency and accuracy of the disconnection scratch connection processing.
According to an aspect of the present invention, there is provided a disconnection scratch connection processing method including:
carrying out dynamic binarization processing on the picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed;
calculating an initial connected domain according to the dynamic binarization response graph, and filtering the initial connected domain to obtain a target connected domain matched with the to-be-processed break scratch;
extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton;
performing gradient quantization processing on a starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point;
determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point;
and carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
According to another aspect of the present invention, there is provided a break scratch connection processing apparatus including:
the dynamic binarization response diagram acquisition module is used for carrying out dynamic binarization processing on the picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed;
the target connected domain acquisition module is used for calculating an initial connected domain according to the dynamic binary response graph, and filtering the initial connected domain to obtain the target connected domain matched with the to-be-processed break scratch;
the starting point set determining module is used for extracting a scratch skeleton from the target connected domain and determining a starting point set corresponding to a target starting point according to the scratch skeleton;
the gradient quantization matrix acquisition module is used for carrying out gradient quantization processing on the initial point set corresponding to the target initial point to obtain a gradient quantization matrix of the target initial point;
the starting point determining module is used for determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point;
and the scratch connection processing module is used for carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of disconnection scratch connection processing according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the method for processing a break scratch connection according to any one of the embodiments of the present invention when executed.
According to the embodiment of the invention, the dynamic binarization processing is carried out on the picture to be processed comprising the break scratches to be processed to obtain the dynamic binarization response graph matched with the picture to be processed, so that the initial connected domain is calculated according to the dynamic binarization response graph, and the filtering processing is carried out on the initial connected domain to obtain the target connected domain matched with the break scratches to be processed. Further, extracting a scratch skeleton from the target connected domain, determining a starting point set corresponding to the target starting point according to the scratch skeleton, and performing gradient quantization processing on the starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point. After the gradient quantization matrix is obtained, the starting point of the to-be-processed breaking scratch is determined from the target starting point according to the gradient quantization matrix of the target starting point, so that the connection processing of the to-be-processed breaking scratch is carried out according to the starting point of the to-be-processed breaking scratch. The technical scheme can solve the problems of lower efficiency and accuracy and the like of the existing disconnection scratch connection processing method, and can improve the efficiency and accuracy of the disconnection scratch connection processing.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for processing a broken scratch connection according to a first embodiment of the present invention;
fig. 2 is a flowchart of a method for processing a broken scratch connection according to a second embodiment of the present invention;
fig. 3 is a schematic diagram of an effect of performing dynamic binarization processing on a picture to be processed according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram showing the effect of a dynamic binary response chart according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of calculating an initial connected domain and a surrounding rectangle of the connected domain according to a second embodiment of the present invention;
Fig. 6 is a schematic diagram of an effect of filtering an initial connected domain according to a second embodiment of the present invention;
fig. 7 is a schematic diagram of an effect of a scratch skeleton extracted from a target connected domain according to a second embodiment of the disclosure;
FIG. 8 is a schematic view of an effect of calculating an initial starting point for a scratch skeleton according to a second embodiment of the disclosure;
fig. 9 is a schematic structural diagram of a communication line according to a second embodiment of the present invention;
fig. 10 is a schematic diagram of a composition structure of a gradient quantization matrix according to a second embodiment of the present invention;
FIG. 11 is a schematic diagram of a composition structure of a gradient quantization matrix for each target starting point according to a second embodiment of the present invention;
fig. 12 is a schematic diagram of a composition structure of a splicing gradient quantization matrix according to a second embodiment of the present invention;
fig. 13 is a schematic view of a broken score connection processing device according to a third embodiment of the present invention;
fig. 14 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and "object" in the description of the present invention and the claims and the above drawings are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a method for processing a break-off scratch connection according to an embodiment of the present invention, where the method may be applied to a case where a break-off scratch is rapidly identified according to a gradient quantization matrix to perform a connection processing on a break-off scratch, and the method may be implemented by a break-off scratch connection processing apparatus, which may be implemented by software and/or hardware, and may be generally integrated in an electronic device, which may be a terminal device or a server device, so long as the method can be used to process image data to implement the break-off scratch connection processing method. Accordingly, as shown in fig. 1, the method includes the following operations:
S110, carrying out dynamic binarization processing on a picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; the picture to be processed comprises a break scratch to be processed.
The picture to be processed may be a picture that needs to be subjected to the disconnection scratch connection processing. The break-off scratch to be processed may be a scratch in a broken state included in the picture to be processed. The dynamic binarization response map may be a picture obtained after the dynamic binarization processing is performed on the picture to be processed.
Optionally, a shot product picture may be obtained, and if there is a broken scratch in the product picture, the product picture may be used as a picture to be processed. After the picture to be processed is obtained, the picture to be processed can be subjected to dynamic binarization processing, and a dynamic binarization response diagram matched with the picture to be processed is obtained. The dynamic binarization process is understood to mean that each partial picture of the picture to be processed is dynamically binarized according to the respective threshold value.
S120, calculating an initial connected domain according to the dynamic binarization response graph, and filtering the initial connected domain to obtain the target connected domain matched with the to-be-processed break scratch.
The initial connected domain may be a connected domain obtained by first calculation based on a dynamic binary response graph. The connected domain (Connected Component) generally refers to an image region formed by foreground pixels having the same pixel value and adjacent to each other in the image. The target connected domain may be preliminarily judged, and there may be connected domains of the break scratches to be processed.
Correspondingly, after the dynamic binary response diagram corresponding to the picture to be processed is obtained, the dynamic binary response diagram can be subjected to connected region segmentation, and each connected region in the picture to be processed is found out and marked to serve as an initial connected region. After each initial connected domain is obtained, filtering treatment can be carried out on each initial connected domain according to a certain screening rule, and the target connected domain which possibly comprises a to-be-treated disconnection scratch is obtained.
S130, extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton.
The scratch skeleton can be skeleton information obtained by skeleton extraction of scratch lines, and can reflect structural characteristics of scratches. The target starting point may be a set of end points of each of the scratch skeletons and adjacent points of the end points.
In order to further analyze the scratches, after the target connected domain is obtained through calculation, a scratch skeleton can be extracted from the target connected domain, and a starting point set corresponding to each target starting point in the scratch skeleton is determined according to the extracted scratch skeleton.
It is understood that an endpoint may correspond to a set of starting points. The scratch skeleton extracted from one target connected domain can correspondingly generate a starting point set corresponding to at least two target starting points. The pixel points in the initial point set are part of the pixel points of the scratch skeleton.
And S140, carrying out gradient quantization processing on the initial point set corresponding to the target initial point to obtain a gradient quantization matrix of the target initial point.
The gradient quantization matrix may be a matrix formed by each gradient quantization value. Alternatively, the gradient quantization matrix may be a row matrix.
In the embodiment of the invention, after the starting point set corresponding to each target starting point is obtained, gradient quantization processing can be performed on the starting point set corresponding to each target starting point. Gradient quantization processing, that is, gradient calculation is performed between each pixel point in the starting point set, so as to obtain quantized values of a plurality of gradients. The quantized value of a gradient can be calculated between every two pixel points, and the quantized value of the gradient calculated between the pixel points can reflect the change trend of the pixel value between the two pixel points. Correspondingly, each two adjacent pixel points in the starting point set corresponding to the target starting point can be calculated to obtain a quantized value of a gradient, and the quantized values of the gradients are arranged in sequence to obtain a gradient quantized matrix of the target starting point.
Alternatively, the quantized value of the gradient may be measured by a fixed value, a tangent value of the pixel value difference between two pixel points, or a normalized value of the pixel value difference between two pixel points, so long as the trend of the pixel value change between every two adjacent pixel points can be reflected.
S150, determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point.
It can be understood that, since the gradient quantization matrix of the target start point is formed according to the quantization value of the gradient between every two adjacent pixels of the start point set corresponding to the target start point, the gradient quantization matrix can reflect the gradient quantization trend of each pixel in the start point set. The starting points of the to-be-processed break scratches can be screened from the target starting points by analyzing the gradient quantization trend reacted by the gradient quantization matrix of the target starting points.
In general, when the change trend of each matrix element value in the gradient quantization matrix corresponding to two target starting points is consistent, the two target starting points can be considered to belong to the same starting point of the break scratch. On the contrary, when the change trend of each matrix element value in the gradient quantization matrix corresponding to the two target starting points is inconsistent, the two target starting points can be considered to be not the starting points of the same break scratches.
Therefore, the embodiment of the invention can rapidly position the change rule of each pixel point in the starting point set corresponding to each target starting point by analyzing the gradient quantization matrix of the target starting point, and can rapidly screen and position the starting point of the break scratch by combining the judging rule of the break scratch, thereby improving the recognition efficiency and precision of the break scratch and further improving the efficiency and accuracy of the break scratch connection processing.
And S160, carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
Correspondingly, after each starting point of the to-be-processed breaking scratch is determined, connection processing can be performed on each starting point of the to-be-processed breaking scratch at the breaking position, so that the to-be-processed breaking scratch is connected to form a complete scratch.
In a specific application scene, the complete scratches formed by connection can be used for accurately calculating the length of a single scratch, so that the problem root of product scratches caused by tracking and positioning is facilitated, and the production quality of products is improved. The method for processing the disconnection scratch connection can be widely applied to the application scene of industrial defect detection.
According to the embodiment of the invention, the dynamic binarization processing is carried out on the picture to be processed comprising the break scratches to be processed to obtain the dynamic binarization response graph matched with the picture to be processed, so that the initial connected domain is calculated according to the dynamic binarization response graph, and the filtering processing is carried out on the initial connected domain to obtain the target connected domain matched with the break scratches to be processed. Further, extracting a scratch skeleton from the target connected domain, determining a starting point set corresponding to the target starting point according to the scratch skeleton, and performing gradient quantization processing on the starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point. After the gradient quantization matrix is obtained, the starting point of the to-be-processed breaking scratch is determined from the target starting point according to the gradient quantization matrix of the target starting point, so that the connection processing of the to-be-processed breaking scratch is carried out according to the starting point of the to-be-processed breaking scratch. The technical scheme can solve the problems of lower efficiency and accuracy and the like of the existing disconnection scratch connection processing method, and can improve the efficiency and accuracy of the disconnection scratch connection processing.
Example two
Fig. 2 is a flowchart of a method for processing connection of a break scratch according to a second embodiment of the present invention, where the present embodiment is based on the above embodiment, and in the present embodiment, various specific optional implementations of performing dynamic binarization processing on a picture to be processed, calculating an initial connected domain, determining a start point set corresponding to a target start point, performing gradient quantization processing on the start point set corresponding to the target start point, and determining a start point of a break scratch to be processed are provided. Accordingly, as shown in fig. 2, the method of this embodiment may include:
s210, carrying out dynamic binarization processing on a picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; the picture to be processed comprises a break scratch to be processed.
In an optional embodiment of the present invention, the performing dynamic binarization processing on the to-be-processed picture to obtain a dynamic binarization response map matched with the to-be-processed picture may include: determining slice configuration information; the slice configuration information comprises a slice shape and a slice moving step length; traversing and slicing the picture to be processed according to the slice configuration information to obtain a plurality of slice local pictures; calculating a gray average value of pixel points included in each slice local picture; taking the gray average value of each slice local picture as a binarization threshold value of each slice local picture, and carrying out binarization processing on each slice local picture according to the binarization threshold value of each slice local picture to obtain a plurality of binarization slice local pictures; and carrying out splicing treatment on the local pictures of the binarization slices to obtain a dynamic binarization response graph matched with the picture to be treated.
The slice configuration information may be reference configuration information for performing dynamic binarization processing on the picture to be processed. The slice shape may be a shape for performing slice processing on the picture to be processed, and may be, for example, a rectangle or square in order to ensure traversal processing of the picture to be processed. As long as the image to be processed can be sliced, and the local image obtained by slicing can cover the whole image to be processed, the embodiment of the invention does not limit the specific shape type of the slice shape. The slice movement step length, that is, the step length for moving the slice shape, can be configured according to actual requirements, and the embodiment of the invention does not limit the specific value of the slice movement step length. And slicing the local picture, namely gradually slicing the picture to be processed according to the slice moving step length by utilizing the slice shape to obtain the local picture of the picture to be processed. It will be appreciated that the number of slice partial pictures is typically a plurality. The gray average value may be an average value of gray values of pixel points included in the slice partial picture. The binarization threshold value is the threshold value which can be subjected to binarization processing. The binarized slice local picture may be a picture obtained by binarizing the slice local picture.
In the embodiment of the invention, a fixed rectangle or square can be adopted as a slice shape, and a proper slice moving step length is set to traverse the slice of the picture to be processed. Fig. 3 is a schematic diagram of an effect of performing dynamic binarization processing on a picture to be processed according to a second embodiment of the present invention. In a specific example, as shown in fig. 3, the length and width of the slice shape may be determined according to the detection specification length of the scratch in the picture to be processed. For example, assuming that the detection specification length of the scratch is len, the length and width of the slice shape may be set to 5×len, and the slice movement step length in the lateral and longitudinal directions may be set to len/2.
Correspondingly, after traversing the slice to the picture to be processed according to the slice configuration information to obtain a plurality of slice local pictures, the gray average value of each slice local picture can be calculated. Alternatively, the gray average of the slice local picture can be calculated using the following formula:
wherein Mean represents the gray average value of the slice local picture, r represents the length of the slice shape, and c represents the slice shapeIs a width of (c). G (x) i ,y j ) Represents the pixel point (x) i ,y j ) The function sort () represents the ordering of the gray values of all pixels within a slice partial picture, d being a constant greater than 0 and less than 1. For example, when d takes a value of 0.6, the physical meaning of the formula is to remove the first 20% and the last 20% of pixel values in the partial slice picture, calculate the gray average value of the pixels by using the remaining 60% of pixel points, and can effectively avoid the influence of the abnormal interference points on the gray average value.
After the gray average value of each slice local picture is obtained, the obtained gray average value can be used as a binarization threshold value to carry out binarization processing on the corresponding slice local picture. Each slice local picture adopts the gray average value obtained by the picture calculation to carry out binarization processing, for example, when the gray value of the current pixel point in the picture is smaller than or equal to the gray average value, the gray value of the current pixel point is set to be 0; when the gray value of the current pixel point in the picture is larger than the gray average value, the gray value of the current pixel point is set to 255. For the whole picture to be processed, the gray average value obtained by each slice local picture is not necessarily the same, so that the binarization threshold value corresponding to each slice local picture is dynamically changed.
Fig. 4 is a schematic diagram of the effect of a dynamic binary response chart according to a second embodiment of the present invention. In a specific example, as shown in fig. 3 and fig. 4, after each slice local picture obtained by slicing in fig. 3 is binarized to obtain each binarized slice local picture, the dynamic binarized response map corresponding to the original picture to be processed as shown in fig. 4 is obtained by further performing stitching processing on each binarized slice local picture.
S220, calculating an initial connected domain according to the dynamic binarization response diagram, and filtering the initial connected domain to obtain the target connected domain matched with the to-be-processed break scratch.
In an optional embodiment of the present invention, the filtering the initial connected domain may include: calculating the area of the connected domain and the surrounding rectangle of the connected domain for each initial connected domain; filtering the bulk interference area from the initial connected domain according to the size relation between the connected domain area of each initial connected domain and the target connected domain area threshold; and/or filtering noise interference areas from the initial connected domains according to the size relation between the connected domain area of each initial connected domain and the area of the connected domain surrounding rectangle and the size relation between the length and the width of the connected domain surrounding rectangle.
The connected domain area may be the number of effective pixel points actually included in the initial connected domain. The effective pixel point may be understood as a pixel point connected domain surrounding rectangle included by a scratch, a noise point, a cluster trace, or the like may be a minimum surrounding rectangle of the initial connected domain. The target connected domain area threshold may be a preset area threshold, which is used for screening and judging the area of the initial connected domain calculation connected domain.
Fig. 5 is a schematic diagram of calculating an initial connected domain and an effect of surrounding a rectangle of the connected domain according to the second embodiment of the present invention, and fig. 6 is a schematic diagram of an effect of filtering the initial connected domain according to the second embodiment of the present invention. In a specific example, as shown in fig. 4 and 5, since the scratches are generally in a thin strip shape, after the initial connected domain is calculated, the connected domain area and the connected domain surrounding rectangle may be calculated for each initial connected domain, so that the interference area is filtered according to the connected domain area and the connected domain surrounding rectangle, and the scratched area in the picture is screened out.
Specifically, the size relationship between the connected domain area of the initial connected domain and the target connected domain area threshold can be compared, and the initial connected domain with the connected domain area larger than the target connected domain area threshold is determined as a bulk interference area and filtered. Meanwhile, the size relation between the area of the connected domain of each initial connected domain and the area of the corresponding connected domain surrounding rectangle can be compared, and the size relation between the length and the width of the connected domain surrounding rectangle can be compared, so that the noise interference filtering area can be screened.
Alternatively, the scratch area in the picture may be screened out based on the following formula:
Wherein a represents the area of the connected domain, i.e. the number of actual effective pixels (e.g. the number of white pixels) in the connected domain except for the foreground. w represents the width of the connected domain surrounding rectangle, and h represents the height of the connected domain surrounding rectangle. M represents a target connected domain area threshold. a. b and c are constants. For example, the value of M may be 25, the value of a may be 4, the value of b may be 3, the value of c may be 3, etc., and the specific values of M, a, b, and c are not limited in the embodiment of the present invention.
According to the above formula, the cluster interference region (1) and the noise interference region (6) in fig. 5 can be filtered out without affecting the linear regions (2), (3), (4) and (5), and the target connected regions can be obtained as the linear regions (2), (3), (4) and (5).
S230, extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton.
Fig. 7 is a schematic diagram of an effect of a scratch skeleton extracted from a target connected domain according to a second embodiment of the disclosure. In a specific example, as shown in fig. 6 and 7, a scratch skeleton is extracted from the target connected domain obtained in fig. 6, and a scratch skeleton as shown in fig. 7 can be obtained. Alternatively, any two connected pixels in the scratch skeleton are connected by means of a single pixel. That is, the line width of the scratch skeleton may be 1 pixel value.
In an optional embodiment of the present invention, the determining, according to the scratch skeleton, a start point set corresponding to a target start point may include: calculating an initial skeleton connected domain for the scratch skeleton, and calculating an initial starting point in the initial skeleton connected domain; screening target starting points from the initial starting points; calculating a target skeleton connected domain corresponding to each target starting point according to a target skeleton connected domain calculation rule; and taking skeleton pixel points included in the target skeleton connected domain corresponding to each target starting point as a starting point set corresponding to the target starting point.
The initial skeleton connected domain may be a connected domain obtained by calculating a scratch skeleton. The initial starting point may be a starting point preliminarily calculated from the initial skeleton connected domain. The target starting point may be a starting point obtained by performing a preliminary screening on the initial starting point. The target skeleton connected domain calculation rule may be used to calculate the target skeleton connected domain with reference. The target skeleton connected domain may be a connected domain constituted by a start point and other pixel points near the start point. Skeleton pixels are pixels that form the skeleton.
Fig. 8 is a schematic view of an effect of calculating an initial starting point for a scratch skeleton according to a second embodiment of the disclosure. In a specific example, as shown in fig. 7 and 8, after the scratch skeleton is calculated, an initial skeleton connected domain may be further calculated for the scratch skeleton, and an initial start point in the initial skeleton connected domain may be calculated, and the point A, B, C, D, E, F, G, H, K shown in fig. 8 is an initial start point, except that any point in the scratch skeleton is not an initial start point.
It is understood that if the skeleton information of the non-break scratches is included in the scratch skeleton, a part of the initial starting points are starting points of the break scratches. Therefore, after the initial starting point is obtained, the initial starting point may be initially screened, so that the initial starting point which may not be the same scratch is excluded, and the screened target starting point is obtained.
In an optional embodiment of the present invention, the selecting a target starting point from the initial starting points may include: calculating Euclidean distance between every two initial starting points; and taking the initial starting point of which the Euclidean distance is smaller than a set Euclidean distance threshold as the target starting point.
The specific value for setting the euclidean distance threshold may be set according to actual requirements, and the embodiment of the present invention does not limit the specific value for setting the euclidean distance threshold.
Continuing with the example above, there are a total of 9 initial starting points A, B, C, D, E, F, G, H, K in FIG. 8. It is apparent that for the initial starting point C, it is closer to the initial starting point D and the initial starting point F, and is likely to be the initial starting point of the same scratch broken. And the initial starting point C is far from the initial starting point H and the initial starting point K, it is unlikely that the initial starting point of the same scratch is the initial starting point. Thus, the starting points of the broken scratches can be initially screened according to the distance between the initial starting points, and 3 target starting points such as C, D, F and the like can be obtained.
Alternatively, the following formula may be used to calculate the Euclidean distance between the two initial starting points:
wherein P (P x ,P y ) Sum point Q (Q) x ,Q y ) Representing two initial starting points, D min Indicating that the euclidean distance threshold is set. The meaning of the above formula is that when the euclidean distance between two initial starting points is less than the set euclidean distance threshold, it means that the two initial starting points may be the target starting points of the same broken scratch.
Correspondingly, after the target starting points are obtained through Euclidean distance screening between the initial starting points, the target skeleton connected domains corresponding to the target starting points can be calculated according to the calculation rules of the target skeleton connected domains, and skeleton pixel points included in the target skeleton connected domains corresponding to the target starting points are used as a starting point set corresponding to the target starting points.
Optionally, calculating the target skeleton connected domain corresponding to each target starting point according to the target skeleton connected domain calculation rule may specifically include the following operations: and taking the current target starting point as a seed point, and calculating the current skeleton connected domain. After the number of the pixel points included in the current skeleton connected domain is determined to reach the set number, such as len/3, calculation of determining the current skeleton connected domain can be stopped, and the current skeleton connected domain is used as a target skeleton connected domain corresponding to the current target starting point. Accordingly, all skeleton pixel points included in the target skeleton connected domain corresponding to the current target starting point can be used as a starting point set corresponding to the current target starting point. Where len represents the specification length of detecting scratches, that is, the number of skeleton pixel points included in the starting point set may be generally set to 1/3 of the scratch length detection specification.
In a specific example, as shown in fig. 8, assuming that a is a current target starting point, calculating a starting point set corresponding to the current target starting point a according to a target skeleton connected domain calculation rule may be a set formed by pixel points of the AJ segment.
S240, determining a target gradient quantization function of gradient quantization processing.
Wherein the target gradient quantization function may be used to calculate a gradient quantization value between every two pixel points.
S250, carrying out gradient quantization processing on the initial point set corresponding to the target initial point according to the target gradient quantization function, and obtaining gradient quantization values of the initial point set corresponding to each target initial point.
In the embodiment of the present invention, when the gradient quantization processing is performed on the starting point set, for convenience of analysis, the gradient is further quantized into an arctangent function, which is expressed by radian, and a specific target gradient quantization function may be:
wherein the point Deltax i Representing the difference, Δy, between the (i+1) th pixel and the i-th pixel in the same set of start points i Representing the difference in ordinate between the (i+1) th pixel point and the i-th pixel point in the same start point set. ri represents the i-th gradient quantization value obtained, and the i-th gradient quantization value may be a gradient quantization value between the (i+1) -th pixel point and the i-th pixel point.
It should be noted that, since the tangent function itself is discontinuous, it may cause abrupt changes at-pi/2 and pi/2, and may cause a smooth curve to have a very large jump value. Fig. 9 is a schematic structural diagram of a communication line according to a second embodiment of the present invention. In a specific example, as shown in fig. 9, points J, K and L are points on the connected line GH, respectively, when the gradient quantization value is calculated by using a formula for solving ri as the target gradient quantization function, the jump amplitude is found to be relatively large and close to pi when the gradient between the quantization point J, K and the point K, L changes. Thus, in order to make the result of the gradient quantization value continuous, the final adopted target gradient quantization function may be:
where Ri represents the final target gradient quantization function employed. The meaning of the above formula is: when the j-th gradient quantization value is close to-pi/2 but is always larger than-pi/2, pi is added to the j-th gradient quantization value from 1 st to j-th gradient quantization value respectively, otherwise, the gradient quantization value is unchanged.
S260, generating a gradient quantization matrix of the target starting point according to the gradient quantization value of the starting point set corresponding to each target starting point.
Specifically, the gradient quantization matrix of each target starting point can be obtained by sequentially sequencing the gradient quantization values of the starting point set corresponding to each target starting point.
Fig. 10 is a schematic diagram of a composition structure of a gradient quantization matrix according to a second embodiment of the present invention. In a specific example, taking the initial point set corresponding to AJ in fig. 8 as an example, the point set includes len/3 points, and (len/3-k) gradient quantization values are obtained, and each gradient quantization value is sequenced to obtain a gradient quantization matrix corresponding to the target initial point a shown in fig. 9. Where k=1, 2,3,4, 5..k=1, 2,3 is generally taken to mean that the gradient quantization matrix consists of partial gradient quantization values. As can be seen from fig. 10, the variation trend of the matrix element values of the gradient quantization matrix can reflect the gradient quantization trend of the pixel points in the starting point set.
Alternatively, the solution formula of ri may be directly adopted as the target gradient quantization function, each gradient quantization value is calculated according to the solution formula of ri, and the gradient quantization matrix of the target starting point is generated according to the gradient quantization value. At this time, considering the problem of discontinuous definition of the tangent function, the gradient jump matrix can be calculated by subtracting the former from the latter in every two adjacent matrix elements in the gradient quantization matrix. After the gradient jump matrix is obtained, target matrix elements which jump more than pi/2 with adjacent matrix elements in the gradient jump matrix can be found, 1 st matrix element is added to the target matrix elements, pi is added or minus pi is subtracted from each element value, matrix element values in original positions are replaced, and smooth processing of the gradient jump matrix is achieved.
Alternatively, the gradient hopping matrix can be smoothed based on the following formula:
wherein V is n Is the value of the nth matrix element in the gradient hopping matrix, V m And V m+1 Is the value of two matrix elements that are adjacent and hop beyond pi/2. The meaning of the above formula is: when the value of the (m+1) th matrix element minus the m-th matrix element is larger than pi/2, adding pi to the 1 st to m-th matrix elements in the gradient jump matrix; when the value of the (m+1) th matrix element minus the m-th matrix element is smaller than-pi/2, the 1 st to m-th matrix elements in the gradient hopping matrix are subtracted by pi.
S270, determining a first target reference starting point and a second target reference starting point according to the gradient quantization matrix of the target starting point.
Wherein the first target reference starting point may be one of target starting points screened from the target starting points. The second target reference starting point may be the remaining target starting points other than the first target reference starting point among the target starting points.
In a specific example, as shown in fig. 8, assuming that the screened target start points include points C, D and F, point C may be determined as a first target reference start point and points D and F may be determined as a second target reference start point.
S280, splicing the gradient quantization matrix of the first target reference starting point and the gradient quantization matrix of the second target reference starting point to obtain a spliced gradient quantization matrix corresponding to each second target reference starting point.
The splicing gradient quantization matrix may be a matrix obtained by splicing a gradient quantization matrix or a gradient jump matrix of the first target reference starting point and the second target reference starting point.
S290, determining the starting point of the to-be-processed break scratch from the target starting point according to the abrupt change condition of the absolute difference value of the gradient in each spliced gradient quantization matrix.
Fig. 11 is a schematic diagram of a composition structure of a gradient quantization matrix for each target starting point according to a second embodiment of the present invention. Fig. 12 is a schematic diagram of a composition structure of a splicing gradient quantization matrix according to a second embodiment of the present invention. In a specific example, taking the splicing process of the gradient quantization matrix to obtain a spliced gradient quantization matrix as an example, as shown in fig. 8 and 11, taking the target starting point C as an example, the target starting point D and the target starting point F may be screened out on the same broken scratch as the target starting point C in a preliminary manner, so that the gradient quantization matrix of the starting point set corresponding to the target starting point C, D and the starting point F shown in fig. 11 can be obtained respectively.
As shown in fig. 11, the change trend of the gradient quantization matrix corresponding to the target starting point C is almost consistent with that of the gradient quantization matrix corresponding to the target starting point D, and the gradient quantization matrix corresponding to the target starting point D and the gradient quantization matrix corresponding to the target starting point F are respectively spliced behind the gradient quantization matrix corresponding to the target starting point C, so as to obtain the spliced gradient quantization matrix shown in fig. 12.
As can be seen from fig. 12, the values of matrix elements in the spliced gradient quantization matrices of the target start point C and the target start point D are identical, and the values of matrix elements having an absolute difference mutation exceeding a preset mutation value exist in the spliced gradient quantization matrices of the target start point C and the target start point F. Alternatively, the preset mutation value may be set to pi/4. I.e. the absolute difference between matrix element "-0.62" and matrix element "0.37" is 0.99, exceeding the preset abrupt value pi/4. Accordingly, the target start point C and the target start point D may be considered as the start points of the scratches belonging to the same break, and the target start point C and the target start point F may not belong to the start points of the scratches belonging to the same break.
S2110, carrying out connection processing on the to-be-processed breaking scratches according to the starting points of the to-be-processed breaking scratches.
In summary, by traversing the splicing gradient quantization matrix, if no element with the absolute value of the difference value between the adjacent matrix elements exceeding the preset abrupt value is found, it can be considered that the two target starting points corresponding to the splicing gradient quantization matrix belong to the starting point of one break scratch, and then the break scratches can be connected according to the starting point of the break scratch, so that the break scratches can be perfectly connected, and the length of a single complete scratch can be accurately and rapidly calculated.
According to the technical scheme, after the starting point set corresponding to each target starting point in the picture to be processed is obtained, the gradient quantization matrix of the target starting point is calculated and generated by utilizing various optional target gradient quantization functions, the splicing gradient quantization matrix is further generated according to the gradient quantization matrix, the starting point of the scratch to be processed is determined from the target starting points according to the abrupt change condition of the absolute difference of the gradient in the splicing gradient quantization matrix between the target starting points, the starting point of the scratch to be processed can be rapidly identified and judged, and then the scratch to be processed is connected through the starting point of the scratch to be processed, so that the efficiency and the accuracy of the scratch connection processing to be disconnected can be improved.
It should be noted that any permutation and combination of the technical features in the above embodiments also belong to the protection scope of the present invention.
Example III
Fig. 13 is a schematic view of a device for handling broken scratch connection according to a third embodiment of the present invention, as shown in fig. 13, where the device includes: a dynamic binarization response map acquisition module 310, a target connected domain acquisition module 320, a start point set determination module 330, a gradient quantization matrix acquisition module 340, a start point determination module 350, and a scratch connection processing module 360, wherein:
A dynamic binarization response map obtaining module 310, configured to perform dynamic binarization processing on a picture to be processed to obtain a dynamic binarization response map matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed;
the target connected domain obtaining module 320 is configured to calculate an initial connected domain according to the dynamic binary response graph, and perform filtering treatment on the initial connected domain to obtain a target connected domain matched with the to-be-treated break scratch;
the starting point set determining module 330 is configured to extract a scratch skeleton from the target connected domain, and determine a starting point set corresponding to a target starting point according to the scratch skeleton;
the gradient quantization matrix obtaining module 340 is configured to perform gradient quantization processing on a start point set corresponding to the target start point, so as to obtain a gradient quantization matrix of the target start point;
a starting point determining module 350, configured to determine a starting point of the break-off scratch to be processed from the target starting points according to a gradient quantization matrix of the target starting points;
and the scratch connection processing module 360 is configured to perform connection processing on the to-be-processed disconnection scratch according to a starting point of the to-be-processed disconnection scratch.
According to the embodiment of the invention, the dynamic binarization processing is carried out on the picture to be processed comprising the break scratches to be processed to obtain the dynamic binarization response graph matched with the picture to be processed, so that the initial connected domain is calculated according to the dynamic binarization response graph, and the filtering processing is carried out on the initial connected domain to obtain the target connected domain matched with the break scratches to be processed. Further, extracting a scratch skeleton from the target connected domain, determining a starting point set corresponding to the target starting point according to the scratch skeleton, and performing gradient quantization processing on the starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point. After the gradient quantization matrix is obtained, the starting point of the to-be-processed breaking scratch is determined from the target starting point according to the gradient quantization matrix of the target starting point, so that the connection processing of the to-be-processed breaking scratch is carried out according to the starting point of the to-be-processed breaking scratch. The technical scheme can solve the problems of lower efficiency and accuracy and the like of the existing disconnection scratch connection processing method, and can improve the efficiency and accuracy of the disconnection scratch connection processing.
Optionally, the dynamic binary response map obtaining module 310 is specifically configured to: determining slice configuration information; the slice configuration information comprises a slice shape and a slice moving step length; traversing and slicing the picture to be processed according to the slice configuration information to obtain a plurality of slice local pictures; calculating a gray average value of pixel points included in each slice local picture; taking the gray average value of each slice local picture as a binarization threshold value of each slice local picture, and carrying out binarization processing on each slice local picture according to the binarization threshold value of each slice local picture to obtain a plurality of binarization slice local pictures; and carrying out splicing treatment on the local pictures of the binarization slices to obtain a dynamic binarization response graph matched with the picture to be treated.
Optionally, the target connected domain obtaining module 320 is specifically configured to: calculating the area of the connected domain and the surrounding rectangle of the connected domain for each initial connected domain; filtering the bulk interference area from the initial connected domain according to the size relation between the connected domain area of each initial connected domain and the target connected domain area threshold; and/or filtering noise interference areas from the initial connected domains according to the size relation between the connected domain area of each initial connected domain and the area of the connected domain surrounding rectangle and the size relation between the length and the width of the connected domain surrounding rectangle.
Optionally, the starting point set determining module 330 is specifically configured to: calculating an initial skeleton connected domain for the scratch skeleton, and calculating an initial starting point in the initial skeleton connected domain; screening target starting points from the initial starting points; calculating a target skeleton connected domain corresponding to each target starting point according to a target skeleton connected domain calculation rule; and taking skeleton pixel points included in the target skeleton connected domain corresponding to each target starting point as a starting point set corresponding to the target starting point.
Optionally, the starting point set determining module 330 is specifically configured to: calculating Euclidean distance between every two initial starting points; and taking the initial starting point of which the Euclidean distance is smaller than a set Euclidean distance threshold as the target starting point.
Optionally, the gradient quantization matrix acquisition module 340 is specifically configured to: determining a target gradient quantization function of gradient quantization processing; performing gradient quantization processing on the initial point set corresponding to the target initial point according to the target gradient quantization function to obtain gradient quantization values of the initial point set corresponding to each target initial point; and generating a gradient quantization matrix of the target starting point according to the gradient quantization value of the starting point set corresponding to each target starting point.
Optionally, the starting point determining module 350 is specifically configured to: determining a first target reference starting point and a second target reference starting point according to the gradient quantization matrix of the target starting point; splicing the gradient quantization matrix of the first target reference starting point and the gradient quantization matrix of the second target reference starting point to obtain splicing gradient quantization matrices corresponding to the second target reference starting point; and determining the starting point of the to-be-processed break scratch from the target starting point according to the abrupt change condition of the absolute difference value of the gradient in each spliced gradient quantization matrix.
The disconnection scratch connection processing device can execute the disconnection scratch connection processing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment can be seen in the disconnection scratch connection processing method provided in any embodiment of the present invention.
Since the above-described break-score connection processing apparatus is an apparatus capable of executing the break-score connection processing method in the embodiment of the present invention, a person skilled in the art will be able to understand the specific implementation of the break-score connection processing apparatus of the embodiment and various modifications thereof based on the break-score connection processing method described in the embodiment of the present invention, so how the break-score connection processing apparatus implements the break-score connection processing method in the embodiment of the present invention will not be described in detail herein. The device used to implement the method for breaking the scratch connection according to the embodiments of the present invention falls within the scope of protection of the present application.
Example IV
Fig. 14 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 14, the electronic device 10 includes at least one processor 11, and a memory such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, such as the break scratch connection processing method.
In some embodiments, the break-away scratch connection processing method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the break scratch connection processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the break scratch connection processing method in any other suitable way (e.g. by means of firmware).
Optionally, the disconnection scratch connection processing method may include: carrying out dynamic binarization processing on the picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed; calculating an initial connected domain according to the dynamic binarization response graph, and filtering the initial connected domain to obtain a target connected domain matched with the to-be-processed break scratch; extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton; performing gradient quantization processing on a starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point; determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point; and carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.

Claims (10)

1. A break-score connection processing method, characterized by comprising:
carrying out dynamic binarization processing on the picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed;
calculating an initial connected domain according to the dynamic binarization response graph, and filtering the initial connected domain to obtain a target connected domain matched with the to-be-processed break scratch;
extracting a scratch skeleton from the target connected domain, and determining a starting point set corresponding to a target starting point according to the scratch skeleton;
Performing gradient quantization processing on a starting point set corresponding to the target starting point to obtain a gradient quantization matrix of the target starting point;
determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point;
and carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
2. The method according to claim 1, wherein the performing the dynamic binarization processing on the to-be-processed picture to obtain the dynamic binarization response map matched with the to-be-processed picture includes:
determining slice configuration information; the slice configuration information comprises a slice shape and a slice moving step length;
traversing and slicing the picture to be processed according to the slice configuration information to obtain a plurality of slice local pictures;
calculating a gray average value of pixel points included in each slice local picture;
taking the gray average value of each slice local picture as a binarization threshold value of each slice local picture, and carrying out binarization processing on each slice local picture according to the binarization threshold value of each slice local picture to obtain a plurality of binarization slice local pictures;
And carrying out splicing treatment on the local pictures of the binarization slices to obtain a dynamic binarization response graph matched with the picture to be treated.
3. The method of claim 1, wherein the filtering the initial connected domain comprises:
calculating the area of the connected domain and the surrounding rectangle of the connected domain for each initial connected domain;
filtering the bulk interference area from the initial connected domain according to the size relation between the connected domain area of each initial connected domain and the target connected domain area threshold; and/or
And filtering noise interference areas from the initial connected domains according to the size relation between the connected domain area of each initial connected domain and the area of the connected domain surrounding rectangle and the size relation between the length and the width of the connected domain surrounding rectangle.
4. The method according to claim 1, wherein the determining a set of start points corresponding to the target start point according to the scratch skeleton includes:
calculating an initial skeleton connected domain for the scratch skeleton, and calculating an initial starting point in the initial skeleton connected domain;
screening target starting points from the initial starting points;
calculating a target skeleton connected domain corresponding to each target starting point according to a target skeleton connected domain calculation rule;
And taking skeleton pixel points included in the target skeleton connected domain corresponding to each target starting point as a starting point set corresponding to the target starting point.
5. The method of claim 4, wherein said selecting a target starting point from among said initial starting points comprises:
calculating Euclidean distance between every two initial starting points;
and taking the initial starting point of which the Euclidean distance is smaller than a set Euclidean distance threshold as the target starting point.
6. The method of claim 1, wherein the performing gradient quantization processing on the start point set corresponding to the target start point to obtain a gradient quantization matrix of the target start point comprises:
determining a target gradient quantization function of gradient quantization processing;
performing gradient quantization processing on the initial point set corresponding to the target initial point according to the target gradient quantization function to obtain gradient quantization values of the initial point set corresponding to each target initial point;
and generating a gradient quantization matrix of the target starting point according to the gradient quantization value of the starting point set corresponding to each target starting point.
7. The method according to claim 1, wherein the determining the starting point of the break-up scratch to be processed from the target starting points according to the gradient quantization matrix of the target starting points comprises:
Determining a first target reference starting point and a second target reference starting point according to the gradient quantization matrix of the target starting point;
splicing the gradient quantization matrix of the first target reference starting point and the gradient quantization matrix of the second target reference starting point to obtain splicing gradient quantization matrices corresponding to the second target reference starting point;
and determining the starting point of the to-be-processed break scratch from the target starting point according to the abrupt change condition of the absolute difference value of the gradient in each spliced gradient quantization matrix.
8. A break-score connection processing device, characterized by comprising:
the dynamic binarization response diagram acquisition module is used for carrying out dynamic binarization processing on the picture to be processed to obtain a dynamic binarization response diagram matched with the picture to be processed; wherein the picture to be processed comprises a break scratch to be processed;
the target connected domain acquisition module is used for calculating an initial connected domain according to the dynamic binary response graph, and filtering the initial connected domain to obtain the target connected domain matched with the to-be-processed break scratch;
the starting point set determining module is used for extracting a scratch skeleton from the target connected domain and determining a starting point set corresponding to a target starting point according to the scratch skeleton;
The gradient quantization matrix acquisition module is used for carrying out gradient quantization processing on the initial point set corresponding to the target initial point to obtain a gradient quantization matrix of the target initial point;
the starting point determining module is used for determining the starting point of the to-be-processed break scratch from the target starting point according to the gradient quantization matrix of the target starting point;
and the scratch connection processing module is used for carrying out connection processing on the to-be-processed disconnection scratch according to the starting point of the to-be-processed disconnection scratch.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the break-score connection processing method of any one of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores computer instructions for causing a processor to implement the break score connection processing method according to any one of claims 1-7 when executed.
CN202311807935.6A 2023-12-26 2023-12-26 Method and device for processing disconnection scratch connection, electronic equipment and storage medium Pending CN117764961A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311807935.6A CN117764961A (en) 2023-12-26 2023-12-26 Method and device for processing disconnection scratch connection, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311807935.6A CN117764961A (en) 2023-12-26 2023-12-26 Method and device for processing disconnection scratch connection, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117764961A true CN117764961A (en) 2024-03-26

Family

ID=90314196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311807935.6A Pending CN117764961A (en) 2023-12-26 2023-12-26 Method and device for processing disconnection scratch connection, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117764961A (en)

Similar Documents

Publication Publication Date Title
CN112995535B (en) Method, apparatus, device and storage medium for processing video
CN115205291B (en) Circuit board detection method, device, equipment and medium
CN116559177A (en) Defect detection method, device, equipment and storage medium
CN115471476A (en) Method, device, equipment and medium for detecting component defects
CN115331132A (en) Detection method and device for automobile parts, electronic equipment and storage medium
CN115294332A (en) Image processing method, device, equipment and storage medium
CN115272290A (en) Defect detection method and device, electronic equipment and storage medium
CN116952958B (en) Defect detection method, device, electronic equipment and storage medium
CN117372499A (en) Log length and diameter determining method, device, equipment and storage medium
CN115272381B (en) Metal wire segmentation method and device, electronic equipment and storage medium
CN117764961A (en) Method and device for processing disconnection scratch connection, electronic equipment and storage medium
CN115700758A (en) Sperm activity detection method, device, equipment and storage medium
CN115205163A (en) Method, device and equipment for processing identification image and storage medium
CN114581711A (en) Target object detection method, apparatus, device, storage medium, and program product
CN117764964A (en) Cross scratch processing method and device, electronic equipment and storage medium
CN116823924B (en) Determination method and device for defect area, electronic equipment and storage medium
CN114037865B (en) Image processing method, apparatus, device, storage medium, and program product
CN117112816B (en) Sorting method, device, equipment and storage medium for security inspection images
CN117746069B (en) Graph searching model training method and graph searching method
CN117557777A (en) Sample image determining method and device, electronic equipment and storage medium
CN118014971A (en) Surface defect detection method, device and equipment for photovoltaic module and storage medium
CN116934739A (en) Image processing method, device, equipment and storage medium
CN117197051A (en) Defect grading method and device, electronic equipment and storage medium
CN117350995A (en) Product defect detection method, device, equipment and storage medium
CN117274361A (en) Material surface area measurement method and device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination