Disclosure of Invention
In order to solve the technical problems, the invention aims to provide a voting and identification method for burrs inside a cast iron pipeline, and the adopted technical scheme is as follows:
the invention provides a voting and identification method for burrs inside a cast iron pipeline, which comprises the following steps:
acquiring a section image of a pipeline to be detected; obtaining an inner wall edge and an outer wall edge in the cross-sectional image;
performing curve fitting on the edge of the inner wall and the edge of the outer wall to obtain an inner wall fitting circular curve and an outer wall fitting circular curve; obtaining the size of the processing sliding window according to the size parameters of the inner wall fitting circular curve and the outer wall fitting circular curve; processing the edge of the inner wall according to the processing sliding window, and taking the inclination angle of a fitting straight line corresponding to a pixel point of the edge of the inner wall in the processing sliding window as the inclination angle information of the center point of the processing sliding window; obtaining the inclination angle information of all inner wall edge pixel points;
obtaining average inclination angle information of each inner wall edge pixel point in a preset neighborhood range, and obtaining an average inclination angle sequence; taking the fluctuation data in the average inclination angle sequence corresponding to the inner wall edge pixel points as suspected edge pixel points;
voting the inner wall edge pixel points in the neighborhood range of each inpatient edge pixel point; counting the voting value of each inner wall edge pixel point, and taking the inner wall edge pixel point with the voting value larger than the average voting value as a first burr pixel point;
rotating the section image according to a preset rotation angle to obtain a rotation image; obtaining a second burr pixel point of the rotating image; and matching the first burr pixel points and the second burr pixel points, wherein the successfully matched inner wall edge pixel points are used as real burr pixel points.
Further, the obtaining a sectional image of the pipe to be detected includes:
acquiring an initial sectional image, and performing median filtering operation on the initial sectional image to obtain the sectional image.
Further, the obtaining the inner wall edge and the outer wall edge in the cross-sectional image includes:
obtaining a segmentation threshold value of the section image according to a maximum inter-class variance method; and obtaining a high threshold and a low threshold in a gradient edge detection algorithm according to the segmentation threshold, and obtaining the inner wall edge and the outer wall edge according to the gradient edge detection algorithm.
Further, the obtaining the size of the processing sliding window according to the size parameters of the inner wall fitting circular curve and the outer wall fitting circular curve comprises:
obtaining the size of the processing sliding window according to a size adaptive adjustment formula, wherein the size adaptive adjustment formula comprises the following steps:
wherein the content of the first and second substances,
in order to handle the size of the window,
in order to pre-set the initial size,
fitting the curvature of a circular curve to the inner wall,
fitting the outer wall with the radius of a circular curve,
fitting the inner wall with the radius of a circular curve,
is a scaling factor.
Further, the using the fluctuation data in the average inclination angle sequence corresponding to the inner wall edge pixel point as an in-doubt edge pixel point includes:
performing curve fitting on the average inclination angle sequence to obtain an inclination angle change reference curve; and taking the inner wall edge pixel points corresponding to the discrete points of the inclination angle change reference curve as the suspected edge pixel points.
Further, the matching the first burr pixel point and the second burr pixel point comprises:
rotating the coordinate information of the second burr pixel point to the coordinate system of the first burr pixel point;
obtaining the offset distance from the first burr pixel point and the second burr pixel point to the center of the circle of the inner wall fitting circular curve;
and if the offset distance between the first burr pixel point and the second burr pixel point at the corresponding position is equal, the first burr pixel point and the second burr pixel point are considered to be successfully matched.
Further, after obtaining the true burr pixel point, the method further comprises:
taking the difference between the radius of the inner wall fitting circular curve and the offset distance of the real burr pixel point as the burr height of the real burr pixel point; and taking the accumulated value of the burr heights of all the real burr pixel points as the burr degree of the pipeline to be detected.
The invention has the following beneficial effects:
1. according to the embodiment of the invention, the inner wall edge and the outer wall edge of the pipeline to be detected are obtained through the image information. And obtaining the specification and the size of the pipeline to be detected according to the edge of the inner wall and the edge of the outer wall. Further, the size of the processing window is set in a self-adaptive mode according to the specification and the size of the pipeline, the inclination angle information of the inner wall edge pixel points is obtained according to the appropriate processing window, and the burr detection precision is improved.
2. According to the embodiment of the invention, the image is rotated, the second burr pixel point obtained after rotation is matched and analyzed with the initial first burr pixel point, and the false detection of the inclination angle mutation point due to the position of the pipeline is screened out according to the matching result, so that the burr detection precision is further improved.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description will be given below in conjunction with the accompanying drawings and preferred embodiments of a voting and identification method for burrs inside a cast iron pipe according to the present invention, and the detailed implementation, structure, features and effects thereof. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
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 concrete scheme of the voting and identification method for the burrs inside the cast iron pipeline provided by the invention is specifically described below by combining the attached drawings.
Referring to fig. 1, a flow chart of a voting and identification method for internal burrs of a cast iron pipe according to an embodiment of the present invention is shown, where the method includes:
step S1: acquiring a section image of a pipeline to be detected; the inner wall edge and the outer wall edge in the sectional image are obtained.
In a cast iron pipeline manufacturing workshop, a cast iron pipeline after casting and cutting is placed on a conveyor belt, an industrial camera can be arranged beside the conveyor belt, so that the industrial camera can acquire a section image of the cast iron pipeline, the position of the industrial camera is proper, a light source is constant, and clear and complete image information is acquired through a visible light source. In the embodiment of the invention, the cast iron pipeline is transversely placed on a conveyor belt, and an industrial camera on the side surface of the conveyor belt is used for acquiring image information.
In the process of image information acquisition and transmission, various noises exist in the acquired initial sectional image under the influence of the environment and an input-output conversion device. Considering that the main noise category in the image is salt and pepper noise, performing median filtering operation on the initial section image, performing noise reduction on the image and keeping edge information of an image empty region to obtain the section image.
And carrying out edge detection on the sectional image to obtain an inner wall edge and an outer wall edge. In the embodiment of the present invention, a sobel operator is selected to perform gradient calculation on the cross-sectional image, and the specific calculation process is a technical means well known to those skilled in the art and is not described herein again. After the gradient information of each pixel point is obtained, edge pixel points need to be extracted according to the size of the gradient information, and therefore a high threshold value and a low threshold value need to be set to screen the pixel points. And obtaining a segmentation threshold of the sectional image according to the maximum inter-class variance method. The background and pipeline information can be segmented according to a segmentation threshold. Therefore, the high and low thresholds in the gradient edge detection algorithm are obtained according to the segmentation threshold, and the inner wall edge and the outer wall edge are obtained according to the gradient edge detection algorithm. In the embodiment of the present invention, a segmentation threshold is used as a high threshold in gradient edge detection, and one third of the segmentation threshold is used as a low threshold in gradient edge detection.
Step S2: performing curve fitting on the inner wall edge and the outer wall edge to obtain an inner wall fitting circular curve and an outer wall fitting circular curve; obtaining the size of the processing sliding window according to the size parameters of the inner wall fitting circular curve and the outer wall fitting circular curve; processing the edge of the inner wall according to the processing sliding window, and taking the inclination angle of a fitting straight line corresponding to the pixel point of the edge of the inner wall in the processing sliding window as the inclination angle information of the central point of the processing sliding window; and obtaining the inclination angle information of all the inner wall edge pixel points.
In order to obtain the specification of the current pipeline to be detected, curve fitting is carried out on the inner wall edge and the outer wall edge, and an inner wall fitting circular curve and an outer wall fitting circular curve are obtained. In the embodiment of the invention, the least square method is utilized to fit the pixel point coordinates of the inner wall edge and the outer wall edge.
When the visual information is used for detecting burrs on the inner wall of the pipeline, the burrs are often detected through the curvature or tangent slope of each inner wall edge pixel point. However, for a pipeline with a large size specification, the inner diameter of the pipeline is large, and when the pixel points at the local positions are analyzed, enough pixel points need to participate in curvature or tangent slope calculation, so that a processing window with a large size needs to be used for processing and analyzing; the smaller the overall curvature of the inner wall edge, the less the local curvature change, and therefore the need to enhance the changing features with a larger size process window. The size of the processing window is therefore proportional to the dimensions of the pipe to be inspected and inversely proportional to the overall curvature of the edge of the inner wall. Obtaining the size of the processing sliding window according to the size parameters of the inner wall fitting circular curve and the outer wall fitting circular curve specifically comprises:
obtaining the size of the processing sliding window according to a size self-adaptive adjustment formula, wherein the size self-adaptive adjustment formula comprises the following steps:
wherein the content of the first and second substances,
in order to handle the size of the window,
in order to pre-set the initial size,
the curvature of the circular curve is fitted to the inner wall,
the radius of the circular curve is fitted to the outer wall,
the radius of the circular curve is fitted to the inner wall,
is a scaling factor.
It should be noted that, because the inner wall fitting circle is a complete circle, the curvature of the inner wall fitting circle curve is the reciprocal of the radius of the inner wall fitting circle curve.
In an embodiment of the present invention, the initial size is set to 5 and the scaling factor is set to 28.
And processing the inner wall edge according to the processing sliding window, namely processing by taking the inner wall edge pixel points as the processing sliding window central point, taking the inclination angle of the fitting straight line corresponding to the pixel point of the inner wall edge in the processing sliding window as the inclination angle information of the processing sliding window central point, traversing all the inner wall edge pixel points, and obtaining the inclination angle information of each inner wall pixel point.
In the embodiment of the invention, the least square method is used for fitting the inner wall edge pixel points in the processing window to obtain a fitting straight line, and the inclination angle information is obtained according to the slope of the fitting straight line.
Step S3: obtaining average inclination angle information of each inner wall edge pixel point in a preset neighborhood range, and obtaining an average inclination angle sequence; and taking the inner wall edge pixel points corresponding to the fluctuation data in the average inclination angle sequence as suspected edge pixel points.
In order to further amplify the influence of the burrs on the inclination angle information of the inner wall edge pixel points, the average inclination angle information of each inner wall edge pixel point in the preset neighborhood range is obtained. If burr points exist in the neighborhood range of the inner wall edge pixel points, the inclination angle information of the burr points influences the size of the average inclination angle information, so that the average inclination angle information can effectively reflect the influence of the burr points existing in the neighborhood range of the inner wall edge pixel points on the inclination angle information. In the embodiment of the invention, the neighborhood range is set to 7, namely, the average inclination angle information is obtained by taking the edge pixel point of the inner wall as the center and combining the inclination angle information of three other edge pixel points of the inner wall at two sides.
And obtaining average dip angle information at the position of each inner wall edge pixel point to obtain an average dip angle sequence. And the position of each element in the average inclination angle sequence represents the position of the corresponding inner wall edge pixel point. In the embodiment of the invention, the average inclination angle information of any one inner wall edge pixel point is selected as the vertex of the average inclination angle sequence, and the average inclination angle information of other inner wall edge pixel points is obtained clockwise along the inner wall edge to obtain the average inclination angle sequence.
If the inner wall of the pipe is smooth, regular linear changes may be present in the corresponding sequence of average inclination angles. If there are burrs on the inner wall of the pipe, the elements in the average inclination sequence are affected, causing sequence fluctuation. Therefore, the inner wall edge pixel points corresponding to the fluctuation data in the average inclination angle sequence are used as the suspected edge pixel points. The specific method for acquiring the fluctuation data comprises the following steps:
and performing curve fitting on the average inclination angle sequence to obtain an inclination angle change reference curve. Because the burr points have less data relative to the normal inner wall edge points, the inclination angle change reference curve is a smooth and linearly changing curve, and the discrete points outside the free and linear change reference curves are points influenced by the burr points. Therefore, the inner wall edge pixel points corresponding to the discrete points of the inclination angle change reference curve are used as the suspected edge pixel points. It should be noted that the method for determining the discrete point is a technical means well known to those skilled in the art, and is not described herein.
Step S4: voting inner wall edge pixel points in the neighborhood range of each inpatient edge pixel point; and counting the voting value of each inner wall edge pixel point, and taking the inner wall edge pixel point with the voting value larger than the average voting value as a first burr pixel point.
The suspected edge pixel points represent pixel points affected by the burr points or pixel points which are themselves burr points. Therefore, the inner wall edge pixel points in the neighborhood range of each inpatient edge pixel point are voted, namely, the voting value of all the inner wall edge pixel points in the neighborhood range of the inpatient edge pixel point is added by one every inpatient edge pixel point. The voting value of each inner wall edge pixel point is counted, because the suspected edge pixel point is a burr point or a normal inner wall edge pixel point, the burr point has more influence on other inner wall edge pixel points, the voting value of the burr point is larger, and the voting value of the normal inner wall edge pixel point is smaller, so that the burr point can be determined according to the voting value. And taking the inner wall edge pixel points with the voting values larger than the average voting value as first burr pixel points.
Step S5: rotating the section image according to a preset rotation angle to obtain a rotation image; obtaining a second burr pixel point of the rotating image; and matching the first burr pixel points and the second burr pixel points, and taking the successfully matched inner wall edge pixel points as true burr pixel points.
It should be noted that the embodiment of the present invention determines the bur point by a voting method, so as to avoid a false detection situation caused by a normal local curvature mutation point in the image when the local curvature is directly analyzed. Local curvature discontinuities such as those near the intersection of the normal circular interior wall edge contour with the horizontal diameter line.
In order to further screen out local curvature catastrophe points in the first burr pixel points, the section image is rotated according to a preset rotation angle, and a rotation image is obtained. And obtaining a second burr pixel point by using the same burr point extraction method for the rotating image. And matching the first burr pixel points and the second burr pixel points, and taking the successfully matched inner wall edge pixel points as real burr pixel points. Wherein, the matching process specifically comprises:
and rotating the coordinate information of the second burr pixel point to the coordinate system of the first burr pixel point.
And obtaining the offset distance from the first burr pixel point and the second burr pixel point to the circle center of the inner wall fitting circular curve.
If the offset distance between the first burr pixel point and the second burr pixel point at the corresponding position is equal, the first burr pixel point and the second burr pixel point are considered to be successfully matched.
In the embodiment of the present invention, the rotation angle is set to 90 °. The specific method for rotating the coordinate information of the second burr pixel point to the coordinate system of the first burr pixel point according to the rotation angle comprises the following steps:
wherein the content of the first and second substances,
the coordinates of the second burr pixel points after rotation,
is the original coordinates of the first burr pixel point,
is the angle of rotation.
After the matching process, the successfully matched points are real burr pixel points. Can confirm the burr degree of current pipe fitting according to the spatial information of true burr point, specifically include:
and taking the difference between the radius of the inner wall fitting circular curve and the offset distance of the real burr pixel point as the burr height of the real burr pixel point. And taking the accumulated value of the burr heights of all the real burr pixel points as the burr degree of the pipeline to be detected. The quality of the current production batch can be evaluated according to the burr degree of each cast iron pipeline, and whether the process parameters need to be adjusted is judged.
In summary, the embodiment of the present invention obtains the specification of the pipe to be detected through the edge information in the cross-sectional image. And adjusting the size of the processing window according to the specification of the pipeline to be detected. And obtaining the dip angle information of all the inner wall edge pixel points through the processing window, obtaining the average dip angle information in the neighborhood range of each inner wall edge pixel point, and obtaining an average dip angle sequence. And obtaining the suspected edge pixel point according to the fluctuation data in the average inclination angle sequence. Voting is carried out on the inner wall edge pixel points in the neighborhood range of the suspected edge pixel points, and first burr pixel points are obtained according to the voting value. And rotating the section image and obtaining a second burr pixel point. And taking the inner wall edge pixel point matched with the first burr pixel point and the second burr pixel point as a true burr pixel point. According to the embodiment of the invention, the size of the processing window is adjusted and the false detection point is eliminated through the pipeline specification, so that the precision and the efficiency in the burr detection process are improved.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. The processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.