CN117274261B - Photovoltaic energy storage electric box connector defect detection method based on machine vision - Google Patents

Photovoltaic energy storage electric box connector defect detection method based on machine vision Download PDF

Info

Publication number
CN117274261B
CN117274261B CN202311558136.XA CN202311558136A CN117274261B CN 117274261 B CN117274261 B CN 117274261B CN 202311558136 A CN202311558136 A CN 202311558136A CN 117274261 B CN117274261 B CN 117274261B
Authority
CN
China
Prior art keywords
pixel point
connector
gray level
level image
obtaining
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
Application number
CN202311558136.XA
Other languages
Chinese (zh)
Other versions
CN117274261A (en
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.)
Noxtlon Electronic Co ltd
Original Assignee
Noxtlon Electronic 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 Noxtlon Electronic Co ltd filed Critical Noxtlon Electronic Co ltd
Priority to CN202311558136.XA priority Critical patent/CN117274261B/en
Publication of CN117274261A publication Critical patent/CN117274261A/en
Application granted granted Critical
Publication of CN117274261B publication Critical patent/CN117274261B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • 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/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to the technical field of image processing, in particular to a machine vision-based defect detection method for a photovoltaic energy storage electric box connector, which comprises the following steps: obtaining a connector gray level image, obtaining a neighborhood range of pixel points in the connector gray level image, obtaining a preferable neighborhood range of any pixel point in the gray level image according to the gradient of the pixel points in the neighborhood range along any direction, obtaining the regular degree of the pixel points in the gray level image according to the gradient of the pixel points in the preferable neighborhood range and the main direction of the pixel points, obtaining a singular value sequence, obtaining the regular index of the pixel points in the gray level image according to the singular value sequence and the regular degree of the pixel points, obtaining the abnormal score value of the pixel points in the gray level image according to the regular index of the pixel points, and further obtaining the defect area of the connector. The invention improves the characteristic indexes of each point on the basis of the traditional isolated forest algorithm, improves the detection accuracy degree and further improves the defect detection effect of the connector.

Description

Photovoltaic energy storage electric box connector defect detection method based on machine vision
Technical Field
The invention relates to the technical field of image processing, in particular to a machine vision-based defect detection method for a photovoltaic energy storage electric box connector.
Background
The shell or the insulating part of the photovoltaic energy storage electric box connector can be cracked or physically damaged due to the influence of the use environment, so that poor electrical isolation or short circuit is caused, the integrity of the connector shell can be detected through computer vision, whether visible cracks or damage exist or not, and the reliability and the safety of an energy storage system can be guaranteed.
In the existing method, an isolated forest algorithm is utilized to perform anomaly detection on an acquired image, and due to the complexity of a connector image, different characteristics are adopted to perform anomaly detection on each pixel point in the image, so that the result is different, and characteristic indexes in an isolated forest cannot be well determined, so that the position of a defect area of the connector cannot be accurately determined.
Disclosure of Invention
In order to solve the problems, the invention provides a machine vision-based defect detection method for a photovoltaic energy storage electric box connector.
The defect detection method of the photovoltaic energy storage electric box connector based on machine vision adopts the following technical scheme:
the invention provides a machine vision-based defect detection method for a photovoltaic energy storage electric box connector, which comprises the following steps of:
collecting a connector image of a photovoltaic energy storage electric box and graying to obtain a connector gray image;
obtaining a neighborhood range of any one pixel point in the connector gray level image according to a preset neighborhood length, obtaining gradient sizes of any one pixel point in the neighborhood range along different directions for the neighborhood range of any one pixel point in the connector gray level image, and obtaining a main direction of any one pixel point in the connector gray level image according to the gradient sizes of each pixel point in the neighborhood range along any one direction;
obtaining a preferred neighborhood range of any one pixel point in the connector gray level image according to the main direction of any one pixel point in the connector gray level image, and obtaining the regularity of any one pixel point in the connector gray level image according to the gradient amplitude and gradient direction of each pixel point in the preferred neighborhood range and the main direction of any one pixel point in the connector gray level image;
obtaining a singular value sequence according to the preferred neighborhood range of any one pixel point in the connector gray level image, and obtaining a rule index of any one pixel point in the connector gray level image according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image;
obtaining an abnormal score value of each pixel point in the connector gray level image according to the rule index of any pixel point in the connector gray level image, and obtaining a defect area of the connector according to the abnormal score value of each pixel point in the connector gray level image.
Further, the step of obtaining the gradient of any pixel point in the neighborhood range along different directions includes the following specific steps:
for a neighborhood range of any pixel point in a connector gray level image, marking any pixel point in the neighborhood range as a first pixel point, taking a gray level difference value of a right pixel point in an eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 0-degree direction, taking a gray level difference value of a right pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 45-degree direction, taking a gray level difference value of an upper pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 90-degree direction, sequentially acquiring gradient sizes of the first pixel point along different directions along a anticlockwise direction, wherein the gradient sizes of the different directions comprise a gradient size of 0-degree direction, a gradient size of 45-degree direction, a gradient size of 90-degree direction, a gradient size of 135-degree direction, a gradient size of 180-degree direction, a gradient size of 225-degree direction and a gradient size of 270-degree direction.
Further, the method for obtaining the main direction of any one pixel point in the connector gray level image according to the gradient of each pixel point in the neighborhood range along any one direction comprises the following specific steps:
for the neighborhood range of any one pixel point in the connector gray level image, in the formula,gray value for p-th pixel in neighborhood,>is the gradient size of the p-th pixel point in the neighborhood along the i-th direction,>is the total number of pixels in the neighborhood range, < +.>For the response value of the pixel point along the ith direction in the connector gray scale image, +.>Representing a linear normalization function, wherein the normalized object is the gray values of all pixel points in the neighborhood range;
and taking the direction corresponding to the maximum value of the response values of the pixel point along all directions as the main direction of the pixel point in the connector gray level image.
Further, the obtaining the preferred neighborhood range of any one pixel point in the connector gray level image according to the main direction of any one pixel point in the connector gray level image includes the following specific steps:
for any pixel point in the connector gray level image, the main direction of the pixel point is recorded asTaking a pixel point as a center, taking the range of R1 multiplied by R1 as the preferable neighborhood range of the pixel point in the connector gray level image, and taking one edge and +.>Is 0 DEG, R1 is the preferred neighborhood length, ">Wherein->R is the preset neighborhood length for the response value of the pixel point along the main direction, and +.>Representing Sigmoid function->Representing a downward rounding function.
Further, the step of obtaining the degree of regularity of any one pixel in the connector gray level image according to the gradient amplitude and gradient direction of each pixel in the preferred neighborhood range and the main direction of any one pixel in the connector gray level image includes the following specific steps:
in the method, in the process of the invention,for the gradient amplitude of the jth pixel point in the preferred neighborhood range of the jth pixel point in the connector gray scale image,/th pixel point>For the gradient direction of the (q) th pixel point in the preferred neighborhood range of the (j) th pixel point in the connector gray level image,/o>Is the main direction of the j-th pixel point in the gray level image of the connector, < >>To take absolute value, +.>For preset parameters, < >>Representing a linear normalization function, wherein the normalized object is the gradient amplitude of all pixel points in the preferred neighborhood range of the jth pixel point,/for>For the number of all pixel points in the preferred neighborhood range of the jth pixel point in the connector gray level image,/for the number of the jth pixel point in the connector gray level image>Is the degree of regularity of the j-th pixel point in the connector gray level image.
Further, the step of obtaining the rule index of any one pixel point in the connector gray level image according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image comprises the following specific steps:
the summation result of the first TZ singular values in the singular value sequence is recorded asTS, marking the summation result of all singular values in the singular value sequence as TP, TZ as undetermined value, and setting TS to be larger thanSequence of all singular values corresponding at the time as the main contributing singular value sequence,/>Presetting a first parameter;
in the method, in the process of the invention,for the main contribution of the variance results of all singular values in the singular value sequence,/>For the degree of regularity of the j-th pixel point in the connector gray level image, < >>Is a rule index of the j-th pixel point in the connector gray level image.
Further, the method for obtaining the neighborhood range of any pixel point in the connector gray level image according to the preset neighborhood length comprises the following specific steps:
for any pixel point in the connector gray level image, taking the pixel point as the center, taking the R multiplied by R range as the neighborhood range of the pixel point in the connector gray level image, and taking R as the preset neighborhood length.
Further, the step of obtaining the singular value sequence according to the preferred neighborhood range of any one pixel point in the connector gray level image comprises the following specific steps:
and regarding the preferred neighborhood range of any pixel point in the connector gray level image, taking the preferred neighborhood range as a matrix of SVD singular value decomposition, decomposing by utilizing an SVD singular value decomposition algorithm to obtain a plurality of singular values, and arranging all the singular values in the sequence from large to small to obtain a singular value sequence.
Further, the obtaining the abnormal score value of each pixel point in the connector gray level image according to the rule index of any pixel point in the connector gray level image comprises the following specific steps:
arranging the regular indexes of all the pixel points in the connector gray level image according to the sequence from left to right and from top to bottom to obtain a regular index sequence, constructing an isolated forest by the regular index sequence through an isolated forest algorithm, and obtaining an abnormal score value of each pixel point in the connector gray level image.
Further, the method for obtaining the defect area of the connector according to the abnormal score value of each pixel point in the gray level image of the connector comprises the following specific steps:
when the abnormal score value of any pixel point in the connector gray level image is larger than the preset score threshold value, the pixel point corresponding to the pixel point larger than the preset score threshold value is used as a defect pixel point in the connector gray level image, and the region formed by all the defect pixel points in the connector gray level image is used as a defect region of the connector.
The technical scheme of the invention has the beneficial effects that: according to the method, the main direction of any one pixel point in the connector gray level image is obtained by utilizing gradient information of any one pixel point neighborhood range in the connector gray level image, the optimal neighborhood range is further obtained, the degree of regularity of gradient in the optimal neighborhood range of each point and the distribution condition of the pixel points are quantified by calculating the mode of combining the gradient regularity of each point in the optimal neighborhood range with singular value decomposition, and further, defective area pixel points in the connector gray level image are distinguished by combining an isolated forest algorithm, the characteristic indexes of each point are improved on the basis of the traditional isolated forest algorithm, the detection accuracy degree is improved, and the defect detection effect of the connector is further improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of steps of a method for detecting defects of a photovoltaic energy storage electric box connector based on machine vision according to an embodiment of the present invention.
Detailed Description
In order to further illustrate the technical means and effects adopted by the invention to achieve the preset aim, the following description refers to the specific implementation, structure, characteristics and effects of the method for detecting the defects of the photovoltaic energy storage electric box connector based on machine vision, which is provided by the invention, with reference to the accompanying drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the machine vision-based photovoltaic energy storage electric box connector defect detection method provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart illustrating a method for detecting defects of a photovoltaic energy storage electronic box connector based on machine vision according to an embodiment of the present invention is shown, the method includes the following steps:
and S001, collecting a connector image of the photovoltaic energy storage electric box and graying to obtain a connector gray image.
It should be noted that, in the present embodiment, for the photovoltaic energy storage electric box connector with defects, the defect image of the photovoltaic energy storage electric box connector is analyzed, the gray information in the neighborhood where each point is located is used to obtain the characteristic index of each point and then calculate the abnormal score value of each point, for the photovoltaic energy storage electric box connector with defects, the concept of the isolated forest algorithm is used to take each pixel point as each point in the isolated forest, the probability that each point is a defect is determined by calculating the abnormal score value of each point, and then the position information of the defect area is obtained, and before the analysis is started, the image needs to be collected first.
Specifically, a connector image of the photovoltaic energy storage electric box is collected through a camera and recorded as a connector image, and the connector image is subjected to gray processing to obtain a connector gray image.
Thus, a connector gray scale image is obtained.
Step S002, obtaining the neighborhood range of any one pixel point in the connector gray level image according to the preset neighborhood length, obtaining the gradient magnitude of any one pixel point in the neighborhood range along different directions for the neighborhood range of any one pixel point in the connector gray level image, and obtaining the main direction of any one pixel point in the connector gray level image according to the gradient magnitude of each pixel point in the neighborhood range along any one direction.
It should be noted that, there are many parallel lines in the connector image, based on this characteristic, choose the neighborhood where each point in the image locates to carry on the measurement of the regularity of the corresponding position; the method comprises the steps of obtaining the main direction of each point in the neighborhood by utilizing gradient information of each point, calculating the regularity of each point along the main direction, obtaining different gray matrixes in the neighborhood regions in different directions when singular value decomposition is utilized, obtaining the gray neighborhood matrix by utilizing the obtained main direction in order to enable the distribution of the singular values to reflect the rule information of pixel point distribution of the neighborhood of the point, correcting the gradient regularity of each point by utilizing the obtained main direction, obtaining more accurate characteristic indexes, and then obtaining isolated forests to calculate abnormal score values of each point, thereby obtaining the defect region of the connector.
Specifically, a neighborhood range of any one pixel point in the connector gray level image is obtained according to a preset neighborhood length, and the method specifically comprises the following steps:
for any pixel point in the connector gray level image, the pixel point is taken as the center, the range of r×r is taken as the neighborhood range of the pixel point in the connector gray level image, R is a preset neighborhood length, and the embodiment is described by taking r=9 as an example, and it should be noted that if any pixel point in the connector gray level image is at the edge of the gray level image, the neighborhood range of the pixel point exceeds the boundary of the connector gray level image, and at this time, the embodiment uses the quadratic linear interpolation method to interpolate and fill data in the part exceeding the boundary of the connector gray level image.
It should be noted that, since the directions of textures in the neighborhood range corresponding to each point in the connector gray image are different, after the neighborhood range of each point is obtained, the direction angle of the textures in the neighborhood range of each point needs to be calculated, and for different directions, the regularity of the directions needs to be different, and the neighborhood range of each point needs to be adjusted by using the directions of the textures in the neighborhood range of each point, so that the transverse and longitudinal directions of the neighborhood range coincide with the directions of the corresponding textures, and further the subsequent degree of regularity is calculated.
Specifically, for a neighborhood range of any one pixel point in the connector gray level image, gradient sizes of any one pixel point in the neighborhood range along different directions are obtained, and the method specifically comprises the following steps:
for a neighborhood range of any pixel point in the connector gray level image, marking any pixel point in the neighborhood range as a first pixel point, taking a gray level difference value of a right pixel point in an eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 0-degree direction, taking a gray level difference value of a right pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 45-degree direction, taking a gray level difference value of an upper pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 90-degree direction, and sequentially acquiring gradient sizes of the first pixel point along different directions along a counterclockwise direction.
It should be noted that, the gradient sizes of any pixel point in the neighborhood range along different directions include a gradient size in a 0 ° direction, a gradient size in a 45 ° direction, a gradient size in a 90 ° direction, a gradient size in a 135 ° direction, a gradient size in a 180 ° direction, a gradient size in a 225 ° direction, a gradient size in a 270 ° direction, and a gradient size in a 315 ° direction, and since the gradient sizes in the subsequent acquisition directions are the same as those in the previous directions, the description will not be repeated.
Further, according to the gradient of each pixel point in the neighborhood range along any direction, the main direction of any pixel point in the connector gray level image is obtained, which is specifically as follows:
for the neighborhood range of any one pixel point in the connector gray level image, in the formula,gray value for p-th pixel in neighborhood,>is the gradient size of the p-th pixel point in the neighborhood along the i-th direction,>is the total number of pixels in the neighborhood range, < +.>For the response value of the pixel point along the ith direction in the connector gray scale image, +.>Representing a linear normalization function, wherein the normalized object is the gray values of all pixel points in the neighborhood range;
and taking the direction corresponding to the maximum value of the response values of the pixel point along all directions as the main direction of the pixel point in the connector gray level image.
It should be noted that, because of the characteristics of the gray level image of the connector, after the neighborhood range corresponding to each point is taken, a plurality of parallel lines exist in the neighborhood range of each point, so that the response values of the gradient sizes of each point in the neighborhood range along different directions are respectively calculated, and the response values in the direction can be prevented from being influenced by the fact that the gradient directions of the pixel points at two sides corresponding to part of lines are opposite by utilizing the gray level values of each point; the pixel point with higher gray value in each point neighborhood is endowed with higher weight coefficient, and the angle corresponding to the highest response value in a certain direction is selected as the main direction corresponding to the point.
So far, the main direction of any pixel point in the connector gray level image is obtained.
Step S003, a preferred neighborhood range of any one pixel point in the connector gray level image is obtained according to the main direction of any one pixel point in the connector gray level image, and the regularity of any one pixel point in the connector gray level image is obtained according to the gradient amplitude and gradient direction of each pixel point in the preferred neighborhood range and the main direction of any one pixel point in the connector gray level image.
It should be noted that, if the above-mentioned main direction of any one pixel point in the connector gray level image is obtained, and the response values of the pixel points in the neighborhood range along different directions are too large or too small, then the neighborhood range needs to be adjusted, so that the selected neighborhood range is more suitable.
Specifically, the preferred neighborhood range of any one pixel point in the connector gray level image is obtained according to the main direction of any one pixel point in the connector gray level image, and specifically comprises the following steps:
for any pixel point in the connector gray level image, the main direction of the pixel point is recorded asTaking the pixel point as the center, taking the R1X R1 range as the preferred neighborhood range of the pixel point in the connector gray level image, and taking one edge and +_ of the preferred neighborhood range of the pixel point>Is 0 DEG, R1 is the preferred neighborhood length, ">Wherein->R is the preset neighborhood length for the response value of the pixel point along the main direction, and is +.>Representing Sigmoid function for normalization, +.>Representing a downward rounding function.
The preferred neighborhood region is a square region, and one edge of the preferred neighborhood region refers to one straight edge of the square region.
It should be noted that, after the improved neighborhood range of each point in the connector gray level image is obtained, that is, the preferred neighborhood range is obtained, the degree of regularity in the preferred neighborhood range where each point is located is calculated, and for the pixel point with higher regularity, the probability of having a defect area in the corresponding preferred neighborhood range is smaller, so that when determining the position of the abnormal area by using the isolated forest algorithm, the area corresponding to the pixel point with relatively weaker regularity in the preferred neighborhood range is considered, and therefore, the degree of regularity in the corresponding preferred neighborhood of each point needs to be calculated to calculate the subsequent feature index.
Specifically, for a preferred neighborhood range of any one pixel point in the connector gray level image, according to a gradient amplitude value and a gradient direction of each pixel point in the preferred neighborhood range and a main direction of any one pixel point in the connector gray level image, a regularity degree of any one pixel point in the connector gray level image is obtained, which is specifically as follows:
in the method, in the process of the invention,for the gradient amplitude of the jth pixel point in the preferred neighborhood range of the jth pixel point in the connector gray scale image,/th pixel point>For the gradient direction of the (q) th pixel point in the preferred neighborhood range of the (j) th pixel point in the connector gray level image,/o>Is the main direction of the j-th pixel point in the gray level image of the connector, < >>To take absolute value, +.>To preset parameters, the embodiment usesFor the purposes of illustration, the objective is to prevent the denominator from being 0 +.>Representing a linear normalization function, wherein the normalized object is the gradient amplitude of all pixel points in the preferred neighborhood range of the jth pixel point,/for>For the number of all pixel points in the preferred neighborhood range of the jth pixel point in the connector gray level image,/for the number of the jth pixel point in the connector gray level image>Is the degree of regularity of the j-th pixel point in the connector gray level image.
It should be noted that, the gradient magnitude and gradient direction of the pixel point in the preferred neighborhood range may be obtained by using a Sobel operator, which is not described in detail in this embodiment.
It should be noted that, the difference between the gradient direction of each point and the main direction corresponding to the obtained point is used to measure the regularity, for the points with different gradient magnitudes, the corresponding weight coefficients are different, the normalization result of the gradient magnitudes of each point in the preferred neighborhood range is used to perform weighted average on the gradient direction difference value, that is, a plurality of pixel points with larger gradient magnitudes exist in the corresponding preferred neighborhood range, the gradient directions are all along the main direction of the central pixel point in the preferred neighborhood range, then a higher regularity index is given to the pixel points, otherwise, for the pixel point neighborhood with possible defects, the existence of the defects can destroy the measure of the regularity to cause lower regularity.
So far, the regularity of any pixel point in the connector gray level image is obtained.
Step S004, a singular value sequence is obtained according to the preferred neighborhood range of any one pixel point in the connector gray level image, and a rule index of any one pixel point in the connector gray level image is obtained according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image.
The degree of regularity is only considered in terms of uniformity of gradient directions in the preferable neighborhood range of each point, and uniformity of arrangement of each point is not considered, so that the regularity index is corrected by using the idea of singular value decomposition. If the matrix of each point neighborhood carries out singular value decomposition along the main direction, the matrix of each point is distributed uniformly, namely the gray values of each row or each column are approximately proportional, the gray vectors of each row or each column can carry out good dimension reduction, because the left matrix and the right matrix after SVD singular value decomposition respectively represent the coefficient matrix of the principal component analysis of the matrix vectors, the singular value is 1/2 times of the contribution rate of the corresponding variance, the first variance contribution rate of the pixel point of the type corresponding to the matrix of the neighborhood is larger, namely the occupation ratio of the first singular value is larger, the subsequent singular values are smaller, the difference of the singular values is larger, otherwise, the difference of a plurality of larger singular values is not excessive, and the regularity index of each point is corrected based on the characteristic, so as to obtain the more accurate characteristic index of each point.
Specifically, a singular value sequence is obtained according to a preferred neighborhood range of any one pixel point in the connector gray level image, and a rule index of any one pixel point in the connector gray level image is obtained according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image, specifically as follows:
preferential neighborhood range for any one pixel point in the connector gray level imageSurrounding, taking a preferred neighborhood range as a matrix of SVD singular value decomposition, decomposing by utilizing an SVD singular value decomposition algorithm to obtain a plurality of singular values, arranging all the singular values in a sequence from big to small to obtain a singular value sequence, marking the summation result of the first TZ singular values in the singular value sequence as TS, marking the summation result of all the singular values in the singular value sequence as TP, TZ as a undetermined value, and marking TS to be larger than the first timeSequence of all singular values corresponding at the time as the main contributing singular value sequence,/>To preset the first parameter, the present embodiment uses +.>Examples are described.
In the method, in the process of the invention,for the main contribution of the variance results of all singular values in the singular value sequence,/>For the degree of regularity of the j-th pixel point in the connector gray level image, < >>Is a rule index of the j-th pixel point in the connector gray level image.
If the sequence of dominant singular values contains only one singular value, then=1, decomposing the gray matrix of the preferred neighborhood where each point is located by singular value decomposition, which corresponds to the singular value distribution rule and reflects the rule of each point distribution to a certain extentThe rhythmicity feature, because the matrix corresponding to the optimal neighborhood range of each point takes a value along the corresponding main direction, if the regularity in the matrix is good, the matrix corresponding to the matrix has a higher probability of correlation, if the contribution rate in the singular value sequence is selected to exceed +.>The singular value variance selected by the matrix with stronger regularity is larger and smaller if the singular value is mainly contributed to the singular value sequence, so that the regularity of each point is corrected by utilizing the variance of the singular value to obtain a more accurate characteristic index of each point; similarly, the singular value matrix with higher regularity exceeds +.>The number of singular values is small, consider that when the number of singular values is selected to be 1, the variance will be 0, and for this type of special case, the variance is set to be 1.
So far, the rule index of any pixel point in the connector gray level image is obtained.
Step S005, obtaining an abnormal score value of each pixel point in the connector gray level image according to the rule index of any pixel point in the connector gray level image, and obtaining a defect area of the connector according to the abnormal score value of each pixel point in the connector gray level image.
The rule index of any one pixel point in the gray level image of the connector is obtained, and the abnormal score value of each pixel point in the image is obtained by using an isolated forest algorithm, so that the defect area of the connector is obtained.
Specifically, the abnormal score value of each pixel point in the connector gray level image is obtained according to the rule index of any pixel point in the connector gray level image, and the defect area of the connector is obtained according to the abnormal score value of each pixel point in the connector gray level image, specifically as follows:
arranging the regular indexes of all pixel points in the connector gray level image according to the sequence from left to right and from top to bottom to obtain a regular index sequence, and utilizing the regular index sequenceThe isolated forest algorithm builds an isolated forest and obtains an abnormal score value of each pixel point in the connector gray level image. The value range of the abnormal score value isIn this embodiment, the number of binary trees in the preset isolated forest algorithm is 200, and the sample of each tree is +.>For the total number of pixel points in the connector gray level image, < > the pixel points are>Representing a downward rounding function, the tree has a depth of 30.
In this embodiment, the preset score threshold is described by taking the preset obtained threshold as 0.8 as an example, when the abnormal score value of any one pixel point in the connector gray level image is greater than the preset score threshold, the pixel point corresponding to the pixel point greater than the preset score threshold is used as the defective pixel point in the connector gray level image, and the region formed by all the defective pixel points in the connector gray level image is used as the defective region of the connector, so as to complete the defect detection of the connector.
Through the steps, the defect detection method of the photovoltaic energy storage electric box connector based on machine vision is completed.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. The defect detection method for the photovoltaic energy storage electric box connector based on machine vision is characterized by comprising the following steps of:
collecting a connector image of a photovoltaic energy storage electric box and graying to obtain a connector gray image;
obtaining a neighborhood range of any one pixel point in the connector gray level image according to a preset neighborhood length, obtaining gradient sizes of any one pixel point in the neighborhood range along different directions for the neighborhood range of any one pixel point in the connector gray level image, and obtaining a main direction of any one pixel point in the connector gray level image according to the gradient sizes of each pixel point in the neighborhood range along any one direction;
obtaining a preferred neighborhood range of any one pixel point in the connector gray level image according to the main direction of any one pixel point in the connector gray level image, and obtaining the regularity of any one pixel point in the connector gray level image according to the gradient amplitude and gradient direction of each pixel point in the preferred neighborhood range and the main direction of any one pixel point in the connector gray level image;
obtaining a singular value sequence according to the preferred neighborhood range of any one pixel point in the connector gray level image, and obtaining a rule index of any one pixel point in the connector gray level image according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image;
obtaining an abnormal score value of each pixel point in the connector gray level image according to the rule index of any pixel point in the connector gray level image, and obtaining a defect area of the connector according to the abnormal score value of each pixel point in the connector gray level image.
2. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the step of obtaining the gradient of any one pixel point in a neighborhood range along different directions comprises the following specific steps:
for a neighborhood range of any pixel point in a connector gray level image, marking any pixel point in the neighborhood range as a first pixel point, taking a gray level difference value of a right pixel point in an eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 0-degree direction, taking a gray level difference value of a right pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 45-degree direction, taking a gray level difference value of an upper pixel point in the eight-adjacent range of the first pixel point and the first pixel point as a gradient size of the first pixel point along a 90-degree direction, sequentially acquiring gradient sizes of the first pixel point along different directions along a counterclockwise direction, wherein the gradient sizes of the different directions comprise a gradient size of the 0-degree direction, a gradient size of the 45-degree direction, a gradient size of the 90-degree direction, a gradient size of the 180-degree direction, a gradient size of the 225-degree direction and a gradient size of the 270-degree direction.
3. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the step of obtaining the main direction of any one pixel point in a connector gray level image according to the gradient of each pixel point in a neighborhood range along any one direction comprises the following specific steps:
calculating response values of pixel points in the connector gray level image along different directions:
for the neighborhood range of any one pixel point in the connector gray level image, in the formula,gray value for p-th pixel in neighborhood,>is the gradient size of the p-th pixel point in the neighborhood along the i-th direction,>is the total number of pixels in the neighborhood range, < +.>For the connector in gray scale imageResponse value of pixel along ith direction,/-for pixel>Representing a linear normalization function, wherein the normalized object is the gray values of all pixel points in the neighborhood range;
and taking the direction corresponding to the maximum value of the response values of the pixel point along all directions as the main direction of the pixel point in the connector gray level image.
4. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 3, wherein the obtaining the preferred neighborhood range of any one pixel point in the connector gray level image according to the main direction of any one pixel point in the connector gray level image comprises the following specific steps:
for any pixel point in the connector gray level image, the main direction of the pixel point is recorded asTaking a pixel point as a center, taking the range of R1 multiplied by R1 as the preferable neighborhood range of the pixel point in the connector gray level image, and taking one edge and +.>Is 0 DEG, R1 is the preferred neighborhood length, ">WhereinR is the preset neighborhood length for the response value of the pixel point along the main direction, and +.>Representing Sigmoid function->Representing a downward rounding function.
5. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the calculation formula of the degree of regularity of any one pixel point in the connector gray level image comprises:
in the method, in the process of the invention,for the gradient amplitude of the jth pixel point in the preferred neighborhood range of the jth pixel point in the connector gray scale image,/th pixel point>For the gradient direction of the (q) th pixel point in the preferred neighborhood range of the (j) th pixel point in the connector gray level image,/o>Is the main direction of the j-th pixel point in the gray level image of the connector, < >>To take absolute value, +.>For preset parameters, < >>Representing a linear normalization function, wherein the normalized object is the gradient amplitude of all pixel points in the preferred neighborhood range of the jth pixel point,/for>For the number of all pixel points in the preferred neighborhood range of the jth pixel point in the connector gray level image,/for the number of the jth pixel point in the connector gray level image>Is the degree of regularity of the j-th pixel point in the connector gray level image.
6. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the step of obtaining the rule index of any one pixel point in the connector gray level image according to the singular value sequence and the rule degree of any one pixel point in the connector gray level image comprises the following specific steps:
the summation result of the first TZ singular values in the singular value sequence is marked as TS, the summation result of all singular values in the singular value sequence is marked as TP, TZ is a undetermined value, and TS is larger than TS for the first timeSequence of all singular values corresponding at the time as the main contributing singular value sequence,/>Presetting a first parameter;
calculating a rule index of pixel points in the connector gray level image:
in the method, in the process of the invention,for the main contribution of the variance results of all singular values in the singular value sequence,/>For the degree of regularity of the j-th pixel point in the connector gray level image, < >>Is a rule index of the j-th pixel point in the connector gray level image.
7. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the method for obtaining the neighborhood range of any one pixel point in a connector gray level image according to a preset neighborhood length comprises the following specific steps:
for any pixel point in the connector gray level image, taking the pixel point as the center, taking the R multiplied by R range as the neighborhood range of the pixel point in the connector gray level image, and taking R as the preset neighborhood length.
8. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the obtaining the singular value sequence according to the preferred neighborhood range of any one pixel point in the connector gray level image comprises the following specific steps:
and regarding the preferred neighborhood range of any pixel point in the connector gray level image, taking the preferred neighborhood range as a matrix of SVD singular value decomposition, decomposing by utilizing an SVD singular value decomposition algorithm to obtain a plurality of singular values, and arranging all the singular values in the sequence from large to small to obtain a singular value sequence.
9. The machine vision-based method for detecting defects of a photovoltaic energy storage electric box connector according to claim 1, wherein the obtaining the abnormal score value of each pixel in the connector gray level image according to the rule index of any pixel in the connector gray level image comprises the following specific steps:
arranging the regular indexes of all the pixel points in the connector gray level image according to the sequence from left to right and from top to bottom to obtain a regular index sequence, constructing an isolated forest by the regular index sequence through an isolated forest algorithm, and obtaining an abnormal score value of each pixel point in the connector gray level image.
10. The method for detecting defects of a photovoltaic energy storage electric box connector based on machine vision according to claim 1, wherein the method for obtaining the defect area of the connector according to the abnormal score value of each pixel point in the connector gray level image comprises the following specific steps:
when the abnormal score value of any pixel point in the connector gray level image is larger than the preset score threshold value, the pixel point corresponding to the pixel point larger than the preset score threshold value is used as a defect pixel point in the connector gray level image, and the region formed by all the defect pixel points in the connector gray level image is used as a defect region of the connector.
CN202311558136.XA 2023-11-22 2023-11-22 Photovoltaic energy storage electric box connector defect detection method based on machine vision Active CN117274261B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311558136.XA CN117274261B (en) 2023-11-22 2023-11-22 Photovoltaic energy storage electric box connector defect detection method based on machine vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311558136.XA CN117274261B (en) 2023-11-22 2023-11-22 Photovoltaic energy storage electric box connector defect detection method based on machine vision

Publications (2)

Publication Number Publication Date
CN117274261A CN117274261A (en) 2023-12-22
CN117274261B true CN117274261B (en) 2024-02-27

Family

ID=89201243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311558136.XA Active CN117274261B (en) 2023-11-22 2023-11-22 Photovoltaic energy storage electric box connector defect detection method based on machine vision

Country Status (1)

Country Link
CN (1) CN117274261B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8413493B1 (en) * 2011-12-12 2013-04-09 Florida Turbine Technologies, Inc. Method for detecting a defect on an operating turbine rotor blade
CN114998198A (en) * 2022-04-24 2022-09-02 南通夏克塑料包装有限公司 Injection molding surface defect identification method
CN115775250A (en) * 2023-02-13 2023-03-10 惠州威尔高电子有限公司 Golden finger circuit board defect rapid detection system based on digital image analysis
CN116758084A (en) * 2023-08-21 2023-09-15 金恒山电气无锡有限公司 Intelligent detection method for welding defects of sheet metal parts based on image data
CN116843688A (en) * 2023-09-01 2023-10-03 山东虹纬纺织有限公司 Visual detection method for quality of textile

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8413493B1 (en) * 2011-12-12 2013-04-09 Florida Turbine Technologies, Inc. Method for detecting a defect on an operating turbine rotor blade
CN114998198A (en) * 2022-04-24 2022-09-02 南通夏克塑料包装有限公司 Injection molding surface defect identification method
CN115775250A (en) * 2023-02-13 2023-03-10 惠州威尔高电子有限公司 Golden finger circuit board defect rapid detection system based on digital image analysis
CN116758084A (en) * 2023-08-21 2023-09-15 金恒山电气无锡有限公司 Intelligent detection method for welding defects of sheet metal parts based on image data
CN116843688A (en) * 2023-09-01 2023-10-03 山东虹纬纺织有限公司 Visual detection method for quality of textile

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
利用改进的SIFT算法检测桥梁拉索表面缺陷;李新科 等;武汉大学学报(信息科学版);第40卷(第1期);第71-76页 *

Also Published As

Publication number Publication date
CN117274261A (en) 2023-12-22

Similar Documents

Publication Publication Date Title
CN102800096B (en) Robustness estimation algorithm of camera parameter
CN111145227A (en) Iterative integral registration method for multi-view point cloud in underground tunnel space
CN104239899B (en) A kind of power transmission line spacer recognition methods for unmanned plane inspection
CN107966638A (en) Method and apparatus, storage medium and the processor of correction error
CN116721107B (en) Intelligent monitoring system for cable production quality
CN112712518B (en) Fish counting method and device, electronic equipment and storage medium
CN115375588A (en) Power grid transformer fault identification method based on infrared imaging
CN111680725A (en) Gas sensor array multi-fault isolation algorithm based on reconstruction contribution
CN116756594A (en) Method, system, equipment and medium for detecting abnormal points of power grid data
CN112365421A (en) Image correction processing method and device
CN117274261B (en) Photovoltaic energy storage electric box connector defect detection method based on machine vision
CN116993725B (en) Intelligent patch information processing system of flexible circuit board
CN114581419A (en) Transformer insulating sleeve defect detection method, related equipment and readable storage medium
CN117011365B (en) Dimension measuring method, dimension measuring device, computer equipment and storage medium
CN117278150A (en) Indoor wireless network signal measurement and calculation method, equipment and medium
CN115877345B (en) Method and device for supplementing missing measurement data of wind profile radar
CN116819561A (en) Point cloud data matching method, system, electronic equipment and storage medium
CN111353526A (en) Image matching method and device and related equipment
CN108416811B (en) Camera self-calibration method and device
CN115760908A (en) Insulator tracking method and device based on capsule network perception characteristics
CN115439319A (en) Exposed detection method for electric slide wire protection device
CN113635299B (en) Mechanical arm correction method, terminal device and storage medium
CN114648544A (en) Sub-pixel ellipse extraction method
CN110930344B (en) Target quality determination method, device and system and electronic equipment
Huang et al. Circle detection and fitting using laser range finder for positioning system

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