Monocular image three-dimensional reconstruction method and device based on improved focusing definition algorithm
By improving the focus definition algorithm, using image features to calculate feature weight values, forming a depth map and performing filtering processing, the problem of focus area identification in multi-focus image fusion is solved, and the accuracy and quality of three-dimensional reconstruction are improved.
Patent Information
- Application Number
- CN202411087450.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-08-09
AI Technical Summary
During the multi-focus image fusion process, it is difficult to accurately identify and extract the focus area in the source image, resulting in artifacts or loss of edge contours in the fusion results, affecting the three-dimensional reconstruction effect.
By improving the focus sharpness algorithm, using features such as image grayscale difference, gradient difference, and entropy to calculate feature weight values, determine key focus sharpness, form a depth map and perform filtering processing, and combine monocular sequence images for fusion and interpolation to construct 3D model.
It improves the accuracy and robustness of image definition assessment, effectively extracts high-definition pixels, enhances the accuracy of depth information, and improves the quality of three-dimensional modeling.
Smart Images

Figure CN118628665A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of monocular images, and in particular to a method and device for three-dimensional reconstruction of monocular images based on an improved focus clarity algorithm. Background Art
[0002] In the field of computer vision and graphics, 3D reconstruction technology occupies a pivotal position. This technology captures the 3D information of the target scene or object through different technical means, and then accurately constructs its mathematical model in a computer environment. Among them, 3D reconstruction technology based on focused depth measurement images has gradually become a research hotspot due to its high precision and high efficiency. Compared with traditional two-dimensional images, focused depth images can intuitively reflect the spatial position and morphological characteristics of objects.
[0003] Focused depth images adjust the focal length of the lens so that the target scene or object presents clear depth information in the image. When using a camera or microscope to shoot, it is hoped that all objects in all scenes can be obtained in clear images. However, due to the limitation of the depth of field, the lens cannot focus on all targets at the same time, resulting in some areas of the photo being clear and some areas being blurred. To solve this problem, the existing technology adopts a solution based on multi-focus image fusion technology. This technology cleverly fuses multiple images at different focus positions in the same scene into a panoramic and clear image, greatly improving the utilization rate of image information. After collecting a multi-focus image sequence in the same field of view, this technology can be used to achieve accurate fusion of the image sequence, thereby obtaining a panoramic and clear image with a large field of view and high resolution. At the same time, this process also indirectly provides clues about the depth information of the object, which has far-reaching significance for three-dimensional reconstruction research.
[0004] However, in the process of multi-focus image fusion, how to accurately identify and extract the focus area in the source image has become a technical difficulty. Incomplete focus area extraction may cause artifacts or loss of edge contours in the fusion result, thus affecting the final 3D reconstruction effect. Summary of the invention
[0005] The embodiments of the present application provide a method and device for three-dimensional reconstruction of monocular images based on an improved focus clarity algorithm, thereby solving the problem in the prior art that it is difficult to accurately identify and extract the focus area in the source image during the multi-focus image fusion process.
[0006] In a first aspect, an embodiment of the present application provides a method for three-dimensional reconstruction of monocular images based on an improved focus clarity algorithm, comprising: graying a monocular sequence image to obtain a grayscale sequence image to form a grayscale image sequence set; determining a feature weight value of a key feature of the grayscale sequence image, and determining a key focus clarity of the grayscale sequence image based on the feature weight value of each key feature; wherein the key feature includes image grayscale difference, image gradient difference and image entropy; determining a combination of target pixels according to the key focus clarity to form a depth map, and filtering the depth map; fusing the filtered depth map with the corresponding monocular sequence image to obtain a composite image, and interpolating the composite image to construct a three-dimensional model.
[0007] In combination with the first aspect, in a possible implementation manner, the focus positions of the grayscale sequence images in the grayscale image sequence set are different.
[0008] In combination with the first aspect, in a possible implementation method, before determining the feature weight values of the key features of the grayscale sequence image, it also includes: performing Gaussian blur on the grayscale sequence image to obtain an optimized grayscale image; subtracting the optimized grayscale image from the grayscale sequence image to obtain a differential image, and adding the differential image to the grayscale sequence image to obtain an enhanced grayscale image; determining the absolute difference between the optimized grayscale image and the enhanced grayscale image, and converting it into a grayscale image to obtain the image grayscale difference.
[0009] In combination with the first aspect, in a possible implementation method, before determining the feature weight value of the key feature of the grayscale sequence image, it also includes: obtaining the edge gradients of different areas of the grayscale sequence image; wherein the edge gradients include horizontal gradients, vertical gradients and diagonal gradients; and accumulating the differences between the edge gradients of different areas and their adjacent pixels to obtain the image gradient difference.
[0010] In combination with the first aspect, in a possible implementation, before determining the feature weight values of the key features of the grayscale sequence images, it also includes: determining a grayscale histogram of the grayscale sequence images; and determining the image entropy of the grayscale sequence images based on the grayscale histogram.
[0011] In combination with the first aspect, in a possible implementation method, determining the key focus clarity of the grayscale sequence image based on the feature weight value of each key feature includes: initializing a population; wherein each individual in the population represents the feature weight value of a set of the key features; initializing the feature weight value of each individual in the population to obtain an initial weight value, and normalizing the initial weight value; evaluating the focus clarity of the initial weight value of each individual using a fitness function; selecting corresponding individuals for reproduction, crossover and mutation according to the focus clarity, and determining the feature weight value and the corresponding key focus clarity according to the focus clarity of the initial weight value of the individuals in all generations.
[0012] In combination with the first aspect, in a possible implementation manner, the fitness function is as follows: ; In the formula, represents the fitness function, the calculation result of which is the focus clarity of the individual, k represents the kth grayscale sequence image in the grayscale image sequence set, N represents the total number of grayscale sequence images in the grayscale image sequence set, represents the image grayscale difference of the kth image in the grayscale sequence, represents the image gradient difference of the kth grayscale sequence image, represents the image entropy of the kth grayscale sequence image, , and Respectively represent the initial weight values of the corresponding individuals, that is, the initial weight values of the image grayscale difference, the image gradient difference and the image entropy of the individual.
[0013] In combination with the first aspect, in a possible implementation, the combination of target pixels determined according to the key focus clarity forms a depth map, including: iteratively performing a mapping step until the grayscale image sequence set is traversed to obtain the combination of target pixels to form the depth map; the mapping step is as follows: iteratively performing an adjustment step until the residual sum of squares meets a convergence condition to obtain a converged residual sum of squares, and fitting a Gaussian curve based on it; the adjustment step is as follows: adjusting key parameters of the Gaussian function; wherein the key parameters include amplitude, mean and standard deviation; determining the fitting value of each pixel in the grayscale sequence image using the Gaussian function after adjusting the key parameters; determining the residual between the corresponding pixel points based on the fitting value, and calculating the residual sum of squares of the residual; determining the target pixel in the grayscale sequence image based on the Gaussian curve and mapping it to the depth fitting map.
[0014] In a second aspect, an embodiment of the present application provides a monocular image three-dimensional reconstruction device based on an improved focus clarity algorithm, characterized in that it includes: a grayscale module, used to grayscale a monocular sequence image to obtain a grayscale sequence image to form a grayscale image sequence set; a feature weight value module, used to determine the feature weight value of the key feature of the grayscale sequence image, and determine the key focus clarity of the grayscale sequence image based on the feature weight value of each of the key features; wherein the key features include image grayscale difference, image gradient difference and image entropy; a depth map module, used to determine the combination of target pixel points according to the key focus clarity to form a depth map, and filter it; a fusion module, used to fuse the filtered depth map with the corresponding monocular sequence image to obtain a synthetic image, and interpolate the synthetic image to construct a three-dimensional model.
[0015] In a third aspect, an embodiment of the present application provides a device, comprising: a processor; a memory for storing processor-executable instructions; when the processor executes the executable instructions, it implements the method described in the first aspect or any possible implementation method of the first aspect.
[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: The embodiment of the present application can obtain accurate focus clarity through the feature weight value of the key feature, improve the accuracy and robustness of the image clarity evaluation; through the key focus clarity, it can extract high-definition pixels in the image, and then effectively fuse the image and infer the depth information in the image, effectively solving the problem that the prior art is difficult to accurately identify and extract the focus area in the source image during the multi-focus image fusion process, and then comprehensively evaluate the focus clarity of the image through multiple key features and their feature weight values, extract high-definition pixels in the image through focus clarity, avoid the process of confirming the focus area, and at the same time make up for the shortcomings of a single key feature evaluation, improve the accuracy and robustness of the image clarity evaluation. It can also enhance the effectiveness of focus clarity, ensure that the obtained depth information is more accurate, and ultimately improve the quality of three-dimensional modeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1A flowchart of a monocular image 3D reconstruction method based on an improved focus clarity algorithm provided in an embodiment of the present application; Figure 2 A flowchart of forming a depth map provided in an embodiment of the present application; Figure 3 A schematic diagram of the structure of a monocular image 3D reconstruction device based on an improved focus clarity algorithm provided in an embodiment of the present application; Figure 4 An example diagram of a synthetic image synthesized after focusing clarity is calculated only by the image grayscale difference of a monocular sequence of images provided in an embodiment of the present application; Figure 5 An example diagram of a synthetic image synthesized after focusing clarity is calculated only by image gradient differences of monocular sequence images provided in an embodiment of the present application; Figure 6 An example diagram of a synthetic image synthesized after focusing clarity is calculated using only the image entropy of a monocular sequence of images provided in an embodiment of the present application; Figure 7 An example diagram of a composite image obtained by calculating focus clarity using the method of the present application provided in an embodiment of the present application; Figure 8 Use provided for the embodiments of this application Figure 4 An example diagram of three-dimensional modeling using the synthetic images in the figure; Fig. 9 Use provided for the embodiments of this application Figure 5 An example diagram of three-dimensional modeling using the synthetic images in the figure; Fig.10 Use provided for the embodiments of this application Figure 6 An example diagram of three-dimensional modeling using the synthetic images in the figure; Fig.11 Use provided for the embodiments of this application Figure 7 An example of 3D modeling based on the synthetic images in . DETAILED DESCRIPTION
[0019] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.
[0021] Figure 1 1 is a flowchart of a monocular image 3D reconstruction method based on an improved focus clarity algorithm provided in an embodiment of the present application, including steps 101 to 104. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of the monocular image 3D reconstruction method based on the improved focus clarity algorithm. In the case where the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.
[0022] Step 101: Grayscale the monocular sequence image to obtain a grayscale sequence image to form a grayscale image sequence set. The monocular sequence image in this application refers to a series of images taken by a single camera at different times or a microscope lens at different heights on the Z axis. These images are arranged in a certain order to record the changes of the same scene at different times or positions. In an embodiment of the present application, the focus positions of the grayscale sequence images in the grayscale image sequence set are different.
[0023] The monocular sequence images after grayscale processing are grayscale sequence images, and multiple grayscale sequence images constitute a grayscale image sequence set.
[0024] In addition, those skilled in the art may also perform filtering processing on the monocular sequence images to reduce noise therein and improve image quality.
[0025] Step 102: Determine the feature weight value of the key feature of the grayscale sequence image, and determine the key focus clarity of the grayscale sequence image based on the feature weight value of each key feature. The key feature includes image grayscale difference, image gradient difference or image entropy.
[0026] In one embodiment of the present application, before determining the feature weight values of the key features of the grayscale sequence images, the method further includes: Gaussian blurring the grayscale sequence images to obtain optimized grayscale images. Specifically, Gaussian blurring is performed on the grayscale sequence images to eliminate some details and potential noise interference in the grayscale sequence images.
[0027] The optimized grayscale image is subtracted from the grayscale sequence image to obtain the differential image, and the differential image is added to the grayscale sequence image to obtain the enhanced grayscale image.
[0028] Specifically, since the optimized grayscale image has been Gaussian blurred, many details in the grayscale sequence image are removed. The grayscale sequence image is subtracted from the optimized grayscale image to obtain a differential image between the two, which can retain the unblurred details (such as edges and textures) in the grayscale sequence image, and the differential image can highlight the detail information in the grayscale sequence image. The differential image is then added to the grayscale sequence image to obtain an enhanced grayscale image, which can fuse the enhanced detail information back into the grayscale sequence image, which not only retains the basic features of the grayscale sequence image, but also injects detail information, improving the clarity and detail expression of the enhanced grayscale image.
[0029] In addition, those skilled in the art may also add weights to the differential image when adding the differential image to the grayscale sequence image to control the degree of detail enhancement of the enhanced grayscale image, so that the enhanced grayscale image does not appear too sharp, or produce unnatural edge effects, or the enhancement effect is not obvious.
[0030] Determine the absolute difference between the optimized grayscale image and the enhanced grayscale image, and convert it into a grayscale image to obtain the image grayscale difference. Specifically, an image processing library (such as OpenCV or PIL) can be used here to calculate the absolute difference in pixel level between the optimized grayscale image and the enhanced grayscale image, and then grayscale it to obtain the image grayscale difference.
[0031] The grayscale difference of an image refers to the difference in grayscale values between adjacent pixels in an image, which can intuitively show the difference between the optimized grayscale image and the enhanced grayscale image. Usually, a smaller grayscale difference corresponds to a higher focus clarity, while a larger grayscale difference corresponds to a lower focus clarity. This step can effectively highlight the high-frequency details and edge information in the grayscale sequence image, making the subsequent evaluation of the focus clarity of the grayscale sequence image more intuitive and effective.
[0032] In another embodiment of the present application, before determining the feature weight value of the key feature of the grayscale sequence image, the method further includes: obtaining edge gradients of different regions of the grayscale sequence image, wherein the edge gradients include horizontal gradients, vertical gradients, and diagonal gradients.
[0033] In the embodiment of the present application, Sobel operators in different directions are used to convolve with the grayscale sequence image to obtain edge gradients in different regions to capture edge information in the image. The details are as follows: , , , .
[0034] In the formula, The Sobel operator represents the horizontal gradient of the grayscale sequence image. The Sobel operator represents the vertical gradient of the grayscale sequence image. The Sobel operator represents the gradient of the grayscale sequence image in the 45-degree direction. Represents the Sobel operator of the gradient in the 135 degree direction of the grayscale sequence image.
[0035] The edge gradient of different regions and the difference between their adjacent pixels are accumulated to obtain the image gradient difference. The details are as follows: .
[0036] in, , , , .
[0037] In the formula, It represents the image gradient difference of the pixel with horizontal coordinate i and vertical coordinate j on the grayscale sequence image. Represents the image gradient value calculated in the horizontal direction, Represents the image gradient value calculated in the vertical direction, Represents the image gradient value calculated in the 45-degree direction. It represents the image gradient value calculated in the 135 degree direction, i represents the horizontal coordinate of the pixel point, and j represents the vertical coordinate of the pixel point. represents a grayscale sequence image, The Sobel operator represents the horizontal gradient of the grayscale sequence image. The Sobel operator represents the vertical gradient of the grayscale sequence image. The Sobel operator represents the gradient of the grayscale sequence image in the 45-degree direction. Represents the Sobel operator of the gradient in the 135 degree direction of the grayscale sequence image.
[0038] Image gradient difference reflects the grayscale change rate between adjacent pixels in a grayscale sequence image. It is an important indicator to measure the clarity of edges or details in grayscale sequence images. The smaller the value of image gradient difference, the clearer the edges and details in the grayscale sequence image, that is, the higher the focus clarity. Conversely, the larger the value of image gradient difference, the more blurred the edges and details of the grayscale sequence image, and the lower the focus clarity.
[0039] In another embodiment of the present application, before determining the feature weight value of the key feature of the grayscale sequence image, the method further includes: determining a grayscale histogram of the grayscale sequence image. Specifically, the grayscale histogram is plotted with the grayscale level as the horizontal axis and the frequency of occurrence of different grayscale levels as the vertical axis, and can reflect the frequency distribution of different grayscale levels in the grayscale sequence image.
[0040] The image entropy of the grayscale sequence image is determined based on the grayscale histogram. The details are as follows: In the formula, represents the image entropy, Indicates Gray levels, Represents the number of gray levels in a grayscale sequence image, Indicates The probability of a gray level appearing.
[0041] Image entropy can quantify the degree of confusion or uncertainty of grayscale information in grayscale sequence images. Areas with lower image entropy values indicate that their grayscale distribution is more concentrated, corresponding to clearer image parts. Areas with higher image entropy values mean that the grayscale distribution is more dispersed, which is usually related to the blurriness or more noise in the image. Therefore, by calculating image entropy, its focus clarity can be effectively evaluated.
[0042] In an embodiment of the present application, a population is initialized. Each individual in the population represents a feature weight value of a set of key features. The feature weight value of each individual in the population is initialized to obtain an initial weight value, and the initial weight value is normalized. The focus clarity of the initial weight value of each individual is evaluated using a fitness function. According to the focus clarity, the corresponding individual is selected for reproduction, crossover and mutation, and the feature weight value and the corresponding key focus clarity are determined according to the focus clarity of the initial weight value of the individual in all generations.
[0043] Among them, the fitness function is as follows: In the formula, represents the fitness function, the calculation result of which is the focus clarity of the individual, k represents the kth grayscale sequence image in the grayscale image sequence set, N represents the total number of grayscale sequence images in the grayscale image sequence set, Represents the image grayscale difference of the kth grayscale sequence image, Represents the image gradient difference of the kth grayscale sequence image, represents the image entropy of the kth grayscale sequence image, , and They represent the initial weight values of the corresponding individuals, namely, the initial weight values of the individual image grayscale difference, image gradient difference and image entropy. The sum of the normalized initial weight values is 1, that is , and The sum of is 1.
[0044] Exemplarily, a set of feature weight values of the key features of the present application are: the feature weight value of the image grayscale difference is 0.43, the feature weight value of the image gradient difference is 0.38, and the feature weight value of the image entropy is 0.19.
[0045] The focus clarity of the initial weight values of individuals in all generations is determined, and the initial weight value corresponding to the value with the largest focus clarity is determined as the feature weight value, and the largest value is determined as the key focus clarity.
[0046] Specifically, after obtaining the focus clarity of each individual in the population, several individuals with the highest focus clarity are selected for reproduction, and several individuals are randomly selected for crossover and mutation. Those skilled in the art should be aware that the number of individuals selected for reproduction, crossover and mutation can be determined according to actual needs or experience, and is not specifically limited here.
[0047] Step 103: Determine the combination of target pixels according to the key focus definition to form a depth map, and perform filtering on the depth map. In the embodiment of the present application, the step of determining the combination of target pixels according to the key focus definition to form a depth map is as follows: Figure 2 As shown, it includes steps 201 to 208, which are specifically as follows.
[0048] Step 201: Adjust the key parameters of the Gaussian function. The key parameters include amplitude, mean and standard deviation. Exemplarily, the least square method is used here to adjust the key parameters of the Gaussian function. In this application, the key parameters of the Gaussian function are initialized when the Gaussian function is used for the first time. The form of the Gaussian function is as follows: In the formula, represents the Gaussian function, represents the amplitude, represents the mean, represents the standard deviation, Represents the pixel points of the grayscale sequence image.
[0049] Step 202: Determine the fitting value of each pixel in the grayscale sequence image using the Gaussian function after adjusting the key parameters. Specifically, the Gaussian function is used to evaluate the pixel of the grayscale sequence image to obtain the corresponding fitting value.
[0050] Step 203: Determine the residual between the fitting value and the corresponding pixel point based on the fitting value, and calculate the residual square sum of the residuals. Specifically, calculate the residual between each pixel point and its corresponding fitting value, then square these residuals and add them up to obtain the residual square sum.
[0051] Step 204: Determine whether the residual sum of squares meets the convergence condition. Specifically, determine whether the residual sum of squares obtained in step 203 meets the convergence condition. Exemplarily, the convergence condition here is set to the minimum residual sum of squares obtained. If the residual sum of squares does not meet the convergence condition, step 201 is executed, and if the residual sum of squares meets the convergence condition, step 205 is executed.
[0052] Step 205: Obtain the converged residual square sum, and use it to fit the Gaussian curve. Specifically, the minimum residual square is used as the converged residual square sum, and the Gaussian curve is fitted to minimize the residual square sum between the Gaussian curve generated by these parameters and the data points.
[0053] Step 206: Determine the target pixel based on the Gaussian curve and map it to the depth fitting map. Specifically, determine the image index corresponding to the pixel with the highest clarity. Exemplarily, in this step, the peak of the Gaussian curve is considered to be the point with the highest clarity, that is, the target pixel. It should be noted that the peak here does not directly correspond to a specific pixel in the grayscale sequence image, but corresponds to the highest clarity metric in the data used for fitting, that is, the converged residual sum of squares. Finally, the target pixel corresponding to the image index is mapped to the depth fitting map.
[0054] Step 207: Determine whether the grayscale image sequence set has been traversed. Specifically, determine whether each grayscale sequence image in the grayscale image sequence set has been traversed. If the grayscale image sequence set has been traversed, execute step 208, otherwise execute step 201 until the grayscale image sequence set is traversed.
[0055] Step 208: Obtain a combination of target pixels to form a depth map. Specifically, the grayscale image sequence set is traversed to map the target pixels in each grayscale sequence image to the depth fitting map, and the combination of target pixels in each grayscale sequence image is obtained to form a depth map, which can accurately reflect the focus clarity distribution of each pixel in the grayscale sequence image.
[0056] The depth map is filtered to remove noise and interference in the depth map and improve the accuracy of the depth information in the depth map. Bilateral filtering is used as an example here.
[0057] Step 104: Fuse the filtered depth map with its corresponding monocular sequence image to obtain a composite image, and interpolate the composite image to construct a 3D model. In the embodiment of the present application, the filtered depth map is converted into an integer type, and then the corresponding pixel values are obtained from the input color monocular sequence image according to the integer value index, and these pixel values are fused with the depth map to generate a high-quality color composite image, such as Figures 4 to 7 shown. Figure 4 This is a synthetic image that is synthesized by calculating the focus clarity only through the image grayscale difference of the monocular sequence image. There is a certain degree of blur in the area marked by the red frame. Figure 5 This is a synthetic image synthesized after calculating the focus clarity only through the image gradient difference of the monocular sequence image. It also shows a certain degree of blur in the area marked by the red frame. Figure 6 This is a synthetic image synthesized by calculating the focus clarity using only the image entropy of the monocular sequence image. The area marked by the red frame is obviously blurred. Figure 7 The composite image obtained after calculating the focus clarity using the method of the present application has a significant improvement in overall clarity. There is almost no obvious blurred area visible to the naked eye, showing a higher image quality.
[0058] In frequency domain analysis, the high-frequency components of an image usually reveal the detail richness and clarity level of the image. Therefore, a clear image often shows more high-frequency components. By calculating the amplitude mean of the spectrum, the high-frequency energy value in the image is quantified, and then used as an indicator for evaluating the clarity of the synthesized image. In this application, Figure 4 The high frequency energy value is 9164.98, Figure 5 The high frequency energy value is 9154.89, Figure 6 The high frequency energy value is 6271.45, Figure 7 The high-frequency energy value of is the highest, which is 9365.51. It can be seen that image 7 has the best clarity due to its significant high-frequency energy value.
[0059] The 3D point cloud data containing the 3D coordinates of each pixel position and the corresponding color information is extracted from the synthetic image with depth and color information. The precise depth value of each pixel is estimated by Lagrange interpolation, and the result is stored in the point cloud container together with the normalized coordinates and color information to obtain continuous point cloud data and complete 3D reconstruction. Lagrange interpolation is used in this process to estimate continuous depth values from discrete depth data, improving the spatial continuity and accuracy of the data.
[0060] The model effects of 3D reconstruction using different focusing methods are shown below: Figures 8 to 11 From a visual perspective, Figure 8There are obvious pits and spikes on the surface of the 3D model in the image. These irregular shapes reduce the accuracy of the 3D model. Figure 8 , Fig. 9 The 3D model is much smoother overall, although there are still signs of potholes in some specific areas. Fig.10 The reconstruction effect is not ideal. There is a big difference between it and the actual 3D model. The spikes and bumps are more obvious, but the area marked by the red frame is Figure 8 and Fig. 9 The corresponding position is closer to the real model. Fig.11 The displayed 3D model has been significantly improved in smoothness, effectively eliminating small spikes and surface potholes, thus presenting a more accurate and delicate reconstruction effect.
[0061] In addition, those skilled in the art can also evaluate the reconstructed three-dimensional model. The details are as follows: In the formula, Represents the surface smoothness of the point cloud of the 3D model, c represents the cth point cloud in the 3D model, N represents the total number of point clouds, Represents the vector difference from point cloud point(c-1) to point cloud point(c), Represents the vector difference from point cloud point(c) to point cloud point(c+1). This formula describes the average value of the normal vector angle difference between adjacent point clouds and is used to measure the surface smoothness of the point cloud.
[0062] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in sequence or in parallel according to the method shown in this embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment).
[0063] like Figure 3 As shown, the embodiment of the present application also provides a monocular image 3D reconstruction device 300 based on an improved focus clarity algorithm. The device includes: a grayscale module 301, a feature weight value module 302, a depth map module 303 and a fusion module 304, as follows.
[0064] The grayscale module 301 is used to grayscale the monocular sequence images to obtain grayscale sequence images to form a grayscale image sequence set.
[0065] The feature weight value module 302 is used to determine the feature weight values of the key features of the grayscale sequence image, and determine the key focus clarity of the grayscale sequence image based on the feature weight values of each key feature. The key features include image grayscale difference, image gradient difference and image entropy.
[0066] The depth map module 303 is used to determine the target pixel combination to form a depth map according to the key focus clarity, and perform filtering processing on it.
[0067] The fusion module 304 is used to fuse the filtered depth map with its corresponding monocular sequence image to obtain a synthetic image, and interpolate the synthetic image to construct a three-dimensional model.
[0068] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0069] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.
[0070] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro)processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit; Abbreviation: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.
[0071] An embodiment of the present application further provides a device, comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, the method described in the embodiment of the present application is implemented.
[0072] The embodiments of the present application also provide a non-volatile computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed, the method described in the embodiments of the present application is implemented.
[0073] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.
[0074] The above storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk drive (HDD) or memory card. The memory can be used to store computer program instructions.
[0075] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly reflected in the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0076] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0077] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.
Claims
1. A monocular image 3D reconstruction method based on improved focus clarity algorithm, It is characterized in that include: Graying the monocular sequence images to obtain grayscale sequence images to form a grayscale image sequence set; Determine the feature weight value of the key feature of the grayscale sequence image, and determine the key focus clarity of the grayscale sequence image based on the feature weight value of each key feature; wherein the key features include image grayscale difference, image gradient difference and image entropy; Determine a combination of target pixels according to the key focus clarity to form a depth map, and perform filtering on the depth map; The depth map after filtering is fused with the corresponding monocular sequence image to obtain a synthetic image, and the synthetic image is interpolated to construct a three-dimensional model.
2. The method according to claim 1, It is characterized in that The focus positions of the grayscale sequence images in the grayscale image sequence set are different.
3. The method according to claim 1, It is characterized in that Before determining the feature weight value of the key feature of the grayscale sequence image, the method further includes: Performing Gaussian blur on the grayscale sequence image to obtain an optimized grayscale image; Subtracting the optimized grayscale image from the grayscale sequence image to obtain a differential image, and adding the differential image to the grayscale sequence image to obtain an enhanced grayscale image; The absolute difference between the optimized grayscale image and the enhanced grayscale image is determined and converted into a grayscale image to obtain the image grayscale difference.
4. The method according to claim 1, It is characterized in that Before determining the feature weight value of the key feature of the grayscale sequence image, the method further includes: Acquire edge gradients of different regions of the grayscale sequence image; wherein the edge gradients include horizontal gradients, vertical gradients, and diagonal gradients; The image gradient difference is obtained by accumulating the difference between the edge gradients of different regions and their adjacent pixels.
5. The method according to claim 1, It is characterized in that Before determining the feature weight value of the key feature of the grayscale sequence image, the method further includes: Determining a grayscale histogram of the grayscale sequence image; The image entropy of the grayscale sequence image is determined based on the grayscale histogram.
6. The method according to claim 1, It is characterized in that The determining the key focus clarity of the grayscale sequence image based on the feature weight value of each key feature includes: Initializing a population; wherein each individual in the population represents a set of feature weight values of the key features; Initializing the feature weight value of each individual in the population to obtain an initial weight value, and normalizing the initial weight value; Using a fitness function to evaluate the focus clarity of each individual initial weight value; According to the focus clarity, corresponding individuals are selected for reproduction, crossover and mutation, and the feature weight value and the corresponding key focus clarity are determined according to the focus clarity of the initial weight values of individuals in all generations.
7. The method according to claim 6, It is characterized in that The fitness function is as follows: ; In the formula, represents the fitness function, the calculation result of which is the focus clarity of the individual, k represents the kth grayscale sequence image in the grayscale image sequence set, N represents the total number of grayscale sequence images in the grayscale image sequence set, represents the image grayscale difference of the kth image in the grayscale sequence, represents the image gradient difference of the kth grayscale sequence image, represents the image entropy of the kth grayscale sequence image, , and Respectively represent the initial weight values of the corresponding individuals, that is, the initial weight values of the image grayscale difference, the image gradient difference and the image entropy of the individual.
8. The method according to claim 1, It is characterized in that The step of determining a combination of target pixels according to the key focus clarity to form a depth map includes: Iteratively executing the mapping step until the grayscale image sequence set is traversed to obtain a combination of the target pixel points to form the depth map; The mapping steps are as follows: Iteratively perform the adjustment steps until the residual sum of squares meets the convergence condition to obtain the converged residual sum of squares, and use it to fit the Gaussian curve; The adjustment steps are as follows: Adjusting the key parameters of the Gaussian function; wherein the key parameters include amplitude, mean and standard deviation; Determine the fitting value of each pixel in the grayscale sequence image by using the Gaussian function after adjusting the key parameters; Determine the residuals between the pixel points corresponding to the fitting values based on the fitting values, and calculate the residual sum of squares of the residuals; The target pixel point in the grayscale sequence image is determined based on the Gaussian curve and mapped to a depth fitting map.
9. A monocular image 3D reconstruction device based on an improved focus clarity algorithm. It is characterized in that include: A grayscale module is used to grayscale the monocular sequence images to obtain grayscale sequence images to form a grayscale image sequence set; A feature weight value module, used to determine the feature weight values of the key features of the grayscale sequence image, and determine the key focus clarity of the grayscale sequence image based on the feature weight values of each of the key features; wherein the key features include image grayscale difference, image gradient difference and image entropy; A depth map module, used to determine the combination of target pixels according to the key focus clarity to form a depth map, and perform filtering processing on the depth map; The fusion module is used to fuse the filtered depth map with the corresponding monocular sequence image to obtain a synthetic image, and interpolate the synthetic image to construct a three-dimensional model.
10. A device for performing a monocular image three-dimensional reconstruction method based on an improved focus clarity algorithm, It is characterized in that include: processor; a memory for storing processor-executable instructions; When the processor executes the executable instructions, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Monocular infrared video three-dimensional reconstruction method based on visual odometer
CN106846417A
Three-dimensional shape reconstruction method combining local and global focusing features
CN115937399A
Image fusion method and device, storage medium and terminal
CN118134788A
Machine vision-based automatic focusing and automatic centering method and system
US20240062988A1
Cited By
Pattern wafer surface three-dimensional shape reconstruction method
CN120355852A
