Flange plate metal piece surface flatness detection method and system

The surface flatness detection of flange metal parts through industrial cameras and image processing algorithms is solved, and the problems of high cost of contactless measurement equipment and complex data processing are achieved, achieving low-cost and efficient flatness detection.

CN120259292APending Publication Date: 2025-07-04SHANDONG EXITO GARMENTS CO LTD

Patent Information

Application Number
CN202510733401.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The non-contact measuring equipment for existing flange metal parts is costly and the data processing is complex, making it difficult to efficiently detect surface flatness.

Method used

The current detected image of the flange metal parts is obtained by using an industrial camera, and the images with the most similar lighting conditions and shooting angles are selected from the reference image group for comparison. Combined with image processing algorithms such as Sobel operator, Hough circle transformation and contour extraction functions, defect characteristic values ​​are obtained to achieve surface flatness detection.

Benefits of technology

It realizes low-cost and simple surface flatness detection of flange metal parts, improves detection efficiency and accuracy, and reduces data processing complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259292A_ABST
    Figure CN120259292A_ABST
Patent Text Reader

Abstract

The invention discloses a flange plate metal piece surface flatness detection method and system, and relates to the technical field of flatness measurement. According to the flange plate metal part surface flatness detection method, a current detection image of a flange plate metal part is obtained based on an industrial camera; acquiring a comparison reference image from a reference image group based on the current detection image; based on the comparison reference image, rotating the current detection image to obtain a feature alignment image; and based on the comparison reference image and the feature alignment image, acquiring a defect feature value of the flange plate metal part in the current detection image. According to the method, the detection images corresponding to the flange plate metal piece with the qualified surface are selected from the historical detection images to form the reference image group, and then the reference image which is most similar to the current detection image in illumination condition and shooting angle is screened from the reference image group to be compared with the current detection image; and further accurately judging whether the surface of the flange plate metal part in the current detection image has defects or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of flatness measurement, and specifically to a method and system for detecting the surface flatness of flange metal parts. Background Art

[0002] As a key mechanical connector in industrial equipment, whether the surface of the flange is flat is a necessary condition to ensure uniform compression of the sealing material. The existing methods for detecting the flatness of flanges include contact measurement methods and non-contact measurement methods. Contact measurement is prone to causing deformation of the flange surface due to physical contact, and has low detection efficiency and poor environmental adaptability. Non-contact measurement (such as laser measurement) has limitations such as high equipment cost, weak environmental anti-interference, and complex data processing. Summary of the Invention

[0003] The purpose of the present application is to provide a method and system for detecting the surface flatness of flange metal parts, so as to solve the technical problems of high cost of non-contact measurement equipment for flange metal parts and complex data processing.

[0004] To achieve the above purpose, the present application provides the following technical solutions: A method for detecting the surface flatness of flange metal parts, which obtains the current detection image of the flange metal part based on an industrial camera; the industrial camera is arranged directly above the conveyor belt and is provided with a ring light source to supplement light for the industrial camera; Obtain a comparison reference image from a reference image group based on the current detection image; the reference image group includes multiple reference images with normal surface flatness; the flange metal part in the comparison reference image is the reference image in the reference image group with the highest similarity to the current detection image; the reference image group is obtained in advance; Based on the comparison reference image, rotate the current detection image to obtain a feature alignment image; the placement position of the flange metal part in the feature alignment image is similar to the placement position of the flange metal part in the comparison reference image; Based on the comparison reference image and the feature alignment image, obtain the defect feature value of the flange metal part in the current detection image; the defect feature value is at least used to characterize the surface flatness of the flange metal part.

[0005] As a specific solution in the technical solution of the present application, the obtaining the current detection image of the flange metal part based on the industrial camera includes: If there is no flange metal part in the shooting area range of the industrial camera, adjust the shooting frequency of the industrial camera to the first shooting frequency; If the flange metal part enters the shooting area range of the industrial camera, the shooting frequency of the industrial camera is adjusted to the second shooting frequency to obtain the current detection image of the flange metal part; the second shooting frequency is greater than the first shooting frequency.

[0006] As a specific solution in the technical solution of this application, the first shooting frequency is greater than or equal to the third shooting frequency and less than or equal to the fourth shooting frequency; The calculation formula of the third shooting frequency is as follows: Wherein, represents the third shooting frequency; represents the maximum shooting interval; represents the length of the shooting area range of the industrial camera along the running direction of the conveyor belt; represents the running speed of the conveyor belt; The calculation formula of the fourth shooting frequency is as follows: Wherein, represents the fourth shooting frequency; represents the minimum shooting interval; represents the radius of the flange metal part; represents the running speed of the conveyor belt.

[0007] As a specific solution in the technical solution of this application, the steps of obtaining the reference image group include: Obtain a detection image group; the detection image group includes historical detection images of multiple flange metal parts; Traverse all the flange metal parts in the detection image group, and based on the Sobel operator, obtain the gray gradient amplitude of multiple historical detection images of the same flange metal part; If the average value of the gray gradient amplitudes of the historical detection images of a certain flange metal part is less than the first preset value, all the historical detection images of the flange metal part are classified into the reference image group, and then update and obtain the reference image group.

[0008] As a specific solution in the technical solution of this application, obtaining the comparison reference image from the reference image group based on the current detection image includes: Map the current detection image and all the reference images in the reference image group to a two-dimensional coordinate system; in the two-dimensional coordinate system, the center of the image is used as the origin; Based on the contour detection function algorithm, obtain the first coordinate and multiple second coordinates; the first coordinate is the geometric center coordinate of the flange metal part in the current detected image in the two-dimensional coordinate system; each second coordinate is the geometric center coordinate of the flange metal part in each reference image in the two-dimensional coordinate system. Based on the first coordinate and each second coordinate, obtain the comparison reference image; the comparison reference image is the reference image corresponding to the second coordinate closest to the first coordinate.

[0009] As a specific solution in the technical solution of the present application, the step of rotating the current detected image based on the comparison reference image to obtain the feature alignment image includes: Map the comparison reference image and the current detected image to the polar coordinate system; in the polar coordinate system, the pole is the geometric center point of the flange metal part. Based on the Hough circle transform algorithm, obtain the first polar angle sequence and the second polar angle sequence from the comparison reference image and the current detected image; the first polar angle sequence is the angle formed by the geometric center of each bolt hole in the comparison reference image and the pole axis; the second polar angle sequence is the angle formed by the geometric center of each bolt hole in the current detected image and the pole axis. Perform discrete Fourier transform based on the first polar angle sequence and the second polar angle sequence, extract the main frequency component phase, and obtain the rotation offset based on the difference of the main frequency component phases. Rotate the current detected image with the pole as the rotation center based on the rotation offset to obtain the feature alignment image.

[0010] As a specific solution in the technical solution of the present application, the step of obtaining the defect feature value of the flange metal part in the current detected image based on the comparison reference image and the feature alignment image includes: Obtain the first contour and the second contour from the comparison reference image and the feature alignment image based on the contour extraction function algorithm; the first contour is the contour of the flange metal part in the comparison reference image; the second contour is the contour of the flange metal part in the feature alignment image. Based on the second contour, obtain the defect area coordinates. Based on the defect area coordinates, obtain the reference area gray mean value from the first contour. Based on the defect area coordinates, obtain the defect area gray mean value from the second contour. Based on the reference area gray mean value and the defect area gray mean value, obtain the defect feature value of the flange metal part in the current detected image.

[0011] As a specific solution in the technical solution of this application, based on the second contour, obtaining the coordinates of the defect area includes: Based on the second contour, obtaining the contour moment of the defect area; Based on polar coordinate transformation, converting each coordinate in the contour moment into polar coordinates; Based on each polar coordinate, obtaining the coordinates of the defect area.

[0012] As a specific solution in the technical solution of this application, the calculation formula for obtaining the contour moment of the defect area based on the second contour is as follows: Wherein, represents the contour area of the defect area; represents the coordinates of the pixel points in the second contour; represents the characteristic function. If I(x, y) is 1, it means the point is inside the contour of the defect area. If is 0, it means the point is outside the contour of the defect area; represents the weighted sum of the contour of the defect area on the x-axis; represents the weighted sum of the contour of the defect area on the y-axis; x represents the abscissa of the coordinate point; y represents the ordinate of the coordinate point.

[0013] As a specific solution in the technical solution of this application, the calculation formula for obtaining the defect characteristic value of the flange metal part in the current detection image based on the gray mean value of the reference area and the gray mean value of the defect area is as follows: Wherein, T represents the defect characteristic value; represents the gray mean value of the defect area; represents the gray mean value of the reference area; represents the standard deviation of the gray value of the defect area; represents the standard deviation of the gray value of the reference area; k represents a constant.

[0014] A surface flatness detection system for a flange metal part includes a processor and a memory. The processor is used to process the instructions stored in the memory to implement the surface flatness detection method for the flange metal part.

[0015] Compared with the prior art, the beneficial effects of this application are: This application uses image difference technology. The inspection images corresponding to the flange metal parts with qualified surfaces are selected from the historical inspection images to form a reference image group. Then, the reference image that is most similar to the current inspection image in terms of lighting conditions and shooting angles is selected from the reference image group and compared with the current inspection image, so as to accurately determine whether there are defects on the surface of the flange metal part in the current inspection image. The equipment cost for implementing this inspection method is relatively low, and the data processing process is relatively simple. Brief Description of the Drawings

[0016] Figure 1 It is a schematic flowchart of a method for detecting the flatness of the surface of a flange metal part proposed in an embodiment of this application; Figure 2 It is a schematic structural diagram of the device for obtaining the current inspection image proposed in an embodiment of this application; Figure 3 It is a schematic diagram of a defect area obtained in an embodiment of this application; In the figure: 1, conveyor belt; 2, flange metal part; 3, industrial camera; 4, annular light source. Detailed Embodiments

[0017] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.

[0018] In the description of the embodiments of the present application and the above-mentioned drawings, terms such as "first" and "second" are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. For example, the first shooting frequency and the second shooting frequency proposed below belong to different shooting frequencies. It should be understood that the names used in this way can be interchanged under appropriate circumstances, so that the embodiments described here can be implemented in an order other than that shown or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules does not necessarily have to be limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or are inherent to these processes, methods, products, or devices. The division of modules in the embodiments of the present application is only a logical division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections between modules can be electrical or other similar forms, which are not limited in the embodiments of the present application. And the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed to multiple circuit modules, and some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.

[0019] In order to solve the technical problems of high cost and complex data processing of the non-contact measurement device for flange metal parts proposed in the background technology, the present application proposes a method for detecting the surface flatness of flange metal parts, as Figure 1 shown, the method for detecting the surface flatness of the flange metal part includes steps S100 to S400.

[0020] Step S100: Obtain the current detection image of the flange metal part based on an industrial camera.

[0021] In this embodiment, as Figure 2 shown, the industrial camera 3 is arranged directly above the conveyor belt 1, and an annular light source 4 is arranged to supplement light for the industrial camera 3. When in use, the flange metal part 2 is placed on the conveyor belt 1. When the flange metal part 2 passes through the shooting area range of the industrial camera 3 (that is, the gray shaded area as Figure 2 shown), the industrial camera 3 can take a picture of the flange metal part 2, and then obtain the current detection image of the flange metal part 2.

[0022] The principle for detecting the surface unevenness of the flange metal part in the embodiment of the present application is as follows: If the surface of the flange metal part is flat, regardless of where the flange metal part is located on the conveyor belt, in the detection image captured by the industrial camera, the colors of all parts of the flange metal part are relatively uniform and there is no shadow; if the surface of the flange metal part is uneven (for example, pits or protrusions, etc.), then under the supplementary lighting effect of the annular light source, the surface of the flange metal part will present a lighting shadow.

[0023] In the embodiment of the present application, there is no limit on the shooting frequency of the industrial camera, as long as it can capture each flange metal part located on the conveyor belt. To ensure that the industrial camera can capture each flange metal part on the conveyor belt, the shooting frequency of the industrial camera can be set relatively high.

[0024] It should be noted that if the shooting frequency of the industrial camera is relatively high, many images without flange metal parts may be captured. In the subsequent data processing stage, each current detection image needs to be processed and analyzed. If the number of images without flange metal parts is relatively large, it will lead to a large amount of data processing. To reduce the subsequent data processing volume, in an embodiment of the present application, step S100, obtaining the current detection image of the flange metal part based on the industrial camera, may include step S110 and step S120.

[0025] Step S110: If there is no flange metal part in the shooting area range of the industrial camera (that is, the gray shadow area as shown in Figure 2 ), adjust the shooting frequency of the industrial camera to the first shooting frequency.

[0026] It should be clear that in this embodiment, the first shooting frequency can be a relatively low shooting frequency (compared with the second shooting frequency below) to avoid a large number of images without flange metal parts captured by the industrial camera, that is, to reduce the subsequent data processing volume.

[0027] It should be noted that the minimum shooting frequency of the industrial camera is affected by the running speed of the conveyor belt and the shooting area range of the camera. To enable the camera to completely capture all flange metal parts, in an embodiment of the present application, the first shooting frequency can be greater than or equal to the third shooting frequency and less than or equal to the fourth shooting frequency. Specifically, in step S110, the calculation formula for the third shooting frequency can be as follows: Among them, represents the third shooting frequency; represents the maximum shooting interval.

[0028] Specifically, the calculation formula for the maximum shooting interval is as follows: Among them, represents the maximum shooting interval; represents the length of the shooting area range of the industrial camera along the running direction of the conveyor belt (that is, as shown by L0 in Figure 2 ); represents the running speed of the conveyor belt.

[0029] It should be noted that in order to obtain the current detection image with the most significant uneven feature of the flange metal part, a general industrial camera needs to collect multiple frames of images of the flange metal part to ensure that at least one frame of image can present the maximum shadow effect of the uneven defect under different lighting angles. Because when there are point protrusions or point depressions on the surface of the flange metal part, if the extension direction of the defect is parallel to the lighting direction, no effective shadow can be formed, so single-angle imaging may lead to missed detection. Therefore, by changing the relative position between the fixed annular light source and the moving conveyor belt, the flange metal part can passively receive multi-angle lighting during the movement, and the surface state of the flange metal part under different lighting angles is continuously recorded by the industrial camera to capture the change of the reflection characteristics of the defect.

[0030] As can be seen from the foregoing, at least 1 frame of effective image in which the flange metal part contacts the shooting area range needs to be captured when the flange metal part is within the shooting area range of the industrial camera, so as to ensure that the critical state of the flange metal part entering the shooting area range can be accurately determined. Therefore, in step S120, the calculation formula of the fourth shooting frequency can be as follows: Among them, represents the fourth shooting frequency; represents the minimum shooting interval.

[0031] Specifically, the calculation formula of the minimum shooting interval is as follows: Among them, represents the fourth shooting frequency; represents the minimum shooting interval; represents the radius of the flange metal part; represents the running speed of the conveyor belt.

[0032] In the embodiment of the present application, any appropriate shooting frequency can be selected as the first shooting frequency within the range of the third shooting frequency and the fourth shooting frequency.

[0033] Step S120: If the flange metal part enters the shooting area range of the industrial camera, adjust the shooting frequency of the industrial camera to the second shooting frequency to obtain the current detection image of the flange metal part.

[0034] In this embodiment, the second shooting frequency is greater than the first shooting frequency. In this embodiment, the second shooting frequency can be set according to actual requirements.

[0035] It should be noted that during the dynamic process from the right edge of the flange metal part coming into contact with the shooting area range to completely entering the shooting area range, the shooting frequency of the industrial camera needs to be adjusted from the first shooting frequency to the second shooting frequency. During the dynamic process from the left edge of the flange metal part coming into contact with the shooting area range to completely moving out of the shooting area range, the shooting frequency of the industrial camera needs to be adjusted from the second shooting frequency to the first shooting frequency.

[0036] In the embodiment of the present application, it can be determined whether the flange metal part has entered the shooting area range based on the image captured by the industrial camera when it is at the first shooting frequency. For example, if the industrial camera is at the first shooting frequency and the area of the flange metal part in the image exceeds 50% of the area where the flange metal part is completely in the image, it means that the flange metal part has entered the shooting area range, and the shooting frequency of the industrial camera can be switched from the first shooting frequency to the second shooting frequency. If the industrial camera is at the second shooting frequency and the area of the flange metal part in the image is less than 50% of the area where the flange metal part is completely in the image, it means that the flange metal part is leaving the shooting area range, and the shooting frequency of the industrial camera can be switched from the second shooting frequency to the first shooting frequency.

[0037] The embodiment of the present application adopts an adaptive camera shooting frequency, that is, the industrial camera only increases the number of shooting frames when the flange metal part enters the shooting area range; when there is no flange metal part in the shooting area range, the number of shooting frames is reduced. It can not only save resources but also effectively capture the defective image of the flange metal part (i.e., the current detection image).

[0038] Step S200: Obtain a comparison reference image from the reference image group based on the current detection image.

[0039] In the embodiment of the present application, the reference image group includes multiple reference images with normal surface flatness. The flange metal part in the comparison reference image is the reference image in the reference image group with the highest similarity to the current detection image. The reference image group is obtained in advance.

[0040] As can be seen from the foregoing, a flange metal part with surface defects (such as scratches and pits) will generate shadows due to the change in geometric structure, forming a gradient mutation region in the grayscale image; while a flange metal part with a flat surface exhibits uniform light reflection characteristics. As can be seen from the following of the embodiments of the present application, the grayscale distribution and gradient change of the images of the flange metal part with a flat surface have similar image performances at different angles, while for the flange metal part with an uneven surface, the defect area will cause abnormal light reflection due to surface deformation under the illumination condition, manifested as grayscale mutation or gradient direction disorder in multiple frames of images, and this feature is in sharp contrast to the stable imaging of the flange metal part with a flat surface. In the following of this embodiment, by comparing the detection images of two flange metal parts at similar positions on the conveyor belt (one is a flange metal part with a flat surface, and the other is the flange metal part to be detected), the flatness of the surface of the flange metal part to be detected can be obtained through the difference degree between the two.

[0041] In this embodiment, the surfaces of the flange metal parts in all the reference images in the reference image group are qualified surfaces (that is, flat surfaces without any defects). In the embodiments of the present application, the reference image group can be obtained in any reasonable manner. For example, multiple flange metal parts with flat surfaces are placed on the conveyor belt, and industrial cameras are used to obtain the detection images of these flange metal parts, and these detection images are collected to form the reference image group. In order to reduce the difficulty of obtaining the reference image group, in an embodiment of the present application, in step S200, the step of obtaining the reference image group includes steps S510 to S530.

[0042] Step S510: Obtain a group of detection images.

[0043] In the embodiments of the present application, the group of detection images includes historical detection images of multiple flange metal parts.

[0044] Step S520: Traverse all the flange metal parts in the group of detection images, and based on the Sobel operator, obtain the grayscale gradient amplitudes of multiple frames of historical detection images of the same flange metal part.

[0045] It should be clear that the Sobel operator is a discrete differential operator for edge detection, mainly used to obtain the first-order gradient of a digital image, and is commonly used in the fields of image processing and computer vision. It is a mature technology. And obtaining the grayscale gradient amplitude of a certain frame of image through the Sobel operator is also a mature technology, which will not be elaborated here.

[0046] Step S530: If the average value of the grayscale gradient amplitude of each historical detection image of a flange metal part is less than a first preset value, all historical detection images of the flange metal part are classified into the reference image group, and then the reference image group is updated and obtained.

[0047] As can be seen from the foregoing, if the surface of the flange metal part is smooth and has no defects, the color uniformity of the flange metal part surface in the detection image is good. In other words, since the flange metal part with a smooth surface reflects light evenly, the grayscale gradient amplitude between its multiple frames tends to be balanced. In other words, if the grayscale gradient amplitudes of each historical detection image of a flange metal part tend to be consistent and the mean value is small, it can be considered that the surface of the flange metal part is smooth and flat, that is, it can be included in the reference image group for subsequent comparison and analysis with the detection images of other flange metal parts to be detected.

[0048] It should be noted that grayscale gradient amplitude detection is usually used to identify the edge of an object. The principle is that there is a significant difference in the grayscale value of the edge area of ​​the object. The grayscale difference between the defective area and the smooth surface of the flange metal part due to illumination can be regarded as a "quasi-edge" feature. When the defect causes a local shadow on the surface of the flange metal part, the grayscale gradient amplitude of the defective area and the surrounding normal surface will change. By calculating the grayscale gradient amplitude of each frame of the flange metal part by the Sobel operator, the flange metal parts with a smooth surface and no defects can be successfully screened out, and then a reference image group can be formed.

[0049] In an embodiment of the present application, a first preset value can be set according to demand. It is easy to understand that if the first preset value is smaller, the number of detection images in the reference image group formed is smaller; if the first preset value is larger, the number of detection images in the reference image group formed is more. In order to reduce the processing amount of subsequent data, in an embodiment of the present application, the first preset value can be reasonably selected so that the number of detection images in the reference image group is controlled to about 1000.

[0050] In other embodiments of the present application, each historical detection image may be arranged in order of grayscale gradient amplitude from small to large, and the historical detection images ranked in the top 5% may be selected to form a reference image group. Of course, in other embodiments of the present application, the top 7% or 10% of historical detection images may also be selected to form a reference image group.

[0051] It should be noted that in this embodiment, when analyzing whether the surface of the flange metal part in the current detected image is flat, it is necessary to select a suitable historical detected image from the reference image group for comparison with the current detected image. In the embodiments of the present application, any suitable method can be used to obtain a comparison reference image from the reference image group based on the current detected image. For example, calculate the similarity between the current detected image and each historical detected image in the reference image group, and then select the historical detected image with the highest similarity to the current detected image as the comparison reference image. Calculating the similarity between two images is a mature technology and will not be elaborated here.

[0052] It should be noted that the data processing volume for calculating the similarity between two images is relatively large. And in this embodiment, to ensure the accuracy of the subsequent comparison results, when selecting a comparison reference image from the reference image group, it is also necessary to make the positions of the flange metal parts in the shooting area range close, that is, to make the lighting conditions and shooting angles of the flange metal parts in the comparison reference image and the flange metal parts in the current detected image tend to be the same, so as to reduce the risk of misjudgment. Based on this, in an embodiment of the present application, step S200, obtaining a comparison reference image from the reference image group based on the current detected image, includes steps S210 to S230.

[0053] Step S210: Map the current detected image and all reference images in the reference image group to a two-dimensional coordinate system.

[0054] It should be clear that mapping image data to a two-dimensional coordinate system is a mature technology. In the embodiments of the present application, the origin of the two-dimensional coordinate system is the center of the image (that is, the current detected image or the historical detected image in the reference image group, etc.).

[0055] Step S220: Based on the contour detection function algorithm, obtain a first coordinate and multiple second coordinates.

[0056] In the embodiments of the present application, the first coordinate is the geometric center coordinate of the flange metal part in the current detected image in the two-dimensional coordinate system. Each second coordinate is the geometric center coordinate of the flange metal part in each reference image in the two-dimensional coordinate system.

[0057] In the embodiments of the present application, the contour detection function algorithm can be any function algorithm that can identify the geometric center coordinates of the flange metal part in the image. For example, the contour detection function algorithm can be the findContours function algorithm.

[0058] Step S230: Based on the first coordinate and each second coordinate, obtain the comparison reference image.

[0059] In an embodiment of the present application, the comparison reference image is the reference image corresponding to the second coordinate closest to the first coordinate. Calculating the distance between two coordinate points is a mature technology and will not be elaborated here. It is easy to understand that if the distance between the first coordinate and a certain second coordinate is the closest, it means that the flange metal part in the current detected image is closest in position to the flange metal part in the historical detected image corresponding to the second coordinate. That is, the illumination conditions and shooting angles of the flange metal parts in the two images tend to be the same. And compared with similarity calculation, the data processing volume of distance calculation is smaller.

[0060] It should be clear that as a typical mechanical part, the annular symmetric structure of the flange metal part usually includes features such as bolt holes and sealing grooves. If the flange metal parts in the comparison reference image and the current detected image are not spatially aligned, the spatial misalignment of the same structure will cause artifacts in the gray difference. Therefore, before comparing the features between the two, it is necessary to rotate any one of the images to align the features of the flange metal parts in the comparison reference image and the current detected image, thereby improving the accuracy of the subsequent detection results. That is to say, in an embodiment of the present application, step S300 also needs to be executed.

[0061] Step S300: Based on the comparison reference image, rotate the current detected image to obtain a feature-aligned image.

[0062] In an embodiment of the present application, the placement position of the flange metal part in the feature-aligned image is similar to the placement position of the flange metal part in the comparison reference image.

[0063] In an embodiment of the present application, any reasonable method can be used to rotate the current detected image based on the comparison reference image to obtain a feature-aligned image. For example, the current detected image can be rotated manually to align the features of the flange metal parts in the comparison reference image and the current detected image. To improve work efficiency, in an embodiment of the present application, step S300, based on the comparison reference image, rotate the current detected image to obtain a feature-aligned image, may include steps S310 to S340.

[0064] Step S310: Map the comparison reference image and the current detected image to the polar coordinate system.

[0065] In this embodiment, the pole of the polar coordinate system is the geometric center point of the flange metal part.

[0066] Step S320: Based on the Hough circle transform algorithm, obtain a first polar angle sequence and a second polar angle sequence from the comparison reference image and the current detected image.

[0067] In this embodiment, the first polar angle sequence is the angle formed by the polar axis between the geometric center of each bolt hole in the comparison reference image and the pole. The second polar angle sequence is the angle formed by the polar axis between the geometric center of each bolt hole in the current detection image and the pole.

[0068] It should be clear that the Hough circle transform algorithm is an image processing technology based on the Hough transform, which is used to detect circular contours in an image. Its core principle is to map the circles in the image space to the parameter space for voting, and determine the center and radius through the local maximum value of the accumulator. The Hough circle transform algorithm is a mature technology and will not be elaborated here.

[0069] Step S330: Perform a discrete Fourier transform based on the first polar angle sequence and the second polar angle sequence, extract the phase of the main frequency component, and obtain the rotation offset based on the difference in the phases of the main frequency components.

[0070] It should be clear that extracting the phase of the main frequency component in the sequence through discrete Fourier transform is a mature technology and will not be elaborated here. The difference in the phases of the main frequency components of the two polar angle sequences is the angular difference between the two flange metal parts.

[0071] Step S340: Rotate the current detection image with the pole as the rotation center based on the rotation offset to obtain a feature-aligned image.

[0072] It should be clear that rotating an image by a fixed angle (i.e., the rotation offset) with a certain center (i.e., the pole) is a mature technology and will not be elaborated here.

[0073] Step S400: Based on the comparison reference image and the feature-aligned image, obtain the defect feature value of the flange metal part in the current detection image.

[0074] In the embodiment of the present application, the defect feature value is at least used to characterize the surface flatness of the flange metal part.

[0075] In the embodiment of the present application, any reasonable method can be used to obtain the defect feature value of the flange metal part in the current detection image based on the comparison reference image and the feature-aligned image. For example, the similarity between the two flange metal parts in the comparison reference image and the feature-aligned image can be directly calculated as the defect feature value. If the similarity between the two is greater, it means that the flange metal part in the feature-aligned image is more similar to the flange metal part in the comparison reference image, that is, the surface of the flange metal part in the current detection image is more flat. If the similarity between the two is smaller, it means that the flange metal part in the feature-aligned image is less similar to the flange metal part in the comparison reference image, that is, the probability that the surface of the flange metal part in the current detection image has defects is greater.

[0076] In order to accurately represent whether the surface of the flange metal part in the current detected image is flat, in an embodiment of the present application, in step S400, based on the comparison reference image and the feature alignment image, a defect feature value of the flange metal part in the current detected image is obtained, including steps S410 to S450.

[0077] Step S410: Obtain a first contour and a second contour from the comparison reference image and the feature alignment image based on the contour extraction function algorithm.

[0078] In the embodiment of the present application, the first contour is the contour of the flange metal part in the comparison reference image. The second contour is the contour of the flange metal part in the feature alignment image.

[0079] In the embodiment of the present application, the contour extraction function algorithm can be any algorithm that can obtain a first contour and a second contour from the comparison reference image and the feature alignment image. For example, the contour extraction function algorithm can be the cv2.findContours function algorithm.

[0080] Step S420: Obtain the defect area coordinates based on the second contour.

[0081] It should be clear that any reasonable method can be used to obtain the defect area coordinates based on the extracted second contour. For example, in an embodiment of the present application, in step S420, obtaining the defect area coordinates based on the second contour includes steps S421 to S423.

[0082] Step S421: Obtain the contour moment of the defect area based on the second contour.

[0083] It should be clear that obtaining the contour moment of a certain defect area based on the contour of the defect area (i.e., the second contour) is a mature technology. Specifically, in step S421, the calculation formula for obtaining the contour moment of the defect area based on the second contour is as follows: Where, represents the contour area of the defect area; represents the coordinates of the pixel points in the second contour; represents the feature function. If is 1, it means that the point is within the contour of the defect area. If is 0, it means that the point Outside the contour of the defect area; Represents the weighted sum of the contour of the defect area on the x-axis; Represents the weighted sum of the contour of the defect area on the y-axis; x represents the abscissa of the coordinate point; y represents the ordinate of the coordinate point.

[0084] Step S422: Based on the polar coordinate transformation, convert each coordinate in the contour moment into polar coordinates.

[0085] It should be clear that converting coordinate values to polar coordinates is a mature technology and will not be elaborated here.

[0086] Step S423: Based on each polar coordinate, obtain the defect area coordinates.

[0087] In the embodiments of the present application, any reasonable method can be used to obtain the defect area coordinates based on each polar coordinate. For example, the coordinates corresponding to each pixel point in the second contour can be used as the defect area coordinates. For the convenience of subsequent comparison calculations, in one embodiment of the present application, step S423, obtaining the defect area coordinates based on each polar coordinate can be as Figure 3 shown. Assume Figure 3 the diamond-shaped area in is the second contour, then the radial interval of the defect area coordinates , and the angular interval . In this embodiment, represents the minimum polar axis of the pixel points in the second contour; represents the maximum polar axis of the pixel points in the second contour; represents the minimum polar angle of the pixel points in the second contour; represents the maximum polar angle of the pixel points in the second contour. That is to say, in this embodiment, the defect area can be as Figure 3 shown by the gray fan-shaped area in.

[0088] Step S430: Based on the defect area coordinates, obtain the reference area gray value mean from the first contour.

[0089] In this embodiment, by extracting the gray values of the defective parts in the second contour from the first contour, it is further conducive to comparing and determining the abnormal degree of the defective parts in the second contour. It should be clear that obtaining the gray value mean of a certain area (i.e., the reference area corresponding to the defect area coordinates, that is, the reference area) in a certain contour (i.e., the first contour) is a mature technology and will not be elaborated here.

[0090] Step S440: Based on the defect area coordinates, obtain the defect area gray value mean from the second contour.

[0091] It should be clear that obtaining the gray mean value of a certain area (i.e., the area corresponding to the defect area coordinates, i.e., the defect area) in a certain contour (i.e., the second contour) is a mature technology and will not be elaborated here.

[0092] Step S450: Based on the gray mean value of the reference area and the gray mean value of the defect area, obtain the defect characteristic value of the flange metal part in the current detected image.

[0093] It should be noted that, as can be seen from the foregoing, on the premise that the illumination conditions, shooting angles, and spatial positions are the same. If the gray mean values of the reference area and the defect area are similar, it indicates that the severity of the defect in the defect area is relatively small; if the gray mean values of the reference area and the defect area differ greatly, it indicates that the severity of the defect in the defect area is relatively large. In the embodiments of the present application, any reasonable method can be used to obtain the defect characteristic value of the flange metal part in the current detected image based on the gray mean value of the reference area and the gray mean value of the defect area. For example, the defect characteristic value can be the difference between the gray mean value of the reference area and the gray mean value of the defect area.

[0094] It should be noted that, in this embodiment, as Figure 3 shown, a part of the selected defect area is a shadow defect (i.e., a diamond-shaped area), and the other part is a normal area (i.e., other areas in the defect area except the diamond-shaped area). That is to say, if the shadow defect in the defect area is more serious, the standard deviation of each pixel point in the defect area is also larger; while the reference area has no defect, so its standard deviation is smaller. In order to be able to characterize the size of the defect degree in the defect area, in an embodiment of the present application, in step S450, the calculation formula for obtaining the defect characteristic value of the flange metal part in the current detected image based on the gray mean value of the reference area and the gray mean value of the defect area is as follows: Where, T represents the defect characteristic value; represents the gray mean value of the defect area; represents the gray mean value of the reference area; represents the standard deviation of the gray values of the defect area; represents the standard deviation of the gray values of the reference area; k represents a constant, which can take any suitable positive number, for example, 3 or 4, etc.

[0095] In the embodiments of the present application, the surface of the flange metal part to be detected can be determined to be qualified by setting a threshold. For example: if the defect characteristic value is greater than or equal to the second preset value, it is determined that the surface of the flange metal part has a defect; if the defect characteristic value is less than the second preset value, it is determined that the surface of the flange metal part does not have a defect.

[0096] It should be noted that in the embodiments of the present application, if the second preset value is large, it is very likely to miss the defective flange metal parts; if the second preset value is small, it is very likely to misidentify the non-defective flange metal parts as defective. Based on this, in the embodiments of the present application, the second preset value can be set according to requirements and experience to keep both the miss detection rate and the false detection rate at a relatively low level.

[0097] The present application also provides a surface flatness detection system for flange metal parts, including a processor and a memory. The processor is configured to process the instructions stored in the memory to implement the surface flatness detection method for flange metal parts.

[0098] The surface flatness detection method and system for flange metal parts proposed in the present application adopt the image difference technology. The detection images corresponding to the flange metal parts with qualified surfaces are selected from the historical detection images to form a reference image group, and then the reference image that is most similar to the current detection image in terms of illumination conditions and shooting angles is selected from the reference image group and compared with the current detection image, so as to accurately determine whether there are defects on the surface of the flange metal part in the current detection image. The equipment cost for implementing this detection method is relatively low, and the data processing process is relatively simple.

[0099] It should be clear that the computer-readable storage medium in the present application includes permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory, static random access memory, dynamic random access memory, other types of random access memory, read-only memory, electrically erasable programmable read-only memory, flash memory or other memory technologies, compact disc read-only memory, digital versatile disc or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transient computer-readable media such as modulated data signals and carrier waves.

[0100] In the above embodiments, the descriptions of the respective embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0101] Those skilled in the art can clearly understand that for the sake of convenience and brevity of description, the specific working processes of the methods, devices, and equipment described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0102] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling, direct coupling, or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the devices or modules can be in an electrical, mechanical, or other form.

[0103] The modules described as separate components may or may not be physically separated. The components displayed as modules may or may not be physical modules, that is, they can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0104] In addition, in each embodiment of the embodiments of the present application, each functional module can be integrated in a processing module, or each module can exist physically alone, or two or more modules can be integrated in one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0105] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.

[0106] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, it generates, wholly or partly, a process or functions in accordance with the embodiments of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a digital video disc), or a semiconductor medium (such as a solid state disk (SSD)).

[0107] Although the embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles of the present application.

Claims

1. A method for detecting the surface flatness of a flange metal part, characterized in that, Including: Obtaining a current detection image of a flange metal part based on an industrial camera; the industrial camera is arranged directly above the conveyor belt and is provided with an annular light source for filling light for the industrial camera; Obtaining a comparison reference image from a reference image group based on the current detection image; the reference image group includes multiple reference images with normal surface flatness; the comparison reference image is the reference image in the reference image group with the highest similarity to the current detection image; the reference image group is obtained in advance; Rotating the current detection image based on the comparison reference image to obtain a feature alignment image; The placement position of the flange metal part in the feature alignment image is similar to the placement position of the flange metal part in the comparison reference image; Obtaining a defect feature value of the flange metal part in the current detection image based on the comparison reference image and the feature alignment image; The defect feature value is at least used to characterize the surface flatness of the flange metal part.

2. The method for detecting the surface flatness of the flange metal part according to claim 1, characterized in that The obtaining of the current detection image of the flange metal part based on the industrial camera includes: If there is no flange metal part in the shooting area range of the industrial camera, adjusting the shooting frequency of the industrial camera to a first shooting frequency; If a flange metal part enters the shooting area range of the industrial camera, adjusting the shooting frequency of the industrial camera to a second shooting frequency to obtain a current detection image of the flange metal part; the second shooting frequency is greater than the first shooting frequency.

3. The method for detecting the surface flatness of the flange metal part according to claim 2, characterized in that, The first shooting frequency is greater than or equal to a third shooting frequency and less than or equal to a fourth shooting frequency; The calculation formula of the third shooting frequency is as follows: Among them, represents the third shooting frequency; represents the maximum shooting interval; represents the length of the shooting area range of the industrial camera along the running direction of the conveyor belt; represents the running speed of the conveyor belt; The calculation formula of the fourth shooting frequency is as follows: Among them, represents the fourth shooting frequency; represents the minimum shooting interval; represents the radius of the flange metal part; represents the running speed of the conveyor belt.

4. The method for detecting the surface flatness of the flange metal part according to any one of claims 1 to 3, characterized in that The steps of obtaining the reference image group include: Obtaining a detection image group; the detection image group includes multiple historical detection images of flange metal parts; Traversing all flange metal parts in the detection image group, and based on the Sobel operator, obtaining the gray gradient amplitude of multiple historical detection images of the same flange metal part; If the average value of the gray gradient amplitudes of the historical detection images of a certain flange metal part is less than a first preset value, classifying all the historical detection images of the flange metal part into the reference image group, and then updating and obtaining the reference image group.

5. The method for detecting the surface flatness of the flange metal part according to claim 4, wherein The obtaining of the comparison reference image from the reference image group based on the current detection image includes: Mapping the current detection image and all reference images in the reference image group to a two-dimensional coordinate system; in the two-dimensional coordinate system, the center of the image is used as the origin; Based on the contour detection function algorithm, obtaining a first coordinate and multiple second coordinates; the first coordinate is the geometric center coordinate of the flange metal part in the current detection image in the two-dimensional coordinate system; each second coordinate is the geometric center coordinate of the flange metal part in each reference image in the two-dimensional coordinate system; Based on the first coordinate and each second coordinate, obtaining the comparison reference image; the comparison reference image is the reference image corresponding to the second coordinate with the closest distance to the first coordinate.

6. The method for detecting the surface flatness of the flange metal part according to claim 5, wherein, The rotating of the current detection image based on the comparison reference image to obtain a feature alignment image includes: Map the comparison reference image and the current detection image to the polar coordinate system; in the polar coordinate system, the pole is the geometric center point of the flange metal part; Based on the Hough circle transform algorithm, obtain a first polar angle sequence and a second polar angle sequence from the comparison reference image and the current detection image; the first polar angle sequence is the angle formed by the polar axis between the geometric center of each bolt hole in the comparison reference image and the pole; the second polar angle sequence is the angle formed by the polar axis between the geometric center of each bolt hole in the current detection image and the pole; Perform a discrete Fourier transform based on the first polar angle sequence and the second polar angle sequence, extract the main frequency component phase, and obtain the rotation offset based on the difference in the main frequency component phases; Rotate the current detection image with the pole as the rotation center based on the rotation offset to obtain a feature alignment image.

7. The method for detecting the surface flatness of the flange metal part according to claim 6, wherein, Obtaining the defect feature value of the flange metal part in the current detection image based on the comparison reference image and the feature alignment image includes: Obtain a first contour and a second contour from the comparison reference image and the feature alignment image based on the contour extraction function algorithm; the first contour is the contour of the flange metal part in the comparison reference image; the second contour is the contour of the flange metal part in the feature alignment image; Based on the second contour, obtain the defect area coordinates; Based on the defect area coordinates, obtain the reference area gray mean value from the first contour; Based on the defect area coordinates, obtain the defect area gray mean value from the second contour; Based on the reference area gray mean value and the defect area gray mean value, obtain the defect feature value of the flange metal part in the current detection image.

8. The method for detecting the surface flatness of the flange metal part according to claim 7, wherein, Obtaining the defect area coordinates based on the second contour includes: Based on the second contour, obtain the contour moments of the defect area; Based on polar coordinate conversion, convert each coordinate in the contour moments to polar coordinates; Based on each polar coordinate, obtain the defect area coordinates.

9. The method for detecting the surface flatness of the flange metal part according to claim 8, wherein, The calculation formula for obtaining the contour moments of the defect area based on the second contour is as follows: Among them, represents the contour area of the defect region; represents the coordinates of the pixel points in the second contour; represents the characteristic function. If is 1, it means that the point is inside the contour of the defect region. If is 0, it means that the point is outside the contour of the defect region; represents the weighted sum of the contour of the defect region on the x-axis; represents the weighted sum of the contour of the defect region on the y-axis; x represents the abscissa of the coordinate point; y represents the ordinate of the coordinate point.

10. A surface flatness detection system for a flange metal part, characterized in that, It includes a processor and a memory, and the processor is used to process the instructions stored in the memory to implement the method for detecting the surface flatness of the flange metal part as described in any one of claims 1-9.

Citation Information

Patent Citations

  • LCD defect detection system and method based on Fourier Merlin and feature matching

    CN108205210A

  • Rapid different-source image registration and fusion method and device based on optical coaxial structure

    CN115294184A

  • Coin correction processing method and system and readable storage medium

    CN116883243A

  • Fine blanking part contour detection algorithm based on machine vision

    CN117274157A

  • Object defect detection method and system, storage medium and electronic equipment

    CN118130503A

Cited By

  • Flange and end face flatness detection method thereof

    CN120912558A