CN117036345B - Method and system for measuring opposite side distance of crimping wire - Google Patents
Method and system for measuring opposite side distance of crimping wire Download PDFInfo
- Publication number
- CN117036345B CN117036345B CN202311282255.7A CN202311282255A CN117036345B CN 117036345 B CN117036345 B CN 117036345B CN 202311282255 A CN202311282255 A CN 202311282255A CN 117036345 B CN117036345 B CN 117036345B
- Authority
- CN
- China
- Prior art keywords
- edge
- upper edge
- lower edge
- wire
- crimping
- 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.)
- Active
Links
- 238000002788 crimping Methods 0.000 title claims abstract description 131
- 238000000034 method Methods 0.000 title claims abstract description 47
- 238000005259 measurement Methods 0.000 claims abstract description 9
- 238000003708 edge detection Methods 0.000 claims description 30
- 239000011159 matrix material Substances 0.000 claims description 20
- 230000009466 transformation Effects 0.000 claims description 20
- 239000004020 conductor Substances 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 12
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 238000004458 analytical method Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 claims description 8
- 238000012216 screening Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000004422 calculation algorithm Methods 0.000 claims description 5
- 230000003044 adaptive effect Effects 0.000 claims description 4
- 238000000605 extraction Methods 0.000 claims description 4
- 238000001914 filtration Methods 0.000 claims description 4
- 230000000877 morphologic effect Effects 0.000 claims description 4
- 238000007670 refining Methods 0.000 claims description 4
- 238000001514 detection method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- XEEYBQQBJWHFJM-UHFFFAOYSA-N Iron Chemical compound [Fe] XEEYBQQBJWHFJM-UHFFFAOYSA-N 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012805 post-processing Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 229910052742 iron Inorganic materials 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/14—Measuring arrangements characterised by the use of optical techniques for measuring distance or clearance between spaced objects or spaced apertures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20092—Interactive image processing based on input by user
- G06T2207/20104—Interactive definition of region of interest [ROI]
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Processing (AREA)
Abstract
The invention relates to the technical field of cable wire measurement and discloses a method and a system for measuring the edge distance of a crimping wire.
Description
Technical Field
The invention relates to the technical field of cable wire measurement, in particular to a method and a system for measuring the opposite side distance of a crimping wire.
Background
Wire crimping refers to a process of connecting two sections of wires or wires with an iron tower by applying hydraulic pressure to an electric power fitting to enable the electric power fitting to generate plastic deformation. Crimp quality plays an important role in the safe operation of the power grid, and crimp butt edge distance is an important parameter for representing the crimp quality. When the edge distance of the crimping pair is too large, the grip strength of the crimping lead cannot meet the requirement, and a large harm is generated to the operation of a power grid, so that the accurate measurement of the edge distance of the crimping pair provides an important reference for accurately evaluating the crimping quality. Current wire crimping is usually carried out in the field, mainly relies on the workman to use slide caliper to carry out the measurement of crimping butt edge distance, and measuring result repeatability is poor and consuming time and effort, is difficult to compromise the requirement of detection precision and efficiency.
Disclosure of Invention
The invention provides a method and a system for measuring the distance between crimping wires, which solve the technical problems that the repeatability of the distance measurement result of the crimping wires in the prior art is poor, the time and the labor are consumed, and the requirements of detection precision and efficiency are difficult to meet.
In view of the above, a first aspect of the present invention provides a method for measuring a distance between crimped wires, comprising the steps of:
acquiring a crimping lead image, and extracting an ROI region image in the crimping lead image;
performing gama gray level transformation processing on the ROI area image to obtain a gray level image;
otsu thresholding is carried out on the gray level image, and connected domain analysis is carried out, so that a crimping lead area image is obtained;
performing edge detection on the crimp wire region image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire;
monotonous treatment is carried out on the upper edge of the crimping wire and the lower edge of the crimping wire, so that a plurality of monotonous edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively are obtained;
performing least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively to obtain an upper edge fitting curve and a lower edge fitting curve;
and calculating the distance between the corresponding upper and lower edge intersection points as the opposite side distance of the crimping wire according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve.
Preferably, the steps of performing gama gray level transformation on the ROI area image to obtain a gray level image specifically include:
performing gama gray level transformation processing on the ROI area image by using a gama transformation formula in the following steps of:
;
in the method, in the process of the invention,for grey scale image +.>For pixel coordinate value, +.>Is the gray value of the pixel point,is->Gray maximum value of>Is a transformation parameter, wherein the transformation parameter +.>The method is calculated by an adaptive calculation formula in the following formula:
;
in the method, in the process of the invention,is the local variance of the gray value of the pixel point, < >>Is the local mean of the pixel gray values,is the global gray average.
Preferably, the step of performing Otsu thresholding on the gray level image and performing connected domain analysis to obtain a crimp wire region image specifically includes:
otsu thresholding is carried out on the gray level image, so that a plurality of connected domains are obtained;
calculating the area of each connected domain, selecting the connected domain with the largest area as an initial crimping lead region, carrying out morphological treatment on the initial crimping lead region, filling the hollow and the gap in the initial crimping lead region, and obtaining a crimping lead region image.
Preferably, the step of performing edge detection on the crimp wire area image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire specifically includes:
performing edge detection on the crimping wire region image through two opposite Sobel operator templates;
filtering the edge detection result, and refining the upper edge of the crimping conductor and the lower edge of the crimping conductor based on a skeleton extraction algorithm to obtain the upper edge of the crimping conductor and the lower edge of the crimping conductor.
Preferably, the step of monotonously modulating the upper edge of the crimp wire and the lower edge of the crimp wire to obtain a plurality of monotonous edge straight line segments corresponding to the upper edge of the crimp wire and the lower edge of the crimp wire respectively specifically includes:
constructing an upper edge coordinate matrix and a lower edge coordinate matrix according to pixel coordinate points respectively corresponding to the upper edge of the crimping lead and the lower edge of the crimping lead;
screening out the pixel coordinate point with the largest ordinate from the upper edge coordinate matrix, constructing an upper edge coordinate set, screening out the pixel coordinate point with the smallest ordinate from the lower edge coordinate matrix, and constructing a lower edge coordinate set;
classifying the upper edge coordinate set and the lower edge coordinate set according to different abscissas to obtain upper edge coordinates and lower edge coordinates under a plurality of abscissas;
and respectively performing straight line fitting on the upper edge coordinates and the lower edge coordinates of each abscissa category to obtain an upper edge monotonic edge straight line segment and a lower edge monotonic edge straight line segment of a plurality of abscissa categories.
Preferably, the step of calculating the distance between the corresponding intersection points of the upper edge and the lower edge as the distance between the opposite sides of the crimping wire according to the normal line of the fitting curve of the upper edge and the intersection point between the normal line and the fitting curve of the lower edge specifically includes:
determining the normal line at each point on the upper edge fitting curve and the corresponding normal line upper edge intersection point according to the upper edge fitting curve;
and determining a normal lower edge intersection point according to an intersection point between the normal and the lower edge fitting curve, and calculating the distance between an upper edge intersection point of the normal and the lower edge intersection point of the normal as the opposite side distance of the crimping wire between the corresponding upper edge intersection point and lower edge intersection point.
In a second aspect, the present invention also provides a pair of edge distance measuring system for crimping a wire, comprising:
the image acquisition module is used for acquiring a crimping wire image and extracting an ROI area image in the crimping wire image;
the gray level conversion module is used for performing gama gray level conversion processing on the ROI area image to obtain a gray level image;
the thresholding module is used for performing Otsu thresholding on the gray level image and performing connected domain analysis to obtain a crimping wire region image;
the edge detection module is used for carrying out edge detection on the crimp wire area image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire;
the monotonous module is used for monotonously processing the upper edge of the crimping wire and the lower edge of the crimping wire to obtain a plurality of monotonous edge straight line segments respectively corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire;
the edge fitting module is used for carrying out least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively to obtain an upper edge fitting curve and a lower edge fitting curve;
and the distance calculation module is used for calculating the distance between the corresponding upper and lower edge intersection points as the opposite side distance of the crimping lead according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve.
In a third aspect, the present invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing a method as described above when executing the computer program.
In a fourth aspect, the present invention also provides a computer readable storage medium storing a computer program which when executed by a processor implements a method as described above.
From the above technical scheme, the invention has the following advantages:
according to the invention, through extracting an ROI region image in a crimping wire image, performing gama gray level conversion and Otsu thresholding on the ROI region image, performing connected domain analysis to obtain a crimping wire region image, performing edge detection on the crimping wire region image to obtain a crimping wire upper edge and a crimping wire lower edge, performing monotonous treatment on the crimping wire upper edge and the crimping wire lower edge to obtain a plurality of corresponding monotonous edge straight line segments, performing least square fitting on the midpoints of the monotonous edge straight line segments to obtain an upper edge fitting curve and a lower edge fitting curve, and calculating the distance between the corresponding upper edge intersection point and the corresponding lower edge intersection point as the crimping wire opposite edge distance according to the normal of the upper edge fitting curve and the intersection point between the normal and the lower edge fitting curve, thereby improving detection precision and efficiency.
Drawings
Fig. 1 is a flowchart of a method for measuring a distance between crimped wires according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of pixels in a 3×3 area corresponding to an image of a crimp wire area according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an upper edge detection operator according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a lower edge detection operator according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a principle of crimp-versus-edge measurement according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a pair of edge distance measuring systems for crimping wires according to an embodiment of the present invention.
Detailed Description
In order to make the present invention better understood by those skilled in the art, the following description will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings, and 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 invention without making any inventive effort, are intended to be within the scope of the invention.
For easy understanding, please refer to fig. 1, the method for measuring the distance between the opposite sides of the crimp wire provided by the invention comprises the following steps:
s1, acquiring a crimping lead image, and extracting an ROI area image in the crimping lead image.
The method comprises the steps that a crimping wire image containing crimping wires can be obtained through a camera, the crimping wire image in the crimping wire image is cut, and an ROI area is segmented.
S2, performing gama gray level conversion processing on the ROI area image to obtain a gray level image.
If Otst thresholding is directly performed, the image is easily broken seriously, which is not beneficial to post-processing, and thus the gama gray scale transformation is performed to enhance the image.
S3, otsu thresholding is carried out on the gray level image, and connected domain analysis is carried out, so that a crimping wire region image is obtained.
And S4, performing edge detection on the crimp wire area image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire.
The Sobel operator can be adopted to carry out edge detection on the crimping wire area image.
S5, monotonously modulating the upper edge of the crimping wire and the lower edge of the crimping wire to obtain a plurality of monotonous edge straight line segments respectively corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire.
It should be noted that, because the surface of the crimp wire is uneven, the edge result obtained by edge detection has larger fluctuation and has a certain influence on the fitting result, so that the edge can be monotonously changed to improve the fitting precision.
S6, performing least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively to obtain an upper edge fitting curve and a lower edge fitting curve.
Specifically, the midpoint of each monotonic edge straight line segment can be selected as the fitting point, and the least square fitting is performed, wherein the fitting equation is thatWherein x and y represent the abscissa and ordinate, a represents a constant, and b and c represent coefficients, respectively.
And S7, calculating the distance between the corresponding upper and lower edge intersection points as the opposite side distance of the crimping wire according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve.
The normal line of the upper edge fitting curve is perpendicular to the tangent line of the intersection point of the upper edge fitting curve and the normal line, and then the normal line is intersected with the lower edge fitting curve, so that the shortest distance between the upper edge point and the lower edge point respectively corresponding to the upper edge fitting curve and the lower edge fitting curve is the opposite side distance between the corresponding upper edge point and the lower edge point of the crimping wire.
It should be noted that this embodiment provides a method for measuring a distance between two adjacent sides of a crimp wire, by extracting an ROI area image in a crimp wire image, performing gama gray level conversion and Otsu thresholding on the ROI area image, performing connected domain analysis to obtain a crimp wire area image, performing edge detection on the crimp wire area image to obtain an upper edge of the crimp wire and a lower edge of the crimp wire, performing monotonous treatment on the upper edge of the crimp wire and the lower edge of the crimp wire to obtain a plurality of corresponding monotonous edge straight line segments, performing least square fitting on midpoints of the monotonous edge straight line segments to obtain an upper edge fitting curve and a lower edge fitting curve, and calculating a distance between corresponding upper and lower edge intersection points as a crimp wire opposite side distance according to a normal line of the upper edge fitting curve and an intersection point between the normal line and the lower edge fitting curve, thereby improving detection accuracy and efficiency.
It should be noted that, because the brightness of the ROI area image is uneven, when Otst thresholding is directly performed, the image is severely broken, which is unfavorable for post-processing, so that gama gray scale transformation is performed to enhance the image. The traditional gama gray level conversion needs to adjust the conversion coefficient for a plurality of times, has weak adaptability to images with different illumination, and can not meet the requirement of field rapid measurement. Therefore, the embodiment designs an adaptive gama transformation algorithm, the image is divided into two types by the average gray level of the image, and corresponding transformation coefficients are automatically calculated for different types of pixels.
In a specific embodiment, step S2 specifically includes:
performing gama gray level transformation processing on the ROI area image by using a gama transformation formula in the following steps of:
;
in the method, in the process of the invention,for grey scale image +.>For pixel coordinate value, +.>Is the gray value of the pixel point,is->Gray maximum value of>Is a transformation parameter, wherein the transformation parameter +.>The method is calculated by an adaptive calculation formula in the following formula:
;
in the method, in the process of the invention,is the local variance of the gray value of the pixel point, < >>Is the local mean of the pixel gray values,is the global gray average.
In a specific embodiment, step S3 specifically includes:
s301, otsu thresholding is carried out on the gray level image, so that a plurality of connected domains are obtained;
s302, calculating the area of each connected domain, selecting the connected domain with the largest area as an initial crimping lead region, performing morphological treatment on the initial crimping lead region, filling the holes and gaps in the initial crimping lead region, and obtaining a crimping lead region image.
Because the gray level image is Otsu thresholded, the area of each connected region is calculated because the crimping wire region occupies most area in the image, the region with the largest area is selected as the crimping region, and then morphological treatment is carried out to fill the holes and gaps in the crimping region, so that the complete crimping region is obtained.
In a specific embodiment, step S4 specifically includes:
s401, performing edge detection on the crimping wire area image through two opposite Sobel operator templates;
s402, filtering edge detection results, and refining the upper edge of the crimping conductor and the lower edge of the crimping conductor based on a skeleton extraction algorithm to obtain the upper edge of the crimping conductor and the lower edge of the crimping conductor.
In practical application, in order to accurately measure the crimping edge distance, the crimping upper and lower edges need to be detected, only one edge can be obtained when a single Sobel operator is used, so that edge detection is performed by using two opposite Sobel operator templates, wherein pixels in a 3×3 region corresponding to the crimping wire region image are shown in fig. 2, an upper edge detection operator is shown in fig. 3, a lower edge detection operator is shown in fig. 4, and specifically, the operation procedures of the upper edge detection operator and the lower edge detection operator are respectively as follows:
;
wherein z is i Representing the pixel gray values corresponding to the convolution templates, i=1, 2, 3, 5, 6, 7,、/>and respectively obtaining partial differential results after the upper edge detection operator and the lower edge detection operator are convolved with the image.
It should be noted that, since the edge width obtained by not setting the threshold value during the detection of the Sobel operator is larger and includes a part of interference edge, the accurate fitting of the edge is not facilitated. Therefore, the area filtering is used for removing the interference edge, and then the skeleton extraction algorithm is used for refining the edge, so that the single-pixel edge is obtained.
In a specific embodiment, step S5 specifically includes:
s501, constructing an upper edge coordinate matrix and a lower edge coordinate matrix according to pixel coordinate points respectively corresponding to the upper edge of the press-bonding wire and the lower edge of the press-bonding wire.
S502, screening out the pixel coordinate point with the largest ordinate in the upper edge coordinate matrix, constructing an upper edge coordinate set, screening out the pixel coordinate point with the smallest ordinate in the lower edge coordinate matrix, and constructing a lower edge coordinate set.
The maximum ordinate corresponding to each abscissa in the upper edge coordinate matrix is the same, and the minimum ordinate corresponding to each abscissa in the lower edge coordinate matrix is the same.
S503, classifying the upper edge coordinate set and the lower edge coordinate set according to different abscissas to obtain an upper edge coordinate and a lower edge coordinate under a plurality of abscissas.
The surface of the crimp wire is uneven, so that the detected edge fluctuates greatly, and the fitting result is affected to a certain extent, so that the edge needs to be monotonously modulated. The edge in the crimping image is composed of a plurality of transverse lines and vertical lines, and the transverse lines can be monotonously modulated according to the abscissa because the line coordinates of the end part of the wire after crimping are minimum, so that the method is more practical.
S504, respectively performing straight line fitting on the upper edge coordinates and the lower edge coordinates under each abscissa category to obtain an upper edge monotonous edge straight line segment and a lower edge monotonous edge straight line segment under a plurality of abscissa categories.
In one example, upper and lower edge point coordinates are stored along the column direction, and an upper edge coordinate set and a lower edge coordinate set are constructed, respectively defined as、/>The pixel points with the same ordinate j are screened, only one pixel point is reserved, so that the vertical lines in the edge are deleted, and later calculation is facilitated, wherein the pixel coordinate point with the largest ordinate is screened out by the upper edge coordinate matrix, and the pixel coordinate point with the smallest ordinate is screened out by the lower edge coordinate matrix, so that the method is more practical and the precision is improved;
the screened coordinate set takes the abscissa i as a classification standard, and the edges are stored as straight line segments、/>Wherein m represents the number of straight line segments divided by the upper edge point, and n is the number of straight line segments divided by the lower edge point, which is +.>Representing an upper edge monotonic edge straight line segment, +.>Representing a lower edge monotonic edge straight line segment.
In a specific embodiment, step S7 specifically includes:
s701, determining the normal line at each point on the upper edge fitting curve and the corresponding normal line upper edge intersection point.
Wherein, according to the fitted upper edge curveCan get any point->The point is the intersection point of the upper edges of the normals, wherein the normal equation of the intersection point of the upper edges of the normals is +.>Wherein->Is constant (I)>、/>Are fitting coefficients.
S702, determining a normal lower edge intersection point according to an intersection point between the normal and the lower edge fitting curve, and calculating the distance between the upper edge intersection point and the normal lower edge intersection point as the opposite side distance of the crimping wire between the corresponding upper edge intersection point and lower edge intersection point.
Wherein, as shown in FIG. 5, FIG. 5 illustrates a press-fit butt edge measurement sourceBy theory, the intersection point between the normal equation and the lower edge fitting curveAs a normal lower edge intersection point, the distance between the corresponding normal upper edge intersection point and the normal lower edge intersection point is the crimping butt edge distance, and the calculation formula is as follows:
;
wherein d m Is the press-fit butt margin.
The foregoing is a detailed description of an embodiment of a method for measuring a distance between two crimp wires, and the following is a detailed description of an embodiment of a system for measuring a distance between two crimp wires.
For ease of understanding, referring to fig. 6, the present invention provides a pair of edge distance measuring system for crimping a wire, comprising:
an image acquisition module 100 for acquiring a crimp wire image, extracting an ROI area image in the crimp wire image;
the gray level conversion module 200 is used for performing gama gray level conversion processing on the ROI area image to obtain a gray level image;
the thresholding module 300 is used for performing Otsu thresholding on the gray level image and performing connected domain analysis to obtain a crimping wire region image;
the edge detection module 400 is used for performing edge detection on the crimp wire area image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire;
the monotonous module 500 is used for monotonously modulating the upper edge of the crimping wire and the lower edge of the crimping wire to obtain a plurality of monotonous edge straight line segments respectively corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire;
the edge fitting module 600 is configured to perform least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to an upper edge of the crimp wire and a lower edge of the crimp wire, so as to obtain an upper edge fitting curve and a lower edge fitting curve;
the distance calculating module 700 is configured to calculate, according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve, the distance between the corresponding intersection points of the upper edge and the lower edge as the opposite side distance of the crimp wire.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing a method as described above when executing the computer program.
The invention also provides a computer readable storage medium storing a computer program which when executed by a processor implements a method as described above.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system, electronic device and computer readable storage medium may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided by the present invention, it should be understood that the disclosed system, electronic device, and computer-readable storage medium and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for executing all or part of the steps of the method according to the embodiments of the present invention by means of a computer device (which may be a personal computer, a server, or a network device, etc.). And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (7)
1. The method for measuring the distance between the edges of the crimping wire is characterized by comprising the following steps of:
acquiring a crimping lead image, and extracting an ROI region image in the crimping lead image;
performing gama gray level transformation processing on the ROI area image to obtain a gray level image;
otsu thresholding is carried out on the gray level image, and connected domain analysis is carried out, so that a crimping lead area image is obtained;
performing edge detection on the crimp wire region image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire;
monotonous treatment is carried out on the upper edge of the crimping wire and the lower edge of the crimping wire, so that a plurality of monotonous edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively are obtained;
performing least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively to obtain an upper edge fitting curve and a lower edge fitting curve;
calculating the distance between the corresponding upper and lower edge intersection points as the opposite side distance of the crimping wire according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve;
monotonous treatment is carried out on the upper edge of the press-connected wire and the lower edge of the press-connected wire, and a plurality of monotonous edge straight line segments corresponding to the upper edge of the press-connected wire and the lower edge of the press-connected wire are obtained, specifically comprising the following steps:
constructing an upper edge coordinate matrix and a lower edge coordinate matrix according to pixel coordinate points respectively corresponding to the upper edge of the crimping lead and the lower edge of the crimping lead;
screening out the pixel coordinate point with the largest ordinate from the upper edge coordinate matrix, constructing an upper edge coordinate set, screening out the pixel coordinate point with the smallest ordinate from the lower edge coordinate matrix, and constructing a lower edge coordinate set;
classifying the upper edge coordinate set and the lower edge coordinate set according to different abscissas to obtain upper edge coordinates and lower edge coordinates under a plurality of abscissas;
respectively performing straight line fitting on the upper edge coordinates and the lower edge coordinates of each abscissa category to obtain an upper edge monotonic edge straight line segment and a lower edge monotonic edge straight line segment of a plurality of abscissa categories;
according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve, calculating the corresponding distance between the upper edge intersection point and the lower edge intersection point as the opposite side distance of the crimping wire, wherein the method specifically comprises the following steps:
determining the normal line at each point on the upper edge fitting curve and the corresponding normal line upper edge intersection point according to the upper edge fitting curve;
and determining a normal lower edge intersection point according to an intersection point between the normal and the lower edge fitting curve, and calculating the distance between an upper edge intersection point of the normal and the lower edge intersection point of the normal as the opposite side distance of the crimping wire between the corresponding upper edge intersection point and lower edge intersection point.
2. The method for measuring the distance between the opposite sides of the crimp wire according to claim 1, wherein the step of performing a gama gray scale transformation process on the ROI area image to obtain a gray scale image specifically includes:
performing gama gray level transformation processing on the ROI area image by using a gama transformation formula in the following steps of:
;
in the method, in the process of the invention,for grey scale image +.>For pixel coordinate value, +.>Is the gray value of the pixel point,is->Gray maximum value of>Is a transformation parameter, wherein the transformation parameter +.>The method is calculated by an adaptive calculation formula in the following formula:
;
in the method, in the process of the invention,is the local variance of the gray value of the pixel point, < >>Is the local mean value of the gray value of the pixel point, < >>Is the global gray average.
3. The method for measuring the distance between the edges of the crimp wire according to claim 1, wherein the step of performing Otsu thresholding on the gray level image and performing connected domain analysis to obtain a crimp wire region image specifically comprises:
otsu thresholding is carried out on the gray level image, so that a plurality of connected domains are obtained;
calculating the area of each connected domain, selecting the connected domain with the largest area as an initial crimping lead region, carrying out morphological treatment on the initial crimping lead region, filling the hollow and the gap in the initial crimping lead region, and obtaining a crimping lead region image.
4. The method for measuring the distance between the edges of the crimp wire according to claim 1, wherein the step of performing edge detection on the crimp wire region image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire comprises the steps of:
performing edge detection on the crimping wire region image through two opposite Sobel operator templates;
filtering the edge detection result, and refining the upper edge of the crimping conductor and the lower edge of the crimping conductor based on a skeleton extraction algorithm to obtain the upper edge of the crimping conductor and the lower edge of the crimping conductor.
5. A pair of edge distance measurement systems for crimped wires, comprising:
the image acquisition module is used for acquiring a crimping wire image and extracting an ROI area image in the crimping wire image;
the gray level conversion module is used for performing gama gray level conversion processing on the ROI area image to obtain a gray level image;
the thresholding module is used for performing Otsu thresholding on the gray level image and performing connected domain analysis to obtain a crimping wire region image;
the edge detection module is used for carrying out edge detection on the crimp wire area image to obtain the upper edge of the crimp wire and the lower edge of the crimp wire;
the monotonous module is used for monotonously processing the upper edge of the press-connected wire and the lower edge of the press-connected wire to obtain a plurality of monotonous edge straight line segments corresponding to the upper edge of the press-connected wire and the lower edge of the press-connected wire respectively, and specifically comprises the following steps:
constructing an upper edge coordinate matrix and a lower edge coordinate matrix according to pixel coordinate points respectively corresponding to the upper edge of the crimping lead and the lower edge of the crimping lead;
screening out the pixel coordinate point with the largest ordinate from the upper edge coordinate matrix, constructing an upper edge coordinate set, screening out the pixel coordinate point with the smallest ordinate from the lower edge coordinate matrix, and constructing a lower edge coordinate set;
classifying the upper edge coordinate set and the lower edge coordinate set according to different abscissas to obtain upper edge coordinates and lower edge coordinates under a plurality of abscissas;
respectively performing straight line fitting on the upper edge coordinates and the lower edge coordinates of each abscissa category to obtain an upper edge monotonic edge straight line segment and a lower edge monotonic edge straight line segment of a plurality of abscissa categories;
the edge fitting module is used for carrying out least square fitting on midpoints of a plurality of monotonic edge straight line segments corresponding to the upper edge of the crimping wire and the lower edge of the crimping wire respectively to obtain an upper edge fitting curve and a lower edge fitting curve;
the distance calculating module is used for calculating the distance between the corresponding upper edge and the corresponding lower edge intersection point as the opposite side distance of the crimping wire according to the normal line of the upper edge fitting curve and the intersection point between the normal line and the lower edge fitting curve, and specifically comprises the following steps:
determining the normal line at each point on the upper edge fitting curve and the corresponding normal line upper edge intersection point according to the upper edge fitting curve;
and determining a normal lower edge intersection point according to an intersection point between the normal and the lower edge fitting curve, and calculating the distance between an upper edge intersection point of the normal and the lower edge intersection point of the normal as the opposite side distance of the crimping wire between the corresponding upper edge intersection point and lower edge intersection point.
6. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 4 when executing the computer program.
7. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311282255.7A CN117036345B (en) | 2023-10-07 | 2023-10-07 | Method and system for measuring opposite side distance of crimping wire |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311282255.7A CN117036345B (en) | 2023-10-07 | 2023-10-07 | Method and system for measuring opposite side distance of crimping wire |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117036345A CN117036345A (en) | 2023-11-10 |
CN117036345B true CN117036345B (en) | 2024-03-05 |
Family
ID=88630267
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311282255.7A Active CN117036345B (en) | 2023-10-07 | 2023-10-07 | Method and system for measuring opposite side distance of crimping wire |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117036345B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117876330B (en) * | 2024-01-11 | 2024-07-30 | 广东粤电科试验检测技术有限公司 | Strain clamp crimping defect detection method and system based on X-ray image identification |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018170366A1 (en) * | 2017-03-16 | 2018-09-20 | The Johns Hopkins University | Geometric calibration for cone beam ct using line fiducials |
CN113469989A (en) * | 2021-07-14 | 2021-10-01 | 广东电网有限责任公司 | Method, system, equipment and medium for extracting power transmission conductor in remote sensing image |
CN115984356A (en) * | 2023-03-20 | 2023-04-18 | 广东电网有限责任公司江门供电局 | Image-based wire crimping distance measuring method and system |
CN116168037A (en) * | 2023-04-26 | 2023-05-26 | 广东电网有限责任公司江门供电局 | Method and system for calculating bending degree of wire crimping based on image processing |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US12112546B2 (en) * | 2021-04-30 | 2024-10-08 | Deere & Company | Vision guidance system using dynamic edge detection |
-
2023
- 2023-10-07 CN CN202311282255.7A patent/CN117036345B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018170366A1 (en) * | 2017-03-16 | 2018-09-20 | The Johns Hopkins University | Geometric calibration for cone beam ct using line fiducials |
CN113469989A (en) * | 2021-07-14 | 2021-10-01 | 广东电网有限责任公司 | Method, system, equipment and medium for extracting power transmission conductor in remote sensing image |
CN115984356A (en) * | 2023-03-20 | 2023-04-18 | 广东电网有限责任公司江门供电局 | Image-based wire crimping distance measuring method and system |
CN116168037A (en) * | 2023-04-26 | 2023-05-26 | 广东电网有限责任公司江门供电局 | Method and system for calculating bending degree of wire crimping based on image processing |
Also Published As
Publication number | Publication date |
---|---|
CN117036345A (en) | 2023-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110866924B (en) | Line structured light center line extraction method and storage medium | |
Malarvel et al. | An improved version of Otsu's method for segmentation of weld defects on X-radiography images | |
CN117036345B (en) | Method and system for measuring opposite side distance of crimping wire | |
CN102175700B (en) | Method for detecting welding seam segmentation and defects of digital X-ray images | |
CN111260616A (en) | Insulator crack detection method based on Canny operator two-dimensional threshold segmentation optimization | |
CN110930390B (en) | Chip pin missing detection method based on semi-supervised deep learning | |
CN112614062B (en) | Colony counting method, colony counting device and computer storage medium | |
CN109993797B (en) | Door and window position detection method and device | |
CN109886921A (en) | Crack size measure, device and electronic equipment based on digital picture | |
CN113313677A (en) | Quality detection method for X-ray image of wound lithium battery | |
CN111221996B (en) | Instrument screen vision detection method and system | |
CN115984356B (en) | Image-based wire crimping spacing measurement method and system | |
JP2013238449A (en) | Crack detection method | |
CN110660072A (en) | Method and device for identifying straight line edge, storage medium and electronic equipment | |
WO2024016632A1 (en) | Bright spot location method, bright spot location apparatus, electronic device and storage medium | |
CN112308872A (en) | Image edge detection method based on multi-scale Gabor first-order derivative | |
CN112381800A (en) | Wire diameter abnormity identification method and device, electronic equipment and computer readable storage medium | |
CN110889374A (en) | Seal image processing method and device, computer and storage medium | |
CN116168037A (en) | Method and system for calculating bending degree of wire crimping based on image processing | |
CN115330796A (en) | Copper wire tinning defect identification method | |
CN116071272A (en) | Image correction method and device, electronic equipment and storage medium thereof | |
CN106530273B (en) | High-precision FPC (Flexible printed Circuit) linear line detection and defect positioning method | |
CN101897592B (en) | Method and device for extracting metallic foreign body from X-ray image | |
CN112967191A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN116993654B (en) | Camera module defect detection method, device, equipment, storage medium and product |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |