A visual inspection method for special-shaped brake lever metal bushings

Through the coordinated operation of the noodle camera and the line array camera, combined with the Hoffyuan detection and edge detection, the problem of low efficiency and insufficient accuracy of traditional detection methods was solved, and high -precision detection of large -shaped brake leverage metal bushes was realized.

CN118710593BActive Publication Date: 2025-01-24TAIYUAN UNIVERSITY OF SCIENCE AND TECHNOLOGY +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410731213.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2025-01-24
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

In railway braking systems, traditional detection methods are inefficient, and accuracy and repeatability cannot meet the current requirements, especially in the detection of special-shaped braking lever metal bushings. The resolution limitation of a single camera leads to high-precision detection of large workpieces Difficult to achieve.

Method used

The method of collaborative operations of the face array camera and the line array camera, through combined calibration and image pre -processing, the line array camera is used for preliminary identification of the type of workpiece, the noodle camera is used for fine detection, combined with Hoffyuan detection and edge detection, to achieve realization Comprehensive coverage and accurate testing of large -scale exotic workpieces.

Benefits of technology

The detection accuracy and reliability of alien brake leverage metal bands is improved, the problem of limited resolution of single camera has been overcome, and high -precision detection of large workpieces is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710593B_ABST
    Figure CN118710593B_ABST
Patent Text Reader

Abstract

The present invention discloses a visual inspection method for a special-shaped brake lever metal bushing, which belongs to the field of machine vision parts inspection. The method comprises the following steps: jointly calibrating a plurality of area array cameras to obtain a plurality of calibrated area array cameras; collecting line array images based on line array cameras, estimating the size of the line array images to obtain the estimated size of the workpiece, and collecting area array images based on the estimated size of the workpiece by the calibrated area array cameras; performing contour recognition on the line array images to obtain the type of workpiece; and based on the type of workpiece, performing fine inspection on the area array images to obtain the size information of the workpiece. The present invention realizes comprehensive coverage and accurate inspection of large special-shaped workpieces, effectively solves the resolution limitation of a single camera, and thus significantly improves the inspection accuracy and reliability of large lever workpieces.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of machine vision parts detection, and in particular relates to a visual detection method for a special-shaped brake lever metal bushing. Background Art

[0002] In the railway transportation system, the performance of the braking system is directly related to the safety and reliability of driving. With the development of high-speed railways and heavy-duty railways, the performance requirements of the braking system are also increasing. Among them, the accurate identification and wear detection of the brake lever in the braking device are particularly critical to ensure the reliability of the entire system. As one of the core components, the brake lever has a wide variety of types and diverse geometric features, so measuring its size and identifying its type has become a challenge.

[0003] Traditional inspection methods rely on manual measurement, such as using simple tools such as calipers, which is not only inefficient but also cannot meet current requirements in terms of accuracy and repeatability. Considering that there may be multiple metal bushing holes on the workpiece, these traditional methods are even more cumbersome and unreliable in practical applications. Therefore, finding an efficient and accurate inspection method has become an urgent need to improve the reliability of railway braking systems.

[0004] The application of image edge detection algorithms in machine vision systems provides a technical basis for achieving automated high-precision detection. Different edge detection algorithms have their own advantages and disadvantages in industrial applications: the Sobel operator performs well in simplicity and noise suppression, but its edge positioning accuracy is insufficient and may miss subtle edges. The Canny edge detection algorithm provides high edge detection accuracy and a good signal-to-noise ratio, but it is highly complex and difficult to meet real-time requirements. The Laplacian operator can highlight sharp edges and is suitable for the detection of workpieces with rich details, but it is highly sensitive to noise and prone to false detection. The Prewitt operator is simple to implement and effectively detects edge directions, but it also has shortcomings in accuracy and noise resistance.

[0005] In addition, the challenges of the detection environment itself, such as poor imaging conditions, uneven lighting, and complex background, greatly increase the difficulty of determining the type of workpiece and performing edge detection, making it particularly difficult to screen the required edges.

[0006] When using a single industrial camera to inspect large, special-shaped workpieces, it is difficult to achieve high-precision inspection of large-sized workpieces due to the limitation of camera resolution, which affects the accuracy and efficiency of inspection. Summary of the invention

[0007] In order to solve the above technical problems, the present invention proposes a visual inspection method for a special-shaped brake lever metal bushing to solve the above problems existing in the prior art.

[0008] To achieve the above object, the present invention provides a visual inspection method for a special-shaped brake lever metal bushing, comprising:

[0009] Jointly calibrating a number of area array cameras to obtain a number of calibrated area array cameras;

[0010] The linear array camera is used to collect linear array images, and the size of the linear array images is estimated to obtain the estimated size of the workpiece. The calibrated area array camera collects area array images based on the estimated size of the workpiece.

[0011] Performing contour recognition on the line array image to obtain the type of workpiece;

[0012] Based on the type of the workpiece, the area array image is finely detected to obtain workpiece size information.

[0013] Optionally, the process of calibrating the array camera includes:

[0014] A plurality of chessboard images are obtained by photographing a chessboard calibration plate at different positions based on an area array camera;

[0015] Based on the Zhang Zhengyou calibration method, a plurality of the chessboard images are analyzed and calculated to obtain a camera intrinsic parameter matrix, a rotation matrix and a distortion coefficient;

[0016] Obtaining a mapping matrix based on the camera intrinsic parameter matrix, the rotation matrix and the distortion coefficient;

[0017] Performing distortion correction on the checkerboard image based on the mapping matrix to obtain a corrected image;

[0018] The camera calibration is completed by calculating the perspective transformation matrix of the rectified image.

[0019] Optionally, the process of performing contour recognition on the line array image to obtain the type of the workpiece includes:

[0020] Preprocessing the line array image to obtain a preprocessed line array image;

[0021] Processing the pre-processed linear array image based on a circularity screening method to obtain a number of circular contours;

[0022] Performing a preliminary classification of workpiece types based on the number of the circular-like contours;

[0023] Based on the preliminary classification results of workpiece types, the aspect ratio of the regular circumscribed rectangle of each circular contour is calculated;

[0024] The type of the workpiece is determined based on the aspect ratio of the regular circumscribed rectangle of the quasi-circular contour.

[0025] Optionally, the process of preprocessing the line array image to obtain a preprocessed line array image includes:

[0026] Performing image color space conversion on the line array image to obtain a grayscale image;

[0027] Performing Gaussian blur processing on the grayscale image to obtain a blurred image;

[0028] Binarizing the blurred image to obtain a black-and-white binary image;

[0029] The black-and-white binary image is subjected to an erosion and dilation operation to obtain a preprocessed linear array image.

[0030] Optionally, the process of detecting a quasi-circular contour based on the pre-processed line array image includes:

[0031] Extracting the overall contour information of the preprocessed linear array image based on the Suzuki-Abe algorithm;

[0032] Filtering the circular contours in the overall contour information based on a roundness formula;

[0033] Wherein, the roundness formula is:

[0034]

[0035] In the formula, circularity represents the roundness, area represents the area of ​​the contour, and perimeter represents the perimeter of the contour.

[0036] Optionally, the process of performing fine detection on the area array image to obtain workpiece size information includes:

[0037] Extracting an image region of a workpiece to be detected in the area array image;

[0038] Preprocessing the image area of ​​the workpiece to be detected to obtain a preprocessed area array image, wherein the process of preprocessing the image area of ​​the workpiece to be detected is the same as the process of preprocessing the line array image;

[0039] Performing circle-like contour detection based on the preprocessed area array image to obtain an image of the area to be detected;

[0040] Performing color space conversion on the image of the area to be detected to obtain a grayscale image of the area to be detected;

[0041] Performing Hough circle detection on the grayscale image of the area to be detected to obtain Circle1;

[0042] Perform edge detection on the grayscale image of the area to be detected to obtain Circle2;

[0043] Matching Circle2 based on Circle1 to obtain Circle3;

[0044] The coordinate transformation of Circle3 is performed based on the perspective transformation matrix to obtain workpiece size information.

[0045] Optionally, before performing the circle-like contour detection on the pre-processed area array image, the method further includes color filling of the contour of the pre-processed area array image;

[0046] Among them, the pixel outline is set, and when the outline area is smaller than the pixel outline, the outline color is filled, and the filling color is the background color.

[0047] Optionally, the process of performing Hough circle detection on the grayscale image of the area to be detected to obtain Circle1 includes:

[0048] Detect the edge of the grayscale image of the area to be detected based on the Canny edge detection algorithm, traverse each edge point, and record a number of combinations of circle center coordinates and radius;

[0049] Determine the circular target in the grayscale image of the area to be detected based on the accumulated values ​​of the center coordinates and the radius;

[0050] Circle1 is obtained based on the plurality of circular targets.

[0051] Optionally, the process of performing edge detection on the grayscale image of the area to be detected to obtain Circle2 includes:

[0052] Performing Gaussian filtering and denoising on the grayscale image of the area to be detected to obtain a denoised grayscale image of the area to be detected;

[0053] Calculate the gradient intensity and direction of each pixel in the grayscale image of the area to be detected after denoising;

[0054] A number of edge segments are obtained based on the gradient strength and direction of the pixel points and the anchor points of the grayscale image of the area to be detected after denoising;

[0055] A circle fitting is performed on the edge segment to obtain Circle2.

[0056] Optionally, the process of matching Circle2 based on Circle1 to obtain Circle3 includes:

[0057] S1. Initialize an empty set and set the center threshold and radius threshold;

[0058] S2, traverse the circles in Circle1, and extract the center coordinates and radius of the current Circle1 circle;

[0059] S3, extract the circle in Circle2, and record the center coordinates and radius of the current Circle2 circle;

[0060] S4, calculating the center distance between the current Circle2 circle and the current Circle1 circle based on the center coordinates and radius of the Circle1 circle and the center coordinates and radius of the Circle2 circle;

[0061] S5. When the center distance is less than the circle center threshold and the difference between the radius of the current Circle2 circle and the current Circle1 circle is also less than the radius threshold, the current Circle2 circle is added to the empty set as a matching circle;

[0062] When no matching circle is found, the center threshold and radius threshold are enlarged;

[0063] S6. Loop through S2-S5 to obtain Circle3.

[0064] Compared with the prior art, the present invention has the following advantages and technical effects:

[0065] The present invention obtains several calibrated area array cameras by jointly calibrating several area array cameras; collects line array images based on the line array cameras, estimates the size of the line array images to obtain the estimated size of the workpiece, and the calibrated area array cameras collect area array images based on the estimated size of the workpiece; performs contour recognition on the line array images to obtain the type of the workpiece; and based on the type of the workpiece, performs fine detection on the area array images to obtain the size information of the workpiece.

[0066] The present invention realizes an automatic detection method for a special-shaped brake lever metal bushing. The area array camera and the line array camera work in collaboration. The line array camera collects and processes the image and accurately determines the type of the workpiece. The detection algorithm corresponding to the area array camera is selected according to the type. This two-camera collaborative detection improves the detection accuracy. The area array image preliminarily screens the area to be detected and cuts it onto a new image. Then, a method combining Hough circle detection and edge detection is used for fine detection. The result of the Hough circle detection is used to match the result of the edge detection. This "preliminary screening + fine detection" reduces the complexity of directly detecting the original image. By using the joint operation of the double-sided array camera and integrating the coordinate systems of the two cameras into the same global coordinate system, comprehensive coverage and precise detection of large special-shaped workpieces are achieved, effectively solving the resolution limitation of a single camera, thereby significantly improving the detection accuracy and reliability of large lever workpieces. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0068] Figure 1 A flow chart of a visual inspection method for a special-shaped brake lever metal bushing according to an embodiment of the present invention;

[0069] Figure 2 An original image of a common workpiece according to an embodiment of the present invention;

[0070] Figure 3 The embodiment of the present invention is based on the original image of the common workpiece to select the detection area, Hough circle detection and edge detection, and the result matching image;

[0071] Figure 4 The original image of the middle tie rod workpiece is taken by two cameras in the embodiment of the present invention;

[0072] Figure 5 It is the screening detection area, two edge detections, and result matching diagram of the original image of the tie rod workpiece in the embodiment of the present invention. DETAILED DESCRIPTION

[0073] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0074] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0075] Embodiment 1

[0076] like Figure 1 As shown, this embodiment provides a visual inspection method for a special-shaped brake lever metal bushing, including joint calibration of two area array cameras; collaborative image acquisition of the line array camera and the area array camera; preprocessing the line array image, detecting the circular contour in the preprocessed image, and judging the type of the workpiece according to the contour; preprocessing the area array image, preliminarily screening the area to be inspected in the preprocessed image, and finely inspecting the area to be inspected to obtain the size information of the circular metal bushing. Figure 2 The figure shows the original image of a common workpiece according to an embodiment of the present invention. The specific implementation steps include:

[0077] Jointly calibrating a plurality of area array cameras to obtain a plurality of calibrated area array cameras includes the following steps: obtaining a plurality of checkerboard images by photographing a checkerboard calibration plate at different positions based on the area array camera; analyzing and calculating the plurality of checkerboard images based on the Zhang Zhengyou calibration method to obtain a camera intrinsic parameter matrix, a rotation matrix and a distortion coefficient; obtaining a mapping matrix based on the camera intrinsic parameter matrix, the rotation matrix and the distortion coefficient; performing distortion correction on the checkerboard image based on the mapping matrix to obtain a corrected image; and completing the camera calibration by calculating the perspective transformation matrix of the corrected image. The specific implementation process includes S1.

[0078] S1. Joint calibration of two array cameras:

[0079] For the images captured by the area array camera, image correction is performed and the pixel coordinates are converted into real world coordinates. Then, the global coordinate systems of the two area array cameras are unified to achieve the synchronization of the coordinates of the images captured by the two cameras in the real world coordinate system.

[0080] S1-1. Two area array cameras are placed side by side to cover large workpieces that are beyond the field of view of a single camera. They are installed at an appropriate height according to the predetermined working distance, and the focal length, aperture size and exposure time of the camera are adjusted. Downlighting is used, and the light is directed through the holes of the metal bushing to highlight the edge features. Assisted by uplighting to enhance the surface brightness of the workpiece, ensure that the image of the workpiece to be inspected can be clearly captured;

[0081] S1-2. For a single area array camera, let the captured chessboard image be X1. Take multiple chessboard calibration plates at different positions, use Zhang Zhengyou calibration method, calculate the camera intrinsic parameter matrix A, rotation matrix R and distortion coefficient to obtain the mapping matrix map x With map y , and then perform distortion correction on each pixel coordinate (u, v) in the acquired image X1 according to formula (1) to obtain the corrected image X2.

[0082] X2(x,y)=map x (u,v),map y (u,v) (1)

[0083] Where x and y are the coordinate values ​​of image X2;

[0084] Using the RANSAC algorithm, the significant corner points in the image are selected as key feature points, and the corner points in the image X2 are searched and the perspective transformation matrix H is calculated. According to the perspective transformation matrix, the image pixel coordinates are converted into actual world coordinates to achieve accurate mapping of coordinates;

[0085] S1-3. Place a calibration plate in the overlapping area of ​​the field of view of the two area array cameras, and each camera independently captures an image containing the calibration plate. Use the method in S1-2 to independently calculate the perspective transformation matrix for each camera, and use the perspective transformation matrix calculated by each camera to convert the pixel coordinates of the subsequent images captured by the two cameras to global coordinates based on the actual physical coordinates of the calibration plate, to ensure that any point in the field of view of the two cameras has the same coordinate value after conversion to the global world coordinate system. This means that although each camera may capture images from different perspectives, the coordinates of the same physical position points in the images of the two cameras can be ensured to be completely matched in the global world coordinate system through the unified adjustment of the coordinate system;

[0086] The linear array camera is used to collect linear array images, and the size of the linear array images is estimated to obtain the estimated size of the workpiece. The calibrated area array camera collects area array images based on the estimated size of the workpiece. The specific implementation process includes S2.

[0087] S2. Collaborative image acquisition between line array camera and area array camera:

[0088] The line array camera and the area array camera are used together. After the line array camera performs image acquisition and makes a preliminary estimate of the workpiece size, the estimated size is used to guide the workpiece to be accurately moved to the field of view of the area array camera for image acquisition.

[0089] S2-1. Install the line array camera at an appropriate height according to the predetermined working distance, adjust the focal length, aperture size and exposure time of the line array camera, and use downward lighting to ensure that the image of the workpiece to be inspected can be clearly captured;

[0090] S2-2. According to the running speed of the conveyor, the line frequency of the linear array camera is adjusted to match the shooting frequency with the moving speed of the workpiece, so as to ensure that the aspect ratio of the image is consistent with the actual one;

[0091] S2-3, through the image captured by the linear array camera, the maximum outer contour of the workpiece is identified and the maximum circumscribed rectangle of the contour is calculated. The length of the workpiece is estimated according to the length of the circumscribed rectangle. Based on this data, the system automatically adjusts the conveyor belt to move the workpiece to the appropriate position to ensure that it can be accurately captured by the two area array cameras described in S1.

[0092] Performing contour recognition on the line array image to obtain the type of workpiece includes the following steps: preprocessing the line array image to obtain a preprocessed line array image; processing the preprocessed line array image based on the roundness screening method to obtain a number of circular contours; performing a preliminary classification of the workpiece types based on the number of circular contours; calculating the aspect ratio of the regular circumscribed rectangle of each circular contour based on the result of the preliminary classification of the workpiece types; and determining the workpiece type based on the aspect ratio of the regular circumscribed rectangle of the circular contour. The specific implementation process includes S3.

[0093] S3. Preprocess the linear array image, detect the circular contour in the preprocessed image, and determine the type of the workpiece according to the contour:

[0094] S3-1, converting the original image into a grayscale image;

[0095] S3-2, performing Gaussian blur processing on the grayscale image to reduce noise in the image and smooth the image to obtain a blurred image;

[0096] S3-3, performing binarization processing on the blurred image to convert the image into a black and white binary image;

[0097] S3-4, performing an erosion and dilation operation on the black and white binary image to remove small objects and obtain a preprocessed linear array image;

[0098] S3-5, using the circularity screening method to screen out the circular contours in the preprocessed linear array image detection image; the specific implementation process includes:

[0099] The Suzuki-Abe algorithm is used to extract the overall contour information of the image.

[0100] According to the limited area, the contours that are approximately the same size as a ring and may contain a ring are initially screened out. Because there are some interferences from other non-circular contours, the circularity is calculated using formula (2). By comparing the area and circumference of the contour, the circular contours that are approximately the same size as a ring are screened out.

[0101]

[0102] Among them, circularity represents the roundness, area represents the area of ​​the contour, and perimeter represents the circumference of the contour.

[0103] Based on the number of detected circular contours, the workpiece types are initially distinguished. Given the existence of workpieces with inclinations, we need to make further judgments. Traverse the filtered contours and perform operations on each contour: calculate the aspect ratio of its regular circumscribed rectangle to determine whether it is close to 1, and further distinguish different workpiece types.

[0104] Based on the type of workpiece, the array image is finely detected to obtain the workpiece size information; including the following steps: extracting the image area of ​​the workpiece to be detected in the array image; preprocessing the image area of ​​the workpiece to be detected to obtain a preprocessed array image, wherein the preprocessing of the image area of ​​the workpiece to be detected is the same as the preprocessing of the line array image; performing circular contour detection based on the preprocessed array image to obtain the image of the area to be detected; performing color space conversion on the image of the area to be detected to obtain a grayscale image of the area to be detected; performing Hough circle detection on the grayscale image of the area to be detected to obtain Circle1; performing edge detection on the grayscale image of the area to be detected to obtain Circle2; matching Circle2 based on Circle1 to obtain Circle3; performing coordinate conversion on Circle3 based on the perspective transformation matrix to obtain the workpiece size information. The specific implementation process includes S4.

[0105] S4, preprocessing the array image, preliminarily screening the area to be detected in the preprocessed image, and performing fine detection in the area to be detected to obtain the size information of the circular metal bushing.

[0106] S4-1, performing a region of interest extraction operation on the original image to roughly cut out the image region of the workpiece to be detected;

[0107] S4-2, performing image color space conversion on the image area of ​​the workpiece to be inspected to obtain a grayscale image;

[0108] S4-3, performing Gaussian blur processing on the grayscale image to reduce noise in the image and smooth the image;

[0109] S4-4, performing binarization processing on the blurred image to convert the image into a black and white binary image;

[0110] S4-5, perform corrosion and expansion operations on the binary image, then use the Suzuki-Abe algorithm to extract the overall contour information of the image and perform contour detection. For contours with an area smaller than a certain pixel size, fill them with the background color to eliminate interference from irrelevant small objects, and obtain a preprocessed array image;

[0111] S4-6, detecting the circular contours in the preprocessed area array image, and screening out the circular contours using a roundness screening method;

[0112] Calculate the minimum circumscribed circle for each circular contour, and record the center and radius information as the circular target area. Determine the radius of the largest circle among all detected circular target areas, and expand a certain pixel value on this basis as a unified cutting size benchmark to ensure that even the largest target area can be completely covered. For all detected target circular areas, use their center as the center point, cut the circumscribed rectangle of the initial array image according to the unified cutting size determined above, and copy it to a solid color background image of the same specification to obtain the image of the area to be detected;

[0113] S4-7, converting the image of the area to be detected into a color space to obtain a grayscale image;

[0114] S4-8, perform Hough circle detection on the grayscale image to obtain a set of Circle1;

[0115] (1) Use the Canny edge detection algorithm to detect the edges of the grayscale image, then traverse each edge point (x, y) and consider all possible circle center coordinates (x c ,y c ) and radius r. For each set of circle center coordinates and radius, we use the standard equation of the circle, formula (3), to determine whether the edge point is on the circle.

[0116] (x-xc) 2 +(y-yc) 2 =r 2 (3)

[0117] (2) The coordinates of the center of the circle that meet the conditions (x c,y c ) and radius r are accumulated in the parameter space. The parameter space is a three-dimensional space corresponding to the x-coordinate, y-coordinate and radius r of the circle center. In the parameter space, each possible circular target will get a cumulative value. By detecting the local peak value that reaches the preset threshold in the parameter space, we can determine the circular target in the image.

[0118] S4-9, use the EdgeDrawing algorithm to detect the edge of the grayscale image and obtain a set of Circle2;

[0119] (1) Perform Gaussian filtering on the grayscale image to obtain a denoised image.

[0120] (2) Calculate the gradient strength and direction of each pixel of the denoised image. You can use gradient operators such as Prewitt, Sobel, Scharr or LSD.

[0121] (3) Calculate the pixel set of the denoised image anchor point. The anchor points correspond to the pixels where the gradient operator produces the maximum value. These pixels are also likely to be the pixels of the edge. Connect the obtained anchor points to draw the edge. The specific process is as follows: Starting from an anchor point, using the gradient strength and direction of neighboring pixels, search for the maximum gradient value and move to the next anchor point, complete the connection and obtain a high-quality edge segment with continuity, smoothness, fineness and good positioning characteristics.

[0122] (4) Try to fit a circle to each edge segment, verify and filter the fitting results through geometric properties, and finally generate a candidate set of circles Circle2.

[0123] S4-10, match Circle2 according to Circle1 to obtain Circle3; the specific implementation process includes:

[0124] S1. Initialize an empty set and set the center threshold and radius threshold;

[0125] S2, traverse the circles in Circle1, and extract the center coordinates and radius of the current Circle1 circle;

[0126] S3, extract the circle in Circle2, and record the center coordinates and radius of the current Circle2 circle;

[0127] S4, calculating the center distance between the current Circle2 circle and the current Circle1 circle based on the center coordinates and radius of the Circle1 circle and the center coordinates and radius of the Circle2 circle;

[0128] S5. When the center distance is less than the circle center threshold and the difference between the radius of the current Circle2 circle and the current Circle1 circle is also less than the radius threshold, the current Circle2 circle is added to the empty set as a matching circle;

[0129] When no matching circle is found, the center threshold and radius threshold are enlarged;

[0130] S6. Loop through S2-S5 to obtain Circle3.

[0131] Implementation steps: Figure 3 :

[0132] Traverse all circles (Circle1) detected by Hough transform and extract the center coordinates and radius information of each circle.

[0133] Initialize an empty collection to temporarily store edge detection circles (Circle2) that may match the current Hough detection circle (Circle1).

[0134] Initial thresholds are set, including a circle center threshold and a radius threshold, and these thresholds are gradually increased until a matching circle is found or the threshold increases to a maximum limit value.

[0135] For each circle (Circle1) identified by edge detection, its center coordinates and radius are extracted, and its distance from the center of the current Hough detection circle (Circle2) is calculated.

[0136] If the calculated distance is less than the circle center threshold and the difference between the two circle radii is also less than the radius threshold, the edge detection circle is regarded as a potential match of the current Hough detection circle and added to the aforementioned set.

[0137] In each iteration, if no matching circle is found, the matching thresholds of the circle center and radius are gradually increased until at least one match is found or the maximum threshold is reached. According to the set matching strategy, an optimal matching circle is selected from the potential matching set and added to the final matching circle set.

[0138] Use the perspective transformation matrix in S1 to transform the result set into actual coordinates, and calculate the size and center distance of the circular metal bushing.

[0139] Figure 4 The two cameras of the embodiment of the present invention take the original image of the middle tie rod workpiece from left to right. Figure 5 As shown, in S4-8, EdgeDrawing edge detection is used to detect an ellipse, and the ellipse is subsequently used to match Circle2 in S4-9.

[0140] The present invention proposes a method for jointly detecting metal bushings of special-shaped brake levers using an area array camera and a linear array camera, namely, using a linear array image to determine the type of a workpiece and using an area array image to precisely detect the size of the workpiece; using a double-sided camera in combination to improve detection accuracy, thereby overcoming the problem of limited resolution of a single camera and limited detection accuracy for large-size levers.

[0141] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A visual inspection method for a special-shaped brake lever metal bushing, characterized in that: include: Jointly calibrating a number of area array cameras to obtain a number of calibrated area array cameras; The linear array camera is used to collect linear array images, and the size of the linear array images is estimated to obtain the estimated size of the workpiece. The calibrated area array camera collects area array images based on the estimated size of the workpiece. Performing contour recognition on the line array image to obtain the type of workpiece; Based on the type of the workpiece, fine detection is performed on the area array image to obtain workpiece size information; The process of finely detecting the area array image to obtain workpiece size information includes: Extracting an image region of a workpiece to be detected in the area array image; Preprocessing the image area of ​​the workpiece to be detected to obtain a preprocessed area array image, wherein the process of preprocessing the image area of ​​the workpiece to be detected is the same as the process of preprocessing the line array image; Performing circle-like contour detection based on the preprocessed area array image to obtain an image of the area to be detected; Performing color space conversion on the image of the area to be detected to obtain a grayscale image of the area to be detected; Performing Hough circle detection on the grayscale image of the area to be detected to obtain Circle1; Perform edge detection on the grayscale image of the area to be detected to obtain Circle2; Matching Circle2 based on Circle1 to obtain Circle3; Performing coordinate transformation on the Circle3 based on the perspective transformation matrix to obtain workpiece size information; Before performing the circle-like contour detection on the pre-processed area array image, the method further includes color filling of the contour of the pre-processed area array image; Among them, a pixel threshold is set. When the contour area is smaller than the pixel threshold, the contour color is filled, and the filling color is the background color; The process of performing Hough circle detection on the grayscale image of the area to be detected to obtain Circle1 includes: Detect the edge of the grayscale image of the area to be detected based on the Canny edge detection algorithm, traverse each edge point, and record a number of combinations of circle center coordinates and radius; Determine the circular target in the grayscale image of the area to be detected based on the accumulated values ​​of the center coordinates and the radius; Obtain Circle1 based on the plurality of circular targets; The process of performing edge detection on the grayscale image of the area to be detected to obtain Circle2 includes: Performing Gaussian filtering and denoising on the grayscale image of the area to be detected to obtain a denoised grayscale image of the area to be detected; Calculate the gradient intensity and direction of each pixel in the grayscale image of the area to be detected after denoising; A number of edge segments are obtained based on the gradient strength and direction of the pixel points and the anchor points of the grayscale image of the area to be detected after denoising; Performing circular fitting on the edge segment to obtain Circle2; The process of matching Circle2 based on Circle1 to obtain Circle3 includes: S1. Initialize an empty set and set the center threshold and radius threshold; S2, traverse the circles in Circle1, and extract the center coordinates and radius of the current Circle1 circle; S3, extract the circle in Circle2, and record the center coordinates and radius of the current Circle2 circle; S4, calculating the center distance between the current Circle2 circle and the current Circle1 circle based on the center coordinates and radius of the Circle1 circle and the center coordinates and radius of the Circle2 circle; S5. When the center distance is less than the circle center threshold and the difference between the radius of the current Circle2 circle and the current Circle1 circle is also less than the radius threshold, the current Circle2 circle is added to the empty set as a matching circle; When no matching circle is found, the center threshold and radius threshold are enlarged; S6. Loop through S2-S5 to obtain Circle3.

2. The visual inspection method for the special-shaped brake lever metal bushing according to claim 1, characterized in that: The process of calibrating an array camera includes: A plurality of chessboard images are obtained by photographing a chessboard calibration plate at different positions based on an area array camera; Based on the Zhang Zhengyou calibration method, a plurality of the chessboard images are analyzed and calculated to obtain a camera intrinsic parameter matrix, a rotation matrix and a distortion coefficient; Obtaining a mapping matrix based on the camera intrinsic parameter matrix, the rotation matrix and the distortion coefficient; Performing distortion correction on the checkerboard image based on the mapping matrix to obtain a corrected image; The camera calibration is completed by calculating the perspective transformation matrix of the rectified image.

3. The visual inspection method for the special-shaped brake lever metal bushing according to claim 2, characterized in that: The process of performing contour recognition on the line array image to obtain the type of the workpiece includes: Preprocessing the line array image to obtain a preprocessed line array image; Processing the pre-processed linear array image based on a circularity screening method to obtain a number of circular contours; Performing a preliminary classification of workpiece types based on the number of the circular-like contours; Based on the preliminary classification results of workpiece types, the aspect ratio of the regular circumscribed rectangle of each circular contour is calculated; The type of the workpiece is determined based on the aspect ratio of the regular circumscribed rectangle of the quasi-circular contour.

4. The visual inspection method for the special-shaped brake lever metal bushing according to claim 3, characterized in that: The process of preprocessing the line array image to obtain a preprocessed line array image includes: Performing image color space conversion on the line array image to obtain a grayscale image; Performing Gaussian blur processing on the grayscale image to obtain a blurred image; Binarizing the blurred image to obtain a black-and-white binary image; The black-and-white binary image is subjected to an erosion and dilation operation to obtain a preprocessed linear array image.

5. The visual inspection method for the special-shaped brake lever metal bushing according to claim 4, characterized in that: The process of detecting the circular contour based on the preprocessed line array image comprises: Extracting the overall contour information of the preprocessed linear array image based on the Suzuki-Abe algorithm; Filtering the circular contours in the overall contour information based on a roundness formula; Wherein, the roundness formula is: In the formula, circularity represents the roundness, area represents the area of ​​the contour, and perimeter represents the circumference of the contour.

Citation Information

Patent Citations

  • Linear array binocular imaging system for pipe gallery apparent disease detection and working method

    CN112329531A