Automatic focusing method for nozzle ring belt microscopic visual detection
By realizing the precise setting of the focus window and adjusting the light source illumination intensity in the nozzle ring belt microscopic visual detection device, the shortcomings of the focus window selection and light source illumination intensity setting in the existing automatic focusing method are solved, and the nozzle ring belt is improved Focus accuracy and image quality.
Patent Information
- Application Number
- CN202411503933.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
AI Technical Summary
The existing automatic focus method has shortcomings in the selection of focus windows and setting the light source lighting intensity, which affects the sharpness and focus accuracy of the nozzle ring belt image.
By constructing a microscopic visual detection device of the nozzle ring belt, including the XY and Z axis motion modules, the light source module and the microimaging module, the precise setting of the focus window and the adjustment of the light source illumination intensity are achieved. Specific steps include coarse focus, obtaining optimal lighting intensity and precise focus, ensuring that the nozzle ring belt is on the focal plane of the object square.
Improve the focus accuracy of the nozzle ring belt, reduce interference from background pixels, ensure image quality and contrast, thereby improving the geometric measurement accuracy of the nozzle ring belt and the accuracy of the surface defect recognition.
Smart Images

Figure CN119439471A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of machine vision detection and digital image processing, and in particular relates to an automatic focusing method for nozzle ring zone microscopic vision detection. Background Art
[0002] In the electro-hydraulic servo valve used as the core component of the servo control system, nozzle parts are important components that control the pressure, speed, direction, flow rate, jet shape and other characteristics of the working medium. Therefore, during the manufacturing process, higher inspection accuracy requirements are placed on their geometric dimensions and surface quality, such as the outer diameter, inner hole diameter, inner and outer circle concentricity and appearance defects of the nozzle jet orifice end face ring (hereinafter referred to as the "nozzle ring").
[0003] At present, the actual quality state detection of nozzle annuli in the size range of 0.3 to 1.0 mm is usually achieved by a non-contact visual inspection system based on the principle of machine vision. First, a two-dimensional image of the nozzle annulus to be tested is collected, and then a series of digital image processing steps are used to solve its shape and position parameters and identify and judge surface defects. In this process, ensuring that the visual inspection system can collect clear and high-quality nozzle annulus images is a key link to improve the accuracy of subsequent image processing and parameter calculation. This requires the visual inspection system to have an automatic focus function, that is, to automatically control the relative position relationship between the visual inspection system and the nozzle to be tested through a certain focusing method, so that the nozzle annulus is on the object focal plane of the visual inspection system. At this time, the collected nozzle annulus image has the largest amount of information, the clearest texture, the richest details and the strongest contrast, thereby truly and accurately reflecting the measured physical quantity, and further improving the measurement accuracy of the geometric dimensions of the nozzle annulus and the recognition accuracy of surface defects.
[0004] Generally speaking, the automatic focusing method of the visual inspection system belongs to passive focusing, and its function realization mainly depends on the setting or selection of the focus window, clarity evaluation function and peak search algorithm. First, in the focus interval containing the best imaging position (object focal plane position), the image of the object to be measured is collected at equal intervals with a certain step length, and the position or coordinates of each image are recorded at the same time. Then, the clarity value of each image in the focus window is calculated through the clarity evaluation function, and then the peak search algorithm is used to find the best imaging position that makes the clarity evaluation function reach the peak value. Finally, the visual inspection system is controlled to move to this position to complete the automatic focusing.
[0005] In the existing autofocus methods, one or more rectangular areas of a certain size are usually set as focus windows within the field of view of the visual inspection system according to actual needs, user expectations or areas of interest, so as to eliminate some useless background information, thereby improving the focusing performance and quality of the system to a certain extent. Although this focus window setting method reduces the number of pixels involved in the clarity calculation, and the position and size of the focus window are more targeted, due to the circular shape of the nozzle ring, the use of a rectangular focus window including the ring will still cause a part of the background pixels to be input into the clarity evaluation function, which will not only affect the calculation efficiency of the focusing process, but also affect the accuracy of the calculated optimal imaging position. On the other hand, during the autofocus process, the illumination intensity of the light source in the system will also have a great impact on the focusing result, and the existing autofocus methods have not considered the adjustment and setting of the light source illumination intensity. Specifically, when the illumination intensity of the light source is high, it is easy to cause overexposure, and when the illumination intensity of the light source is low, it is easy to cause underexposure. Both will cause some details and texture features in the image to be obliterated, resulting in a decrease in image quality, affecting the accuracy of the autofocus results, and even causing focus misjudgment, which will have a great adverse impact on subsequent image processing, size calculation, defect identification, etc. Summary of the invention
[0006] The technology of the present invention solves the problem: to overcome the deficiencies of the prior art and to provide an automatic focusing method for nozzle ring zone microscopic visual inspection, aiming to solve the deficiencies of the existing automatic focusing method in focusing window selection and light source illumination intensity setting.
[0007] In order to solve the above technical problems, the present invention discloses an automatic focusing method for nozzle ring zone microscopic visual detection, comprising:
[0008] Construct a nozzle annulus microscopic visual inspection device;
[0009] Clamp the nozzle to be tested onto the nozzle ring microscopic visual inspection device;
[0010] Parameters of the nozzle ring zone microscopic visual detection device are adjusted to complete automatic focusing of the nozzle ring zone of the nozzle being tested;
[0011] After the automatic focusing is completed, the nozzle annulus microscopic visual detection device collects the in-focus microscopic image of the nozzle annulus and outputs it.
[0012] In the above-mentioned automatic focusing method for nozzle ring belt microscopic visual inspection, the nozzle ring belt microscopic visual inspection device includes: a base, an XY-axis motion module, a Z-axis motion module, a special fixture, a microscopic imaging module, a column, a controller, a host computer and a light source module; wherein the XY-axis motion module and the column are installed on the horizontal surface of the base, and the XY-axis motion module is located in front of the column; the Z-axis motion module is installed on the front surface of the column in the vertical direction; the light source module is installed on the microscopic imaging module, and the microscopic imaging module is installed on the movable support plate of the Z-axis motion module; the special fixture is installed on the movable support plate of the XY-axis motion module; the host computer is connected to the controller through a transmission control cable, and the controller is connected to the XY-axis motion module, the Z-axis motion module, the microscopic imaging module and the light source module through a transmission control cable.
[0013] In the above-mentioned automatic focusing method for nozzle ring band microscopic visual inspection, the nozzle to be tested is clamped on the nozzle ring band microscopic visual inspection device, including: the nozzle to be tested is cleaned and blown dry and then clamped on a special fixture, so that the nozzle ring band of the nozzle to be tested is facing the microscopic imaging module, and the geometric axis of the nozzle to be tested is parallel to the Z-axis direction through mechanical adjustment and alignment, and the nozzle ring band is in a position parallel to the XY plane.
[0014] In the above-mentioned automatic focusing method for nozzle annulus microscopic visual detection, the parameters of the nozzle annulus microscopic visual detection device are adjusted to complete the automatic focusing of the nozzle annulus of the nozzle to be detected, including:
[0015] Set the initial autofocus parameters: adjust the relative posture of the nozzle to be tested and the microscopic imaging module through the XY-axis motion module and the Z-axis motion module, so that the nozzle ring belt completely enters the field of view of the microscopic imaging module, and then set the autofocus starting position, focus range and step size in the host computer, and control the Z-axis motion module to drive the microscopic imaging module to move to the set autofocus starting position;
[0016] Coarse focus: adjust the initial illumination intensity of the light source module, set the entire field of view as the coarse focus window, and perform coarse focus of the nozzle ring by the microscopic imaging module according to the built-in clarity evaluation function and peak search algorithm in the host computer as well as the set focus interval and step size, and determine the coarse focus position, and then control the Z-axis motion module to drive the microscopic imaging module to move to the coarse focus position;
[0017] Setting a fine focus window: acquiring an original image of the nozzle ring zone acquired by the microscopic imaging module at a coarse focus position, performing image processing on the original image, and setting a fine focus window according to the image processing result;
[0018] Obtaining the optimal lighting intensity: at the coarse focus position, gradually change the lighting intensity of the light source module, and simultaneously collect images of the nozzle annulus to obtain nozzle annulus images under different lighting intensities; input the nozzle annulus images under different lighting intensities into the clarity evaluation function, and calculate the clarity values within the fine focus window under different lighting intensities; through the hill climbing search algorithm, find the lighting intensity that makes the clarity value reach the maximum value, which is the optimal lighting intensity;
[0019] Precision focusing: Control the light source module to maintain the optimal lighting intensity unchanged, and perform precision focusing of the nozzle ring band on the microscopic imaging module according to the built-in clarity evaluation function and peak search algorithm in the host computer, as well as the set focus start position, focus range, step size and precision focusing window, and determine the precision focusing position, which is the optimal imaging position; then control the microscopic imaging module to move to the precision focusing position, at which time the nozzle ring band is on the object focal plane of the microscopic imaging module, thereby achieving precise automatic focusing of the nozzle ring band.
[0020] In the above-mentioned automatic focusing method for nozzle annulus microscopic visual detection, image processing is performed on the original image, and a fine focus window is set according to the image processing result, including: filtering and denoising, threshold segmentation, disconnected area division, target area selection, hole filling and morphological operation processing are performed on the original image to extract the complete nozzle annulus area in the original image; the minimum circumscribed circle and the maximum inscribed circle of the nozzle annulus area are obtained; and the area enclosed by the minimum circumscribed circle and the maximum inscribed circle is set as the fine focus window.
[0021] In the above-mentioned autofocus method for microscopic visual inspection of the nozzle band, after the autofocus is completed, the in-focus microscopic image of the nozzle band is collected by the nozzle band microscopic visual inspection device and output, including: after controlling the microscopic imaging module to move to the fine focus position, the image of the nozzle band at the fine focus position is collected by the microscopic imaging module, that is, the in-focus microscopic image of the nozzle band.
[0022] In the above-mentioned automatic focusing method for nozzle ring zone microscopic visual detection, it also includes:
[0023] Based on the visual measurement algorithm, the positive focus microscopic image of the nozzle ring is analyzed and processed to obtain the key size parameters; and the size defect detection and identification results of the nozzle ring are obtained based on the comparison results of the key size parameters and the corresponding parameter design values;
[0024] Through the defect detection algorithm based on convolutional neural network and deep learning training framework, the positive focus microscopic image of the nozzle ring belt is analyzed and processed to obtain the surface defect detection and identification results of the nozzle ring belt;
[0025] According to the obtained size defect detection and identification results and surface defect detection and identification results of the nozzle ring band, the processing quality of the nozzle ring band is comprehensively evaluated to obtain a comprehensive evaluation result.
[0026] In the above-mentioned automatic focusing method for microscopic visual inspection of the nozzle annulus, based on the visual measurement algorithm, the in-focus microscopic image of the nozzle annulus is analyzed and processed to obtain key size parameters; and the size defect detection and identification result of the nozzle annulus is obtained according to the comparison result of the key size parameters and the corresponding parameter design values, including: sending the in-focus microscopic image of the nozzle annulus to the host computer; the host computer calls the size defect detection module to perform image processing on the in-focus microscopic image of the nozzle annulus to obtain the outer edge and inner edge of the nozzle annulus area in the in-focus microscopic image; performing least squares circle fitting on the outer edge and the inner edge respectively to obtain the pixel radius R of the outer edge fitting circle p1 , pixel roundness error δ p1 , pixel center coordinates (u1, v1), and pixel radius R of the inner edge fitting circle p2 , pixel roundness error δ p2 and pixel center coordinates (u2, v2); according to R p1 , δ p1 、(u1,v1),R p2 , δ p2 and (u2, v2), combined with the pixel size equivalent K of the calibrated nozzle annulus microscopic visual inspection device, the outer diameter Φ1, inner hole diameter Φ2, outer circle roundness δ1, inner hole roundness δ2 and inner and outer circle concentricity δ of the nozzle annulus are calculated. c ; The calculated outer diameter Φ1, inner diameter Φ2, outer roundness δ1, inner roundness δ2 and inner and outer concentricity δ c The results of nozzle ring size defect detection and identification are obtained by comparing them with the corresponding parameter design values.
[0027] In the above-mentioned autofocus method for microscopic visual inspection of the nozzle ring band, the in-focus microscopic image of the nozzle ring band is analyzed and processed by a defect detection algorithm based on a convolutional neural network and a deep learning training framework to obtain a surface defect detection and identification result of the nozzle ring band, including: sending the in-focus microscopic image of the nozzle ring band to a host computer; the host computer calls a surface defect detection module, and uses a pre-trained deep learning detection model based on a combined neural network to analyze and process the in-focus microscopic image to obtain a surface defect detection and identification result of the nozzle ring band.
[0028] In the above-mentioned automatic focusing method for microscopic visual inspection of the nozzle ring band, the size defect detection and identification results include: the nozzle ring band has no size defects and the nozzle ring band has size defects; the types of size defects include: outer circle diameter tolerance, inner hole diameter tolerance, outer circle roundness tolerance, inner hole roundness tolerance and inner and outer circle concentricity tolerance; the surface defect detection and identification results include: the nozzle ring band has no surface defects and the nozzle ring band has surface defects; the types of surface defects include: scratches, burrs, bumps and edge defects; when the size defect detection and identification results are that the nozzle ring band has no size defects, and the surface defect detection and identification results are that the nozzle ring band has no surface defects, the processing quality of the nozzle ring band is determined to be qualified; when the size defect detection and identification results are that the nozzle ring band has size defects, and / or the surface defect detection and identification results are that the nozzle ring band has surface defects, the processing quality of the nozzle ring band is determined to be unqualified.
[0029] The present invention has the following advantages:
[0030] (1) The present invention discloses an automatic focusing method for nozzle ring zone microscopic visual inspection, which takes the lighting intensity factor of the light source module into consideration during the automatic focusing process, adds a step of adjusting the lighting intensity of the light source module, and enables the precise focusing process to be completed under the optimal lighting intensity condition, thereby further improving the focusing accuracy and making up for the shortcomings of the existing automatic focusing method.
[0031] (2) The present invention discloses an autofocus method for nozzle ring band microscopic visual detection, which divides the autofocus process into coarse focusing and fine focusing, and extracts the nozzle ring band area at the coarse focusing position through a threshold segmentation method based on the maximum inter-class variance, and sets it as the fine focusing window.
[0032] (3) The present invention discloses an automatic focusing method for nozzle ring zone microscopic visual detection. During the fine focusing process, the nozzle ring zone area is set as the focusing window to remove the interference of background pixels, thereby maximizing the targeting of the automatic focusing process and facilitating the acquisition of a more accurate object focal plane position. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flow chart of an automatic focusing method for nozzle annulus microscopic visual inspection in an embodiment of the present invention;
[0034] Figure 2 is a schematic structural diagram of a nozzle to be tested in an embodiment of the present invention;
[0035] Figure 3 is a structural schematic diagram of a nozzle annulus microscopic visual inspection device in an embodiment of the present invention;
[0036] Figure 4is a schematic diagram of an original image of a nozzle ring zone collected at a coarse focus position in an embodiment of the present invention;
[0037] Figure 5 is a schematic diagram of a nozzle annulus region in an embodiment of the present invention;
[0038] Figure 6 is a schematic diagram of a fine focus window in an embodiment of the present invention;
[0039] Figure 7 It is a schematic diagram of a focused microscopic image of a nozzle ring zone collected at a fine focusing position in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments disclosed in the present invention will be further described in detail below with reference to the accompanying drawings.
[0041] One of the core ideas of the present invention is to provide an automatic focusing method for nozzle annulus microscopic visual inspection, which is implemented by relying on the nozzle annulus microscopic visual inspection device, and realizes automatic and accurate focusing of the nozzle annulus through the targeted setting of the focusing window and the light source illumination intensity. This method accurately sets the focusing window to the nozzle annulus area, removes the influence of background pixels on the numerical calculation of clarity, and at the same time adds the adjustment and control link of the light source illumination intensity in the automatic focusing process, thereby further improving the focusing accuracy of the nozzle annulus, so as to assist the nozzle annulus microscopic visual inspection device to collect the original image with the largest amount of information, the clearest texture, the richest details, and the strongest contrast, laying a solid foundation for the accurate detection of the geometric size and surface quality of the nozzle annulus.
[0042] In this embodiment, if Figure 1 As shown, the automatic focusing method for nozzle ring zone microscopic visual inspection includes:
[0043] Step 1: construct a nozzle ring microscopic visual inspection device.
[0044] In this embodiment, the nozzle annulus microscopic visual inspection device adopts a forward lighting method, adopts a column-type overall structure, and has three mutually perpendicular linear motion axes: X-axis, Y-axis and Z-axis, which can realize single-axis motion and three-axis linkage; the X-axis and Y-axis are located in the horizontal plane, the Z-axis is in the vertical direction, and conforms to the right-hand rule; the X-axis and the Y-axis are integrated together and realized by the XY-axis motion module; the Z-axis is arranged separately and realized by the Z-axis motion module. Figure 3As shown, the nozzle annulus microscopic visual inspection device mainly includes: a base 21, an XY axis motion module 22, a Z axis motion module 23, a special fixture 24, a microscopic imaging module 25, a column 26, a controller 27, a host computer 28 and a light source module 29. Among them: the XY axis motion module 22 and the column 26 are installed on the horizontal surface of the base 21, and the XY axis motion module 22 is located in front of the column 26; the Z axis motion module 23 is installed on the front surface of the column 26 along the vertical direction; the XY axis motion module 22 and the Z axis motion module 23 are equipped with high-precision linear guides and linear grating rulers to ensure the movement stability and linear displacement accuracy of each axis. The light source module 29 is installed on the microscopic imaging module 25, and the microscopic imaging module 25 is installed on the moving support plate of the Z axis motion module 23; the microscopic imaging module 25 faces the negative direction of the Z axis, and the imaging optical axis direction of the microscopic imaging module 25 is parallel to the Z axis direction through mechanical adjustment. The Z-axis motion module 23 can drive the microscopic imaging module 25 and the light source module 29 to move along the Z-axis direction. The special fixture 24 is installed on the moving support plate of the XY-axis motion module 22, and the special fixture 24 can be driven to move along the X and Y-axis directions through the XY-axis motion module 22. The nozzle 1 to be tested is clamped in the special fixture 24 so that the geometric axis direction of the nozzle 1 to be tested is parallel to the Z-axis direction. The structure of the nozzle 1 to be tested is as follows: Figure 2 As shown; through the X-direction and Y-direction movement of the XY-axis motion module 22 and the Z-direction movement of the Z-axis motion module 23, the nozzle 1 to be tested can be moved to the right below the microscopic imaging module 25, so that the nozzle ring belt 11 completely enters the field of view of the microscopic imaging module 25, and the uniform and stable light emitted by the light source module 29 is emitted from the front of the nozzle 1 to be tested and illuminates the nozzle ring belt 11. After the diffuse reflection light enters the microscopic imaging module 25, it is imaged on the photosensitive surface, and the positive focus microscopic image of the nozzle ring belt 11 can be obtained. The host computer 28 is connected to the controller 27 through a transmission control cable, and the controller 27 is connected to the XY-axis motion module 22, the Z-axis motion module 23, the microscopic imaging module 25 and the light source module 29 through a transmission control cable. The host computer 28 is configured with a host computer software, which can provide a graphical human-machine interface for flexible operation by the operator, and has the functions of system parameter setting, detection program compilation, data acquisition, graphic fitting, surface defect recognition, geometric parameter solution and output display.
[0045] Step 2: Clamp the nozzle 1 to be tested onto the nozzle ring microscopic visual inspection device.
[0046] In this embodiment, the nozzle 1 to be tested is cleaned and dried and then clamped on a special fixture 24, so that the nozzle ring 11 of the nozzle 1 to be tested faces the microscopic imaging module 25, and the geometric axis of the nozzle 1 to be tested is parallel to the Z-axis direction through mechanical adjustment and alignment. At this time, the nozzle ring 11 is in an orientation parallel to the XY plane. The structure of the nozzle 1 to be tested is as follows: Figure 2shown.
[0047] Step 3, adjusting parameters of the nozzle annulus microscopic visual detection device to complete automatic focusing on the nozzle annulus 11 of the nozzle 1 to be tested.
[0048] In this embodiment, the automatic focusing mainly includes the following process:
[0049] Set the initial autofocus parameters: adjust the relative posture of the nozzle 1 to be tested and the microscopic imaging module 25 through the XY-axis motion module 22 and the Z-axis motion module 23, so that the nozzle ring 11 completely enters the field of view of the microscopic imaging module 25, and then set the autofocus starting position, focus range and step size in the host computer 28, and control the Z-axis motion module 23 to drive the microscopic imaging module 25 to move to the set autofocus starting position.
[0050] Coarse focus: adjust the initial illumination intensity of the light source module 29, set the entire field of view as the coarse focus window, and perform coarse focus of the nozzle ring belt 11 by the microscopic imaging module 25 according to the clarity evaluation function and peak search algorithm built into the host computer 28 and the set focus interval and step size, and determine the coarse focus position, and then control the Z-axis motion module 23 to drive the microscopic imaging module 25 to move to the coarse focus position. It should be noted that the initial illumination intensity of the light source module 29 should enable the surface texture and detail features of the nozzle ring belt 11 to be well presented in the field of view of the microscopic imaging module 25, and more details and texture features can be observed in the visual effect, without obvious overexposure or underexposure.
[0051] Set the fine focus window: obtain the original image of the nozzle ring zone 11 collected by the microscopic imaging module 25 at the coarse focus position, such as Figure 4 As shown; the original image is processed, and the fine focus window is set according to the image processing result. Specifically: the original image is subjected to filtering and noise reduction, threshold segmentation, disconnected area division, target area selection, hole filling and morphological operation processing to extract the complete nozzle ring zone 41 in the original image, as shown Figure 5 As shown; obtain the minimum circumscribed circle 42 and the maximum inscribed circle 43 of the nozzle annulus region 41; set the area enclosed by the minimum circumscribed circle 42 and the maximum inscribed circle 43 as the fine focus window 4, such as Figure 6 shown.
[0052] Obtaining the optimal illumination intensity: at the coarse focus position, gradually change the illumination intensity of the light source module 29, and synchronously collect images of the nozzle annulus 11 to obtain nozzle annulus images under different illumination intensity conditions; input the nozzle annulus images under different illumination intensity conditions into the clarity evaluation function, and calculate the clarity values in the fine focus window under different illumination intensity conditions; through the hill climbing search algorithm, find the illumination intensity that makes the clarity value reach the maximum value, which is the optimal illumination intensity. It should be noted that the optimal illumination intensity can also be replaced by the optimal exposure time, and the acquisition of the optimal exposure time is similar to the acquisition of the optimal illumination intensity: at the coarse focus position, gradually change the exposure time of the microscopic imaging module 25, and synchronously collect images of the nozzle annulus 11 to obtain nozzle annulus images under different exposure time conditions; input the nozzle annulus images under different exposure time conditions into the clarity evaluation function, and calculate the clarity values in the fine focus window under different exposure time conditions; through the hill climbing search algorithm, find the exposure time that makes the clarity value reach the maximum value, which is the optimal exposure time.
[0053] Precision focusing: Control the light source module 29 to maintain the optimal lighting intensity unchanged, and perform precision focusing of the nozzle ring band 11 by the microscopic imaging module 25 according to the clarity evaluation function and peak search algorithm built into the host computer 28 as well as the set focus starting position, focus interval, step size and precision focusing window, and determine the precision focusing position, which is the optimal imaging position; then control the microscopic imaging module 25 to move to the precision focusing position, at which time the nozzle ring band 11 is on the object focal plane of the microscopic imaging module 25, thereby achieving precise automatic focusing of the nozzle ring band 11.
[0054] Preferably, in the above-mentioned coarse focusing, obtaining the optimal lighting intensity, and fine focusing processes, the clarity evaluation function is used to quantitatively calculate the image clarity within the focus window range and output the corresponding clarity value. The clarity evaluation function is implemented by an improved Prewitt edge detection operator, and the gradient calculation directions of the original Prewitt operator are increased from 2 to 4 to improve the sensitivity and stability of the clarity calculation. For an image region I with a pixel number of M×N, the clarity evaluation function is defined as:
[0055]
[0056] Where D(I) represents the clarity calculation result of image area I, that is, the clarity value; (x, y) represents the coordinates of the pixel in image area I; G x (x,y) and G y (x, y) represents the gradient convolution template of pixel (x, y) in the horizontal and vertical directions respectively; G xy (x,y) and Gyx (x, y) represents the gradient convolution template added at the pixel (x, y) in the +45° and -45° directions respectively; M represents the number of rows of pixels in the image area I, and N represents the number of columns of pixels in the image area I;
[0057] Preferably, in the above-mentioned coarse focusing, obtaining the optimal lighting intensity, and fine focusing processes, the peak search algorithm uses a curve fitting method to form a sample data point set with the clarity value of each image and its position or coordinates, and then selects a suitable second-order or third-order function to perform curve fitting on the data point set, thereby approximating the clarity curve and obtaining its peak value through analysis.
[0058] Step 4: After the automatic focusing is completed, a microscopic image of the nozzle annulus 11 is collected by a nozzle annulus microscopic visual detection device and output.
[0059] In this embodiment, after the microscopic imaging module 25 is controlled to move to the fine focus position, the image of the nozzle annulus at the fine focus position is acquired by the microscopic imaging module 25, that is, the positive focus microscopic image of the nozzle annulus 11, as shown in FIG. Figure 7 This positive focus microscopic image has the largest amount of information, the clearest texture, the richest details and the strongest contrast, and can be used in subsequent image processing processes, laying a solid foundation for the precise detection of the geometric dimensions and surface quality of the nozzle ring belt 11. The specific applications are as follows:
[0060] Step 5, based on the visual measurement algorithm, the focus microscope image of the nozzle ring band 11 is analyzed and processed to obtain key dimensional parameters; and based on the comparison results of the key dimensional parameters with the corresponding parameter design values, the dimensional defect detection and identification results of the nozzle ring band are obtained.
[0061] In this embodiment, the in-focus microscopic image of the nozzle annulus 11 is sent to the host computer 28; the host computer 28 calls the size defect detection module to filter and reduce noise in the in-focus microscopic image of the nozzle annulus 11 (mean filtering, median filtering or Gaussian filtering, etc. can be used to suppress noise in the collected in-focus microscopic image), threshold segmentation (a grayscale threshold determined based on the maximum inter-class variance method can be used to divide the denoised image into a foreground area and a background area), disconnected area division (disconnected area division is to further divide the foreground area into a number of independent sub-areas that are not connected to each other based on whether they are connected or not), target area selection (the area of the sub-area (the number of pixels contained in the sub-area) can be set) ), shape and other screening conditions, accurately select the nozzle annulus area from several independent sub-areas that are not connected to each other and use it as the target area), hole filling (fill the holes and holes in the target area to make it a closed and complete annular figure), morphological operation (opening operation of corrosion followed by expansion can be used to disconnect small connections and eliminate small protrusions to make the inner and outer edges of the annular figure smooth) and sub-pixel edge extraction (moment estimation method, interpolation method and fitting method can be used) and other image processing to obtain the outer edge and inner edge of the nozzle annulus area in the positive focus microscopic image; perform least squares circle fitting on the outer edge and the inner edge respectively to obtain the pixel radius R of the outer edge fitting circle p1 , pixel roundness error δ p1 , pixel center coordinates (u1, v1), and pixel radius R of the inner edge fitting circle p2 , pixel roundness error δ p2 and pixel center coordinates (u2, v2); according to R p1 , δ p1 、(u1,v1),R p2 , δ p2 and (u2, v2), combined with the pixel size equivalent K of the calibrated nozzle annulus microscopic visual inspection device, the outer diameter Φ1, inner hole diameter Φ2, outer circle roundness δ1, inner hole roundness δ2 and inner and outer circle concentricity δ of the nozzle annulus 11 are calculated. c ; The calculated outer diameter Φ1, inner diameter Φ2, outer roundness δ1, inner roundness δ2 and inner and outer concentricity δ of the nozzle ring 11 c The nozzle annulus size defect detection and identification results are obtained by comparing with the corresponding parameter design values. It should be noted that before the microscopic visual inspection of the quality defects of the nozzle annulus, the pixel size equivalent K of the nozzle annulus microscopic visual inspection device is accurately calibrated using a target with good shape and position accuracy and known geometric size information.
[0062] Preferably, the outer diameter Φ1, the inner diameter Φ2, the outer roundness δ1, the inner roundness δ2 and the inner and outer concentricity δ c The calculation formula is as follows:
[0063] Φ1=2·K·R p1
[0064] Φ2=2·K·R p2
[0065] δ1=K·δ p1
[0066] δ2=K·δ p2
[0067]
[0068] Preferably, the outer diameter Φ1, inner diameter Φ2, outer roundness δ1, inner roundness δ2 and inner and outer concentricity δ1 of the nozzle annulus 11 are calculated. c The comparison result with the corresponding parameter design value can determine whether the nozzle ring band 11 has a dimensional defect and what kind of dimensional defect it is. Specifically, the calculated key dimensional parameter of the nozzle ring band 11 can be recorded as Q i If Q i Exceeds the design value Q i ′ tolerance range, it is determined that the nozzle ring 11 has a corresponding dimensional defect; where i = 1, 2, 3, 4, 5, Q1 = Φ1, Q2 = Φ2, Q3 = δ1, Q4 = δ2, Q5 = δ c , Q1′=Φ1′, Q2′=Φ′2, Q3′=δ1′, Q4′=δ2′, Q5′=δ c ′, Φ1′ represents the design value of the outer diameter of the nozzle annulus, Φ′2 represents the design value of the inner hole diameter of the nozzle annulus, δ1′ represents the design value of the outer roundness of the nozzle annulus, δ2′ represents the design value of the inner hole roundness of the nozzle annulus, δ c ' represents the design value of the inner and outer circle concentricity of the nozzle annulus. For example, if the calculated inner and outer circle concentricity δ c Exceeds the design value of inner and outer circle concentricity δ c ’, it is determined that the nozzle ring has a dimensional defect, and the type of dimensional defect is the concentricity of the inner and outer circles out of tolerance.
[0069] Step 6: Analyze and process the positive focus microscopic image of the nozzle ring band 11 through a defect detection algorithm based on a convolutional neural network and a deep learning training framework to obtain a surface defect detection and identification result of the nozzle ring band.
[0070] In this embodiment, the in-focus microscopic image of the nozzle annulus 11 is sent to the host computer 28; the host computer 28 calls the surface defect detection module, and uses a pre-trained deep learning detection model based on a combined neural network to analyze and process the in-focus microscopic image to obtain a surface defect detection and identification result of the nozzle annulus.
[0071] Preferably, the deep learning detection model based on the combined neural network can adopt the structure of "YOLOv7 neural network + PaddlePaddle artificial intelligence learning framework", use the PaddlePaddle framework to import the training set and YOLOv7 neural network, adjust the learning rate, gradient descent rate, neural network hyperparameters and other indicators, continuously optimize the learning process, and import the learning results into the test set to evaluate the training effect.
[0072] Furthermore, before conducting microscopic visual inspection of quality defects of the nozzle ring band, a certain number of sample images of the nozzle ring band can be collected. These sample images should include images with four major types of surface defects such as scratches, burrs, bumps, and edge defects, as well as defect-free images. The marking classification, entry recognition, algorithm modeling, parameter fine-tuning, model training and other processes of various surface defects should be completed, thereby forming a pre-trained deep learning detection model based on a combined neural network. At the same time, a model recovery training window is reserved, and the operator can classify the newly taken images and enter them into the system for supplementary training to continuously improve the detection accuracy of the model.
[0073] Step 7: Based on the obtained size defect detection and recognition results and surface defect detection and recognition results of the nozzle ring band, a comprehensive evaluation is performed on the processing quality of the nozzle ring band 11 to obtain a comprehensive evaluation result.
[0074] In this embodiment, the size defect detection and recognition results include: the nozzle annulus has no size defects and the nozzle annulus has size defects; further, the types of size defects include: outer diameter tolerance, inner hole diameter tolerance, outer circle roundness tolerance, inner hole roundness tolerance and inner and outer circle concentricity tolerance. The surface defect detection and recognition results include: the nozzle annulus has no surface defects and the nozzle annulus has surface defects; further, the types of surface defects include: scratches, burrs, bumps and edge defects. Among them, when the size defect detection and recognition results are that the nozzle annulus has no size defects, and the surface defect detection and recognition results are that the nozzle annulus has no surface defects, it is determined that the processing quality of the nozzle annulus is qualified. When the size defect detection and recognition results are that the nozzle annulus has size defects, and / or the surface defect detection and recognition results are that the nozzle annulus has surface defects, it is determined that the processing quality of the nozzle annulus is unqualified; further, if there is a size defect, the type of size defect and the actual measurement result can be further output; if there is a surface defect, the type of surface defect, the position of the annotation box and the confidence level can be further output.
[0075] Although the present invention has been disclosed as above in the form of a preferred embodiment, it is not intended to limit the present invention. Any person skilled in the art may make possible changes and modifications to the technical solution of the present invention by using the methods and technical contents disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the protection scope of the technical solution of the present invention.
[0076] The contents not described in detail in the specification of the present invention belong to the common knowledge of the professionals in this field.
Claims
1. An automatic focusing method for nozzle annulus microscopic visual inspection, characterized in that: include: Construct a nozzle annulus microscopic visual inspection device; Clamping the nozzle (1) to be tested onto a nozzle ring microscopic visual inspection device; Parameters of a nozzle annulus microscopic visual detection device are adjusted to complete automatic focusing of the nozzle annulus (11) of the nozzle (1) being tested; After the automatic focusing is completed, a positive focus microscopic image of the nozzle annulus (11) is collected by a nozzle annulus microscopic visual detection device and outputted.
2. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 1, characterized in that: A nozzle annulus microscopic visual inspection device comprises: a base (21), an XY axis motion module (22), a Z axis motion module (23), a special fixture (24), a microscopic imaging module (25), a column (26), a controller (27), a host computer (28) and a light source module (29); wherein the XY axis motion module (22) and the column (26) are installed on the horizontal surface of the base (21), and the XY axis motion module (22) is located in front of the column (26); the Z axis motion module (23) is installed on the column in the vertical direction. (26); the light source module (29) is mounted on the microscopic imaging module (25), and the microscopic imaging module (25) is mounted on the movable support plate of the Z-axis motion module (23); the special fixture (24) is mounted on the movable support plate of the XY-axis motion module (22); the host computer (28) is connected to the controller (27) through a transmission control cable, and the controller (27) is connected to the XY-axis motion module (22), the Z-axis motion module (23), the microscopic imaging module (25) and the light source module (29) through a transmission control cable.
3. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 2, characterized in that: The nozzle (1) to be tested is clamped onto a nozzle ring belt microscopic visual inspection device, comprising: cleaning and drying the nozzle (1) to be tested and then clamping it onto a special fixture (24), so that the nozzle ring belt (11) of the nozzle (1) to be tested faces the microscopic imaging module (25), and mechanically adjusting and aligning the geometric axis of the nozzle (1) to be tested is parallel to the Z-axis direction, and at this time, the nozzle ring belt (11) is in a position parallel to the XY plane.
4. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 3, characterized in that: Parameters of a nozzle annulus microscopic visual detection device are adjusted to complete automatic focusing of a nozzle annulus (11) of a nozzle (1) to be detected, including: Setting initial autofocus parameters: adjusting the relative position of the nozzle (1) to be tested and the microscopic imaging module (25) through the XY axis motion module (22) and the Z axis motion module (23) so that the nozzle ring (11) completely enters the field of view of the microscopic imaging module (25), and then setting the autofocus starting position, focus interval and step length in the host computer (28), and controlling the Z axis motion module (23) to drive the microscopic imaging module (25) to move to the set autofocus starting position; Coarse focusing: adjusting the initial illumination intensity of the light source module (29), setting the entire field of view as a coarse focusing window, and based on the definition evaluation function and peak search algorithm built into the host computer (28) and the set focus interval and step length, performing coarse focusing of the nozzle ring belt (11) by the microscopic imaging module (25), and determining the coarse focusing position, and then controlling the Z-axis motion module (23) to drive the microscopic imaging module (25) to move to the coarse focusing position; Setting a fine focus window: acquiring an original image of the nozzle ring zone (11) acquired by the microscopic imaging module (25) at a coarse focus position, performing image processing on the original image, and setting a fine focus window according to the image processing result; Obtaining the optimal illumination intensity: at the coarse focus position, gradually changing the illumination intensity of the light source module (29), and synchronously collecting images of the nozzle annulus (11), to obtain nozzle annulus images under different illumination intensity conditions; inputting the obtained nozzle annulus images under different illumination intensity conditions into a clarity evaluation function, and calculating the clarity values within the fine focus window under different illumination intensity conditions; and finding the illumination intensity that makes the clarity value reach the maximum value through a hill climbing search algorithm, which is the optimal illumination intensity; Precision focusing: Control the light source module (29) to maintain the optimal lighting intensity unchanged, and according to the clarity evaluation function and peak search algorithm built into the host computer (28) and the set focus start position, focus interval, step length and precision focusing window, perform precision focusing of the nozzle ring band (11) by the microscopic imaging module (25), and determine the precision focusing position, which is the optimal imaging position; then control the microscopic imaging module (25) to move to the precision focusing position, at which time the nozzle ring band (11) is on the object focal plane of the microscopic imaging module (25), thereby achieving precise automatic focusing of the nozzle ring band (11).
5. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 4, characterized in that: The original image is processed, and a fine focus window is set according to the image processing result, including: filtering and denoising, threshold segmentation, disconnected area division, target area selection, hole filling and morphological operation processing of the original image to extract the complete nozzle annulus area in the original image; obtaining the minimum circumscribed circle and the maximum inscribed circle of the nozzle annulus area; setting the area enclosed by the minimum circumscribed circle and the maximum inscribed circle as the fine focus window.
6. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 4, characterized in that: After the automatic focusing is completed, a microscopic image of the nozzle annulus (11) is acquired through a nozzle annulus microscopic visual detection device and output, including: after controlling the microscopic imaging module (25) to move to a fine focusing position, an image of the nozzle annulus at the fine focusing position is acquired through the microscopic imaging module (25), that is, a microscopic image of the nozzle annulus (11) is acquired through the microscopic imaging module (25).
7. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 1, characterized in that: Also includes: Based on the visual measurement algorithm, the positive focus microscopic image of the nozzle ring (11) is analyzed and processed to obtain the key size parameters; And according to the comparison result of the key size parameters and the corresponding parameter design values, the size defect detection and identification result of the nozzle ring band is obtained; By using a defect detection algorithm based on a convolutional neural network and a deep learning training framework, a positive focus microscopic image of the nozzle ring band (11) is analyzed and processed to obtain a surface defect detection and recognition result of the nozzle ring band; Based on the obtained dimensional defect detection and identification results and surface defect detection and identification results of the nozzle ring band, a comprehensive evaluation is performed on the processing quality of the nozzle ring band (11) to obtain a comprehensive evaluation result.
8. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 7, characterized in that: Based on the visual measurement algorithm, the positive focus microscopic image of the nozzle ring (11) is analyzed and processed to obtain the key size parameters; And according to the comparison result of the key size parameter and the corresponding parameter design value, the size defect detection and identification result of the nozzle ring band is obtained, including: sending the positive focus microscopic image of the nozzle ring band (11) to the host computer (28); The upper computer (28) calls the size defect detection module to perform image processing on the positive focus microscopic image of the nozzle annulus (11) to obtain the outer edge and inner edge of the nozzle annulus region in the positive focus microscopic image; the outer edge and the inner edge are respectively fitted with the least squares circle to obtain the pixel radius R of the outer edge fitting circle. p1 , pixel roundness error δ p1 , pixel center coordinates (u1, v1), and pixel radius R of the inner edge fitting circle p2 , pixel roundness error δ p2 and pixel center coordinates (u2, v2); according to R p1 , δ p1 、(u1,v1),R p2 , δ p2 and (u2, v2), combined with the pixel size equivalent K of the calibrated nozzle annulus microscopic visual detection device, the outer circle diameter Φ1, inner hole diameter Φ2, outer circle roundness δ1, inner hole roundness δ2 and inner and outer circle concentricity δ of the nozzle annulus (11) are calculated. c The calculated outer diameter Φ1, inner diameter Φ2, outer roundness δ1, inner roundness δ2 and inner and outer concentricity δ of the nozzle annulus (11) are c The results of nozzle ring size defect detection and identification are obtained by comparing them with the corresponding parameter design values.
9. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 8, characterized in that: The method comprises: using a defect detection algorithm based on a convolutional neural network and a deep learning training framework, analyzing and processing the in-focus microscopic image of the nozzle annulus (11) to obtain a surface defect detection and identification result of the nozzle annulus, including: sending the in-focus microscopic image of the nozzle annulus (11) to a host computer (28); the host computer (28) calling a surface defect detection module, using a pre-trained deep learning detection model based on a combined neural network, analyzing and processing the in-focus microscopic image to obtain a surface defect detection and identification result of the nozzle annulus.
10. The automatic focusing method for nozzle annulus microscopic visual inspection according to claim 9, characterized in that: The size defect detection and identification results include: the nozzle ring band has no size defects and the nozzle ring band has size defects; the types of size defects include: outer circle diameter tolerance, inner hole diameter tolerance, outer circle roundness tolerance, inner hole roundness tolerance and inner and outer circle concentricity tolerance; the surface defect detection and identification results include: the nozzle ring band has no surface defects and the nozzle ring band has surface defects; the types of surface defects include: scratches, burrs, bumps and edge defects; when the size defect detection and identification results are that the nozzle ring band has no size defects, and the surface defect detection and identification results are that the nozzle ring band has no surface defects, it is determined that the processing quality of the nozzle ring band (11) is qualified; when the size defect detection and identification results are that the nozzle ring band has size defects, and / or the surface defect detection and identification results are that the nozzle ring band has surface defects, it is determined that the processing quality of the nozzle ring band (11) is unqualified.
Citation Information
Cited By
Rapid defect detecting and screening device for finished drug spray head products
CN120228059A