CN115496724A - Line width detection method and device and storage medium - Google Patents

Line width detection method and device and storage medium Download PDF

Info

Publication number
CN115496724A
CN115496724A CN202211158449.1A CN202211158449A CN115496724A CN 115496724 A CN115496724 A CN 115496724A CN 202211158449 A CN202211158449 A CN 202211158449A CN 115496724 A CN115496724 A CN 115496724A
Authority
CN
China
Prior art keywords
point
determining
line
target
image
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
CN202211158449.1A
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.)
Shenzhen Lingyun Shixun Technology Co ltd
Original Assignee
Shenzhen Lingyun Shixun 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 Shenzhen Lingyun Shixun Technology Co ltd filed Critical Shenzhen Lingyun Shixun Technology Co ltd
Priority to CN202211158449.1A priority Critical patent/CN115496724A/en
Publication of CN115496724A publication Critical patent/CN115496724A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30241Trajectory

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Algebra (AREA)
  • Geometry (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application relates to the technical field of visual images, in particular to a line width detection method, a line width detection device and a storage medium, and can solve the problem of low width detection efficiency of a bar-shaped track to a certain extent. The central line of the strip-shaped track in the image to be detected can be determined by acquiring the image to be detected and further by the partial derivative of each pixel point after the image to be detected is filtered; the search line of the target center point can be determined through the normal line of each target center point in the center line; by means of the method and the device, the width of the bar-shaped track can be determined based on the search lines, and the width detection efficiency of the bar-shaped track is improved.

Description

Line width detection method and device and storage medium
Technical Field
The present disclosure relates to the field of visual image technologies, and in particular, to a line width detection method, apparatus, and storage medium.
Background
With the continuous development of intelligent manufacturing, it is necessary to detect the strip-shaped tracks such as scratches and glue paths existing in the product to be detected, and by taking glue path detection as an example, by detecting the width of the glue path, it is one of the criteria for judging the pass of the glue path of the product to be detected.
In the related art, the detection of the bar track generally includes edge detection or edge extraction, extracting an edge profile of the bar track, including two edge lines, and determining, by a caliper tool in visual detection, an edge point pair from the two edge lines, and then determining the width of the bar track.
However, determining the width of the strip-shaped trajectory by means of the edge lines is inefficient.
Disclosure of Invention
In order to solve the problem of low width detection efficiency of the strip-shaped track, the application provides a line width detection method, a line width detection device and a storage medium.
The embodiment of the application is realized as follows:
a first aspect of the embodiments of the present application provides a line width detection method, including the following steps:
acquiring an image to be detected;
determining a central line of a strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through a target central point;
determining a search line based on the normal of each target center point;
based on the search lines, the width of the bar tracks is determined.
With reference to the first aspect, in a possible implementation manner, determining a search line based on a normal line of each target central point includes:
determining a search line through the center points of the targets and along the normal of the center points of the targets, wherein the length of the search line is determined by the filtering parameters;
determining a width of the bar track based on the search line, comprising:
determining edge points based on extreme values of the search lines and the gradient image, wherein the gradient image is determined by partial derivatives of all pixel points after the image to be detected is filtered;
based on the edge points, the width of the bar track is determined.
With reference to the first aspect, in a possible implementation manner, when the search line includes a first search line and a second search line, determining the search line based on a normal of each target center point includes:
determining a first search line through each target center point and along the normal direction of the target center point;
determining a second search line through each target center point and along the opposite direction of the normal direction of the target center point;
the length of the first search line is determined by the filter parameter and the preset coefficient, and the length of the first search line is the same as that of the second search line.
With reference to the first aspect, in a possible implementation manner, determining a width of a bar track based on a search line includes:
determining a first edge point based on the first search line and a first extreme value of the gradient image;
determining a second edge point based on the second search line and a second extreme value of the gradient image;
determining the width of the bar track based on the distance between the first edge point and the second edge point;
the gradient image is determined by the first-order partial derivative of each pixel after the image to be detected is filtered.
With reference to the first aspect, in a possible implementation manner, determining a width of a bar track based on a search line includes:
determining a real symmetric matrix for each search point on the search line based on a preset mask;
determining a second curve model of the gradient values of the gradient image based on the real symmetric matrix, wherein the second curve model is determined along the direction of the characteristic vector corresponding to the maximum characteristic value of the real symmetric matrix;
determining edge points based on the second curve model;
based on the edge points, the width of the bar trace is determined.
With reference to the first aspect, in a possible implementation manner, determining a center line of a strip trajectory in an image to be measured based on a partial derivative of each pixel after filtering the image to be measured includes:
constructing a first curve model of each pixel point based on a second-order partial derivative of each pixel point after the image to be detected is filtered;
determining a target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold;
and determining the central line of the image to be detected based on the target central point.
With reference to the first aspect, in a possible implementation manner, determining a target center point of an image to be detected based on a first curve model of each pixel point and a preset screening threshold includes:
determining an initial central point of a pixel point based on the constructed first curve model;
and screening out the target central point from the initial central point based on a preset screening threshold value.
With reference to the first aspect, in a possible implementation manner, when the preset filtering threshold includes a preset high threshold and a preset low threshold, the screening the target central point from the initial central point includes:
when the characteristic value of the initial central point is greater than or equal to a preset low threshold value, screening out an alternative central point from the initial central point; when the characteristic value of the alternative central point is greater than or equal to a preset high threshold value, screening an alternative starting point from the alternative central point; when the characteristic value of the alternative central point is smaller than a preset high threshold value, screening alternative connection points from the alternative central point;
determining a target starting point based on the characteristic value of the alternative starting point;
determining at least two adjacent central points based on the tangential direction of the feature vector of the target starting point, wherein the adjacent central points comprise alternative connecting points and/or alternative starting points;
when the distance between the adjacent central point and the target starting point is minimum and the angle difference between the adjacent central point and the target starting point is minimum, determining the corresponding adjacent central point as a target connecting point;
and determining a target central point based on the target starting point and the target connecting point.
A second aspect of the embodiments of the present application provides a line width detection apparatus, including an obtaining module, an analyzing module, and an executing module;
the acquisition module is used for acquiring an image to be detected;
the analysis module is used for determining a central line of a strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through a target central point;
the execution module is used for determining a search line based on the normal of each target central point;
and the execution module is also used for determining the width of the bar-shaped track based on the search line.
A third aspect of embodiments of the present application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program causes the processor to execute the steps of the line width detection method according to the first aspect of the disclosure.
The beneficial effects of the application are that; the central line of the strip-shaped track in the image to be detected can be determined by acquiring the image to be detected and further by the partial derivative of each pixel point after the image to be detected is filtered; the search line of the target center point can be determined through the normal line of each target center point in the center line; by means of the method and the device, the width of the bar-shaped track can be determined based on the search lines, and the width detection efficiency of the bar-shaped track is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 shows a schematic diagram of the detection of one type of glue line in application;
fig. 2 is a schematic flow chart illustrating a line width detection method provided in an embodiment of the present application;
fig. 3 is a schematic flow chart illustrating the determination of the center line of a bar track in a line width detection method provided by the embodiment of the present application;
fig. 4 is a schematic flow chart illustrating width determination of a bar track in a line width detection method provided by an embodiment of the present application;
fig. 5 is a schematic flowchart illustrating edge point determination in a line width detection method according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating a 3X 3 mask in a line width detection method according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating an example of edge point determination in a line width detection method provided in the embodiment of the present application;
fig. 8a shows a first schematic diagram of a width of a bar track in a line width detection method provided by the embodiment of the present application;
FIG. 8b is a second schematic diagram illustrating the width of a bar track in a line width detection method provided by the embodiment of the present application;
fig. 9 shows a schematic structural diagram of a line width detection device provided in an embodiment of the present application.
Detailed Description
To make the objects, embodiments and advantages of the present application clearer, the following description of exemplary embodiments of the present application will clearly and completely describe the exemplary embodiments of the present application with reference to the accompanying drawings in the exemplary embodiments of the present application, and it is to be understood that the described exemplary embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
It should be noted that the brief descriptions of the terms in the present application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of the present application. These terms should be understood in their ordinary and customary meaning unless otherwise indicated.
The terms "first," "second," "third," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between similar or analogous objects or entities and not necessarily for describing a particular sequential or chronological order, unless otherwise indicated. It is to be understood that the terms so used are interchangeable under appropriate circumstances.
The terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or apparatus that comprises a list of elements is not necessarily limited to all elements expressly listed, but may include other elements not expressly listed or inherent to such product or apparatus.
The strip-shaped tracks such as scratches, rubber paths and the like in the product to be detected can be detected through visual detection, the edge profile of the strip-shaped track is extracted through edge detection or edge extraction for the strip-shaped track detection, the strip-shaped track comprises two edge lines, the detected strip-shaped track is represented based on the two edge lines, and a certain distance is reserved between the two edge lines, namely the width of the strip-shaped track.
With the continuous development of intelligent manufacturing, it is necessary to detect the strip-shaped tracks such as scratches and glue paths existing in a product to be detected, taking glue path detection as an example, fig. 1 shows a schematic diagram of detection of a glue path in application, as shown in fig. 1, if the width of the glue path 10 in fig. 1 is detected, an edge in an image is extracted first, an edge line is determined, and then, after an edge point pair is determined from two edge lines by a caliper tool in visual detection, the width of the glue path 10 is determined.
In order to solve the above problems, the present application provides a line width detection method, device and storage medium, wherein a central line of a strip track in an image to be detected can be determined by obtaining the image to be detected and further by a partial derivative of each pixel point after filtering the image to be detected; the search line of the target center point can be determined through the normal line of each target center point in the center line; by means of the method and the device, the width of the bar-shaped track can be determined based on the search lines, and the width detection efficiency of the bar-shaped track is improved.
The line width detection method, apparatus, and storage medium according to embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 2 shows a schematic flow chart of a line width detection method provided in the embodiment of the present application, and as shown in fig. 2, the embodiment of the present application provides a line width detection method.
The line width detection method comprises the following steps:
and S110, acquiring an image to be detected.
The image to be detected is an image of the product to be detected, which is shot by the visual detection system, wherein a bar-shaped track may exist or not exist.
It should be noted that the strip-shaped trace described in the embodiment of the present application may be a scratch, a glue line, or other detections with a strip-shaped trace, so that an application scenario of the embodiment of the present application may be defect detection, quality detection, and the embodiment of the present application does not impose a too narrow limitation on this.
S120, determining a central line of the strip-shaped track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through the target central point.
For the filtering processing of the image to be detected, a first order partial derivative and a second order partial derivative can be solved through a gaussian function to obtain different gaussian kernels, the image to be detected is filtered based on the different gaussian kernels, a first order partial derivative corresponding to each pixel point on the image to be detected is determined, and then a second order partial derivative corresponding to each pixel point is obtained.
For example, for the pixel point D (x, y), the corresponding first partial derivative r is obtained by gaussian function filtering x 、r y Second partial derivative r xx 、r xy 、r yy
In some embodiments, the gradient image may be determined based on the first partial derivative of each pixel after filtering the image to be measured. The expression of the gradient image e (x, y) is as follows:
Figure BDA0003858374900000051
in some embodiments, a hessian (hessian) matrix may be constructed based on the second-order partial derivative of each pixel after filtering the image to be detected, and the feature value and the feature vector of the corresponding pixel in the image are obtained by solving the hessian matrix. The hessian matrix is as follows:
Figure BDA0003858374900000052
the hessian matrix is a square matrix formed by second-order partial derivatives of a multivariate function and is also a real symmetric matrix, the gray gradient change in each direction is described, and two eigenvalues and two corresponding eigenvectors are obtained by solving the hessian matrix. The directions of the two eigenvectors include the tangential direction and the normal direction. In the eigenvector obtained by using the hessian matrix of the corresponding point and the corresponding eigenvalue, the eigenvector corresponding to the larger eigenvalue is perpendicular to the straight line, and the eigenvector corresponding to the smaller eigenvalue is along the straight line direction.
Fig. 3 shows a schematic flow chart of determining a center line of a strip track in a line width detection method provided in the embodiment of the present application, and as shown in fig. 3, for step 120, the determining a center line of a strip track in an image to be detected based on a partial derivative of each pixel after filtering the image to be detected includes the following steps:
s121, constructing a first curve model of each pixel point based on the second-order partial derivative of each pixel point after the image to be detected is filtered.
And determining the characteristic value and the characteristic vector of each pixel point based on the second-order partial derivative of each pixel point after the filtering of the image to be detected, wherein the characteristic value at least comprises two initial characteristic values, and the characteristic vector at least comprises two initial characteristic vectors. And constructing a first curve model of each pixel point based on the characteristic value and the characteristic vector of each pixel point. Screening out the initial characteristic values of the pixel points to obtain a target characteristic value with the largest absolute value; and determining a first curve model of the pixel point based on the target characteristic value and the target characteristic vector corresponding to the target characteristic value.
It should be understood that the first curve model of a pixel point is a one-dimensional quadratic polynomial which is derived to correspond to its extreme point when the derivative is 0.
And S122, determining a target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold.
It should be understood that the target central point is determined from the image to be measured based on the constructed curve module and the preset screening threshold, and the central line is further determined by determining the target central point, where the target central point is located on the central line of the bar-shaped track.
For step 122, determining a target center point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold, the method comprises the following steps:
and S1221, determining an initial central point of the pixel point based on the constructed first curve model.
And S1222, screening the target central point from the initial central point based on a preset screening threshold.
When the preset screening threshold comprises a preset high threshold and a preset low threshold, screening out the target central point from the initial central point, comprising the following steps:
s12221, when the characteristic value of the initial central point is larger than or equal to a preset low threshold value, screening out an alternative central point from the initial central point; when the characteristic value of the alternative central point is greater than or equal to a preset high threshold value, screening an alternative starting point from the alternative central point; when the characteristic value of the alternative central point is smaller than a preset high threshold value, screening alternative connection points from the alternative central point;
and S12222, determining the target starting point based on the characteristic value of the alternative starting point.
In some embodiments, after the alternative starting points are sorted according to the size of the feature value, the alternative starting point with the largest feature value is selected as the target starting point, after the determination of the target center point of the bar-shaped track of the target starting point is finished, the next alternative starting point is selected as the target starting point by sorting the alternative starting points, and so on, it is known that all the alternative starting points are connected.
And S12223, determining at least two adjacent central points based on the tangential direction of the feature vector of the target starting point, wherein the adjacent central points comprise alternative connecting points and/or alternative starting points.
In some embodiments, the at least two adjacent central points may be further determined based on a tangential direction of the feature vector of the target starting point and a preset direction area in which the tangential direction is located. The preset direction area can be divided into a plurality of areas, and the target starting point is taken as the center.
In some embodiments, the neighboring center points may be all points greater than the preset low threshold, that is, the neighboring center points may be alternative connection points, may be alternative starting points, and may include both the alternative connection points and the alternative starting points.
The number of the adjacent center points is at least two, and the adjacent center points are candidate center points adjacent to the target starting point, for example, three adjacent center points can be found.
And S12224, when the distance between the adjacent central point and the target starting point is the minimum and the angle difference between the adjacent central point and the target starting point is the minimum, determining the corresponding adjacent central point as the target connecting point.
In some embodiments, when the distance between the adjacent central point and the target starting point is not the minimum or the angle difference between the adjacent central point and the target starting point is not the minimum, the target connecting point is determined to be ended.
And S12225, determining the target central point based on the target starting point and the target connecting point.
As shown in fig. 3, in S123, a central line of the image to be measured is determined based on the target central point.
And according to the target central point and the tangent direction of the target central point, sequentially connecting the target central point and determining the central line of the image to be detected.
As shown in fig. 2, S130 determines a search line based on the normal of the center point of each object.
Each target central point on the central line has directivity, each target central point is determined by using a straight line determination algorithm, a search line is determined along the normal of the target central point, and the length of the search line is determined according to a preset length.
In some embodiments, the length of the search line is determined by the filter parameters.
It should be understood that a search line is a line passing through the center point of the object and along the direction of the normal to the center point of the object.
When the search line is a straight line, the search line passing through the center point can be set, the length of the search line extends to two corresponding edges of the bar-shaped track along the direction of the normal, and the search line is a straight line.
When the number of the search lines is two, a search line can be determined along the normal direction of the target central point through the target central point, and the search line extends to the edge of one side corresponding to the bar-shaped track; determining another search line along the direction opposite to the normal direction, wherein the search line extends to the edge of the other side corresponding to the bar track; wherein one search line and the other search line are arranged collinearly.
In some embodiments, when the search line comprises a first search line and a second search line, determining the search line based on the normal of the respective target center point comprises:
determining a first search line through each target center point and along the normal direction of the target center point; and determining a second search line passing through the center points of the targets and along the direction opposite to the normal direction of the center points of the targets.
The length of the first search line is determined by a filter parameter and a preset coefficient, and the length of the first search line is the same as that of the second search line.
The search line in each case may be determined based on bresenham's algorithm, or may be determined based on other algorithms related to line scan conversion.
In step 130, the target center point is taken as a point on the search line, the direction of the normal line of the target center point is taken as the direction of the search line, the preset length is taken as the length of the search line, and the search line is determined by the algorithm related to the linear scan conversion based on the preset length.
In some embodiments, the first search line and the second search line are determined by bresenham's algorithm based on the target center point as a starting point of the search line, the normal direction of the target center point as a direction of the first search line, the opposite direction of the normal direction of the target center point as a direction of the second search line, and N times of the filter parameter as lengths of the first search line and the second search line; wherein N is a coefficient.
The filter parameter may be a smoothing degree parameter σ of a gaussian filter function, and is a smoothing coefficient for representing a smoothing degree.
It should be understood that the width of the gaussian filter, determines the degree of smoothing; the degree of smoothing is characterized by a parameter σ, and σ is related to the degree of smoothing by: the larger the parameter σ, the wider the band of the gaussian filter and the better the smoothing degree.
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 σ -5 σ; when there is only one search line, the length of the search line may be 3 σ to 10 σ.
From this, it is understood that the search line in each of the above cases is provided perpendicular to the center line.
And S140, determining the width of the bar-shaped track based on the search line.
Fig. 4 shows a schematic flowchart of width determination of a bar track in a line width detection method provided by the embodiment of the present application, and as shown in fig. 4, for determining the width of the bar track based on the search line in step 140, the method includes the following steps: the method specifically comprises the following steps:
and S141, determining edge points based on extreme values of the search lines and the gradient image, wherein the gradient image is determined by partial derivatives of all pixel points after the image to be detected is filtered.
And determining the edge point through the search line, wherein the maximum value point corresponding to the search line on the gradient image can be determined as the edge point.
In some embodiments, when the search line is one, the first edge point and the second edge point of the edge are determined based on the search line.
In some embodiments, when there are two search lines, that is, the first search line and the second search line, corresponding maximum value points are determined on the gradient image obtained in step 110, and the corresponding maximum value points are the first edge point and the second edge point.
Fig. 5 shows a schematic flowchart of determining edge points in a line width detection method, where as shown in fig. 5, step 141 determines edge points based on extremum values of a search line and a gradient image, and includes the following steps:
s1411, for each search point on the search line, determining a real symmetric matrix based on a preset mask.
And fitting each search point and surrounding points thereof by using a mask with a preset size, and determining a real symmetric matrix according to the fitted equation.
FIG. 6 is a schematic diagram illustrating a 3X 3 mask in a line width detection method according to an embodiment of the present application. As shown in FIG. 6, when the size of the mask 20 is 3X 3, the following equation can be fitted to each search point (x, y) and the corresponding nine points of the eight neighborhoods:
f(x,y)=k 1 x+k 2 y+k 3 x 2 +k 4 xy+k 5 y 2
in the formula, k 1 、k 2 、k 3 、k 4 、k 5 Are the coefficients of the equation.
Using coefficient k 3 、k 4 、k 5 The following matrix is composed:
Figure BDA0003858374900000081
and solving the matrix to obtain the eigenvalue and the eigenvector of the matrix.
And S1412, determining a second curve model of the gradient values of the gradient image based on the real symmetric matrix, wherein the second curve model is determined along the direction of the feature vector corresponding to the maximum feature value of the real symmetric matrix.
And solving the real symmetric matrix to obtain the eigenvalue and the eigenvector of the matrix, selecting the largest eigenvalue in the eigenvalues and the eigenvector corresponding to the eigenvalue, and determining a second curve model along the direction of the eigenvector.
S1413, determining edge points based on the second curve model;
the second curve model is derived, when the derivative is 0, the maximum value point of the gradient is obtained, and the corresponding edge point (p) is obtained x ,p y ) Comprises the following steps:
(p x ,p y )=(x 0 +tn x ,y 0 +tn y )
in the formula, x 0 、y 0 Is a pixel point, n x 、n y For the feature vector corresponding to the maximum feature value, t is determined by the following expression:
Figure BDA0003858374900000091
in the formula, k 1 、k 2 、k 3 、k 4 、k 5 For the coefficients of the fitting equation above, n x 、n y The feature vector corresponding to the maximum feature value is obtained.
The method of solving the edge points through mask fitting reduces the calculated amount and improves the processing speed and efficiency.
For example, when the search line includes the first search line and the second search line, the edge point is determined in step 141 based on the search line and the extreme value of the gradient image. Fig. 7 is a schematic diagram illustrating an example of determining edge points in a line width detection method provided by the embodiment of the present application, as shown in fig. 7, a portion of a bar-shaped track 30 in fig. 7 is a target center point O on a center line.
A first edge point A is determined based on the first search line and a first extreme of the gradient image. And determining a second edge point B based on the second search line and a second extreme value of the gradient image. The gradient image is determined by the first-order partial derivative of each pixel after the image to be detected is filtered.
For the determination of the first extreme value and the second extreme value, the principle and method thereof are related to steps 1411 to 1413, and are not described herein again.
The precision of the edge points determined by the embodiment of the application can reach a sub-pixel level, and the accuracy is high.
As shown in fig. 4, based on the edge points, the width of the bar track is determined S142.
The edge points comprise a first edge point and a second edge point, and the width of the strip-shaped track is determined through the distance between the first edge point and the second edge point.
When the included angle between the search line passing through the normal direction of the target central point O and the edge line passing through the edge point is within a first preset range, the intersection point of the search line and the edge line is P, and then OP is the half width of the bar track. Wherein the first predetermined range includes a right angle.
Fig. 8a shows a first schematic diagram of a width of a bar track in a line width detection method provided by the embodiment of the present application; as shown in fig. 8a, when the included angle between the search line passing through the normal direction n of the target center point O and the edge line passing through the direction d of the edge point E is within the second preset range, the intersection point P of the search line and the edge line will deviate from the edge point E; wherein the second preset range is smaller than the first preset range.
For example, the first preset range may be 80 ° to 110 °, and the second preset range may be less than 80 °.
When the situation shown in fig. 8a occurs, fig. 8b shows a second schematic diagram of the width of the bar track in the line width detection method provided by the embodiment of the present application; as shown in fig. 8b, if the distance between the intersection point P of the search line and the edge point E is greater than the preset distance, the perpendicular line passing through the edge point E is made as the search line, and the dip falls on Q, and at this time, OQ is the half width of the bar track.
According to the method and the device, the line width corresponding to the central line is obtained by using the normal direction of the detected central line, so that the method for obtaining the line width is simpler and more visual.
The embodiment of the application provides a line width detection method. The central line of the strip-shaped track in the image to be detected can be determined by acquiring the image to be detected and further by the partial derivative of each pixel point after the image to be detected is filtered; the search line of the target center point can be determined through the normal line of each target center point in the center line; the edge points corresponding to the target central points can be quickly and accurately determined based on the search lines, the width of the bar-shaped track can be determined through the edge points, and the width detection efficiency of the bar-shaped track is improved.
Fig. 9 shows a schematic structural diagram of a line width detection apparatus provided in an embodiment of the present application, and as shown in fig. 9, the line width detection apparatus 900 includes an obtaining module 910, an analyzing module 920, and an executing module 930.
And the acquisition module is used for acquiring the image to be detected.
And the analysis module is used for determining a central line of the strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through the target central point.
The execution module is used for determining a search line based on the normal of each target central point; and is also used to determine the width of the bar track based on the search line.
In some embodiments, the execution module is further configured to determine a search line through each of the target center points and along a normal to the target center point, wherein a length of the search line is determined by the filtering parameter; determining edge points based on extreme values of the search lines and the gradient image, wherein the gradient image is determined by partial derivatives of all pixel points after the image to be detected is filtered; based on the edge points, the width of the bar trace is determined.
In some embodiments, the execution module is further configured to determine a first search line through each target center point and along a normal direction of the target center point; determining a second search line through each target center point and along the opposite direction of the normal direction of the target center point; the length of the first search line is determined by the filter parameter and the preset coefficient, and the length of the first search line is the same as that of the second search line.
In some embodiments, the execution module is further to determine a first edge point based on the first search line and a first extremum of the gradient image; determining a second edge point based on the second search line and a second extreme value of the gradient image; determining the width of the bar track based on the distance between the first edge point and the second edge point; the gradient image is determined by the first-order partial derivative of each pixel after the image to be detected is filtered.
In some embodiments, the execution module is further configured to determine a real symmetric matrix for each search point on the search line based on a preset mask; determining a second curve model of the gradient values of the gradient image based on the real symmetric matrix, wherein the second curve model is determined along the direction of the characteristic vector corresponding to the maximum characteristic value of the real symmetric matrix; determining edge points based on the second curve model; based on the edge points, the width of the bar trace is determined.
In some embodiments, the analysis module is further configured to construct a first curve model of each pixel point based on the second-order partial derivative of each pixel point after filtering the image to be detected; determining a target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold; and determining the central line of the image to be detected based on the target central point.
In some embodiments, the analysis module is further configured to determine an initial center point of the pixel point based on the constructed first curve model; and screening out the target central point from the initial central point based on a preset screening threshold value.
In some embodiments, the analysis module is further configured to screen out an alternative central point from the initial central point when the characteristic value of the initial central point is greater than or equal to a preset low threshold; when the characteristic value of the alternative central point is greater than or equal to a preset high threshold value, screening an alternative starting point from the alternative central point; when the characteristic value of the alternative central point is smaller than a preset high threshold value, screening alternative connection points from the alternative central point; determining a target starting point based on the characteristic value of the alternative starting point; determining at least two adjacent central points based on the tangential direction of the feature vector of the target starting point, wherein the adjacent central points comprise alternative connecting points and/or alternative starting points; when the distance between the adjacent central point and the target starting point is minimum and the angle difference between the adjacent central point and the target starting point is minimum, determining the corresponding adjacent central point as a target connecting point; and determining a target central point based on the target starting point and the target connecting point.
The embodiment of the application provides a line width detection device, which comprises an acquisition module, an analysis module and an execution module; the implementation principle and technical effect are similar to those of the above method embodiments, and are not described herein again.
The computer device further provided in the embodiment of the present application includes a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the principle and technical effect implemented by the processor are similar to those of the method embodiment described above, and are not described herein again.
An embodiment of the present application further provides a computer storage medium, where a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the computer program implements the following steps:
acquiring an image to be detected; determining a central line of a strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through a target central point; determining a search line based on the normal of each target central point; based on the search lines, the width of the bar track is determined.
In some embodiments, determining the search line based on the normal to the center point of each object comprises: determining a search line through the center points of the targets and along the normal of the center points of the targets, wherein the length of the search line is determined by the filtering parameters;
determining a width of the bar track based on the search line, comprising: determining edge points based on extreme values of the search lines and the gradient image, wherein the gradient image is determined by partial derivatives of all pixel points after the image to be detected is filtered; based on the edge points, the width of the bar trace is determined.
In some embodiments, when the search line comprises a first search line and a second search line, determining the search line based on the normal of the respective target center point comprises:
determining a first search line through each target center point and along the normal direction of the target center point; determining a second search line through each target center point and along the opposite direction of the normal direction of the target center point; the length of the first search line is determined by the filter parameter and the preset coefficient, and the length of the first search line is the same as that of the second search line.
In some embodiments, determining the width of the bar track based on the search line comprises:
determining a first edge point based on the first search line and a first extreme value of the gradient image; determining a second edge point based on the second search line and a second extreme value of the gradient image; determining the width of the bar track based on the distance between the first edge point and the second edge point; the gradient image is determined by the first-order partial derivative of each pixel after the image to be detected is filtered.
In some embodiments, determining the width of the bar track based on the search line comprises:
determining a real symmetric matrix for each search point on the search line based on a preset mask; determining a second curve model of the gradient values of the gradient image based on the real symmetric matrix, wherein the second curve model is determined along the direction of the characteristic vector corresponding to the maximum characteristic value of the real symmetric matrix; determining edge points based on the second curve model; based on the edge points, the width of the bar trace is determined.
In some embodiments, determining a center line of a bar track in the image to be measured based on a partial derivative of each pixel point after filtering the image to be measured includes:
constructing a first curve model of each pixel point based on a second-order partial derivative of each pixel point after the image to be detected is filtered; determining a target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold; and determining the central line of the image to be detected based on the target central point. In some embodiments, determining the target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold includes: determining an initial central point of a pixel point based on the constructed first curve model; and screening out the target central point from the initial central point based on a preset screening threshold value.
In some embodiments, when the preset filtering threshold includes a preset high threshold and a preset low threshold, filtering out the target central point from the initial central point, including:
when the characteristic value of the initial central point is greater than or equal to a preset low threshold value, screening out an alternative central point from the initial central point; when the characteristic value of the alternative central point is greater than or equal to a preset high threshold value, screening an alternative starting point from the alternative central point; when the characteristic value of the alternative central point is smaller than a preset high threshold value, screening alternative connection points from the alternative central point; determining a target starting point based on the characteristic value of the alternative starting point; determining at least two adjacent central points based on the tangential direction of the feature vector of the target starting point, wherein the adjacent central points comprise alternative connecting points and/or alternative starting points; when the distance between the adjacent central point and the target starting point is minimum and the angle difference between the adjacent central point and the target starting point is minimum, determining the corresponding adjacent central point as a target connecting point; and determining a target central point based on the target starting point and the target connecting point.
The implementation principle and technical effect of the computer-readable storage medium provided by this embodiment are similar to those of the above-described method embodiment, and are not described herein again.
The following paragraphs will comparatively list the Chinese terms referred to in this specification and their corresponding English terms for easy reading and understanding.
The foregoing description, for purposes of explanation, has been presented in conjunction with specific embodiments. However, the foregoing discussion in some embodiments is not intended to be exhaustive or to limit the embodiments to the precise forms disclosed above. Many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles and the practical application, to thereby enable others skilled in the art to best utilize the embodiments and various embodiments with various modifications as are suited to the particular use contemplated.

Claims (10)

1. A line width detection method is characterized by comprising the following steps:
acquiring an image to be detected;
determining a central line of a strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through a target central point;
determining a search line based on the normal of each target central point;
determining a width of the bar track based on the search line.
2. The method of claim 1, wherein the determining a search line based on the normal of each of the target center points comprises:
determining a search line through each target central point and along a normal of the target central point, wherein the length of the search line is determined by a filtering parameter;
the determining the width of the bar track based on the search line includes:
determining edge points based on the search lines and extreme values of a gradient image, wherein the gradient image is determined by partial derivatives of all pixel points after the image to be detected is filtered;
determining the width of the bar track based on the edge points.
3. The method according to claim 1, wherein when the search line includes a first search line and a second search line, the determining a search line based on a normal of each of the target center points comprises:
determining a first search line through each target center point and along the normal direction of the target center point;
determining a second search line through each target central point and along the opposite direction of the normal direction of the target central point;
the length of the first search line is determined by a filter parameter and a preset coefficient, and the length of the first search line is the same as that of the second search line.
4. The line width detection method according to claim 3, wherein the determining the width of the bar trace based on the search line comprises:
determining a first edge point based on the first search line and a first extreme value of a gradient image;
determining a second edge point based on the second search line and a second extreme value of the gradient image;
determining a width of the bar track based on a distance between the first edge point and the second edge point;
and determining the gradient image according to the first-order partial derivative of each pixel after the image to be detected is filtered.
5. The line width detection method according to claim 1, wherein the determining the width of the bar track based on the search line comprises:
determining a real symmetric matrix for each search point on the search line based on a preset mask;
determining a second curve model of gradient values of the gradient image based on the real symmetric matrix, wherein the second curve model is determined in the direction of the eigenvector corresponding to the maximum eigenvalue of the real symmetric matrix;
determining edge points based on the second curve model;
determining the width of the bar track based on the edge points.
6. The method for detecting line width according to claim 1, wherein the determining the central line of the strip trajectory in the image to be detected based on the partial derivative of each pixel point after the filtering of the image to be detected comprises:
constructing a first curve model of each pixel point based on the second-order partial derivative of each pixel point after the image to be detected is filtered;
determining a target central point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold;
and determining the central line of the image to be detected based on the target central point.
7. The line width detection method according to claim 6, wherein the determining the target center point of the image to be detected based on the first curve model of each pixel point and a preset screening threshold comprises:
determining an initial central point of the pixel point based on the constructed first curve model;
and screening out a target central point from the initial central point based on a preset screening threshold value.
8. The method according to claim 7, wherein screening out the target center point from the initial center point when the preset screening threshold includes a preset high threshold and a preset low threshold, comprises:
when the characteristic value of the initial central point is greater than or equal to a preset low threshold value, screening out an alternative central point from the initial central point; when the characteristic value of the alternative central point is greater than or equal to a preset high threshold value, screening an alternative starting point from the alternative central point; when the characteristic value of the alternative central point is smaller than a preset high threshold value, screening alternative connection points from the alternative central point;
determining a target starting point based on the characteristic value of the alternative starting point;
determining at least two adjacent central points based on the tangential direction of the feature vector of the target starting point, wherein the adjacent central points comprise alternative connecting points and/or alternative starting points;
when the distance between the adjacent central point and the target starting point is minimum and the angle difference between the adjacent central point and the target starting point is minimum, determining the corresponding adjacent central point as a target connecting point;
and determining a target central point based on the target starting point and the target connecting point.
9. A line width detection device, comprising:
the acquisition module is used for acquiring an image to be detected;
the analysis module is used for determining a central line of a strip track in the image to be detected based on the partial derivative of each pixel point after the image to be detected is filtered, wherein the central line is determined through a target central point;
the execution module is used for determining a search line based on the normal of each target central point;
the execution module is further configured to determine a width of the bar track based on the search line.
10. A computer storage medium, characterized in that a computer program is stored on the computer readable storage medium, which, when executed by a processor, causes the processor to perform the steps of the line width detection method according to any one of claims 1 to 8.
CN202211158449.1A 2022-09-22 2022-09-22 Line width detection method and device and storage medium Pending CN115496724A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211158449.1A CN115496724A (en) 2022-09-22 2022-09-22 Line width detection method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211158449.1A CN115496724A (en) 2022-09-22 2022-09-22 Line width detection method and device and storage medium

Publications (1)

Publication Number Publication Date
CN115496724A true CN115496724A (en) 2022-12-20

Family

ID=84470151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211158449.1A Pending CN115496724A (en) 2022-09-22 2022-09-22 Line width detection method and device and storage medium

Country Status (1)

Country Link
CN (1) CN115496724A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115908431A (en) * 2023-03-09 2023-04-04 国网山东省电力公司东营供电公司 Cable positioning and accommodating method for power transmission and transformation project

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115908431A (en) * 2023-03-09 2023-04-04 国网山东省电力公司东营供电公司 Cable positioning and accommodating method for power transmission and transformation project

Similar Documents

Publication Publication Date Title
CN104574421B (en) Large-breadth small-overlapping-area high-precision multispectral image registration method and device
CN107230203B (en) Casting defect identification method based on human eye visual attention mechanism
CN111476159B (en) Method and device for training and detecting detection model based on double-angle regression
CN110210448B (en) Intelligent face skin aging degree identification and evaluation method
CN115187548A (en) Mechanical part defect detection method based on artificial intelligence
CN114998323B (en) Deformed steel bar abnormity determination method based on attention mechanism
CN108345881A (en) A kind of document quality detection method based on computer vision
EP3025273B1 (en) Keypoint identification
Gottschlich et al. Robust orientation field estimation and extrapolation using semilocal line sensors
Daixian SIFT algorithm analysis and optimization
CN109740606A (en) A kind of image-recognizing method and device
CN115082472B (en) Quality detection method and system for hub mold casting molding product
CN110766657A (en) Laser interference image quality evaluation method
CN104318559A (en) Quick feature point detecting method for video image matching
CN106340010A (en) Corner detection method based on second-order contour difference
CN110991493A (en) Hyperspectral anomaly detection method based on collaborative representation and anomaly elimination
CN112308873A (en) Edge detection method for multi-scale Gabor wavelet PCA fusion image
CN115496724A (en) Line width detection method and device and storage medium
Coulibaly et al. Semiautomatic road extraction from VHR images based on multiscale and spectral angle in case of earthquake
CN112950594B (en) Method, device and storage medium for detecting surface defects of product
CN111199251B (en) Multi-scale hyperspectral image classification method based on weighted neighborhood
CN111860500B (en) Shoe stamp wearing area detection and edge tracing method
CN104820992A (en) hypergraph model-based remote sensing image semantic similarity measurement method and device
CN107944474A (en) Multiple dimensioned cooperation table based on local auto-adaptive dictionary reaches hyperspectral classification method
CN115511928A (en) Matching method of multispectral image

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