Image Generation Method, Apparatus, Electronic Device, and Readable Storage Medium
By alternately exposing and fusing reference cache frames, the problem of low frame rate after HDR image processing is solved, and efficient generation and switching of high dynamic range images are realized, suitable for recording preview and video recording.
Patent Information
- Application Number
- CN202210282765.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-03-22
AI Technical Summary
In the prior art, the frame rate of the data stream after HDR image processing is low, resulting in poor results in recording preview and video recording.
By alternately exposing and fusing reference cache frames, the exposure parameters of the current image are determined based on the historical image and fused with the previous frame image to generate a target image with a high dynamic range.
Without reducing the frame rate and clarity, the data stream frame rate after HDR processing is improved, and seamless switching between previewing HDR images and recording multi-frame HDR images is achieved.
Smart Images

Figure CN114630056B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of imaging technology, and particularly relates to an image generation method, apparatus, electronic device, and readable storage medium. Background Art
[0002] With the development of the times, people's requirements for photo restoration are getting higher and higher. To meet people's needs, High-Dynamic Range (HDR) images have emerged. HDR images are generated by multiple Low-Dynamic Range (LDR) images with different exposure times through image synthesis technology. Compared with ordinary images, HDR images can provide more dynamic range and image details, and can better reflect the visual effects in the real environment. Currently, in the process of obtaining an HDR composite image, the number of exposure times of the image acquisition device is often greater than the number of obtained HDR composite images, which results in a lower frame rate of the data stream after HDR processing. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide an image generation method, apparatus, electronic device, and readable storage medium, which can solve the problem of the lower frame rate of the data stream after HDR processing in the related art.
[0004] In a first aspect, the embodiments of this application provide an image generation method, which includes: determining a first exposure parameter of a current image based on at least one frame of historical image; performing exposure processing on the current image based on the first exposure parameter to obtain a first image; and fusing the first image with at least one frame of second image to obtain a target image; where the second image is an image output before the first image, the first exposure parameter is different from a second exposure parameter of a third image, and the third image is the previous frame image of the first image.
[0005] In a second aspect, the embodiments of this application provide an image generation apparatus, which includes: a parameter determination module, configured to determine a first exposure parameter of a current image based on at least one frame of historical image; an image acquisition module, configured to perform exposure processing on the current image based on the first exposure parameter to obtain a first image; and an image fusion module, configured to fuse the first image with at least one frame of second image to obtain a target image; where the second image is an image output before the first image, the first exposure parameter is different from a second exposure parameter of a third image, and the third image is the previous frame image of the first image.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instructions are stored, and when the program or instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is used to run a program or instructions to implement the method described in the first aspect.
[0009] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0010] In the embodiments of the present application, a first exposure parameter of a current image is determined based on at least one frame of historical images; the current image is exposed based on the first exposure parameter to obtain a first image; the first image is fused with at least one frame of second images to obtain a target image; wherein, the second image is an image output before the first image, the first exposure parameter is different from a second exposure parameter of a third image, and the third image is the previous frame image of the first image. That is to say, for each frame of the first image obtained, a frame of high-dynamic-range target image can be correspondingly obtained. Therefore, the number of output image frames is close to the number of collected image frames, that is, the frame rate of the data stream after HDR processing is effectively improved. Without dropping frames and without sacrificing clarity and power consumption performance, the embodiments of the present application expand the dynamic range by means of alternating exposure and fusing reference buffer frames, enabling a better presentation of the image, and solving the problem that the frame rate must be sacrificed for current multi-frame HDR images. The embodiments of the present application can be applied to video preview and video recording, and can achieve a perfect switch between previewing HDR images and recording multi-frame HDR images. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is the flow of the image generation method according to the embodiment of the present application Figure 1 ;
[0012] Figure 2 is the flow of the image generation method according to the embodiment of the present application Figure 2 ;
[0013] Figure 3 is the flow of the image generation method according to the embodiment of the present application Figure 3 ;
[0014] Figure 4 It is a schematic diagram of image fusion in the image generation method according to an embodiment of the present application;
[0015] Figure 5 It is a block diagram of the image generation device according to an embodiment of the present application;
[0016] Figure 6 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present application Figure 1 ;
[0017] Figure 7 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present application Figure 2 . Specific embodiments
[0018] Next, the technical solutions of the embodiments of the present application will be clearly described in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0019] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0020] Next, the image generation method provided by the embodiments of the present application will be described in detail in conjunction with the accompanying drawings and specific embodiments and their application scenarios.
[0021] Figure 1 The flowchart of the image generation method according to an embodiment of the present application is shown. The method is applied to an electronic device and includes:
[0022] Step 10, determining a first exposure parameter of the current image based on at least one frame of historical image.
[0023] In this step, the current image refers to the image collected by the electronic device at the current moment; at least one frame of historical image refers to the images collected by the electronic device before the current moment; the first exposure parameter is the exposure parameter corresponding to the image acquisition device when exposing the current image, and the exposure parameter includes but is not limited to parameters such as exposure time, exposure gain, and aperture.
[0024] Specifically, the number of historical images can be one frame, two frames, or multiple frames. The number of at least one frame of historical images can be preset. For example, it is predetermined that the number of images of at least one frame of historical images is 3 frames, that is, at least one frame of historical images can correspond to 3 adjacent frames of images output before the first image. It can also be predetermined that the number of images of at least one frame of historical images is 1 frame, that is, at least one frame of historical images can correspond to 1 frame of image corresponding to the current image output before the first image.
[0025] In a possible implementation, the electronic device performs image exposure through an alternating exposure method. For example, the first frame of image is a long-exposure image corresponding to a long-exposure parameter, the second frame of image alternates to a short-exposure image corresponding to a short-exposure parameter, the third frame of image alternates to a long-exposure image corresponding to a long-exposure parameter, the fourth frame of image alternates to a short-exposure image corresponding to a short-exposure parameter, and so on. Continuously alternating between the long-exposure parameter and the short-exposure parameter is the alternating exposure method. Of course, an alternating cycle of alternating exposure can include not only the long-exposure parameter and the short-exposure parameter, but also N exposure parameters between the long-exposure parameter and the short-exposure parameter, where N is a positive integer greater than 1, and the parameter values corresponding to the N exposure parameters can decrease in sequence.
[0026] If the current image is the Kth frame of short-exposure image, the previous frame is the Kth frame of long-exposure image, the previous frame of the Kth frame of long-exposure image is the (K - 1)th frame of short-exposure image, and the previous frame of the (K - 1)th frame of short-exposure image is the (K - 1)th frame of long-exposure image, then when at least one frame of historical images corresponds to 1 frame of image corresponding to the current image output before the first image, at least one frame of historical images is the (K - 1)th frame of short-exposure image, and the first exposure parameter of the current image is quickly determined by considering the previous frame of short-exposure image. When at least one frame of historical images corresponds to 3 adjacent frames of images output before the first image, at least one frame of historical images corresponds to 2 frames of long-exposure images (the Kth frame of long-exposure image and the (K - 1)th frame of long-exposure image) and 1 frame of short-exposure image (the (K - 1)th frame of short-exposure image). By comprehensively considering the long-exposure image and the short-exposure image, the first exposure parameter of the current image is accurately determined.
[0027] Step 20, perform exposure processing on the current image based on the first exposure parameter to obtain a first image.
[0028] In this step, the first image is an image obtained by exposing the current image using the first exposure parameter, and different first exposure parameters correspond to first images with different image effects.
[0029] Specifically, if the first exposure parameter is a long-exposure parameter, the obtained first image is a long-exposure image; if the first exposure parameter is a short-exposure parameter, the obtained first image is a short-exposure image.
[0030] Step 30: Fuse the first image with at least one frame of second images to obtain a target image;
[0031] Wherein, the second image is an image output before the first image, the first exposure parameter is different from the second exposure parameter of a third image, and the third image is the previous frame image of the first image.
[0032] In this step, at least one frame of second images are images output before the first image; it should be noted that although both at least one frame of historical images and at least one frame of second images are images output before the first image, the number of images and the image content corresponding to at least one frame of historical images and at least one frame of second images may be different. Of course, at least one frame of historical images and at least one frame of second images may also be the same in terms of image content and number of images, that is to say, the historical images used to determine the first exposure parameter are ultimately also used for image fusion.
[0033] In an optional implementation, it is preset to determine the first exposure parameter of the current image through the adjacent 3 frames of historical images output before the first image. At this time, the number of at least one frame of historical images is 3; it is preset to fuse the first image with the adjacent 1 frame of image output before the first image. At this time, the number of at least one frame of second images is 1, and at least one frame of historical images includes the second image.
[0034] In an optional implementation, it is preset to determine the first exposure parameter of the current image through one frame of historical image corresponding to the current image output before the current image. For example, if the current image is a short exposure parameter, the first exposure parameter of the current image is determined using the previous frame of short exposure parameter. At this time, the number of at least one frame of historical images is 1; it is preset to fuse the first image with the adjacent 2 frames of images output before the first image. At this time, the number of at least one frame of second images is 2. If the previous two frames of images include the previous frame of short exposure image, then at least one frame of second images includes at least one frame of historical images. If the previous two frames of images do not include the previous frame of short exposure image, then at least one frame of second images and at least one frame of historical images are not related in terms of image content and number of images.
[0035] The third image is the previous frame image of the first image, that is, the third image is also an image output before the first image. If at least one frame of second images takes the adjacent 1 frame of image output before the first image, then at least one frame of second images is the third image; if at least one frame of second images takes the adjacent N (N is an integer greater than 1) frames of images output before the first image, then at least one frame of second images includes the third image; if at least one frame of second images takes the images output before the first image but does not include the adjacent 1 frame of image output before the first image, then at least one frame of second images is not related to the third image.
[0036] The second exposure parameter is the exposure parameter corresponding to the image acquisition device when exposing the third image. The first exposure parameter of the first image is different from the second exposure parameter of the third image. That is, when the electronic device performs image exposure, the exposure parameters of two adjacent frames of images are different.
[0037] In a possible implementation, the electronic device performs image exposure in an alternating exposure manner. An alternating cycle includes M alternating exposure parameters, where M is a positive integer greater than or equal to 2, and the M alternating exposure parameters are different. Then, when performing image fusion, at least one second image can be determined according to M. For example, at least one second image can be the M-1 adjacent frames of images before the output of the first image. Of course, when M is greater than 2, the number of at least one second image can also be less than M-1.
[0038] In a possible application scenario, the electronic device performs image exposure in an exposure manner of alternating long exposure parameters and short exposure parameters. At this time, M is equal to 2. The first exposure parameter of the current image is determined by using the 3 adjacent historical images (corresponding to at least one historical image) output before the first image. After obtaining the first exposure parameter, the first image is obtained. The first image is a long exposure image. The first image is fused with the previous short exposure image (corresponding to at least one second image) to obtain a target image. The obtained target image is a high-dynamic-range image. By means of alternating exposure and fusing with the previous frame of image, the number of frames of the data stream after HDR processing is effectively increased.
[0039] It should be noted that as time goes by, the image acquisition device continuously acquires images. Therefore, at least one historical image, the current image, the first exposure parameter, the first image, and at least one second image are all dynamically changing to obtain a real-time target image.
[0040] In the embodiments of the present application, the first exposure parameter of the current image is determined by using at least one historical image, and then the current image is exposed by using the first exposure parameter to obtain the first image. Further, the first image is fused with at least one second image to obtain a target image. Therefore, the number of output image frames is close to the number of acquired image frames, that is, the frame rate of the data stream after HDR processing is effectively increased. Without reducing the frame rate, sacrificing clarity and power consumption performance, the embodiments of the present application expand the dynamic range by means of alternating exposure and fusing reference cache frames, so that the image has a better effect presentation, and solve the problem that the current multi-frame HDR images necessarily sacrifice the frame rate. The embodiments of the present application can be applied to video preview and video recording, and can realize the perfect switching between previewing HDR images and recording multi-frame HDR images.
[0041] In some embodiments, determining the first exposure parameter of the current image based on at least one historical image includes:
[0042] Step 101: Obtain the historical exposure parameters corresponding to the at least one frame of historical image.
[0043] In this step, the historical exposure parameter is the exposure parameter corresponding to the image acquisition device when exposing the historical image, and each frame of historical image corresponds to one historical exposure parameter.
[0044] Step 102: Determine the first exposure parameter of the current image based on the historical exposure parameters.
[0045] In this step, the historical exposure parameter reflects the exposure situation of the image acquisition device at the historical moment before the current moment. In this embodiment, the exposure parameters corresponding to two adjacent frames of images are different. However, when determining the first exposure parameter of the current image, the historical exposure parameter is considered, and the determined first exposure parameter has good brightness stability and brightness smoothness with the historical exposure parameter.
[0046] Specifically, after obtaining the historical exposure parameter, use the AEC algorithm (Automatic Exposure Control algorithm) for calculation to determine the first exposure parameter of the current image. For example, when the current image is a long exposure image, calculate the first exposure parameter of the current image using the historical exposure parameter corresponding to the previous frame of long exposure image; when the current image is a short exposure image, calculate the first exposure parameter of the current image using the historical exposure parameter corresponding to the previous frame of short exposure image.
[0047] In an optional implementation manner, step 102 of determining the first exposure parameter of the current image based on the historical exposure parameter includes:
[0048] Step 1021: Determine the exposure parameter of the exposure image group based on the historical exposure parameter, where the exposure image group includes the current image, and the exposure parameters of two adjacent images in the exposure image group are different.
[0049] In the above implementation manner, the exposure image group includes at least two frames of images. That is to say, when determining the first exposure parameter of the current image according to the historical exposure parameter, the exposure parameters corresponding to at least two frames of images are determined at one time, where at least two frames of images include the current image, and the exposure parameters of two adjacent images are different. Thus, by calculating once, the exposure parameters of the exposure image group are determined, which can effectively reduce the number of calculations and ensure the smooth operation of the electronic device.
[0050] For example, when acquiring at least one frame of historical image, the at least one frame of historical image includes at least one frame of historical long-exposure image and at least one frame of historical short-exposure image. Determine the historical long-exposure parameters corresponding to the at least one frame of historical long-exposure image and the historical short-exposure parameters corresponding to the at least one frame of historical short-exposure image. Comprehensively consider the historical long-exposure parameters and the historical short-exposure parameters to determine the exposure parameters of the exposure image group, where the exposure image group includes images of at least one subsequent alternating period. If the current image is a long-exposure image, when determining the exposure parameters of the exposure image group, the first exposure parameter corresponding to the current image will be determined. The first exposure parameter is a long-exposure parameter, and the exposure parameter of the next frame of the current image is a short-exposure parameter. Thus, when the next frame of the image is the current image, the exposure parameter of this image has been calculated and does not need to be calculated again. By determining the exposure parameters of the exposure image group, skip-frame calculation can be achieved, effectively saving computing resources and ensuring the smooth operation of the electronic device.
[0051] Further, the step 1021 of determining the exposure parameters of the exposure image group based on the historical exposure parameters includes:
[0052] Sub-step A, based on the historical exposure parameters, determine the first preset exposure parameter of the current image.
[0053] In this step, the first preset exposure parameter is the original exposure parameter calculated for the current image. This original exposure parameter is a parameter to be adjusted and needs to be further verified and adjusted in subsequent steps to obtain the first exposure parameter.
[0054] In a possible implementation, after determining the historical exposure parameters, determine the weight coefficients corresponding to the respective historical exposure parameters. The weight coefficients can be determined according to a weight coefficient table, and the weight coefficient table can be a preset table. According to the weighted average of the historical exposure parameters and the weight coefficients, determine the first preset exposure parameter of the current image.
[0055] Sub-step B, based on the first preset exposure parameter, determine the preset brightness value of the current image.
[0056] In this step, the preset brightness value refers to the brightness value of the image obtained if the first preset exposure parameter is used for image exposure.
[0057] Sub-step C, in the case where the difference between the preset brightness value and the historical brightness value is greater than the brightness threshold, adjust the first preset exposure parameter to obtain the first adjusted exposure parameter; where the historical brightness value is obtained based on the brightness values of the at least one frame of historical image.
[0058] In this step, the brightness threshold is a preset value, and the size of the brightness threshold can be determined according to the actual situation. After obtaining at least one frame of historical image, the historical brightness value is further determined based on the brightness values of the at least one frame of historical image. The historical brightness value is the target value of the image brightness in the current scene determined according to the brightness values of the at least one frame of historical image.
[0059] In a possible implementation, the brightness values of at least one frame of historical image are determined, and the preset brightness standard parameter is further determined. Based on the brightness standard parameter, the brightness values of the at least one frame of historical image are adjusted to determine the target value of the image brightness in the current scene, that is, the historical brightness value.
[0060] The historical brightness value is compared with the preset brightness value. When the difference between the preset brightness value and the historical brightness value is greater than the brightness threshold, it is proved that the preset brightness value is inappropriate, and the first preset exposure parameter affecting the preset brightness value needs to be adjusted to obtain the first adjusted exposure parameter.
[0061] Specifically, when the difference obtained by subtracting the historical brightness value from the preset brightness value is greater than the brightness threshold, that is, the preset brightness value is too large, the first preset exposure parameter affecting the preset brightness value is adjusted to reduce the parameter value of the first preset exposure parameter to obtain the first adjusted exposure parameter. When the difference obtained by subtracting the preset brightness value from the historical brightness value is greater than the brightness threshold, that is, the preset brightness value is too small, the first preset exposure parameter affecting the preset brightness value is adjusted to increase the parameter value of the first preset exposure parameter to obtain the first adjusted exposure parameter.
[0062] Sub-step D, when the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold, the first preset exposure parameter is used as the first adjusted exposure parameter.
[0063] In this step, when the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold, the preset brightness value is more appropriate. At this time, there is no need to adjust the first preset exposure parameter, that is, the first preset exposure parameter can be directly used as the first adjusted exposure parameter.
[0064] Specifically, the situation where the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold includes that the difference obtained by subtracting the historical brightness value from the preset brightness value is less than or equal to the brightness threshold, and also includes that the difference obtained by subtracting the preset brightness value from the historical brightness value is less than or equal to the brightness threshold.
[0065] Sub-step E, when the first adjusted exposure parameter meets the preset conditions, the first adjusted exposure parameter is used as the first exposure parameter.
[0066] Sub-step F: When the first adjusted exposure parameter does not meet the preset condition, adjust the first adjusted exposure parameter to obtain the first exposure parameter.
[0067] The preset condition includes at least one of the following: the difference between the first adjusted exposure parameter and the exposure parameter of the fourth image is within a preset difference range; the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image is within a preset ratio range; the fourth image is the image corresponding to the current image among the at least one frame of historical images, and the fifth image is the next frame image of the current image.
[0068] Further calibrate the first adjusted exposure parameter to determine whether it meets the preset condition. If it meets the preset condition, it proves that the first adjusted exposure parameter is appropriate and no further adjustment is required for the first adjusted exposure parameter, and the first adjusted exposure parameter can be directly used as the first exposure parameter. If it does not meet the preset condition, it proves that the first adjusted exposure parameter still needs to be adjusted, that is, adjust the first adjusted exposure parameter to obtain the first exposure parameter.
[0069] In an alternative embodiment, the preset condition is that the difference between the first adjusted exposure parameter and the exposure parameter of the fourth image is within a preset difference range, and the fourth image is the image corresponding to the current image among the at least one frame of historical images. For example, the electronic device uses an alternating exposure method for image exposure. An alternating cycle includes a long exposure parameter, a normal exposure parameter, and a short exposure parameter. If the current image is a long exposure image, the fourth image is the previous long exposure image. Determine the exposure parameter corresponding to the previous long exposure image, and compare whether the difference between the first adjusted exposure parameter and the exposure parameter corresponding to the previous long exposure image is within the preset difference range. If so, it meets the preset condition; if not, it does not meet the preset condition.
[0070] In an alternative embodiment, the preset condition is that the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image is within a preset ratio range, and the fifth image is the next frame image of the current image. For example, the electronic device uses an alternating exposure method for image exposure. An alternating cycle includes a long exposure parameter and a short exposure parameter. If the current image is a long exposure image and the fifth image is a short exposure image, determine the exposure parameter of the fifth image, further determine the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image, and compare the obtained ratio result with the preset ratio range. If it is within the preset ratio range, it meets the preset condition; if it is not within the preset ratio range, it does not meet the preset condition.
[0071] Further, when determining the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image, it is necessary to determine the short exposure parameter corresponding to the fifth image. In one possible implementation, the short exposure parameter corresponding to the fifth image is set to be the same as the short exposure parameter corresponding to the previous short exposure image. Of course, if the current image is a short exposure image and the fifth image is a long exposure image, when determining the long exposure parameter corresponding to the fifth image, the long exposure parameter corresponding to the fifth image can be set to be the same as the long exposure parameter corresponding to the previous long exposure image. That is, when determining the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image, the exposure parameter of the fifth image is fixed, so that when the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image is not within the preset ratio range, only the first adjusted exposure parameter needs to be adjusted.
[0072] In an alternative embodiment, the preset condition is that the difference between the first adjusted exposure parameter and the exposure parameter of the fourth image is within a preset difference range; and the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image is within a preset ratio range. That is, when both the difference between the first adjusted exposure parameter and the exposure parameter of the fourth image is within the preset difference range and the ratio of the first adjusted exposure parameter to the exposure parameter of the fifth image is within the preset ratio range, the preset condition is satisfied.
[0073] The first exposure parameter determined by the above method can ensure the smoothness of the brightness between the output images, which is beneficial to subsequent fusion of the images to obtain a more accurate target image.
[0074] In some embodiments, step 30 of fusing the first image with at least one second image to obtain a target image includes:
[0075] Step 301, performing alignment processing on the first image and the at least one second image.
[0076] In this step, first, the first image and the at least one second image are aligned to ensure more accurate fusion of the first image and the at least one second image subsequently.
[0077] In one implementation, a reference image is determined from the first image and the at least one second image; and non-reference images in the first image and the at least one second image are aligned and adjusted based on the reference image.
[0078] Specifically, determine the rules for determining the reference image in advance, and determine the reference image from the first image and at least one frame of second images according to the preset rules. The preset rules include, but are not limited to, the first output image among the first image and at least one frame of second images, the image with the largest exposure parameter value among the first image and at least one frame of second images, and the image with the smallest exposure parameter value among the first image and at least one frame of second images. After determining the reference image, determine the first bit corresponding to the reference image, determine the second bit corresponding to the non-reference image, and adjust the second bit of the non-reference image based on the quotient of the first bit and the second bit to achieve the alignment process of the first image and at least one frame of second images.
[0079] In a possible application scenario, the number of second images is one frame, and the first image and the second image alternate between long-exposure images and short-exposure images, that is, if the first image is a long-exposure image, the second image is a short-exposure image; if the first image is a short-exposure image, the second image is a long-exposure image. Then the preset rule can be to specify the second image as the reference image. As Figure 3 shown, when the first image is S1, the second image L1 is used as the reference image, and when the first image is L2, the second image S1 is used as the reference image; the preset rule can also be to specify the long-exposure image as the reference image, as Figure 3 shown, when the first image is S1, the second image L1 is used as the reference image, and when the first image is L2, the first image L2 is used as the reference image; the preset rule can also be to specify the second image as the reference image, when the first image is S1, L1 is used as the reference image, and when the first image is L2, S1 is used as the reference image.
[0080] Step 302: Based on the pixel value of the first pixel in the first image, the pixel value of the second pixel in the at least one frame of second images, and a preset pixel threshold, fuse the first pixel in the first image and the second pixel in the second image to obtain the pixel value of the target pixel in the target image;
[0081] wherein, the second pixel is the pixel corresponding to the first pixel.
[0082] In this step, the first pixel is the pixel position in the first image, and the pixel value of the first pixel is the value corresponding to the first pixel in the first image; the second pixel is the pixel position corresponding to the first pixel in each frame of the second image, and the pixel value of the second pixel is the value corresponding to the second pixel in each frame of the second image; the target pixel in the target image is the pixel position in the target image, and the pixel position of the target pixel in the target image corresponds to the pixel position of the first pixel in the first image and the pixel position of the second pixel in the second image.
[0083] In this embodiment, a preset pixel threshold is set in advance, and the pixel value of the first pixel in the first image and the pixel values of the second pixels in at least one frame of the second image are compared with the preset pixel threshold, so as to select and discard the pixel values of the first pixel in the first image and the pixel values of the second pixels in at least one frame of the second image, and determine the pixel value of the target pixel in the target image.
[0084] In a possible application scenario, the first image is a long-exposure image such as that shown by (1) Long Exp in the left figure of FIG. 4, and the second image is a short-exposure image such as that shown by (2) Short Exp in the left figure. The long-exposure image is determined as the reference image, and the second image is mapped to the high bit corresponding to the first image, that is, the second image is multiplied by Ratio (L / S) to obtain a straight line (3) in the middle figure, so as to perform alignment processing on the first image and the second image. The pixel value of the first pixel in the first image is compared with the preset pixel threshold. If it is less than the preset pixel threshold, the pixel value of the first pixel in the first image is taken. If it is greater than the preset pixel threshold, the pixel value of the second pixel in the second image is taken, so as to realize pixel-level fusion of the first image and the second image, and obtain a straight line (4) in the right figure. After fusion, it is mapped back to the original bit through the ToneMapping curve, such as the curve (5) in the right figure, to obtain the fused target image. Figure 4 Left figure (2) Short Exp shown in the left figure, determine the long exposure image as the reference image, map the second image to the high bit corresponding to the first image, that is, multiply the second image by Ratio (L / S) to obtain the straight line (3) in the middle figure as shown in Figure 4 In the middle figure, to align the first image and the second image. Compare the pixel value of the first pixel in the first image with the preset pixel threshold. If it is less than the preset pixel threshold, take the pixel value of the first pixel in the first image. If it is greater than the preset pixel threshold, take the pixel value of the second pixel in the second image, to achieve pixel-level fusion of the first image and the second image, and obtain a straight line (4) in the right figure as shown in Figure 4 In the right figure, after fusion, it is mapped back to the original bit through the ToneMapping curve, such as the curve (5) in the right figure as shown in Figure 4 In the right figure, to obtain the fused target image.
[0085] Further, as shown in Figure 3 L1 and S1 are fused (HDR fusion) to obtain M1, where M1 represents the first target image. S1 and L2 are fused to obtain M2, where M2 represents the second target image. L2 and S2 are fused to obtain M3, where M3 represents the third target image. S2 and L3 are fused to obtain M4, where M4 represents the fourth target image. After obtaining multiple target images, the multiple target images are subjected to TNR noise reduction, and the noise-reduced data stream is sent for encoding to obtain video encoding data, or the noise-reduced data stream is sent to an electronic device for preview. That is to say, the technical solution provided in this embodiment can be applied to real-time video recording and can also be used for preview. And when switching from the preview state to the shooting state, there is no need to restart the image acquisition device, realizing seamless switching and ensuring the smoothness of the switching.
[0086] In a possible application scenario, the number of the second images is two frames, namely the second image A and the second image B. The first image, the second image A, and the second image B alternate in the long-exposure image, the normal-exposure image, and the short-exposure image. For example, the first image is a short-exposure image, the second image A is a normal-exposure image, and the second image B is a long-exposure image. The long-exposure image is pre-specified as the reference image, that is, the first image and the second image A are fused with the second image B as the reference. Specifically, the second image A and the second image B can be fused first, and then the fused result is fused with the first image. At this time, the preset pixel thresholds can include a preset pixel threshold A and a preset pixel threshold B. For example, the pixel value of the second pixel in the second image B is compared with the preset pixel threshold A. If it is less than the preset pixel threshold A, the pixel value of the second pixel in the second image B is taken. If it is greater than the preset pixel threshold A, the pixel value of the second pixel in the second image A is taken to obtain a fused image. The pixel value of the third pixel in the fused image is compared with the preset pixel threshold B, where the pixel position of the third pixel in the fused image corresponds to the pixel position of the first pixel in the first image. If it is less than the preset pixel threshold B, the pixel value of the third pixel in the fused image is taken. If it is greater than the preset pixel threshold B, the pixel value of the first pixel in the first image is taken to obtain the pixel value of the target pixel in the target image.
[0087] In a possible application scenario, there are at least two images with the same exposure parameter range among the first image and at least one frame of the second images. For example, the first image is a short-exposure image, the second image A among at least one frame of the second images is a long-exposure image, and the second image B is a short-exposure image. Then, when fusing the first image and at least one frame of the second images, the at least two images with the same exposure parameter range are fused first, and then the fused result is further fused with other images among the first image and at least one frame of the second images, that is, the first image and the second image B are fused first, and the obtained fused image is then fused with the second image A.
[0088] In the above embodiment, the pixel-level fusion of the first image and at least one frame of the second images can be displayed to ensure the accuracy of the fused image.
[0089] In some embodiments, step 30 of fusing the first image with at least one frame of the second images to obtain a target image includes:
[0090] Step 303, performing an alignment process on the first image and the at least one frame of the second images;
[0091] Step 304, obtaining the pixel value of the target region in the target image based on the pixel value of the first image region in the first image and the pixel value of the second image region in the at least one frame of the second images.
[0092] In the above embodiments, the first image is divided into different image regions. The first image region refers to any divided image region in the first image. The first image region includes at least two pixels, and the pixel values of the first image region refer to the pixel values corresponding to each pixel in the first image region. The second image is divided into different image regions based on the same division method as the first image. The second image region refers to the image region in the second image corresponding to the first image region. The second image region includes at least two pixels, and the pixel values of the second image region refer to the pixel values corresponding to each pixel in the second image region. Further, based on the pixel values of the first image region in the first image and the pixel values of the second image region in at least one frame of the second image, the pixel values of the target region in the target image are obtained.
[0093] Specifically, when dividing the first image into image regions, it can be divided into regular image regions or irregular image regions. When dividing irregular image regions, it is divided by means of intelligent recognition (AI recognition) of overexposed regions.
[0094] In an alternative embodiment, the first pixel mean corresponding to the pixel values of each pixel in the first image region of the first image is determined, the second pixel mean corresponding to the pixel values of each pixel in the second image region of at least one frame of the second image is determined, the fusion weights corresponding to the first image and at least one frame of the second image are determined, and based on the weighted average of the fusion weights, the first pixel mean, and the second pixel mean, the pixel values of the target region in the target image are determined.
[0095] In an alternative embodiment, a preset region threshold is preset, and based on the pixel values of the first image region in the first image, the pixel values of the second image region in at least one frame of the second image, and the preset region threshold, the pixel values of the target region in the target image are obtained.
[0096] Specifically, the first image is a long-exposure image, and at least one frame of the second image is a short-exposure image. The long-exposure image is determined as the reference image, and the second image is mapped to the high bit positions of the first image to align the first image and the second image. The first image is divided into regions to determine the first image regions, and the second image is divided into regions to determine the second image regions corresponding to the first image regions. Further, the pixel values of each pixel in the first image regions of the first image are determined to obtain the first pixel mean value, and the pixel values of each pixel in the second image regions of the second image are determined to obtain the second pixel mean value. The first pixel mean value is compared with a preset region threshold. If it is less than the preset region threshold, the pixel values of the first image regions in the first image are taken; if it is greater than the preset region threshold, the pixel values of the second image regions in the second image are taken, realizing the region-level fusion of the first image and the second image. To ensure the smoothness of the image, the edges of the fusion region are smoothed and mapped back to the low bit positions using Tone Mapping to obtain the fused target image.
[0097] In the above embodiment, by dividing the first image and at least one frame of the second image into regions, the first image and at least one frame of the second image can be fused according to the image regions, effectively improving the image fusion speed.
[0098] In the image generation method provided by the embodiments of the present application, the execution subject may be an image generation device. In the embodiments of the present application, taking the image generation device executing the image generation method as an example, the image generation device provided by the embodiments of the present application is described.
[0099] Figure 5 The block diagram of the image generation device according to another embodiment of the present application is shown. The device includes:
[0100] A parameter determination module 51, configured to determine the first exposure parameter of the current image based on at least one frame of historical images;
[0101] An image acquisition module 52, configured to perform exposure processing on the current image based on the first exposure parameter to obtain a first image;
[0102] An image fusion module 53, configured to fuse the first image with at least one frame of second images to obtain a target image;
[0103] Wherein, the second image is an image output before the first image, the first exposure parameter is different from the second exposure parameter of a third image, and the third image is the previous frame image of the first image.
[0104] Optionally, the parameter determination module includes:
[0105] A parameter acquisition unit, configured to acquire historical exposure parameters corresponding to the at least one frame of historical images;
[0106] A parameter determination unit, configured to determine a first exposure parameter of the current image based on the historical exposure parameters.
[0107] Optionally, the parameter determination unit is further configured to determine exposure parameters of an exposure image group based on the historical exposure parameters, where the exposure image group includes the current image, and exposure parameters of two adjacent images in the exposure image group are different.
[0108] Optionally, the parameter determination unit includes:
[0109] A first determination subunit, configured to determine a first preset exposure parameter of the current image based on the historical exposure parameters;
[0110] A second determination subunit, configured to determine a preset brightness value of the current image based on the first preset exposure parameter;
[0111] A first adjustment subunit, configured to adjust the first preset exposure parameter to obtain a first adjusted exposure parameter when a difference between the preset brightness value and a historical brightness value is greater than a brightness threshold; where the historical brightness value is obtained based on brightness values of the at least one frame of historical images;
[0112] A third determination subunit, configured to use the first preset exposure parameter as the first adjusted exposure parameter when the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold;
[0113] A fourth determination subunit, configured to use the first adjusted exposure parameter as the first exposure parameter when the first adjusted exposure parameter meets a preset condition;
[0114] A second adjustment subunit, configured to adjust the first adjusted exposure parameter to obtain the first exposure parameter when the first adjusted exposure parameter does not meet the preset condition;
[0115] The preset condition includes at least one of the following: a difference between the first adjusted exposure parameter and an exposure parameter of a fourth image is within a preset difference range; a ratio of the first adjusted exposure parameter to an exposure parameter of a fifth image is within a preset ratio range; where the fourth image is an image corresponding to the current image in the at least one frame of historical images, and the fifth image is a next frame image of the current image.
[0116] Optionally, the image fusion module includes:
[0117] A first alignment unit for aligning the first image and the at least one second image;
[0118] A first fusion unit for fusing a first pixel in the first image and a second pixel in the second image based on the pixel value of the first pixel in the first image, the pixel value of the second pixel in the at least one second image, and a preset pixel threshold to obtain the pixel value of a target pixel in a target image;
[0119] wherein the second pixel is a pixel corresponding to the first pixel.
[0120] Optionally, the image fusion module:
[0121] A second alignment unit for aligning the first image and the at least one second image;
[0122] A second fusion unit for obtaining the pixel value of a target region in a target image based on the pixel value of a first image region in the first image and the pixel value of a second image region in the at least one second image;
[0123] wherein both the first image region and the second image region include at least two pixels, and the second image region is a region corresponding to the first image region.
[0124] The image generation device in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than a terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., or may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0125] The image generation device according to an embodiment of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.
[0126] The image generation device provided by the embodiments of the present application can implement each process implemented by the above method embodiments, achieving the same technical effects. To avoid repetition, details are not described here again.
[0127] Optionally, as Figure 6 shown, an embodiment of the present application further provides an electronic device 60, including a processor 61, a memory 62, a program or instruction stored on the memory 62 and executable on the processor 61. When the program or instruction is executed by the processor 61, it implements each step of any of the above image generation method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described here again.
[0128] It should be noted that the electronic device according to the embodiments of the present application includes the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0129] Figure 7 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application.
[0130] The electronic device 700 includes but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710, etc.
[0131] Those skilled in the art can understand that the electronic device 700 may further include a power source (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 710 through a power management system, so as to manage functions such as charging, discharging, and power consumption management through the power management system. Figure 7 The structure of the electronic device shown in does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which are not described here again.
[0132] Among them, the processor 710 determines a first exposure parameter of the current image based on at least one frame of historical image; performs exposure processing on the current image based on the first exposure parameter to obtain a first image; fuses the first image with at least one frame of second image to obtain a target image; wherein, the second image is an image output before the first image, the first exposure parameter is different from a second exposure parameter of a third image, and the third image is the previous frame image of the first image.
[0133] Optionally, the processor 710 obtains historical exposure parameters corresponding to the at least one frame of historical images, and determines a first exposure parameter of the current image based on the historical exposure parameters.
[0134] Optionally, the processor 710 is further configured to determine exposure parameters of an exposure image group based on the historical exposure parameters, where the exposure image group includes the current image, and exposure parameters of two adjacent images in the exposure image group are different.
[0135] Optionally, the processor 710 is further configured to determine a first preset exposure parameter of the current image based on the historical exposure parameters; determine a preset brightness value of the current image based on the first preset exposure parameter; in a case where a difference between the preset brightness value and a historical brightness value is greater than a brightness threshold, adjust the first preset exposure parameter to obtain a first adjusted exposure parameter, where the historical brightness value is obtained based on brightness values of the at least one frame of historical images; in a case where the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold, use the first preset exposure parameter as the first adjusted exposure parameter; in a case where the first adjusted exposure parameter meets a preset condition, use the first adjusted exposure parameter as the first exposure parameter; in a case where the first adjusted exposure parameter does not meet the preset condition, adjust the first adjusted exposure parameter to obtain the first exposure parameter; the preset condition includes at least one of the following: a difference between the first adjusted exposure parameter and an exposure parameter of a fourth image is within a preset difference range; a ratio of the first adjusted exposure parameter to an exposure parameter of a fifth image is within a preset ratio range, where the fourth image is an image corresponding to the current image in the at least one frame of historical images, and the fifth image is a next frame image of the current image.
[0136] Optionally, the processor 710 is further configured to perform alignment processing on the first image and the at least one frame of second images; fuse a first pixel in the first image and a second pixel in the second image based on a pixel value of the first pixel in the first image, a pixel value of the second pixel in the at least one frame of second images, and a preset pixel threshold to obtain a pixel value of a target pixel in a target image, where the second pixel is a pixel corresponding to the first pixel.
[0137] Optionally, the processor 710 is further configured to perform alignment processing on the first image and the at least one frame of second images; obtain pixel values of a target area in a target image based on pixel values of a first image area in the first image and pixel values of a second image area in the at least one frame of second images, where both the first image area and the second image area include at least two pixels, and the second image area is an area corresponding to the first image area.
[0138] It should be understood that in the embodiments of the present application, the input unit 704 may include a Graphics Processing Unit (GPU) 7041 and a microphone 7042. The graphics processor 7041 processes the image data of static pictures or video images obtained by an image capturing device (such as a camera) in the video image capturing mode or the image capturing mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of, for example, a liquid crystal display, an organic light emitting diode, etc. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also referred to as a touch screen. The touch panel 7071 may include two parts: a touch detection device and a touch controller. The other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and an action lever, which will not be elaborated herein. The memory 709 may be used to store software programs and various data, including but not limited to application programs and operating systems. The processor 710 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interfaces, and application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 710 either.
[0139] The memory 709 can be used to store software programs and various data. The memory 709 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 709 may include a volatile memory or a non-volatile memory, or the memory 709 may include both a volatile and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 709 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.
[0140] The processor 710 may include one or more processing units; optionally, the processor 710 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 710 either.
[0141] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above image generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0142] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.
[0143] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above image generation method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0144] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0145] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above image generation method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0146] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0147] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0148] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific implementation manners. The above specific implementation manners are merely illustrative rather than restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. An image generation method, characterized in that, The method includes: Determining a first exposure parameter of a current image based on at least one frame of historical images; Performing exposure processing on the current image based on the first exposure parameter to obtain a first image; Fusing the first image with at least one frame of second images to obtain a target image; wherein, after obtaining each frame of the first image, perform the operation of fusing the first image with at least one frame of second images to obtain a target image, so as to obtain one frame of the target image; Wherein, the second image is an image output before the first image, the first exposure parameter is different from a second exposure parameter of a third image, and the third image is the previous frame image of the first image; Wherein, the current image is an image acquired by an electronic device at the current moment, and the at least one frame of historical images, the current image, the first exposure parameter, the first image and the second image change dynamically along with the image acquisition process.
2. The method according to claim 1, characterized in that, The determining the first exposure parameter of the current image based on at least one frame of historical images includes: Obtaining historical exposure parameters corresponding to the at least one frame of historical images; Determining the first exposure parameter of the current image based on the historical exposure parameters.
3. The method according to claim 2, wherein The determining the first exposure parameter of the current image based on the historical exposure parameters includes: Determining exposure parameters of an exposure image group based on the historical exposure parameters, wherein the exposure image group includes the current image, and the exposure parameters of two adjacent images in the exposure image group are different.
4. The method according to claim 3, characterized in that, The determining the exposure parameters of the exposure image group based on the historical exposure parameters includes: Determining a first preset exposure parameter of the current image based on the historical exposure parameters; Determining a preset brightness value of the current image based on the first preset exposure parameter; In the case that the difference between the preset brightness value and a historical brightness value is greater than a brightness threshold, adjusting the first preset exposure parameter to obtain a first adjusted exposure parameter; wherein, the historical brightness value is obtained based on the brightness values of the at least one frame of historical images; In the case that the difference between the preset brightness value and the historical brightness value is less than or equal to the brightness threshold, taking the first preset exposure parameter as the first adjusted exposure parameter; In the case that the first adjusted exposure parameter meets a preset condition, taking the first adjusted exposure parameter as the first exposure parameter; In the case that the first adjusted exposure parameter does not meet the preset condition, adjusting the first adjusted exposure parameter to obtain the first exposure parameter; The preset condition includes at least one of the following: the difference between the first adjusted exposure parameter and the exposure parameter of a fourth image is within a preset difference range; the ratio of the first adjusted exposure parameter to the exposure parameter of a fifth image is within a preset ratio range; Wherein, the fourth image is the image corresponding to the current image in the at least one frame of historical images, and the fifth image is the next frame image of the current image.
5. The method according to claim 1, wherein The fusing the first image with at least one frame of second images to obtain a target image includes: Performing alignment processing on the first image and the at least one frame of second images; Based on the pixel value of the first pixel in the first image, the pixel value of the second pixel in the at least one frame of second images, and a preset pixel threshold, fuse the first pixel in the first image and the second pixel in the second images to obtain the pixel value of the target pixel in the target image; wherein, the second pixel is the pixel corresponding to the first pixel.
6. The method according to claim 1, wherein The step of fusing the first image and at least one frame of second images to obtain a target image includes: Performing an alignment process on the first image and the at least one frame of second images; Based on the pixel values of the first image region in the first image and the pixel values of the second image region in the at least one frame of second images, obtain the pixel values of the target region in the target image; wherein, both the first image region and the second image region include at least two pixels, and the second image region is the region corresponding to the first image region.
7. An image generation device, characterized in that, The apparatus includes: a parameter determination module, configured to determine a first exposure parameter of a current image based on at least one frame of historical images; an image acquisition module, configured to perform an exposure process on the current image based on the first exposure parameter to obtain a first image; an image fusion module, configured to fuse the first image and at least one frame of second images to obtain a target image; wherein, after each frame of the first image is obtained, perform the operation of fusing the first image and at least one frame of second images to obtain a target image, so as to obtain one frame of the target image; wherein, the second image is an image output before the first image, the first exposure parameter is different from the second exposure parameter of a third image, and the third image is the previous frame image of the first image; wherein, the current image is an image acquired by an electronic device at the current moment, and the at least one frame of historical images, the current image, the first exposure parameter, the first image and the second image change dynamically along with the image acquisition process.
8. The device according to claim 7, characterized in that, The parameter determination module includes: a parameter acquisition unit, configured to acquire the historical exposure parameters corresponding to the at least one frame of historical images; a parameter determination unit, configured to determine the first exposure parameter of the current image based on the historical exposure parameters.
9. The device according to claim 8, characterized in that, The parameter determination unit is further configured to determine the exposure parameters of an exposure image group based on the historical exposure parameters, wherein the exposure image group includes the current image, and the exposure parameters of two adjacent images in the exposure image group are different.
10. The device according to claim 9, characterized in that, The parameter determination unit includes: a first determination subunit, configured to determine a first preset exposure parameter of the current image based on the historical exposure parameters; a second determination subunit, configured to determine a preset brightness value of the current image based on the first preset exposure parameter; a first adjustment subunit, configured to adjust the first preset exposure parameter to obtain a first adjusted exposure parameter when the difference between the preset brightness value and the historical brightness value is greater than a brightness threshold; wherein, the historical brightness value is obtained based on the brightness values of the at least one frame of historical images; A third determination subunit, configured to use the first preset exposure parameter as a first adjusted exposure parameter when a difference between the preset brightness value and a historical brightness value is less than or equal to a brightness threshold; A fourth determination subunit, configured to use the first adjusted exposure parameter as the first exposure parameter when the first adjusted exposure parameter meets a preset condition; A second adjustment subunit, configured to adjust the first adjusted exposure parameter to obtain the first exposure parameter when the first adjusted exposure parameter does not meet the preset condition; The preset condition includes at least one of the following: a difference between the first adjusted exposure parameter and an exposure parameter of a fourth image is within a preset difference range; a ratio of the first adjusted exposure parameter to an exposure parameter of a fifth image is within a preset ratio range; wherein, the fourth image is an image corresponding to the current image in the at least one frame of historical images, and the fifth image is a next frame image of the current image.
11. The device according to claim 7, characterized in that, The image fusion module includes: A first alignment unit, configured to perform alignment processing on the first image and the at least one frame of second images; A first fusion unit, configured to fuse a first pixel in the first image and a second pixel in the second image based on a pixel value of the first pixel in the first image, a pixel value of the second pixel in the at least one frame of second images, and a preset pixel threshold to obtain a pixel value of a target pixel in a target image; wherein, the second pixel is a pixel corresponding to the first pixel.
12. The device according to claim 7, characterized in that, The image fusion module includes: A second alignment unit, configured to perform alignment processing on the first image and the at least one frame of second images; A second fusion unit, configured to obtain a pixel value of a target region in a target image based on a pixel value of a first image region in the first image and a pixel value of a second image region in the at least one frame of second images; wherein, both the first image region and the second image region include at least two pixels, and the second image region is a region corresponding to the first image region.
13. An electronic device, characterized in that, It includes a processor and a memory, the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the image generation method according to any one of claims 1 to 6 are implemented.
14. A readable storage medium, characterized in that, The program or instruction is stored on the readable storage medium, and when the program or instruction is executed by the processor, the steps of the image generation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Exposure control method and exposure control device
CN113784056A
Image processing method and device thereof
CN113905185A