Method and device for simulating imaging of large aperture lens
Through technical means such as depth of field processing and gamma correction, the bokeh effect of simulating large aperture lenses is achieved, solving the problem of the inability to achieve natural depth of field transition and simulate real lens bokeh in the existing technology, and is suitable for a wide range of picture editing.
Patent Information
- Application Number
- CN202211325678.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-10-27
AI Technical Summary
The prior art cannot achieve a natural depth of field transition with the further background and the stronger the degree of blurring, and cannot simulate the bokeh effect of real lenses, and is suitable for a wide range of picture editing.
By obtaining the original image, the depth of field is processed to obtain the depth value, the radius and size of the diffuse circle are calculated, the gamma correction and bokeh blur are performed, and finally the inverse gamma correction is performed to obtain the bokeh effect that simulates the large aperture lens.
It realizes that the bokeh effect of different intensities is observed in different depth areas of the picture. The effect is delicate and natural, suitable for image editing from various sources, does not rely on hardware devices, and can run independently on mobile devices.
Smart Images

Figure CN115996323B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and particularly relates to a method and device for simulating the imaging of a large-aperture lens. Background Art
[0002] With the improvement of people's living standards, tourism has become one of the most popular ways for people to relax, and people like to take pictures to record the moment during tourism. When taking pictures, for the close-up pictures of people or objects taken by an ordinary camera, in order to highlight the key points of the pictures, users may hope to perform post-processing operations on the pictures to blur the out-of-focus area while keeping the in-focus area clear, simulating the shallow depth-of-field effect when shooting with a large-aperture lens. Currently, the implementation methods of related post-processing operations on the market are mainly divided into the following several types.
[0003] From the perspective of depth-of-field division, only the in-focus area and the out-of-focus area are segmented, and the same degree of blur is used for the out-of-focus area. This method can achieve the effect of blurring the out-of-focus area, but the blurring degree of the out-of-focus area is exactly the same, and it is impossible to achieve the natural transition effect that the farther the out-of-focus area is from the focal plane, the greater the blurring degree. Moreover, for relatively complex pictures, it is difficult to accurately segment the in-focus and out-of-focus areas, resulting in a heavier boundary of the processed picture and a worse visual effect.
[0004] Or by means of a specific camera, obtaining the depth information of the photo during shooting, and guiding the blurring degree of the out-of-focus area through the depth information. This method can achieve a better blurring effect, but it requires the picture to completely record the depth information during shooting, with relatively large limitations, and most pictures on the market are not applicable to this method.
[0005] Or from the perspective of blurring processing, the vast majority of post-processing effects directly use the Gaussian blurring algorithm, but this method cannot simulate the bokeh effect of a real physical lens.
[0006] In summary, the existing shooting methods cannot achieve the natural depth-of-field transition with the farther background and the stronger blurring degree, and cannot simulate the bokeh effect of a real lens; or can only edit the pictures taken within a specific camera model and under a specific shooting mode, and are not applicable to the editing of a wide range of ordinary pictures. Summary of the Invention
[0007] In view of this, the purpose of the present invention is to overcome the deficiencies of the prior art and provide a method and device for simulating the imaging of a large-aperture lens to solve the problem that the methods for achieving the bokeh effect in the prior art are not applicable to the editing of a wide range of pictures.
[0008] To achieve the above purpose, the present invention adopts the following technical solution: A method for simulating the imaging of a large-aperture lens, comprising:
[0009] Obtaining an original image;
[0010] Perform depth-of-field processing on the original image to obtain a depth-of-field map;
[0011] Calculate the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determine the size of the circle of confusion, and enhance the brightness of the circle of confusion through gamma correction to obtain a corrected image;
[0012] Perform bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh-blurred image;
[0013] Perform inverse gamma correction on the bokeh-blurred image to obtain a result image.
[0014] Further, the performing depth-of-field processing on the original image to obtain a depth-of-field map includes:
[0015] Input the original image into a preset depth-of-field recognition model to obtain an initial depth-of-field information map;
[0016] Perform box filter blur processing on the initial depth-of-field information map to obtain a depth-of-field map.
[0017] Further, the inputting the original image into a preset depth-of-field recognition model to obtain an initial depth-of-field information map includes:
[0018] Input the original image into the depth-of-field recognition model to obtain the gray-scaled depth information corresponding to the original image;
[0019] Among them, the value range of the depth value is 0 to 1, the gray value corresponds to the depth information from the background to the foreground in the original image, and the larger the depth value, the closer the scene is to the lens.
[0020] Further, the circle of confusion is corrected in the following manner
[0021] y = pow(x, a)
[0022] where x is the original color of the pixel in the original image, y is the color of the pixel after gamma correction, and a is the intensity of gamma correction.
[0023] Further, the performing bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh-blurred image includes:
[0024] Traverse each pixel point in the corrected image within a preset radius range, and determine the traversed points as diffusion points;
[0025] Calculate the distance between the diffusion point and the corresponding pixel point;
[0026] Compare the distance with the radius of the circle of confusion. When the distance is less than the radius of the circle of confusion, calculate the weight of the diffusion point and determine the spot shape.
[0027] Further, calculate the weight of the diffusion point through a distance field function.
[0028] Further, perform inverse gamma correction on the bokeh blurred image in the following manner, including:
[0029] z = pow(y, 1 / a)
[0030] where z is the color of the pixel after inverse gamma correction.
[0031] An embodiment of the present application provides an imaging device for simulating a large aperture lens, including:
[0032] An acquisition module, configured to acquire an original image,
[0033] A depth of field processing module, configured to perform depth of field processing on the original image to obtain a depth of field map;
[0034] A correction module, configured to calculate the radius of the circle of confusion in the original image according to the depth value of the depth of field map, determine the size of the circle of confusion, and enhance the brightness of the circle of confusion through gamma correction to obtain a corrected image;
[0035] A bokeh blur module, configured to perform bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image;
[0036] An inverse correction module, configured to perform inverse gamma correction on the bokeh blurred image to obtain a result image.
[0037] The beneficial effects that can be achieved by the present invention adopting the above technical solutions include:
[0038] The present invention provides an imaging method and device for simulating a large aperture lens. The present application uses a deep learning method to obtain the depth of a picture, does not rely on the original information of the picture, and can process pictures from various sources; it also does not rely on hardware devices and can run independently on different mobile devices; in addition, the bokeh effect of the present application is based on the depth map rather than foreground and background segmentation, and the effect is more delicate and natural, and different intensities of bokeh effects can be observed in different depth regions of the picture; the blur processing method provided by the present application can better simulate the effect of the circle of confusion generated during bokeh compared to other blur algorithms. Description of the Drawings
[0039] 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 drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0040] Figure 1 Schematic diagram of the steps of the method for simulating the imaging of a large-aperture lens according to the present invention;
[0041] Figure 2 Schematic flow chart of the method for simulating the imaging of a large-aperture lens according to the present invention;
[0042] Figure 3 Schematic diagram of the circle of confusion provided by the present invention;
[0043] Figure 4 Another schematic diagram of the circle of confusion provided by the present invention;
[0044] Figure 5 Schematic diagram of the original image provided by the present invention;
[0045] Figure 6 Schematic diagram of the initial depth-of-field map provided by the present invention;
[0046] Figure 7 Schematic diagram of the depth-of-field map provided by the present invention;
[0047] Figure 8 Schematic diagram of the corrected image provided by the present invention;
[0048] Figure 9 Schematic diagram of the result image provided by the present invention;
[0049] Figure 10 Schematic diagram of the structure of the device for simulating the imaging of a large-aperture lens according to the present invention;
[0050] Figure 11 Schematic diagram of the structure of the computer device involved in the method for simulating the imaging of a large-aperture lens according to the present invention. Detailed implementation manners
[0051] To make the objectives, technical solutions and advantages of the present invention clearer, the following will describe the technical solutions of the present invention in detail. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other implementation manners obtained by those of ordinary skill in the art without creative efforts belong to the scope protected by the present invention.
[0052] In the methods for achieving the bokeh effect by using a defocused out-of-focus scene on the market currently, some methods simply divide the picture into foreground and background parts, and cannot generate a delicate bokeh effect according to depth information, resulting in poor performance in the face of complex scenes; another part of the methods rely on the depth information provided by specific hardware devices, with low universality and cannot be well applied to various pictures; at the same time, most of the bokeh effect implementations are based on the Gaussian blur method and cannot well simulate the real bokeh effect.
[0053] The following introduces a specific method and device for simulating the imaging of a large aperture lens provided in the embodiments of the present application in conjunction with the accompanying drawings.
[0054] As Figure 1 shown, the method for simulating the imaging of a large aperture lens provided in the embodiments of the present application includes:
[0055] S101, obtaining an original image;
[0056] It can be understood that the technical solution provided by the present application can be implemented through a mobile device, such as a mobile phone, a tablet computer, a handheld device, etc. The original image can be obtained by taking a photo through the camera of the mobile device or obtained from the photo album stored in the mobile device, and the images in the photo album are pre-stored images.
[0057] S102, performing depth of field processing on the original image to obtain a depth of field map;
[0058] It can be understood that in the present application, the depth of field processing can be performed through a pre-constructed depth of field recognition model. Among them, the depth of field recognition model is a mobile model, which can be stored in the mobile device and supports running under the mobile device.
[0059] S103, calculating the radius of the circle of confusion in the original image according to the depth value of the depth of field map, determining the size of the circle of confusion, and enhancing the brightness of the circle of confusion through gamma correction to obtain a corrected image;
[0060] In the present application, gamma correction is used to enhance the brightness of the circle of confusion to achieve the effect of brightening the circle of confusion.
[0061] S104, performing bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image;
[0062] It can be understood that in the present application, bokeh parameters are manually selected, such as parameters of the focus plane, adjusting the bokeh intensity, bokeh shape, etc. The bokeh parameters can also include other parameters, which can be adjusted according to actual needs, and then the gamma-corrected picture is subjected to bokeh blur processing through the bokeh parameters.
[0063] S105, performing inverse gamma correction on the bokeh blurred image to obtain a result image.
[0064] By performing inverse gamma correction on the bokeh blurred image, the effect of brightening the circle of confusion is achieved, and finally the result image is obtained.
[0065] The working principle of the method for simulating the imaging of a large aperture lens is as follows: Figure 2 As shown, in this application, the original image is first obtained by shooting or storing on a mobile device, and then the pre-stored depth of field recognition model is used to perform depth of field processing on the original image to obtain the depth information of the original image, that is, the depth value. Then, the radius of the circle of confusion is calculated using the depth value to determine the size of the circle of confusion. The brightness of the circle of confusion is enhanced through gamma correction to obtain a corrected image. The corrected image is subjected to bokeh blur processing according to the pre-set bokeh parameters to obtain a bokeh blurred image, and finally inverse gamma correction is performed on the bokeh blurred image to obtain the final result image.
[0066] In some embodiments, the performing depth of field processing on the original image to obtain a depth of field map includes:
[0067] Inputting the original image into a pre-set depth of field recognition model to obtain an initial depth of field information map;
[0068] Performing box filter blur processing on the initial depth of field information map to obtain a depth of field map.
[0069] In one embodiment, the inputting the original image into a pre-set depth of field recognition model to obtain an initial depth of field information map includes:
[0070] Inputting the original image into the depth of field recognition model to obtain the grayscale depth information corresponding to the original image;
[0071] Wherein, the value range of the depth value is 0 to 1, the grayscale value corresponds to the depth information from the background to the foreground in the original image, and the larger the depth value, the closer the scene is to the lens.
[0072] It can be understood that the depth of field recognition is mainly completed by the depth of field recognition model. The depth of field recognition model can receive the input image and output the grayscale depth information corresponding to the input image. The grayscale value range is 0 to 1, corresponding to the depth information from the background to the foreground in the input image. The larger the depth value, the closer the scene is to the lens. This model is a mobile model that can be stored on a mobile device and supports running under the performance of common mobile terminals. The specific implementation method can adopt a suitable implementation scheme according to needs.
[0073] After obtaining the initial depth-of-field information map, it is also necessary to perform box filtering and blurring on the initial depth-of-field information map. During the blurring process, if the depth value of the surrounding pixels is smaller than that of the central pixel, the blurring weight needs to be multiplied by an additional coefficient s. The purpose is to avoid the problem of too strong edge sense caused by depth discontinuity in the subsequent processing. After this step, the true depth-of-field map is obtained.
[0074] After obtaining the depth-of-field map, the depth value is known, and the radius of the circle of confusion can be calculated through the depth value. Specifically, if the depth value is smaller than the focal plane, as shown in the appendix Figure 3 shown, the light emitted by the light source p1 is exactly focused on p1' on the focal plane. At this time, the light emitted by the light source p2 that is farther from the focal plane than p1 is focused on p2' behind the focal plane. The light emitted by p2 will form a circle of confusion on the focal plane; if the depth value is larger than the focal plane, as shown in the appendix Figure 4 shown, the light emitted by the light source p2 that is closer to the focal plane than p1 is focused on p2' in front of the focal plane. The light emitted by p2 will also form a circle of confusion on the focal plane. According to the formation principle of the circle of confusion and the imaging principle of the convex lens, let the radius of the circle of confusion be r, the depth value of p1 be d1, the depth value of p2 be d2, and k be the intensity parameter that can be adjusted for bokeh blur. It can be obtained that r = |d1 - d2| * k. When k is larger, the radius of the circle of confusion is larger.
[0075] Then, the brightness of the circle of confusion is enhanced through gamma correction to obtain a corrected image. Specifically, during the bokeh blur process, in order to achieve the spot effect, the brightness of the circle of confusion also needs to be enhanced through gamma correction. Let the original color of the pixel be x, the color after gamma correction be y, and the intensity of gamma correction be a. The formula y = pow(x, a) is used for gamma correction to obtain the corrected image.
[0076] In some embodiments, the step of performing bokeh blur processing on the corrected image according to the preset bokeh parameters to obtain a bokeh blurred image includes:
[0077] Traverse each pixel point in the corrected image within the preset radius range, and determine the traversed point as a diffusion point;
[0078] Calculate the distance between the diffusion point and the corresponding pixel point;
[0079] Compare the distance with the radius of the circle of confusion. When the distance is less than the radius of the circle of confusion, calculate the weight of the diffusion point and determine the spot shape.
[0080] As a preferred implementation manner, the weight of the diffusion point is calculated through a distance field function.
[0081] Specifically, for each point c(x, y) on the image, x is the abscissa of the pixel and y is the ordinate of the pixel. c performs pixel traversal within a range with a radius of R. At this time, with c as the center point, the value range of the abscissa during the traversal process is (x - R, x + R), and the value range of the ordinate is (y - R, y + R). For the traversed point c’(x’, y’), which is called the diffusion point, calculate the diffusion circle radius r for c and c’. If the distance distance(c, c’) between c’ and c < r, then it enters the shape control part; otherwise, skip this pixel point.
[0082] When the distance is less than the radius of the diffusion circle, within the distance range of the bokeh diffusion circle, control the weights of each diffusion point through the distance field function to form the final spot shape. Let the distance between the center point and the diffusion point be d, and the distance field function be SDF. Then the weight f of the final diffusion point is obtained from the formula f = SDF(d).
[0083] In some embodiments, the following method is used to perform inverse gamma correction on the bokeh blurred image, including:
[0084] z = pow(y, 1 / a)
[0085] Where z is the color of the pixel after inverse gamma correction.
[0086] The color after inverse gamma correction is z, and the formula z = pow(y, 1 / a) is used for inverse correction to achieve the effect of brightening the diffusion circle.
[0087] As a specific implementation manner, in this application, Figure 5 Taking the original image as the input, through depth of field processing, the initial depth of field map is obtained as shown in Figure 6 , and then it is blurred to obtain the depth of field map as shown in Figure 7 . Then, manually select the focus plane on the mobile device, adjust parameters such as the bokeh intensity and bokeh shape, perform gamma correction on the original image to obtain the corrected image as shown in Figure 8 . Perform bokeh blur processing on the corrected image according to the bokeh parameters, and then perform inverse gamma correction processing to obtain the result image as shown in Figure 9 .
[0088] The technical solution provided by this application uses the deep learning method to obtain the depth of the picture, does not rely on the original information of the picture, and can process pictures from various sources; it also does not rely on hardware devices and can run independently on different mobile devices; in addition, the bokeh effect of this application is based on the depth map rather than foreground and background segmentation, and the effect is more delicate and natural. Different intensities of bokeh effects can be observed in different depth regions of the picture; the blur processing method provided by this application can better simulate the effect of the diffusion circle generated during bokeh compared with other blur algorithms.
[0089] As Figure 10 shown, an imaging device simulating a large aperture lens according to an embodiment of the present application includes:
[0090] An acquisition module 201 for acquiring an original image,
[0091] A depth of field processing module 202 for performing depth of field processing on the original image to obtain a depth of field map;
[0092] A correction module 203 for calculating the radius of the circle of confusion in the original image according to the depth value of the depth of field map, determining the size of the circle of confusion, and enhancing the brightness of the circle of confusion through gamma correction to obtain a corrected image;
[0093] A bokeh blur module 204 for performing bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image;
[0094] An inverse correction module 205 for performing inverse gamma correction on the bokeh blurred image to obtain a result image.
[0095] The working principle of the imaging device simulating a large aperture lens provided by the present application is that the acquisition module 201 acquires an original image, the depth of field processing module 202 performs depth of field processing on the original image to obtain a depth of field map; the correction module 203 calculates the radius of the circle of confusion in the original image according to the depth value of the depth of field map, determines the size of the circle of confusion, and enhances the brightness of the circle of confusion through gamma correction to obtain a corrected image; the bokeh blur module 204 performs bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image; the inverse correction module 205 performs inverse gamma correction on the bokeh blurred image to obtain a result image.
[0096] The present application provides a computer device, including: a memory 1 and a processor 2, and may further include a network interface 3. The memory stores a computer program. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in forms such as read-only memory (ROM) or flash memory (flash RAM). The computer device stores an operating system 4, and the memory is an example of a computer-readable medium. When the computer program is executed by the processor, the processor executes the imaging method of the large aperture lens simulation, Figure 11 The structure shown is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0097] In one embodiment, the method for simulating large-aperture lens imaging provided by the present application can be implemented in the form of a computer program, and the computer program can run on a computer device as shown in Figure 11 .
[0098] In some embodiments, when the computer program is executed by the processor, the processor is caused to perform the following steps: obtaining an original image; performing depth-of-field processing on the original image to obtain a depth-of-field map; calculating the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determining the size of the circle of confusion, enhancing the brightness of the circle of confusion through gamma correction to obtain a corrected image; performing bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blur image; and performing inverse gamma correction on the bokeh blur image to obtain a result image.
[0099] The present application also provides a computer storage medium. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tape storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information accessible by a computing device.
[0100] In some embodiments, the present invention also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, obtains an original image; performs depth-of-field processing on the original image to obtain a depth-of-field map; calculates the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determines the size of the circle of confusion, enhances the brightness of the circle of confusion through gamma correction to obtain a corrected image; performs bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh blur image; and performs inverse gamma correction on the bokeh blur image to obtain a result image.
[0101] In summary, the present invention provides a method and apparatus for simulating large-aperture lens imaging. The method includes obtaining an original image; performing depth-of-field processing on the original image to obtain a depth-of-field map; calculating the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determining the size of the circle of confusion, and enhancing the brightness of the circle of confusion through gamma correction to obtain a corrected image; performing bokeh blur processing on the corrected image according to preset bokeh parameters to obtain a bokeh-blurred image; and performing inverse gamma correction on the bokeh-blurred image to obtain a result image. The present invention uses a deep learning method to obtain the depth of a picture, does not rely on the original information of the picture, and can process pictures from various sources; it also does not rely on hardware devices and can run independently on different mobile devices to provide a bokeh effect, which is suitable for most picture editing; in addition, based on the depth map rather than foreground and background segmentation, the effect is more delicate and natural, and different intensities of bokeh effects can be observed in different depth regions of the picture.
[0102] It can be understood that the above-provided method embodiments correspond to the above device embodiments, and the corresponding specific contents can be referred to each other, and will not be elaborated here.
[0103] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0104] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0105] 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, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction method, and the instruction method implements the process in Figure 1 one process or multiple processes and / or blocksFigure 1 The functions specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementing the steps of the functions specified in one or more processes and / or boxes Figure 1 One or more processes Figure 1 specified in one or more boxes.
[0107] As described above, this is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for simulating the imaging of a large aperture lens, characterized in that, Including: Obtain the original image; Perform depth-of-field processing on the original image to obtain a depth-of-field map, including: Input the original image into a preset depth-of-field recognition model to obtain an initial depth-of-field information map; Perform box filtering blurring on the initial depth-of-field information map to obtain a depth-of-field map; Calculate the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determine the size of the circle of confusion, and enhance the brightness of the circle of confusion through gamma correction to obtain a corrected image; Perform bokeh blurring on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image, including: traversing each pixel point in the corrected image within a preset radius range and determining the traversed points as points of confusion; Calculate the distance between the point of confusion and the corresponding pixel point; Compare the distance with the radius of the circle of confusion. When the distance is less than the radius of the circle of confusion, calculate the weight of the point of confusion and determine the spot shape; Perform inverse gamma correction on the bokeh blurred image to obtain a result image.
2. The method according to claim 1, wherein The step of inputting the original image into a preset depth-of-field recognition model to obtain an initial depth-of-field information map includes: Input the original image into the depth-of-field recognition model to obtain the grayscale depth information corresponding to the original image; Wherein, the value range of the depth value is 0 to 1, the depth value corresponds to the depth information from the background to the foreground in the original image, and the larger the depth value, the closer the scene is to the lens.
3. The method according to claim 1, wherein Correct the circle of confusion in the following manner y = pow(x, a) Where x is the original color of the pixel in the original image, y is the color of the pixel after gamma correction, and a is the intensity of gamma correction.
4. The method according to claim 1, wherein Calculate the weight of the point of confusion through a distance field function.
5. The method according to claim 3, characterized in that, Perform inverse gamma correction on the bokeh blurred image in the following manner, including: z = pow(y, 1 / a) Where z is the color of the pixel after inverse gamma correction.
6. An imaging device simulating a large aperture lens, characterized in that, Including: An acquisition module for acquiring the original image, A depth-of-field processing module for performing depth-of-field processing on the original image to obtain a depth-of-field map, including: Input the original image into a preset depth-of-field recognition model to obtain an initial depth-of-field information map; Perform box filtering blurring on the initial depth-of-field information map to obtain a depth-of-field map; A correction module for calculating the radius of the circle of confusion in the original image according to the depth value of the depth-of-field map, determining the size of the circle of confusion, and enhancing the brightness of the circle of confusion through gamma correction to obtain a corrected image; A bokeh blurring module for performing bokeh blurring on the corrected image according to preset bokeh parameters to obtain a bokeh blurred image, including: traversing each pixel point in the corrected image within a preset radius range and determining the traversed points as points of confusion; Calculate the distance between the point of confusion and the corresponding pixel point; Compare the distance with the radius of the circle of confusion. When the distance is less than the radius of the circle of confusion, calculate the weight of the point of confusion and determine the spot shape; An inverse correction module for performing inverse gamma correction on the bokeh blurred image to obtain a result image.
Citation Information
Patent Citations
Image blurring processing method and apparatus
CN106530241A
Target object blurring method and device, storage medium and electronic equipment
CN114372931A
Method and apparatus for using a virtual camera to dynamically refocus a digital image
US7623726B1