A method for synthesizing telecentric lens images under variable object distances

By using the variable object distance image synthesis method in telecentric lens image synthesis, the difficulty of processing multiple images caused by multiple object distance adjustments is solved, efficient fusion and processing of images are achieved, and real-time and accuracy of processing are improved.

CN114972142BActive Publication Date: 2025-05-30HANGZHOU HUICUI INTELLIGENT TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210522966.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-05-30
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

When shooting objects with height difference, the prior art requires multiple object distance adjustments, resulting in multiple captured images, making it difficult to perform subsequent image processing and analysis, and the processing time is long and the real-time performance is not high.

Method used

A telecentric lens image synthesis method is proposed in the case of variable object distance. By collecting images at different object distances, gradient calculation and comparison are performed, the image number corresponding to the maximum gradient amplitude of each pixel point is obtained, and the object distance and image number are interpolated to generate the final fusion image.

Benefits of technology

It realizes the fusing of multiple images taken from different object distances into one image, simplifying subsequent image processing and analysis, and improving the processing speed and accuracy of results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972142B_ABST
    Figure CN114972142B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for synthesizing telecentric lens images under variable object distances, including: Step 1, obtaining images of an object at different object distances; Step 2, calculating the gradient magnitudes of pixel points at different coordinates on each image; Step 3, obtaining the image numbers corresponding to the maximum gradient magnitudes of each pixel point; Step 4, determining whether the pixel point is an image boundary pixel point. If not, further determine whether the image number corresponding to the maximum gradient magnitude of the pixel point coordinates is the same as the image numbers corresponding to the maximum gradient magnitudes of the surrounding coordinate pixel points. If so, enter Step 6; Step 5, according to the judgment result of Step 4, perform interpolation calculation to obtain the final fused image corresponding to the pixel point; Step 6, calculate the final fused image corresponding to the image boundary pixel points; Step 7, combine the calculation results of Step 5 and Step 6 to obtain a complete fused image. The present invention can accurately and quickly perform multi-image fusion on objects with large surface height differences.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image fusion, and in particular to a method for synthesizing telecentric lens images under variable object distances. Background Art

[0002] For a telecentric lens, its object distance is generally fixed. Although the depth of field of a telecentric lens is relatively large, in order to achieve an ideal shooting effect, the object distance of the lens still needs to be adjusted. Therefore, for an object with a large height difference, in order to photograph the surfaces of objects at various heights, in the existing technical solutions, the object distance needs to be adjusted multiple times. As a result, for the same object, multiple captured images are generated, which is not convenient for subsequent image processing and analysis operations, such as size measurement, detection, etc.

[0003] For the above application scenarios, even if it is allowed to separately process and analyze the multiple captured images, certain drawbacks will also be brought. For example, as the number of captured images increases, the time required to separately process more images will become longer, resulting in low real-time performance of the processing. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for synthesizing telecentric lens images under variable object distances, so as to solve the problem of difficult processing of multiple images captured for the same object at different object distances in the prior art.

[0005] On the one hand, an embodiment of the present invention provides a method for synthesizing telecentric lens images under variable object distances, including the following steps:

[0006] Step 1, for the surface of an object with a height difference, obtain images of the object at different object distances through an acquisition module;

[0007] Step 2, perform gradient calculation on each of the obtained images to obtain the gradient amplitudes of different coordinate pixel points on each image;

[0008] Step 3, compare the gradient amplitude sizes of each pixel point on different images, and obtain the image number corresponding to the maximum gradient amplitude of each pixel point;

[0009] Step 4, determine whether the pixel point is an image boundary pixel point. If not, further determine whether the image number corresponding to the maximum gradient amplitude of the pixel point coordinates is the same as the image numbers corresponding to the maximum gradient amplitudes of its surrounding coordinate pixel points. If so, enter Step 6;

[0010] Step 5, according to the judgment result of Step 4, perform interpolation calculation in combination with the object distance, image number, and gradient amplitude to obtain the corresponding points of the non-boundary pixel points of the image on the final fused image;

[0011] Step 6, calculate the corresponding points of the image boundary pixel points on the fused image;

[0012] Step 7, combine the calculation results of Step 5 and Step 6 to obtain a complete fused image.

[0013] Further, sort the N obtained images in ascending order of the optimal object distance, and the maximum object distance difference H obtained is:

[0014] H = h N - h 1

[0015] where h N is the object distance corresponding to the Nth image, and h 1 is the object distance corresponding to the 1st image.

[0016] Further, Step 2 further includes:

[0017] Step 2-1, obtain the gray values of each pixel point on each image;

[0018] Step 2-2, use the sobel operator to calculate the gradient magnitude of each pixel point on each image respectively.

[0019] Further, Step 3 further includes: for each pixel point, compare the gradient magnitudes of the pixel points at the same coordinates on the N images respectively, and record the image number Index(x, y) corresponding to the maximum gradient magnitude, that is, satisfy:

[0020] g(x, y, Index(x, y)) ≥ g(x, y, i)

[0021] where (x, y) represents the coordinates of the pixel point, g(x, y, Index(x, y)) represents the gradient magnitude of the pixel point with coordinates (x, y) on the Index(x, y)th image, g(x, y, i) represents the gradient magnitude of the pixel point with coordinates (x, y) on the ith image, and i ∈ [1, N], 1 ≤ Index(x, y) ≤ N.

[0022] Further, Step 4 further includes: for the pixel point with coordinates (x, y), determine whether it satisfies the following conditions:

[0023] Index(x, y) = Index(x, y - 1) = Index(x, y + 1) = Index(x - 1, y) = Index(x + 1, y)

[0024] Among them, the pixel points with coordinates (x, y-1), (x, y+1), (x-1, y), and (x+1, y) are the surrounding coordinate pixel points of the pixel point with coordinates (x, y), and Index(x, y-1), Index(x, y+1), Index(x-1, y), and Index(x+1, y) respectively represent the image numbers corresponding to the maximum gradient amplitudes of the pixel points with coordinates (x, y-1), (x, y+1), (x-1, y), and (x+1, y).

[0025] Further, step 5 further includes: if the judgment result in step 4 meets the conditions, the calculation formula for the fused image is:

[0026] F 1 (x, y) = f(x, y, Index(x, y))

[0027] Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel point with coordinates (x, y) on the fused image, and f(x, y, Index(x, y)) represents the gray value of the pixel point with coordinates (x, y) on the Index(x, y)-th image.

[0028] Further, step 5 further includes: if the judgment result in step 4 does not meet the conditions, the calculation formula for the fused image is:

[0029]

[0030] Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel point with coordinates (x, y) on the fused image, m = x - 1, n = y - 1,

[0031] The calculation formula for r(m, n) is as follows:

[0032]

[0033] Among them, the calculation formula for S in the calculation formula for r(m, n) is as follows:

[0034]

[0035] Among them, h Index(x,y) represents the object distance of the image corresponding to the image number Index(x, y) corresponding to the maximum gradient amplitude of the pixel point (x, y), 1 ≤ Index(x, y) ≤ N.

[0036] Further, step 6 further includes: for boundary pixel points, the calculation formula for their fused image is:

[0037]

[0038] Among them, F 2 (x, y) represents the gray value corresponding to the image boundary pixel point with coordinates (x, y) on the fused image, and f(x, y, i) represents the gray value of the pixel point with coordinates (x, y) on the i-th image.

[0039] The beneficial effects of the present invention are as follows: The method for synthesizing telecentric lens images under variable object distances proposed by the present invention can fuse multiple images with different object distances obtained after adjusting the object distance multiple times, and finally obtain a fused image containing a clear surface of each height of the object. Since the time for image processing and analysis of a single fused image is less than the time required for processing multiple captured images separately, it is more convenient for subsequent image processing and analysis operations, such as size measurement, detection, etc. The present invention can fuse multiple images taken at different object distances into one image, and during the processing, it determines whether each pixel point needs to be fused according to the actual situation, maximizing the speed of subsequent image processing and the accuracy of the fusion result. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:

[0041] Figure 1 is the overall flowchart of the method for synthesizing telecentric lens images under variable object distances provided in the embodiments of the present invention;

[0042] Figure 2 is a schematic diagram of collecting images at different object distances in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer and more understandable, the following will further describe the embodiments of the present invention in detail with reference to the drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but not to limit the present invention.

[0044] In the description of this specification, the terms such as "including", "comprising", "having", "containing", etc. are all open-ended terms, meaning including but not limited to. The description referring to terms such as "one embodiment", "one specific embodiment", "some embodiments", "for example", etc. means that the specific features, structures or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. The order of steps involved in each embodiment is used to schematically illustrate the implementation of the present application, and the order of steps is not limited and can be adjusted appropriately as needed.

[0045] An image synthesis method for a telecentric lens under variable object distance is provided in an embodiment of the present invention. Figure 1 As shown in the schematic diagram of the overall process of this method, Figure 1 the method includes the following steps:

[0046] Step 1, for the surface of an object with a height difference, obtain images of the object at different object distances through an acquisition module;

[0047] Among them, with reference to Figure 2 for the schematic illustration, the acquisition module can ensure that the magnification of the obtained images does not change within a certain object distance range; the acquisition module is a camera, preferably a telecentric lens.

[0048] It should be noted that for an object with a height difference on the surface, in order to obtain clear images of the surfaces with different height differences of the object, it is necessary to adjust the object distance multiple times during acquisition, so as to take images of the object surfaces at each height.

[0049] Record N images obtained by the acquisition module and the object distance h corresponding to each image i , h i represents the object distance corresponding to the i-th image, i ∈ [1, N].

[0050] Step 1 further includes: sorting the obtained N images in ascending order according to the optimal object distance, where the optimal object distance refers to: for the images acquired by the acquisition module, if they are clear images within a certain object distance range, then this object distance range is called the optimal object distance range, and the object distance corresponding to the clear image is its optimal object distance.

[0051] Among them, the clarity of the images can be judged by using image clarity evaluation methods, such as the Tenengrad gradient method, the Laplacian gradient method, etc., or can also be judged by manual recognition. In the present invention, the user selects the clear images.

[0052] The obtained maximum object distance difference H is:

[0053] H = h N -h 1

[0054] where h N is the object distance corresponding to the Nth image, and h 1 is the object distance corresponding to the 1st image.

[0055] Step 2: Perform gradient calculation on each obtained image to obtain the gradient magnitudes of pixel points at different coordinates on each image;

[0056] Among them, Step 2 further includes:

[0057] Step 2-1: Obtain the gray values of each pixel point on each image;

[0058] The present invention can use the Gamma correction algorithm to calculate the gray value f(x, y, i) of the pixel point, and f(x, y, i) represents the gray value of the pixel point with coordinates (x, y) on the ith image.

[0059] Step 2-2: Use the sobel operator to calculate the gradient magnitudes of each pixel point on each image respectively.

[0060] Step 3: Compare the gradient magnitude sizes of each pixel point on different images to obtain the image number corresponding to the maximum gradient magnitude of each pixel point;

[0061] Specifically, Step 3 further includes: For each pixel point, compare the gradient magnitudes of the pixel points at the same coordinates on N images respectively, and record the image number Index(x, y) corresponding to the maximum gradient magnitude, that is, satisfying:

[0062] g(x, y, Index(x, y)) ≥ g(x, y, i)

[0063] where (x, y) represents the coordinates of the pixel point, g(x, y, Index(x, y)) represents the gradient magnitude of the pixel point with coordinates (x, y) on the Index(x, y)th image, g(x, y, i) represents the gradient magnitude of the pixel point with coordinates (x, y) on the ith image, and i ∈ [1, N], 1 ≤ Index(x, y) ≤ N.

[0064] Step 4: Determine whether the pixel point is an image boundary pixel point. If not, further determine whether the image number corresponding to the maximum gradient magnitude of the pixel point coordinates is the same as the image numbers corresponding to the maximum gradient magnitudes of the surrounding coordinate pixel points. If so, enter Step 6;

[0065] Among them, Step 4 further includes:

[0066] Step 4-1: Determine whether the pixel is an image boundary pixel. If not, proceed to Step 4-2; if so, directly proceed to Step 6.

[0067] Step 4-2: For the pixel with coordinates (x, y), determine whether it satisfies the following conditions:

[0068] Index(x, y) = Index(x, y - 1) = Index(x, y + 1) = Index(x - 1, y) = Index(x + 1, y)

[0069] Among them, the pixels with coordinates (x, y - 1), (x, y + 1), (x - 1, y), and (x + 1, y) are the surrounding coordinate pixels of the pixel with coordinates (x, y), and Index(x, y - 1), Index(x, y + 1), Index(x - 1, y), and Index(x + 1, y) respectively represent the image numbers corresponding to the maximum gradient amplitudes of the pixels with coordinates (x, y - 1), (x, y + 1), (x - 1, y), and (x + 1, y).

[0070] Step 5: According to the judgment result of Step 4, combined with the object distance, image number, and gradient amplitude, perform interpolation calculation to obtain the corresponding points of the non-boundary pixels of the image on the final fused image.

[0071] Specifically, Step 5 also includes:

[0072] If the judgment result in Step 4-2 satisfies the condition, the calculation formula for the fused image is:

[0073] F 1 (x, y) = f(x, y, Index(x, y))

[0074] Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel with coordinates (x, y) on the fused image;

[0075] f(x, y, Index(x, y)) represents the gray value of the pixel with coordinates (x, y) on the Index(x, y)-th image.

[0076] If the judgment result in Step 4-2 does not satisfy the condition, the calculation formula for the fused image is:

[0077]

[0078] Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel with coordinates (x, y) on the fused image, m = x - 1, n = y - 1,

[0079] The calculation formula of r(m,n) is as follows:

[0080]

[0081] Among them, the calculation formula of S in the calculation formula of r(m,n) is as follows:

[0082]

[0083] Among them, h Index(x,y) represents the object distance of the image corresponding to the image number Index(x,y) corresponding to the maximum gradient amplitude of the pixel point (x,y), where 1 ≤ Index(x,y) ≤ N.

[0084] Through the calculation in step 5, except for the boundary pixel points, the corresponding points F 1 (x,y) of each pixel point inside the image on the fused image have been obtained.

[0085] Step 6, calculate the corresponding points of the image boundary pixel points on the fused image;

[0086] Among them, step 6 also includes: for the boundary pixel points, the calculation formula of their fused image is:

[0087]

[0088] Among them, F 2 (x,y) represents the gray value corresponding to the image boundary pixel point with coordinates (x,y) on the fused image, and f(x,y,i) represents the gray value of the pixel point with coordinates (x,y) on the i-th image.

[0089] Step 7, combine the calculation results of step 5 and step 6 to obtain the complete fused image.

[0090] Specifically, by combining the corresponding points of the non-boundary points and the boundary points on the final fused image, the complete fused image is obtained.

[0091] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.

[0092] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general purpose computers, special purpose computers, embedded processors, or other programmable data processing devices to produce a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0093] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including instruction means that implement the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in the Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.

[0095] The specific embodiments described above further elaborate on the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for synthesizing telecentric lens images under variable object distances, characterized in that, it includes the following steps: Step 1, for the surface of an object with a height difference, obtain images of the object at different object distances through an acquisition module; Step 2, perform gradient calculations on the acquired images to obtain the gradient magnitudes of pixel points at different coordinates on each image; Step 3, compare the gradient magnitudes of each pixel point on different images, and obtain the image number corresponding to the maximum gradient magnitude of each pixel point; Step 4, determine whether the pixel point is an image boundary pixel point. If the pixel point is not an image boundary pixel point, further determine whether the image number corresponding to the maximum gradient magnitude of the pixel point is the same as the image number corresponding to the maximum gradient magnitude of its surrounding coordinate pixel points. After obtaining the judgment result, enter Step 5. If the pixel point is an image boundary pixel point, enter Step 6; Step 5, according to the judgment result of whether the image number corresponding to the maximum gradient magnitude of the pixel point in Step 4 is the same as the image number corresponding to the maximum gradient magnitude of its surrounding coordinate pixel points, combine the object distance, image number, and gradient magnitude to perform interpolation calculations to obtain the corresponding points of the non-boundary pixel points of the image on the final fused image; Step 6, calculate the corresponding points of the image boundary pixel points on the fused image; Step 7, combine the calculation results of Step 5 and Step 6 to obtain a complete fused image.

2. The method for synthesizing telecentric lens images under variable object distances according to claim 1, characterized in that, Step 1 further includes: sorting the N acquired images in ascending order of the optimal object distance, and the maximum object distance difference H obtained is: H = h N -h 1 where h N is the object distance corresponding to the Nth image, and h 1 is the object distance corresponding to the first image.

3. The method for synthesizing telecentric lens images under variable object distances according to claim 1, characterized in that, Step 2 further includes: Step 2-1, obtain the gray values of each pixel point on each image; Step 2-2, use the sobel operator to calculate the gradient magnitudes of each pixel point on each image respectively.

4. The method for synthesizing telecentric lens images under variable object distances according to claim 1, characterized in that, Step 3 further includes: for each pixel point, respectively compare the gradient magnitudes of the pixel points at the same coordinates on N images, and record the image number Index(x, y) corresponding to the maximum gradient magnitude, that is, satisfy: g(x, y, Index(x, y)) ≥ g(x, y, i) where (x, y) represents the coordinates of the pixel point, g(x, y, Index(x, y)) represents the gradient magnitude of the pixel point with coordinates (x, y) on the Index(x, y)th image, g(x, y, i) represents the gradient magnitude of the pixel point with coordinates (x, y) on the ith image, and i ∈ [1, N], 1 ≤ Index(x, y) ≤ N.

5. The method for synthesizing telecentric lens images under variable object distances according to claim 4, characterized in that, Step 4 further includes: for a pixel point with coordinates (x, y), determine whether it satisfies the following conditions: Index(x,y) = Index(x,y - 1) = Index(x,y + 1) = Index(x - 1,y) = Index(x + 1,y), where the pixel points with coordinates (x,y - 1), (x,y + 1), (x - 1,y), and (x + 1,y) are the surrounding coordinate pixel points of the pixel point with coordinates (x,y), and Index(x,y - 1), Index(x,y + 1), Index(x - 1,y), and Index(x + 1,y) respectively represent the image numbers corresponding to the maximum gradient magnitudes of the pixel points with coordinates (x,y - 1), (x,y + 1), (x - 1,y), and (x + 1,y).

6. The telecentric lens image synthesis method under variable object distance according to claim 5, characterized in that, step 5 further includes: if the judgment result in step 4 is that the image number corresponding to the maximum gradient magnitude of the pixel point is the same as the image numbers corresponding to the maximum gradient magnitudes of its surrounding coordinate pixel points, the calculation formula for the fused image is: F 1 (x,y) = f(x,y,Index(x,y)) Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel point of the coordinate (x, y) on the fused image, and f(x, y, Index(x, y)) represents the gray value of the pixel point with the coordinate (x, y) on the Index(x, y)-th image.

7. The telecentric lens image synthesis method under variable object distance according to claim 5, characterized in that, step 5 further includes: if the judgment result in step 4 is that the image number corresponding to the maximum gradient magnitude of the pixel point is different from the image numbers corresponding to the maximum gradient magnitudes of its surrounding coordinate pixel points, the calculation formula for the fused image is: Among them, F 1 (x, y) represents the gray value corresponding to the non-boundary pixel point of the coordinate (x, y) on the fused image, m = x - 1, n = y - 1, The calculation formula for r(m,n) is as follows: Among them, the calculation formula for S in the calculation formula for r(m,n) is as follows: where h Index(x,y) represents the object distance of the image corresponding to the image number Index(x, y) corresponding to the maximum gradient amplitude of the pixel point (x, y), where 1 ≤ Index(x, y) ≤ N.

8. The telecentric lens image synthesis method under variable object distance according to claim 2, characterized in that, step 6 further includes: for the boundary pixel points, the calculation formula for their fused image is: Among them, F 2 (x, y) represents the gray value corresponding to the image boundary pixel point with coordinates (x, y) on the fused image, and f(x, y, i) represents the gray value of the pixel point with coordinates (x, y) on the i-th image.

Citation Information

Patent Citations

  • Method and device for collecting images in machine vision

    CN105491280A

  • Image fusion method based on gradient domain mapping

    CN110517211A