A multi-focal plane image fusion method and system for three-dimensional workpiece detection
By installing a zoom lens on an industrial camera to acquire and fuse the multifocal image of the three-dimensional workpiece, the problem of frequent focal plane adjustment in complex three-dimensional workpiece detection is solved, and an efficient and accurate detection process is achieved.
Patent Information
- Application Number
- CN202510205665.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-02-25
AI Technical Summary
The prior art is difficult to effectively detect complex three-dimensional workpieces, especially under different height focal planes, which requires multiple manual focus adjustments to the camera, resulting in low detection efficiency and the use of multiple sets of machine vision systems at the same time.
The multifocal image fusion method is adopted, by installing a zoom lens on an industrial camera, multi-dimensional focal plane image data of the three-dimensional workpiece, multi-threshold segmentation and fusion of the images, and a complete image with high definition and high visual effects are generated and detected.
It improves detection efficiency and accuracy, reduces the number of times that mobile hardware devices need to repeat focus due to different focal planes, avoids the need to use multiple machine vision systems, and simplifies the processing of detection results.
Smart Images

Figure CN119693252B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional workpiece visual detection, and in particular to a multi-focal plane image fusion method and system for three-dimensional workpiece detection. Background Art
[0002] For two-dimensional visual inspection, accurate and reliable feature information can only be provided when the light can be clearly focused on the focal plane after passing through the imaging system to form a clear and sharp image; if the object deviates from the focal plane, the light cannot be accurately focused, resulting in blurred images and unclear edges, which will increase the difficulty of image processing and reduce the accuracy of inspection. However, in general, a set of visual systems can only perform visual inspection on one focal plane, which is difficult to meet the inspection requirements of complex three-dimensional workpieces. The inspection of complex three-dimensional workpieces requires the use of multiple machine vision systems at the same time, which not only makes the inspection result processing process complicated, but also has low inspection speed and high inspection cost. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0004] To this end, the purpose of the present invention is to provide a multi-focal plane image fusion method and system for three-dimensional workpiece detection, which includes adding a variable focus lens to an industrial camera, collecting multi-dimensional focal plane image data of the three-dimensional workpiece, performing multi-threshold segmentation on the image, and then fusing the focus plane images of each segmented area to obtain a complete image with high definition and high visual effect. Various parameters of this complete image are detected, and the detection result processing is relatively simple, which not only improves the detection efficiency, but also solves the problem of low efficiency caused by multiple manual focus adjustments of the camera at different heights of the three-dimensional workpiece focal plane and the need to use multiple sets of machine vision systems at the same time.
[0005] In order to achieve the above object, the technical solution of the present invention provides a multi-focal plane image fusion method for three-dimensional workpiece detection, comprising the following steps:
[0006] Collect multi-dimensional focal plane image data of stereo workpieces from vertical or adjustable specified angles;
[0007] Preprocessing the collected raw image data includes setting the gamma value according to the overall grayscale level of the image to perform gamma transformation, performing dynamic grayscale equalization of the image, and setting the block size and contrast;
[0008] Perform Gaussian curve fitting and smoothing on the grayscale histogram of the preprocessed image data, and accurately extract the minimum value points in the grayscale histogram as multi-threshold segmentation parameters;
[0009] The gray value interval of the preprocessed image data is hierarchically and recursively segmented according to the multi-threshold segmentation parameters to generate multiple image segmentation regions;
[0010] Based on the multi-scale closing operation of the morphological algorithm, small pseudo targets and noise points in the image segmentation area are removed, and secondary screening is performed based on the area, shape and edge features of the image segmentation area;
[0011] Based on the Bezier curve fitting algorithm, the boundaries of the image segmentation area are smoothly optimized with high precision, and the irregularities of the boundaries are eliminated based on the Gaussian edge filtering algorithm;
[0012] Label and spatially index the optimized image segmentation areas;
[0013] From the preprocessed image data, screenshots are taken according to the image segmentation area, and the clarity is calculated according to the multi-factor clarity evaluation model to extract the clearest image of each image segmentation area;
[0014] The clearest images of all image segmentation areas are fused and constructed to form a complete image.
[0015] In the above technical solution, preferably, the step of fusing and constructing the clearest images of all image segmentation areas to form a complete image includes the following steps:
[0016] Determine the focal plane of the clearest image in each image segmentation area as its target focal plane;
[0017] Based on the regional feature fusion algorithm, the target focal plane parameters of each image segmentation area are normalized, and key data are stored to determine the target focal plane information of each image segmentation area, wherein the key data includes position coordinate data and focal plane data;
[0018] Select the target focal plane of the image segmentation area with the highest definition as the reference focal plane;
[0019] The target focal planes of different image segmentation areas are seamlessly spliced and fused with the reference focal plane according to their mutual positional relationship to form a complete image.
[0020] In any of the above technical solutions, preferably, the step of fusing and constructing the clearest images of all image segmentation areas to form a complete image comprises the following steps:
[0021] Determine the focal plane of the clearest image in each image segmentation area as its target focal plane;
[0022] Based on the regional feature fusion algorithm, the target focal plane parameters corresponding to the clearest image of each image segmentation area are normalized, and key data are stored to determine the target focal plane information of each image segmentation area, wherein the key data includes position coordinate data and focal plane data;
[0023] Select the target focal plane of the image segmentation area with the largest area as the reference focal plane;
[0024] The target focal planes of different image segmentation areas are seamlessly spliced and fused with the reference focal plane according to their mutual positional relationship to form a complete image.
[0025] In any of the above technical solutions, preferably, before the target focal planes of different image segmentation areas are seamlessly spliced and merged with the reference focal plane according to their relative positions to form a complete image,
[0026] Based on the spatial projection correction algorithm and the reference focal plane, parameter matching and alignment are performed on target focal planes other than the reference focal plane, wherein the parameters include region position information and boundary information.
[0027] In any of the above technical solutions, preferably, the following steps are also included:
[0028] Gaussian smoothing and image reconstruction algorithms are used to eliminate artifacts and transition traces at the regional junctions of the fused complete image, and a complete image with high definition and high visual effects is reconstructed.
[0029] In any of the above technical solutions, preferably, the step of acquiring multi-dimensional focal plane image data of a three-dimensional workpiece from a vertical or adjustable specified angle comprises the following steps:
[0030] Acquire a background image without stereo artifacts and a global image containing stereo artifacts;
[0031] Based on the pixel-level difference calculation method, the global image and the background image are denoised and fused, and the background area is eliminated through an adaptive segmentation algorithm. Only the three-dimensional workpiece image is retained to obtain the multi-dimensional focal plane image data of the three-dimensional workpiece.
[0032] In any of the above technical solutions, preferably, the step of performing Gaussian curve fitting and smoothing on the grayscale histogram based on the preprocessed image data to accurately extract the minimum value points in the grayscale histogram as multi-threshold segmentation parameters comprises the following steps:
[0033] Calculate the absolute histogram of the grayscale value in the preprocessed image data, and count the number of pixels of each grayscale value according to the first formula, where the first formula is: ,in, It is represented by the pixel value at the coordinate (x, y) in the image, I is represented by the gray value, N and M are represented by the width and height of the image respectively, H(I) is represented by the number of pixels with gray value I, and δ is represented by the interval between gray levels, that is, the difference between adjacent gray values;
[0034] Gaussian filtering is used to smooth the absolute histogram, and the local minimum value of the smoothed histogram is extracted to obtain a set of minimum value points;
[0035] The minimum point set is used as the multi-threshold segmentation parameter.
[0036] In any of the above technical solutions, preferably, performing hierarchical recursive segmentation on the grayscale value interval of the preprocessed image data according to the multi-threshold segmentation parameters to generate multiple image segmentation regions comprises the following steps:
[0037] The grayscale value interval of the preprocessed image data is segmented according to the multi-threshold segmentation parameters, wherein the multi-threshold segmentation parameters include I 1 , I 2 ,…,I n , the gray value interval is divided into [0, I 1 ],[I 1 , I 2 ],...,[I n-1 , 255];
[0038] Each gray value interval corresponds to a potential segmentation region;
[0039] Take the center of each potential segmentation area as the seed point and search outwards in sequence. If the gray value difference between the newly added pixel and the current area is greater than the gray value threshold or the shortest distance between the newly added pixel coordinate point and the current area is greater than the distance value threshold, stop searching outwards and mark all the pixels in the connected area obtained for preliminary segmentation, where the gray value threshold is 5-10 pixel values and the distance value threshold ranges from 15-20 pixel values;
[0040] For the connected areas that have been segmented, continue to use the center of each area as the seed point, repeat the above steps of searching outward in sequence, and gradually grow the area until the pixel value difference between the edge positions of two adjacent segmented areas is greater than the set threshold, and the threshold is set to 5-10 pixels. At the same time, there is no segmented area with an area less than 50 pixels, forming multiple image segmentation areas.
[0041] In any of the above technical solutions, preferably, the multi-factor clarity evaluation model includes:
[0042] ,
[0043] Among them, Clarity represents the image clarity of the image segmentation area, α, β, γ represent the weight coefficients, G (x, y) represents the gradient amplitude of the image segmentation area, C represents the contrast, and H represents the texture entropy.
[0044] The technical solution of the present invention also proposes a multi-focal plane image fusion system for three-dimensional workpiece detection, including a variable-focus image acquisition module, the variable-focus image acquisition module includes an industrial camera and a variable-focus lens, and is used to dynamically acquire images with different focal lengths; a computer device, the computer device includes a processor, the processor is used to implement any one of the multi-focal plane image fusion methods for three-dimensional workpiece detection in the above-mentioned technical solutions when executing a computer program stored in a memory, and the computer device is communicatively connected to the variable-focus image acquisition module.
[0045] The multi-focal plane image fusion method and system for three-dimensional workpiece detection proposed by the present invention have the following beneficial technical effects:
[0046] (1) The multi-focal plane image fusion method and system for three-dimensional workpiece detection proposed in the present invention can fuse the image segmentation areas under multiple focal planes of the three-dimensional workpiece to form a complete image with high definition and high visual effect, which can effectively reduce the problem of repeated focusing of mobile hardware equipment caused by different focal planes at different positions of the three-dimensional workpiece, thereby greatly improving the detection efficiency and detection accuracy.
[0047] (2) The present invention proposes a multi-focal plane image fusion method and system for three-dimensional workpiece detection. A variable-focal-plane lens is installed on an industrial camera to collect multi-dimensional focal plane image data of the three-dimensional workpiece, and the image is segmented by multiple thresholds. Then, the focus plane images of each segmented area are fused to obtain a complete image with high definition and high visual effect. Various parameters of this complete image are detected, and the detection result processing is relatively simple. This not only improves the detection efficiency, but also solves the problem of low efficiency caused by multiple manual focus adjustments of the camera at different focal plane heights of the three-dimensional workpiece and the need to use multiple sets of machine vision systems at the same time.
[0048] (3) The present invention proposes a multi-focal plane image fusion method and system for three-dimensional workpiece detection. By adding a variable focal lens to the industrial camera, it is possible to collect image data of different focal planes at vertical or specified angles without changing the position of the industrial camera. The image acquisition method is simpler and more reliable. The clarity of each area in these image data is different. By analyzing and fusing these image data, a complete detection image can be obtained. Only this detection image needs to be analyzed to obtain the detection result. The detection analysis is relatively simple and the detection accuracy is high.
[0049] (4) The multi-focal plane image fusion method and system for three-dimensional workpiece detection proposed in the present invention uses a multi-factor clarity evaluation model to evaluate the clarity of the image segmentation area, which is more accurate and can more accurately determine the target focal plane with the highest clarity in each image segmentation area, which is conducive to improving the fusion effect.
[0050] (5) The multi-focal plane image fusion method and system for three-dimensional workpiece detection proposed in the present invention can realize the fusion of multiple images, and fuse the clearest photos of each image segmentation area, so as to achieve better fusion effect. All parts of the three-dimensional workpiece under the same angle of the industrial camera are clearly presented in the same fused picture, which is convenient for detection and analysis.
[0051] (6) The present invention proposes a multi-focal plane image fusion method and system for three-dimensional workpiece detection, which uses a regional feature fusion algorithm to normalize the focal plane parameters of each area, determine the focal plane information of each segmented area, select the target focal plane of the largest area in the segmented area as the reference focal plane or the target focal plane of the segmented area with the highest clarity as the reference focal plane, and use spatial projection correction technology to match and align the focal planes of other areas to make their characteristics consistent with the reference focal plane, thereby achieving seamless stitching and fusion of each image segmentation area. At the same time, the image is smoothly reconstructed to ensure the consistency of the image content in space and vision.
[0052] Additional aspects and advantages of the present invention will be given in part in the following description and, in part, will be obvious from the following description or learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0054] Figure 1 A schematic flow chart of a multi-focal plane image fusion method for three-dimensional workpiece detection according to an embodiment of the present invention is shown;
[0055] Figure 2 A schematic diagram showing preliminary image segmentation of a multi-focal plane image fusion method for three-dimensional workpiece detection according to an embodiment of the present invention is shown;
[0056] Figure 3 A schematic diagram showing a plurality of image segmentation regions formed by a multi-focal plane image fusion method for three-dimensional workpiece detection according to an embodiment of the present invention;
[0057] Figure 4 A focal plane image of a car door lock is shown;
[0058] Figure 5Another focal plane image of a car door lock is shown;
[0059] Figure 6 Shown is a fused image of a car door lock. DETAILED DESCRIPTION
[0060] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0061] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0062] Combine the following Figures 1 to 6 A multi-focal plane image fusion method and system for three-dimensional workpiece detection according to an embodiment of the present invention is specifically described.
[0063] like Figure 1 As shown, a multi-focal plane image fusion method for three-dimensional workpiece detection according to an embodiment of the present invention comprises the following steps:
[0064] S102, collecting multi-dimensional focal plane image data of a three-dimensional workpiece from a vertical or adjustable specific angle;
[0065] The multi-dimensional focal plane image data of the three-dimensional workpiece is captured from a vertical or adjustable specified angle through an industrial-grade high-resolution camera. The acquisition system is equipped with an autofocus function and an intelligent fill light module to ensure the uniformity of illumination and image clarity. At the same time, with the help of an intelligent control stage, multi-angle dynamic shooting of the workpiece to be measured is achieved, providing high-quality input data for subsequent processing.
[0066] S104, preprocessing the collected raw image data, the preprocessing including: setting the gamma value according to the overall gray level of the image to perform gamma transformation, performing dynamic gray level equalization of the image, and setting the block size and contrast;
[0067] Gamma transformation and dynamic grayscale equalization of images can improve the brightness of images, enhance image contrast, and highlight image defect information.
[0068] S106, performing Gaussian curve fitting and smoothing processing on the grayscale histogram based on the preprocessed image data, and accurately extracting the minimum value point in the grayscale histogram as a multi-threshold segmentation parameter;
[0069] S108, performing hierarchical recursive segmentation on the grayscale value interval of the preprocessed image data according to the multi-threshold segmentation parameters to generate a plurality of image segmentation regions;
[0070] S110 uses a multi-scale closing operation based on a morphological algorithm to remove small pseudo targets and noise points in the image segmentation area, and performs secondary screening based on the area, shape and edge features of the image segmentation area. In addition, a deep learning classification model is used to calibrate and classify the screened targets to facilitate subsequent focal plane extraction and fusion.
[0071] S112, based on the Bezier curve fitting algorithm, the boundary of the image segmentation area is smoothly optimized with high precision, and the irregularity of the boundary is eliminated based on the Gaussian edge filtering algorithm; thereby, it can be ensured that a regularized and high-precision target area can be generated.
[0072] S114, labeling and spatial indexing the optimized image segmentation areas, thereby facilitating subsequent focal plane extraction and fusion calculation.
[0073] S116, taking screenshots from the preprocessed image data according to the image segmentation area, and performing clarity calculation according to a multi-factor clarity evaluation model to extract the clearest image of each image segmentation area; the multi-factor clarity evaluation model includes: , where Clarity represents the image clarity of the image segmentation area, α, β, γ represent weight coefficients, G (x, y) represents the gradient amplitude of the image segmentation area, C represents the contrast, and H represents the texture entropy. Therefore, the image clarity of each image segmentation area is comprehensively evaluated by multiple factors, and the image clarity evaluation is highly accurate.
[0074] S118, the clearest images of all image segmentation areas are fused and constructed to form a complete image.
[0075] Thus, the fusion of multiple focal planes of the three-dimensional workpiece can be achieved, which can effectively reduce the problem of needing to move the hardware equipment to repeatedly focus due to different focal planes at different positions of the three-dimensional workpiece, thereby greatly improving the detection efficiency and detection accuracy.
[0076] Further, step S102 specifically includes: S1021, obtaining a background image without a 3D artifact and a global image containing a 3D artifact; S1022, based on a pixel-level difference calculation method, denoising and fusing the global image and the background image, eliminating the background area through an adaptive segmentation algorithm, retaining only the 3D artifact image, and obtaining multi-dimensional focal plane image data of the 3D artifact. Taking the 3D artifact as an example, the specific method is as follows: Figure 4 and Figure 5 shown.
[0077] Therefore, the computational complexity of the multi-focal plane image fusion method can be greatly reduced and the accuracy of image segmentation region extraction can be improved.
[0078] Further, step S106 specifically includes: S1061, calculating an absolute histogram of grayscale values in the preprocessed image data, and counting the number of pixels of each grayscale value according to a first formula, wherein the first formula is: ,in, It is represented by the pixel value at the coordinate (x, y) in the image, I is represented by the gray value, N and M are represented by the width and height of the image respectively, H(I) is represented by the number of pixels with gray value I, δ is represented by the interval between gray levels, that is, the difference between adjacent gray values; S1062, using Gaussian filtering to smooth the absolute histogram, extracting local minimum values from the smoothed histogram to obtain a set of minimum value points; S1063, using the set of minimum value points as a multi-threshold segmentation parameter.
[0079] When using Gaussian filtering to smooth the absolute histogram, it is necessary to select appropriate Gaussian filtering standard deviation parameters, specifically, to keep the original histogram curve without losing key change points, so that the noise in the histogram can be reduced, making the minimum value of the histogram more obvious and stable. In addition, using the minimum value point set as a multi-threshold segmentation parameter can achieve multi-region segmentation of the image, making it easier to find the clearest image segmentation area for fusion.
[0080] Further, step S108 specifically includes: S1081, segmenting the grayscale value interval of the preprocessed image data according to the multi-threshold segmentation parameters, wherein the multi-threshold segmentation parameters include I 1 , I 2 ,…,I n , the gray value interval is divided into [0, I 1 ],[I 1 , I 2 ],...,[I n-1 , 255]; S1082, each gray value interval corresponds to a potential segmentation area; S1083, take the center of each potential segmentation area as the seed point, search outward in sequence, if the gray value difference between the newly added pixel and the current area is greater than the gray value threshold or the shortest distance between the newly added pixel coordinate point and the current area is greater than the distance value threshold, then stop searching outward, and mark all the pixels in the connected area obtained, and perform preliminary segmentation, where the gray value threshold is 5-10 pixel values, and the distance value threshold ranges from 15-20 pixel values. Taking the three-dimensional workpiece as a car door lock as an example, the schematic diagram of the preliminary segmentation of the image is as follows Figure 2As shown; S1084, for the connected areas that have been segmented, continue to use the center of each area as the seed area, repeat the steps of S1082 to search outwards in sequence, and gradually increase the area until the pixel value difference between the edge positions of two adjacent segmented areas is greater than the set threshold, the threshold is set to 5-10 pixels, and there is no segmented area with an area less than 50 pixels, forming multiple image segmentation areas, such as Figure 3 shown.
[0081] Therefore, by performing hierarchical recursive segmentation on the gray value interval, the high accuracy and integrity of image segmentation can be ensured.
[0082] Further, step S118 specifically includes: S1181, determining the focal plane of the clearest image of each image segmentation area as its target focal plane; S1182, based on the regional feature fusion algorithm, normalizing the target focal plane parameters of each image segmentation area, and storing key data to determine the target focal plane information of each image segmentation area, wherein the key data includes position coordinate data and focal plane data, and the normalization process uses Z-Score to adjust the mean of the data to 0 and the standard deviation to 1. , where μ is the mean of the focal plane parameters of all regions, and σ is the standard deviation; S1183, select the target focal plane of the image segmentation region with the highest clarity as the reference focal plane, and perform parameter matching and alignment on the target focal planes of other image segmentation regions based on the spatial projection correction algorithm. The parameters include regional position information and boundary information to ensure that their characteristics are consistent with the reference focal plane; S1184, seamlessly splice and fuse the target focal planes of different image segmentation regions with the reference focal plane according to their mutual positional relationship, adjust the color, brightness and texture features between images, and ensure the spatial and visual consistency of the image content; S1185, use Gaussian smoothing and image reconstruction algorithms to eliminate artifacts and transition traces at the regional junctions of the fused image, and reconstruct a complete image with high clarity and high visual effects. Take the three-dimensional workpiece as an example of a car door lock, as follows Figure 6 As shown, the overall image has better coherence and aesthetics, which facilitates the measurement of various parameters of the fused image and improves the accuracy of three-dimensional workpiece detection.
[0083] In addition, S1183 may also select the target focal plane of the image segmentation area with the largest area as the reference focal plane.
[0084] The use of the method of the present invention for multi-focal plane imaging of three-dimensional workpieces solves the difficulties of conventional focus adjustment through hardware systems. This not only simplifies the operation process, but also significantly improves imaging efficiency and accuracy. It can also automatically select different focus levels for image fusion, effectively solving the problem of image blur caused by inaccurate focal length, ensuring that the details of the three-dimensional workpiece on different focal planes are clearly presented, and improving the reliability and accuracy of quality inspection.
[0085] A multi-focal plane image fusion system for three-dimensional workpiece detection according to an embodiment of the present invention includes a variable focus image acquisition module, which includes an industrial camera and a variable focus lens for dynamically acquiring images with different focal lengths; a computer device, which includes a processor, which is used to implement the multi-focal plane image fusion method for three-dimensional workpiece detection in the above embodiment when executing a computer program stored in a memory, and the computer device is communicatively connected with the variable focus image acquisition module. The industrial camera is an industrial-grade high-resolution camera that captures multi-dimensional focal plane image data of a three-dimensional workpiece from a vertical or adjustable specified angle. By adjusting the focal length of the variable focus lens, the dynamic acquisition function of images with different focal lengths is realized. The acquisition system is equipped with an autofocus function and an intelligent fill light module to ensure illumination uniformity and imaging clarity, and at the same time, with the help of an intelligent control stage, multi-angle dynamic shooting of the workpiece to be measured is realized, providing high-quality input data for subsequent processing.
[0086] The steps in the method of the present invention can be adjusted in order, combined or deleted according to actual needs.
[0087] The units in the device of the present invention can be combined, divided and deleted according to actual needs.
[0088] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A multi-focal plane image fusion method for three-dimensional workpiece detection, characterized in that: The following steps are involved: Collect multi-dimensional focal plane image data of stereo workpieces from vertical or adjustable specified angles; Preprocessing the collected raw image data includes setting the gamma value according to the overall grayscale level of the image to perform gamma transformation, performing dynamic grayscale equalization of the image, and setting the block size and contrast; Perform Gaussian curve fitting and smoothing on the grayscale histogram of the preprocessed image data, and accurately extract the minimum value points in the grayscale histogram as multi-threshold segmentation parameters; The gray value interval of the preprocessed image data is hierarchically and recursively segmented according to the multi-threshold segmentation parameters to generate multiple image segmentation regions; Based on the multi-scale closing operation of the morphological algorithm, small pseudo targets and noise points in the image segmentation area are removed, and secondary screening is performed based on the area, shape and edge features of the image segmentation area; Based on the Bezier curve fitting algorithm, the boundaries of the image segmentation area are smoothly optimized with high precision, and the irregularities of the boundaries are eliminated based on the Gaussian edge filtering algorithm; Label and spatially index the optimized image segmentation areas; From the preprocessed image data, screenshots are taken according to the image segmentation area, and the clarity is calculated according to the multi-factor clarity evaluation model to extract the clearest image of each image segmentation area; The clearest images of all image segmentation areas are fused and constructed to form a complete image.
2. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 1, characterized in that: The process of fusing and constructing the clearest images of all image segmentation areas to form a complete image includes the following steps: Determine the focal plane of the clearest image in each image segmentation area as its target focal plane; Based on the regional feature fusion algorithm, the parameters of the target focal plane of each image segmentation area are normalized, and key data are stored to determine the target focal plane information of each image segmentation area, wherein the key data includes position coordinate data and focal plane data; The target focal plane of the image segmentation area with the highest definition is selected as the reference focal plane; the target focal planes of different image segmentation areas are seamlessly spliced and fused with the reference focal plane according to their relative positions to form a complete image.
3. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 1, characterized in that: The process of fusing and constructing the clearest images of all image segmentation areas to form a complete image includes the following steps: Determine the focal plane of the clearest image in each image segmentation area as its target focal plane; Based on the regional feature fusion algorithm, the target focal plane parameters of each image segmentation area are normalized, and key data are stored to determine the target focal plane information of each image segmentation area, wherein the key data includes position coordinate data and focal plane data; Select the target focal plane of the image segmentation area with the largest area as the reference focal plane; The target focal planes of different image segmentation areas are seamlessly spliced and fused with the reference focal plane according to their mutual positional relationship to form a complete image.
4. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 2 or 3, characterized in that: Before the target focal planes of different image segmentation areas are seamlessly spliced and merged with the reference focal plane according to their relative positions to form a complete image, Based on the spatial projection correction algorithm and the reference focal plane, parameter matching and alignment are performed on target focal planes other than the reference focal plane, wherein the parameters include region position information and boundary information.
5. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 2 or 3, characterized in that: The following steps are also included: Gaussian smoothing and image reconstruction algorithms are used to eliminate artifacts and transition traces at the regional junctions of the fused complete image, and a complete image with high definition and high visual effects is reconstructed.
6. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 1, characterized in that: The method of collecting multi-dimensional focal plane image data of a three-dimensional workpiece from a vertical or adjustable specified angle comprises the following steps: Acquire a background image without stereo artifacts and a global image containing stereo artifacts; Based on the pixel-level difference calculation method, the global image and the background image are denoised and fused, and the background area is eliminated through an adaptive segmentation algorithm. Only the three-dimensional workpiece image is retained to obtain the multi-dimensional focal plane image data of the three-dimensional workpiece.
7. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 1, characterized in that: The method of performing Gaussian curve fitting and smoothing on the grayscale histogram of the preprocessed image data and accurately extracting the minimum value points in the grayscale histogram as multi-threshold segmentation parameters comprises the following steps: Calculate the absolute histogram of the grayscale value in the preprocessed image data, and count the number of pixels of each grayscale value according to the first formula, where the first formula is: ,in, It is represented by the pixel value at the coordinate (x, y) in the image, I is represented by the gray value, N and M are represented by the width and height of the image respectively, H(I) is represented by the number of pixels with gray value I, and δ is represented by the interval between gray levels, that is, the difference between adjacent gray values; Gaussian filtering is used to smooth the absolute histogram, and the local minimum value of the smoothed histogram is extracted to obtain a set of minimum value points; The minimum point set is used as the multi-threshold segmentation parameter.
8. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 7, characterized in that: The step of performing hierarchical recursive segmentation on the grayscale value interval of the preprocessed image data according to the multi-threshold segmentation parameters to generate multiple image segmentation regions comprises the following steps: The grayscale value interval of the preprocessed image data is segmented according to the multi-threshold segmentation parameters, wherein the multi-threshold segmentation parameters include I1, I2, ..., I n , the gray value interval is divided into [0, I1], [I1, I2], ..., [I n-1 , 255]; Each gray value interval corresponds to a potential segmentation region; Take the center of each potential segmentation area as the seed point and search outwards in sequence. If the gray value difference between the newly added pixel and the current area is greater than the gray value threshold or the shortest distance between the newly added pixel coordinate point and the current area is greater than the distance value threshold, stop searching outwards and mark all the pixels in the connected area for preliminary segmentation. The gray value threshold is 5-10 pixels and the distance value threshold is in the range of 15-20 pixels. For the connected areas that have been segmented, continue to use the center of each area as the seed point, repeat the above steps of searching outward in sequence, and gradually grow the area until the pixel value difference between the edge positions of two adjacent segmented areas is greater than the set threshold, and the threshold is set to 5-10 pixels. At the same time, there is no segmented area with an area less than 50 pixels, forming multiple image segmentation areas.
9. The multi-focal plane image fusion method for three-dimensional workpiece detection according to claim 1, characterized in that: The multi-factor clarity evaluation model includes: , Among them, Clarity represents the image clarity of the image segmentation area, α, β, γ represent the weight coefficients, G (x, y) represents the gradient amplitude of the image segmentation area, C represents the contrast, and H represents the texture entropy.
10. A multi-focal plane image fusion system for three-dimensional workpiece detection, characterized in that: It includes a zoom image acquisition module, which includes an industrial camera and a zoom lens for dynamically acquiring images with different focal lengths; a computer device, which includes a processor, and the processor is used to implement the multi-focal plane image fusion method for stereo workpiece detection as described in any one of claims 1 to 9 when executing a computer program stored in a memory, and the computer device is communicatively connected to the zoom image acquisition module.
Citation Information
Patent Citations
Image definition evaluation method for three-dimensional object
CN110956624A
Automatic focusing imaging method and system for multi-focal-plane object of microscopic system
CN117812468A