Image generation method, apparatus and electronic device
By using the image generation device of a multi-camera module in the intelligent device, the spectral information of different band ranges is collected and compensated, the problem that the images captured by the smart device are affected by ambient light is solved, and a better image effect is achieved.
Patent Information
- Application Number
- CN202211202866.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-29
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-09-29
AI Technical Summary
Smart devices can’t avoid being affected by external ambient light when shooting images through a single sensor camera module, resulting in poor image production results.
The image generation device including a first imaging module and a second imaging module is adopted. The first imaging module acquires visible light information with a band range of 390 nm to 780 nm, and the second imaging module acquires multi-spectral information with a band range of 700 nm to 2500 nm and 200 nm to 800 nm, and compensates the images acquired by the first imaging module through the images acquired by the second imaging module.
It effectively avoids the impact of ambient light on the image production effect, improves the image effect of taking pictures, and ensures the clarity of the image and the richness of the color.
Smart Images

Figure CN115580760B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of camera technology, and particularly relates to an image generation method, apparatus, and electronic device. Background Art
[0002] With the continuous improvement of the imaging and photographing technology of intelligent devices, people's requirements for photo taking and texture are also getting higher and higher.
[0003] In the related art, an intelligent device captures an image through a camera module with a single sensor, and it is inevitable to be affected by external ambient light, resulting in poor image output quality. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide an image generation method, apparatus, and electronic device, which realizes compensating the captured image according to images in different wavelength ranges, avoids the influence of ambient light on the image output effect, and improves the image effect of photographing.
[0005] In a first aspect, the embodiments of this application provide an image generation method, which is applied to an image generation apparatus. The image generation apparatus includes a first camera module and a second camera module. The image generation method includes: obtaining a first image, a second image, and a third image. The first image is an image captured by the first camera module, and both the second image and the third image are images captured by the second camera module. The wavelength range corresponding to the first image is 390nm - 780nm, the wavelength range corresponding to the second image is 700nm - 2500nm, and the wavelength range corresponding to the third image is 200nm - 800nm; generating a target image according to the first image, the second image, and the third image.
[0006] In a second aspect, the embodiments of this application provide an image generation apparatus. The image generation apparatus includes a first camera module and a second camera module. The image generation apparatus includes: an obtaining module, configured to obtain a first image, a second image, and a third image. The first image is an image captured by the first camera module, and both the second image and the third image are images captured by the second camera module. The wavelength range corresponding to the first image is 390nm - 780nm, the wavelength range corresponding to the second image is 700nm - 2500nm, and the wavelength range corresponding to the third image is 200nm - 800nm; a generating module, configured to generate a target image according to the first image, the second image, and the third image.
[0007] In a third aspect, the embodiments of this application provide an electronic device, including a processor and a memory. The memory stores a program or instructions that can run on the processor. When the program or instructions are executed by the processor, the steps of the method in the first aspect are implemented.
[0008] Fourthly, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method in the first aspect are implemented.
[0009] Fifthly, 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 instruction to implement the steps of the method in the first aspect.
[0010] Sixthly, 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 in the first aspect.
[0011] In the embodiment of the present application, the second camera module acquires spectral information in different wavelength ranges, respectively records the multi-spectral information in different bands in the second image and the third image, and processes the first image according to the second image and the third image, so that when the first camera module of the image generation device captures the first image, it can automatically compensate the first image according to the second image and the third image captured by the second camera module. And the compensation method is to compensate the captured first image according to the images in different wavelength ranges, avoiding the influence of ambient light on the image output effect and improving the image effect of taking pictures. Description of the Drawings
[0012] Figure 1 Fig. 1 shows one of the schematic structural diagrams of the image generation device provided by the embodiment of the present application;
[0013] Figure 2 Fig. 2 shows one of the schematic flowcharts of the image generation method provided by the embodiment of the present application;
[0014] Figure 3 Fig. 3 shows another schematic structural diagram of the image generation device provided by the embodiment of the present application;
[0015] Figure 4 Fig. 4 shows another schematic flowchart of the image generation method provided by the embodiment of the present application;
[0016] Figure 5 Fig. 5 shows the schematic block diagram of the image generation device provided by the embodiment of the present application;
[0017] Figure 6 Fig. 6 shows the schematic block diagram of the electronic device according to the embodiment of the present application;
[0018] Figure 7 Fig. 7 is a schematic hardware structure diagram of an electronic device for implementing the embodiment of the present application.
[0019] Reference Numerals:
[0020] 100 Image generation device, 102 first camera module, 104 second camera module, 106 third camera module. Detailed implementation manners
[0021] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in 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.
[0022] 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 category, 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.
[0023] Next, in combination with the attached Figures 1 to 7 , the image generation method, image generation device, electronic device, and storage medium provided by the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0024] In some embodiments of the present application, an image generation method is provided, which is applied to an image generation device. Figure 1 FIG. shows one of the schematic structural diagrams of the image generation device provided by the embodiments of the present application. As Figure 1 shown, the image generation device 100 includes a first camera module 102 and a second camera module 104. The first camera module 102 is used to collect visible light information in the shooting environment with a wavelength range of 390 nm to 780 nm, and the second camera module 104 is used to collect multispectral information in the shooting environment with a wavelength range of 700 nm to 2500 nm and a wavelength range of 200 nm to 800 nm.
[0025] Figure 2 FIG. shows one of the schematic flowcharts of the image generation method provided by the embodiments of the present application. As Figure 2 shown, the image generation method includes:
[0026] Step 202: Obtain a first image, a second image, and a third image. The first image is an image captured by a first imaging module, and the second image and the third image are both images captured by a second imaging module. The wavelength range corresponding to the first image is 390 nm to 780 nm, the wavelength range corresponding to the second image is 700 nm to 2500 nm, and the wavelength range corresponding to the third image is 200 nm to 800 nm.
[0027] In the embodiment of the present application, after the image generation device receives an input to start shooting, the first imaging module and the second imaging module are controlled to run synchronously to collect visible light information and multi-spectral information in different wavelength bands in the shooting environment.
[0028] The frequency band range corresponding to the first image captured by the first shooting module is 390 nm to 780 nm. The first image is an RGB (red, green, blue) image, that is, a primary color image. The frequency band range corresponding to the second image captured by the second shooting module is 700 nm to 2500 nm, and the frequency band range corresponding to the third image is 200 nm to 800 nm. Both the second image and the third image include multi-spectral information.
[0029] Step 204: Generate a target image according to the first image, the second image, and the third image.
[0030] In the embodiment of the present application, a first imaging module and a second imaging module for collecting images in different frequency band ranges are provided in the image generation device. During the process of the image generation device shooting an image, the first image captured by the first imaging module, and the second image and the third image captured by the second imaging module are obtained. Since the multi-spectral information in the second image and the third image includes spectral information in different wavelength bands, therefore, by processing the first image with the second image and the third image, the influence caused by ambient light during the shooting of the first image can be eliminated, thereby improving the clarity of the first image.
[0031] Specifically, the wavelength range corresponding to the second image is 700 nm to 2500 nm, and the wavelength range corresponding to the third image is 200 nm to 800 nm. During the process of compensating and processing the first image with the second image and the third image, the first image can be compensated with multi-spectral information in different frequency band ranges, which can enrich the color information of the first image.
[0032] In the embodiments of the present application, the second camera module acquires spectral information in different wavelength ranges, records the multi-spectral information in different bands in the second image and the third image respectively, and processes the first image according to the second image and the third image, so that when the first camera module captures the first image, the image generation device can automatically compensate the first image according to the second image and the third image captured by the second camera module. Moreover, the compensation method is to compensate the captured first image according to the images in different wavelength ranges, avoiding the influence of ambient light on the image output effect and improving the captured image effect.
[0033] In some embodiments of the present application, generating a target image according to the first image, the second image, and the third image includes: performing a difference calculation on the first image and the second image to obtain a fourth image; performing a difference calculation on the first image and the third image to obtain a fifth image; and obtaining the target image according to the first image, the fourth image, and the fifth image.
[0034] In the embodiments of the present application, by subtracting the first image from the second image, a first spectral difference value between the first image and the second image can be obtained, and according to this first spectral difference value, a fourth image is generated. By subtracting the first image from the third image, a second spectral difference value between the first image and the third image can be obtained, and according to this second spectral difference value, a fifth image is generated.
[0035] Specifically, a fourth image can be generated through the first spectral difference value and the first mapping transformation relationship. The expression of the first mapping transformation relationship is shown in formula (1):
[0036]
[0037] where X n , Y n , Z n are the color mapping relationships of different wavelength bands in the fourth image respectively, are the matching values of different wavelength color functions respectively, and φ λ is the sensitivity of the second image wavelength band range.
[0038] A fifth image can be generated through the second spectral difference value and the second mapping transformation relationship. The expression of the second mapping transformation relationship is shown in formula (2):
[0039]
[0040] where X w , Y w , Z w are the color mapping relationships of different wavelength bands in the fifth image respectively, are the matching values of different wavelength color functions respectively, and φλ The sensitivity for the third image band range.
[0041] It should be noted that the fourth image can reflect the difference in RGB components between the first image and the second image, and the fifth image can reflect the difference in RGB components between the first image and the third image.
[0042] After determining the fourth image and the fifth image, since the fourth image and the fifth image can reflect the differences between the first image and the second image and the third image, and the second image and the third image include the multispectral information in the shooting environment of the first image, the RGB components of the first image can be corrected through the fourth image and the fifth image.
[0043] In the embodiments of the present application, by performing difference calculations based on the first image and the second image, and the first image and the third image respectively, the fourth image and the fifth image can be obtained. Since the fourth image and the fifth image can respectively reflect the differences between the first image and the second image and the third image, the RGB components of the first image can be accurately corrected through the fourth image and the fifth image, enriching the color information of the first image.
[0044] In some embodiments of the present application, a target image is obtained based on the first image, the fourth image, and the fifth image, including: performing color mapping on the fourth image and the fifth image respectively to obtain a first matrix and a second matrix; performing a multiplication operation on the first matrix and the second matrix to obtain a fused image; and correcting the first image based on the fused image to obtain the target image.
[0045] In the embodiments of the present application, after obtaining the fourth image and the fifth image, color mapping is performed on the fourth image and the fifth image respectively. Specifically, the fourth image and the fifth image are respectively mapped from the RGB color space to the XYZ domain color space to obtain a first matrix and a second matrix. The first matrix is the matrix corresponding to the fourth image in the XYZ domain color space, and the second matrix is the matrix corresponding to the fifth image in the XYZ domain color space.
[0046] Specifically, the fourth image and the fifth image are respectively color-mapped through the following formula (3) to obtain the corresponding first matrix and second matrix. Formula (3) is as follows:
[0047]
[0048] Wherein, X, Y, and Z are the color channel values of the fourth image or the fifth image in the XYZ color space, M XYZ→RGB is the color mapping relationship, and R multi , G multi , B multi are the color channel values of the fourth image or the fifth image in the RGB color space.
[0049] By performing color mapping on the fourth image and the fifth image, a first matrix and a second matrix are obtained. The first matrix is the color matrix of the fourth image in the XYZ domain color space, and the second matrix is the color matrix of the fifth image in the XYZ domain color space.
[0050] After obtaining the first matrix and the second matrix, by performing a multiplication calculation on the first matrix and the second matrix, a fused image is obtained.
[0051] Specifically, after performing a multiplication calculation on the first matrix and the second matrix, a third matrix is obtained. The third matrix is the color matrix corresponding to the fused image in the XYZ domain color space. By mapping the third matrix in the XYZ domain color space to the RGB color space, the fused image is obtained. The fused image can be calculated through the following formulas (4) and (5):
[0052] M multi→RGB =[M R ×M G ×M B (4);
[0053]
[0054] where R, G, and B are the color channel values of the fused image in the RGB space, M R , M G , M B are the matrices of the fused image in the R channel, G channel, and B channel, and R multi , G multi , B multi are the color channel values of the fourth image or the fifth image in the RGB color space.
[0055] When the fused image is calculated, the color components of the first image in the RGB channels are corrected by the fused image. Specifically, when there is a difference between the color components in the RGB channels of the first image and the color components of the fused image, the color attributes of the first image, that is, the RGB values of the first image, are corrected according to their mapping relationship.
[0056] It should be noted that when detecting whether there is a difference in the color components between the first image and the fused image, by comparing the values of R / G (R channel value / G channel value) and B / G (B channel value / G channel value) in the first image and the fused image, when a difference is detected between the two, the first image is corrected by the fused image.
[0057] In the embodiments of the present application, by performing color mapping on the fourth image and the fifth image, a first matrix and a second matrix in the XYZ domain color space can be obtained, and by using the product of the first matrix and the second matrix as the fused image to correct the color information of the first image, the effect of automatically correcting the first image is achieved.
[0058] In some embodiments of the present application, correcting the first image based on the fused image to obtain a target image includes: determining gain value information based on the fused image and the first image; correcting the first image according to the gain value information to obtain the target image.
[0059] In the embodiments of the present application, in the process of correcting the first image by using the fused image, it is necessary to determine gain value information according to the fused image and the first image, and the gain value information is used to correct the first image.
[0060] Specifically, the R / G value and B / G value of different images captured by different camera modules under the same light source are usually fixed within a certain range. Therefore, according to the R / G value and B / G value in the fused image and the first image, the pixels in the first image are classified and counted, and then the shooting environment is determined according to the light source color temperature corresponding to the shooting environment, and the gain value information is determined accordingly. The gain value information includes the gain values corresponding to the R, G, and B channels respectively. The first image is corrected according to the gain value, so that the R / G value and B / G value of the target image are equal to the R / G value and B / G value in the fused image.
[0061] The gain value information includes R gain 、G gain 、B gain ,where R gain 、G gain 、B gain are the gain values corresponding to the R channel, G channel, and B channel respectively.
[0062] In the embodiments of the present application, after determining the gain value information, the values of the RGB channels of the first image are respectively multiplied by the corresponding gain values in the gain value information, so as to obtain the target image after adjusting the image white balance, as shown in formula (6) specifically:
[0063]
[0064] where R gain 、G gain 、B gain are the gain values corresponding to the R channel, G channel, and B channel respectively, R, G, and B are the color channel values of the first image, and R new 、G new 、B new are the color channel values of the target image.
[0065] In the embodiments of the present application, the gain value information for correcting the first image can be determined according to the first image and the fused image, and the first image is color-corrected according to the gain value information, realizing the automatic correction of the first image and ensuring the image effect of the corrected first image.
[0066] In some embodiments of the present application, correcting the first image based on the fused image to obtain a target image includes: obtaining the global average brightness value of the first image; obtaining the brightness difference corresponding to each image region based on the region average brightness value and the global average brightness value corresponding to each image region in the fused image; compensating the brightness value corresponding to each image region in the first image based on the brightness difference corresponding to each image region to obtain the target image.
[0067] In the embodiments of the present application, the global average brightness value of the first image is obtained by calculating the average value of the brightness values of each pixel in the first image, that is, the global average brightness value is the average brightness value of all pixels. Each image region in the fused image is obtained by dividing the fused image into multiple image regions, and the region average brightness value corresponds one-to-one with the image region. Each image region corresponds to a region average brightness value, and the region average brightness value is the average brightness value of all pixels in the corresponding image region.
[0068] By calculating the difference between multiple region average brightness values and the global average brightness value, the brightness difference corresponding to each image region can be obtained, and the brightness values of each image region in the first image are compensated according to the brightness difference, thereby obtaining the target image.
[0069] Specifically, if the first image is an image with a size of M×N pixels, then the fused image is also an image with a size of M×N pixels. To calculate the global average brightness value of the first image, the fused image is cut into multiple pixel blocks with a size of m×n pixels, and each pixel block corresponds to an image region in the first image. Calculate the average brightness value of each pixel block in the multiple pixel blocks, that is, the region average brightness value. Calculate the difference between the global average brightness value and the region average brightness values corresponding to the multiple image regions to obtain the brightness differences corresponding to the multiple image regions, and perform brightness compensation on the corresponding image regions in the first image according to the brightness differences. The compensated first image is the target image.
[0070] The global average brightness value is the average brightness value of each pixel in the first image, and the calculation method is shown in formula (7):
[0071]
[0072] where Lum av is the global average brightness value, p(i, j) is the brightness value, and M×N is the pixel matrix of the first image.
[0073] The regional average luminance value is the average luminance value of the image region in the fused image, and the calculation method is as shown in formula (8):
[0074]
[0075] where Lum multi is the regional average luminance value, p(i, j) is the luminance value, and m×n is the pixel matrix of a single pixel block.
[0076] The luminance difference is the difference between the regional average luminance value and the global average luminance value. Specifically, the global average luminance value minus the regional average luminance value gives the luminance difference, and the calculation method is as shown in formula (9);
[0077] △Lum 1 = Lum av - Lum multi (9)
[0078] where △Lum 1 is the luminance difference, Lum av is the global average luminance value, and Lum multi is the regional average luminance value.
[0079] Since the color performance of the target image is affected by the ambient luminance, adjusting the luminance of the first image through the fused image can effectively avoid color cast caused by the influence of ambient light.
[0080] In the embodiments of the present application, by dividing the fused image into multiple image regions and taking the difference between the regional average luminance value of the multiple image regions and the global average luminance value of the first image, the luminance difference corresponding to each image region in the first image can be obtained, so as to perform luminance compensation on the image regions in the corresponding first image according to the luminance difference, realizing luminance compensation for each image region in the first image and improving the accuracy of adjusting the luminance of the first image.
[0081] In some embodiments of the present application, compensating the luminance values corresponding to the respective image regions in the first image based on the luminance differences corresponding to the respective image regions includes: determining a first target image region in the first image according to the luminance differences corresponding to the respective image regions; reducing the luminance value corresponding to the first target image region when the luminance difference corresponding to the first target image region is greater than a first threshold; and enhancing the luminance value corresponding to the first target image region when the luminance difference corresponding to the first target region is less than a second threshold.
[0082] In the embodiments of the present application, each brightness difference corresponds one-to-one to each image region in the first image. When it is detected that the brightness difference corresponding to any image region is within a preset difference range, it is determined that the image region is the first target image region that needs to be adjusted in brightness. Among them, the preset difference range is greater than the first threshold or less than the second threshold, and the second threshold is less than the first threshold. Specifically, when the brightness difference is within the preset difference range, it is determined that the first target image region corresponding to the brightness difference is an image region with a higher or lower brightness, and the brightness value of the first target image region needs to be adjusted.
[0083] In the process of adjusting the brightness value of the first target image region, it is necessary to determine whether the brightness of the image region in the first image is too high or too low. When it is detected that the brightness difference is greater than the first threshold, it is determined that the corresponding first target image region has too high brightness. At this time, the brightness of the first target image region is attenuated and suppressed to reduce the brightness value of the first target image region. When it is detected that the brightness difference is less than the second threshold, it is determined that the first target image region has too low brightness, and the brightness of the image region is enhanced.
[0084] It should be noted that since the brightness difference is the global average brightness value minus the regional average brightness value, the first threshold is a positive number and the second threshold is a negative number. When the brightness difference is greater than the first threshold, it is determined that the brightness of the first target image region is too high. When the brightness difference is less than the first threshold, it is determined that the brightness of the first target image region is too low.
[0085] In the embodiments of the present application, according to the numerical relationship between the brightness difference corresponding to each image region in the first image and the first threshold and the second threshold, the first target image region that needs to be adjusted in brightness among multiple image regions in the first image is accurately determined. And according to the numerical relationship between the brightness value difference corresponding to the first target image region and the first threshold and the second threshold, it is determined whether the brightness of the first target image region is too high or too low, and accordingly, the corresponding adjustment method is executed for the first target image region, improving the accuracy of adjusting the brightness value of the first image and avoiding color cast caused by the influence of ambient light on the captured image.
[0086] In some embodiments of the present application, the image generation device further includes a third camera module. The target image is obtained according to the first image, the fourth image, and the fifth image, including: identifying the image features of the sixth image collected by the third camera module; determining the second target image region of the first image according to the image features, where the second target image region corresponds to the third target image region, and the third target image region is the image region in the sixth image whose image features meet the target conditions; and updating the color information corresponding to the second target image region based on the fourth image and the fifth image to obtain the target image.
[0087] Figure 3 FIG. 2 shows a second schematic structural diagram of the image generation device provided in the embodiment of the present application. As Figure 3 shown, the image generation device 100 includes a first camera module 102, a second camera module 104, and a third camera module 106. The third camera module 106 may be a multi-modal camera module. The third camera module 106 is capable of collecting a sixth image, and the sixth image includes multi-spectral information. The sixth image corresponds to the image content of the first image. The third camera module is capable of identifying the image features in the sixth image and determining the second target image area in the first image based on the image features. Specifically, when the sixth image is collected by the third camera module, the third target image area in the sixth image is determined according to the identified image features, and the image features of the images in the third target image area meet the target conditions.
[0088] Exemplarily, when the user selects the portrait shooting mode through the electronic device, the third camera module can identify the portrait area in the sixth image according to the image features in the collected sixth image. The portrait area is the third target image area in the sixth image, that is, the portrait features in the portrait area are the image features that meet the target conditions, and the corresponding portrait area in the first image is determined as the second target image area.
[0089] Exemplarily, when the user selects the landscape shooting mode through the electronic device, the third camera module can identify the background area in the sixth image according to the image features in the collected sixth image. The background area is the third target image area in the sixth image, that is, the landscape features in the background area are the image features that meet the target conditions, and the corresponding background area in the first image is determined as the second target image area.
[0090] After determining the second target image area in the first image, the color information in the second target image area is updated according to the fourth image and the fifth image to obtain the target image, realizing the automatic identification of the second target image area that needs to be corrected in the first image and automatically correcting the color information of the second target image area.
[0091] In the embodiment of the present application, before correcting the color information of the first image according to the fourth image and the fifth image, the electronic device can screen the second target image area that needs to be compensated in the first image according to the image features in the sixth image captured by the third camera module, so that when compensating the first image according to the fourth image and the fifth image, only the second target image area is compensated, making the image effect of the captured picture conform to the shooting mode.
[0092] In some embodiments of the present application, based on the fourth image and the fifth image, the color information corresponding to the second target image region is updated to obtain a target image, including: respectively updating the color information of the fourth image and the fifth image to obtain updated color information; determining target spectral information according to the updated color information; determining saturation weight information according to the color saturation information of the second target image region and the target spectral information; and updating the color information of the second target image region according to the updated color information and the saturation weight information to obtain a target image.
[0093] In the embodiments of the present application, in the process of updating the color information corresponding to the second target image region through the fourth image and the fifth image, in order to avoid deviations in the spectral color gamut, it is necessary to update the color information of the fourth image and the fifth image to obtain updated color information, and the updated color information includes the updated color information of the fourth image and the fifth image.
[0094] Specifically, the color information of the fourth image and the fifth image is updated through the following formula (10), and formula (10) is as follows:
[0095]
[0096] Wherein, R λ , G λ , B λ are the color information of the updated fourth image or fifth image, Y w is the brightness value of the white pixel collected by the second camera module, R w , G w , B w are the color channel values of the white point in the first image corrected by the gain value information, R, G, B are the color channel values of the first image, and D is an adaptive factor.
[0097] Exemplarily, the value range of the adaptive factor D is 0 ≤ D < 1.
[0098] Specifically, in the process of calculating the color information of the fourth image through the above formula (10), Y w is set as the brightness value of the white pixel in the fourth image, and in the process of calculating the color information of the fifth image, Y w is set as the brightness value of the white pixel in the fifth image. Through the above formula (10), the fourth image and the fifth image can be updated respectively to obtain R λ , G λ , B λ corresponding to the fourth image and the fifth image.
[0099] After performing an update process on the color information of the fourth image and the fifth image to obtain the updated color information of the fourth image and the fifth image, the target spectral information is calculated based on the updated color information, spectral range information, and target brightness difference of the fourth image and the fifth image. This target spectral information is the corrected multispectral information.
[0100] Specifically, the target spectral information is calculated using the following formula (11), and formula (11) is as follows:
[0101]
[0102] Where I is the target spectral information, R λ 、G λ 、B λ are the color channel values of the updated fourth image and fifth image, a and b are correction coefficients, NIR is the spectral range, and △Lum 2 is the target brightness difference.
[0103] Exemplarily, the value range of the correction coefficient a is 0 < a ≤ 1, and the value range of the correction coefficient b is 0 < b ≤ 1.
[0104] If a difference is detected between the brightness values of the fourth image and the fifth image and the brightness threshold, the target brightness difference is calculated.
[0105] After calculating the target spectral information, the saturation weight information is calculated based on the target spectral information and the color saturation information of the second target image area in the first image.
[0106] Specifically, the saturation weight information is calculated using the following formula (12), and formula (12) is as follows:
[0107]
[0108] Where S i(x,y) is the saturation weight information, R (x,y) 、G (x,y) 、B (x,y) respectively represent the color saturation of the second target image area in the RGB channels, and I is the target spectral information.
[0109] After calculating the saturation weight information, the updated color information of the second target image area can be calculated based on the updated color information of the fourth image and the fifth image and the saturation weight information.
[0110] Specifically, the updated color information of the second target image area is calculated using the following formula (13), and formula (13) is as follows:
[0111]
[0112] Among them, S i(x,y) is the saturation weight information, and R λ , G λ , B λ are the color information of the updated fourth and fifth images, and R, G, and B are the color information of the second target image area.
[0113] In the embodiments of the present application, by first updating the fourth and fifth images, calculating the saturation weight information after the update, and updating the color information in the second target area based on the saturation weight information, in the case of a brighter shooting environment, the color and saturation of the second target area are improved, and the brightness of the second target area is reduced. In the case of a darker shooting environment, light compensation can be performed on the second target area, the saturation of the target image is improved, and the problem of color cast is avoided.
[0114] In some embodiments of the present application, after updating the color information of the second target image area according to the color information and saturation weight information of the updated fourth and fifth images, it further includes: configuring special effect information for the target image according to the feature information, where the feature information is associated with the image features extracted from the sixth image.
[0115] In the embodiments of the present application, after generating the target image, the electronic device can configure corresponding special effect information for the target image according to the image features in the sixth image.
[0116] Exemplarily, in the case where the target image includes portrait features, the third camera module can recognize the feature information of the portrait features, and the feature information includes emotion information. The electronic device automatically configures corresponding image special effects according to the emotion information. The feature information also includes makeup information, and the electronic device can configure corresponding image special effects according to the makeup information.
[0117] It should be noted that the third camera module can also collect multispectral information, and according to the multispectral information combined with image recognition technology, the feature information in the sixth image can be accurately recognized.
[0118] In the embodiments of the present application, after generating the target image, corresponding image features are set for the target image through the multispectral information and feature information in the sixth image, further improving the shooting effect of the image.
[0119] Figure 4 Shows the second flowchart of the image generation method provided by the embodiments of the present application. As Figure 4 shown, the image generation method includes:
[0120] Step 402, collect a first image through a first imaging module, collect a second image and a third image through a second imaging module, and collect a sixth image through a third imaging module;
[0121] Step 404, determine a fourth image based on the first image and the second image, and determine a fifth image based on the first image and the third image;
[0122] Step 406, determine gain value information of the first image based on a fused image of the fourth image and the fifth image, correct the first image according to the gain value information, and compensate the brightness values of each image region in the first image according to the regional average brightness value of the fused image of the fourth image and the fifth image and the global average brightness value of the first image, and determine a second target image region in the first image according to the image features of the sixth image, and update the color information of the second target image region according to the fourth image and the fifth image;
[0123] Step 408, obtain a target image;
[0124] Step 410, configure special effect information for the target image based on the image features in the sixth image.
[0125] In the embodiments of the present application, both the second imaging module and the third imaging module can collect multispectral information. The multispectral information collected by the second imaging module generates a second image and a third image. The wavelength range corresponding to the first image collected by the first imaging module is 390 nm to 780 nm, the wavelength range corresponding to the second image is 700 nm to 2500 nm, and the wavelength range corresponding to the third image is 200 nm to 800 nm.
[0126] After the second image and the third image are collected, a fourth image is generated based on the first image and the second image, and a fifth image is generated based on the first image and the third image. The first image is processed through the fourth image and the fifth image to obtain a target image.
[0127] Processing the first image through the fourth image and the fifth image includes:
[0128] Determine a fused image of the fourth image and the fifth image. Specifically, after converting the fourth image and the fifth image to the XYZ domain color space, a first matrix and a second matrix are obtained. Multiply the first matrix and the second matrix to obtain a third matrix, and map the color of the third matrix to the RGB color space to obtain a fused image.
[0129] Determine gain value information for compensating the first image according to the fused image, and compensate the first image through the gain value information.
[0130] Divide the fused image into multiple image regions, calculate the regional average luminance value of each image region, and the global average luminance value of the first image. Compensate the luminance values of the respective image regions according to the luminance difference between the global average luminance value range and the regional average luminance values of each region.
[0131] Identify the image features in the sixth image. Since the image parameters of the sixth image are the same as those of the first image, the second target image region in the first image can be found according to the third target image region where the image features are located. Determine the color saturation weight information of the second target image region according to the fourth image and the fifth image, and update the color information of the second target image region in the first image according to the color saturation weight information.
[0132] After the above steps of processing the first image, a target image is obtained.
[0133] Determine the special effect information to be configured into the target image according to the feature information in the sixth image. Configure the special effect for the target image according to the special effect information.
[0134] In the embodiments of the present application, the second image and the third image collected by the second camera module, and the sixth image collected by the third camera module can be used to compensate the first image, thereby eliminating the interference of ambient light on the shooting process and performing light compensation. And it can also configure special effects for the compensated first image according to the feature information in the sixth image. For the image generation method provided in the embodiments of the present application, the execution subject can 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 in the embodiments of the present application is described.
[0135] In some embodiments of the present application, an image generation device is provided. The image generation device includes a first camera module and a second camera module. Figure 5 The structural schematic diagram of the image generation device 500 provided in the embodiments of the present application is shown, as Figure 5 shown, the image generation device 500 includes:
[0136] An acquisition module 502, configured to acquire a first image, a second image, and a third image. The first image is an image acquired by the first camera module, and the second image and the third image are both images acquired by the second camera module. The wavelength range corresponding to the first image is 390nm - 780nm, the wavelength range corresponding to the second image is 700nm - 2500nm, and the wavelength range corresponding to the third image is 200nm - 800nm;
[0137] A generation module 504, configured to generate a target image according to the first image, the second image, and the third image.
[0138] In the embodiments of the present application, the second imaging module acquires spectral information in different wavelength ranges, records the multi-spectral information of different bands in the second image and the third image respectively, and processes the first image according to the second image and the third image, realizing that when the first imaging module acquires the first image, the image generation device can automatically compensate the first image according to the second image and the third image acquired by the second imaging module. And the compensation method is to compensate the acquired first image according to the images in different wavelength ranges, avoiding the influence of ambient light on the image output effect and improving the image effect of shooting.
[0139] In some embodiments of the present application, the image generation device 500 further includes:
[0140] A calculation module, configured to perform a difference calculation according to the first image and the second image to obtain a fourth image;
[0141] The calculation module is further configured to perform a difference calculation according to the first image and the third image to obtain a fifth image;
[0142] A generation module 504, further configured to obtain a target image according to the first image, the fourth image, and the fifth image.
[0143] In the embodiments of the present application, by performing difference calculations according to the first image and the second image, and the first image and the third image respectively, a fourth image and a fifth image can be obtained. Since the fourth image and the fifth image can respectively reflect the differences between the first image and the second image and the third image, the RGB components of the first image can be accurately corrected through the fourth image and the fifth image, enriching the color information of the first image.
[0144] In some embodiments of the present application, the image generation device 500 further includes:
[0145] A mapping module, configured to perform color mapping on the fourth image and the fifth image respectively to obtain a first matrix and a second matrix;
[0146] A calculation module, configured to perform a multiplication operation on the first matrix and the second matrix to obtain a fused image;
[0147] A correction module, configured to correct the first image based on the fused image to obtain a target image.
[0148] In the embodiments of the present application, by performing color mapping on the fourth image and the fifth image, a first matrix and a second matrix in the XYZ domain color space can be obtained, and the color information of the first image is corrected by using the product of the first matrix and the second matrix as the fused image, realizing the effect of automatically correcting the first image.
[0149] In some embodiments of the present application, the image generation device 500 further includes:
[0150] A first determination module, configured to determine gain value information based on the fused image and the first image;
[0151] A correction module, further configured to correct the first image according to the gain value information to obtain a target image.
[0152] In the embodiments of the present application, the gain value information for correcting the first image can be determined according to the first image and the fused image, and the first image is color-corrected according to the gain value information, realizing automatic correction of the first image and ensuring the image effect of the corrected first image.
[0153] In some embodiments of the present application, an acquisition module 502 is configured to acquire the global average brightness value of the first image;
[0154] The image generation device further includes:
[0155] A second determination module, configured to obtain the brightness difference corresponding to each image region based on the region average brightness value and the global average brightness value corresponding to each image region in the fused image;
[0156] The second determination module is configured to compensate the brightness value corresponding to each image region in the first image based on the brightness difference corresponding to each image region to obtain a target image.
[0157] In the embodiments of the present application, by dividing the fused image into multiple image regions and subtracting the global average brightness value of the first image from the region average brightness value of the multiple image regions, the brightness difference corresponding to each image region in the first image can be obtained, so as to perform brightness compensation on the image regions in the corresponding first image according to the brightness difference, realizing brightness compensation for each image region in the first image and improving the accuracy of adjusting the brightness of the first image.
[0158] In some embodiments of the present application, the second determination module is further configured to determine a first target image region in the first image according to the brightness difference corresponding to each image region;
[0159] The image generation device further includes:
[0160] An adjustment module, configured to reduce the brightness value corresponding to the first target image region when the brightness difference corresponding to the first target image region is greater than a first threshold;
[0161] The adjustment module is configured to enhance the brightness value corresponding to the first target image region when the brightness difference corresponding to the first target region is less than a second threshold.
[0162] In the embodiments of the present application, according to the numerical relationship between the brightness difference corresponding to each image region in the first image and the first threshold and the second threshold, the first target image region whose brightness value needs to be adjusted among the multiple image regions in the first image is accurately determined. And according to the numerical relationship between the brightness value difference corresponding to the first target image region and the first threshold and the second threshold, it is determined whether the brightness of the first target image region is too high or too low, and accordingly, the corresponding adjustment method is performed on the first target image region, which improves the accuracy of adjusting the brightness value of the first image and avoids color cast caused by the influence of ambient light on the captured image.
[0163] In some embodiments of the present application, the image generating device 500 further includes a third imaging module;
[0164] The image generating device 500 further includes:
[0165] An identification module, configured to identify the image features of the sixth image collected by the third imaging module;
[0166] A third determination module, configured to determine a second target image region of the first image according to the image features, where the second target image region corresponds to a third target image region, and the third target image region is an image region in the sixth image whose image features meet the target conditions;
[0167] An update module, configured to update the color information corresponding to the second target image region based on the fourth image and the fifth image to obtain a target image.
[0168] In the embodiments of the present application, before correcting the color information of the first image through the fourth image and the fifth image, the electronic device can screen the second target image region that needs to be compensated in the first image according to the image features in the sixth image captured by the third imaging module, so that when compensating the first image according to the fourth image and the fifth image, only the second target image region is compensated, making the image effect of the captured image conform to the shooting mode.
[0169] In some embodiments of the present application, the update module is further configured to update the color information of the fourth image and the fifth image respectively to obtain updated color information;
[0170] The third determination module is further configured to determine target spectral information according to the updated color information;
[0171] The third determination module is further configured to determine saturation weight information according to the color saturation information of the second target image region and the target spectral information;
[0172] The update module is further configured to update the color information of the second target image region according to the updated color information and the saturation weight information to obtain a target image.
[0173] In the embodiments of the present application, by first updating the fourth image and the fifth image, calculating the saturation weight information after the update, and updating the color information in the second target area based on the saturation weight information, in the case of a brighter shooting environment, the color and saturation of the second target area are improved, and the brightness of the second target area is reduced. In the case of a darker shooting environment, the second target area can be compensated for illumination, the saturation of the target image is increased, and the problem of color cast is avoided.
[0174] In some embodiments of the present application, the image generation device 500 further includes:
[0175] A configuration module, configured to configure special effect information for the target image according to the feature information, where the feature information is associated with the image features extracted from the sixth image.
[0176] In the embodiments of the present application, after the target image is generated, corresponding image features are set for the target image through the multispectral information and feature information in the sixth image, further improving the shooting effect of the image.
[0177] 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 the 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. It 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.
[0178] The image generation device in the embodiments 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. The embodiments of the present application do not make specific limitations.
[0179] 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, it will not be elaborated here.
[0180] Optionally, the embodiments of the present application further provide an electronic device, which includes the image generation device in any of the above embodiments, and thus has all the beneficial effects of the image generation device in any of the embodiments. There is no need to elaborate here too much.
[0181] Optionally, the embodiments of the present application further provide an electronic device Figure 6 which shows a structural block diagram of the electronic device according to the embodiments of the present application, as Figure 6 shown, the electronic device 600 includes a processor 602, a memory 604, a program or instruction stored on the memory 604 and executable on the processor 602. When the program or instruction is executed by the processor 602, it implements each process of the above image generation method embodiments and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0182] It should be noted that the electronic device in the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0183] Figure 7 It is a schematic diagram of the hardware structure of an electronic device for implementing the embodiments of the present application.
[0184] 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 and other components.
[0185] 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 realize functions such as management of 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 some components, or have different component arrangements. There is no need to elaborate here.
[0186] Among them, the processor 710 is used to obtain a first image, a second image, and a third image. The first image is an image collected by a first camera module, and the second image and the third image are both images collected by a second camera module. The wavelength range corresponding to the first image is 390 nm to 780 nm, the wavelength range corresponding to the second image is 700 nm to 2500 nm, and the wavelength range corresponding to the third image is 200 nm to 800 nm;
[0187] A processor 710 for generating a target image based on a first image, a second image, and a third image.
[0188] In an embodiment of the present application, the second camera module acquires spectral information within different wavelength ranges, records the multi-spectral information of different bands in the second image and the third image respectively, and processes the first image according to the second image and the third image, so that when the first camera module captures the first image, the image generation device can automatically compensate the first image according to the second image and the third image captured by the second camera module. And the compensation method is to compensate the captured first image according to the images within different wavelength ranges, avoiding the influence of ambient light on the image output effect and improving the image effect of the captured image.
[0189] Optionally, the processor 710 is configured to perform a difference calculation based on the first image and the second image to obtain a fourth image;
[0190] The processor 710 is configured to perform a difference calculation based on the first image and the third image to obtain a fifth image;
[0191] The processor 710 is configured to obtain a target image based on the first image, the fourth image, and the fifth image.
[0192] In an embodiment of the present application, by performing difference calculations based on the first image and the second image, and the first image and the third image respectively, a fourth image and a fifth image can be obtained. Since the fourth image and the fifth image can respectively reflect the differences between the first image and the second image and the third image, the RGB components of the first image can be accurately corrected through the fourth image and the fifth image, enriching the color information of the first image.
[0193] Optionally, the processor 710 is configured to perform color mapping on the fourth image and the fifth image respectively to obtain a first matrix and a second matrix;
[0194] The processor 710 is configured to perform a multiplication operation on the first matrix and the second matrix to obtain a fused image;
[0195] The processor 710 is configured to correct the first image based on the fused image to obtain a target image.
[0196] In an embodiment of the present application, by performing color mapping on the fourth image and the fifth image, a first matrix and a second matrix in the XYZ color space can be obtained, and the color information of the first image is corrected by using the product of the first matrix and the second matrix as the fused image, achieving the effect of automatically correcting the first image.
[0197] Optionally, a processor 710 is configured to determine gain value information based on the fused image and the first image;
[0198] The processor 710 is configured to correct the first image according to the gain value information to obtain a target image.
[0199] In the embodiments of the present application, the gain value information for correcting the first image can be determined according to the first image and the fused image, and the first image is color-corrected according to the gain value information, so as to automatically correct the first image and ensure the image effect of the corrected first image.
[0200] Optionally, the processor 710 is configured to obtain the global average brightness value of the first image;
[0201] The processor 710 is configured to obtain the brightness difference corresponding to each image region based on the region average brightness value and the global average brightness value corresponding to each image region in the fused image;
[0202] The processor 710 is configured to compensate the brightness value corresponding to each image region in the first image based on the brightness difference corresponding to each image region to obtain a target image.
[0203] In the embodiments of the present application, by dividing the fused image into multiple image regions and subtracting the global average brightness value of the first image from the region average brightness value of the multiple image regions, the brightness difference corresponding to each image region in the first image can be obtained, so as to perform brightness compensation on the image regions in the corresponding first image according to the brightness difference, realizing brightness compensation for each image region in the first image and improving the accuracy of adjusting the brightness of the first image.
[0204] Optionally, the processor 710 is configured to determine a first target image region in the first image according to the brightness difference corresponding to each image region;
[0205] The processor 710 is configured to reduce the brightness value corresponding to the first target image region when the brightness difference corresponding to the first target image region is greater than a first threshold;
[0206] The processor 710 is configured to enhance the brightness value corresponding to the first target image region when the brightness difference corresponding to the first target region is less than a second threshold.
[0207] In the embodiments of the present application, according to the numerical relationship between the brightness difference corresponding to each image region in the first image and the first threshold and the second threshold, the first target image region whose brightness value needs to be adjusted among the multiple image regions in the first image is accurately determined. And according to the numerical relationship between the brightness value difference corresponding to the first target image region and the first threshold and the second threshold, it is determined whether the brightness of the first target image region is too high or too low, and accordingly, the corresponding adjustment method is performed on the first target image region, improving the accuracy of adjusting the brightness value of the first image and avoiding color cast caused by the influence of ambient light on the captured image.
[0208] Optionally, the image generating device further includes a third camera module;
[0209] The processor 710 is configured to identify the image features of the sixth image collected by the third camera module;
[0210] The processor 710 is configured to determine the second target image region of the first image according to the image features, where the second target image region corresponds to the third target image region, and the third target image region is the image region in the sixth image whose image features meet the target conditions;
[0211] The processor 710 is configured to update the color information corresponding to the second target image region based on the fourth image and the fifth image to obtain the target image.
[0212] In the embodiments of the present application, before correcting the color information of the first image through the fourth image and the fifth image, the electronic device can screen the second target image region that needs to be compensated in the first image according to the image features in the sixth image captured by the third camera module, so that when compensating the first image according to the fourth image and the fifth image, only the second target image region is compensated, making the image effect of the captured image match the shooting mode.
[0213] Optionally, the processor 710 is configured to update the color information of the fourth image and the fifth image respectively to obtain the updated color information;
[0214] The processor 710 is configured to determine the target spectral information according to the updated color information;
[0215] The processor 710 is configured to determine the saturation weight information according to the color saturation information of the second target image region and the target spectral information;
[0216] The processor 710 is configured to update the color information of the second target image region according to the updated color information and the saturation weight information to obtain the target image.
[0217] In the embodiments of the present application, by first updating the fourth image and the fifth image, calculating saturation weight information after the update, and updating the color information in the second target area based on the saturation weight information, in the case of a relatively bright shooting environment, the color and saturation of the second target area are improved, and the brightness of the second target area is reduced. In the case of a relatively dark shooting environment, the second target area can be compensated for illumination, the saturation of the target image is improved, and the problem of color cast is avoided.
[0218] Optionally, the processor 710 is configured to configure special effect information for the target image according to the feature information, and the feature information is associated with the image features extracted from the sixth image.
[0219] In the embodiments of the present application, after the target image is generated, corresponding image features are set for the target image through the multi-spectral information and feature information in the sixth image, further improving the shooting effect of the image.
[0220] 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 the static pictures or videos obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of 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 called 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, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0221] 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 can 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 can include volatile memory or non-volatile memory, or the memory 709 can include both volatile and non-volatile memory. Among them, the non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 709 in the embodiments of the present application includes but is not limited to these and any other suitable types of memory.
[0222] 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.
[0223] 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 method embodiments and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0224] Among them, the processor is the processor in the electronic device 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.
[0225] 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 embodiment of the image generation method, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0226] 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.
[0227] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above embodiment of the image generation method, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0228] 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 explicitly listed, or also includes elements inherent to such process, method, article, or device. Without more limitations, the element defined by the statement "including one..." 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.
[0229] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods in the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it 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. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present application.
[0230] 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 embodiments. The above specific embodiments 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 fall within the protection scope of the present application.
Claims
1. An image generation method, applied to an image generation device, characterized in that, the image generation device includes a first camera module and a second camera module, and the image generation method includes: Obtain a first image, a second image, and a third image. The first image is an image collected by the first camera module, and both the second image and the third image are images collected by the second camera module. The wavelength range corresponding to the first image is 390nm - 780nm, the wavelength range corresponding to the second image is 700nm - 2500nm, and the wavelength range corresponding to the third image is 200nm - 800nm; Generate a target image according to the first image, the second image, and the third image; The step of generating a target image according to the first image, the second image, and the third image includes: Perform a difference calculation according to the first image and the second image to obtain a fourth image; Perform a difference calculation according to the first image and the third image to obtain a fifth image; Obtain the target image according to the first image, the fourth image, and the fifth image.
2. The image generation method according to claim 1, characterized in that, the step of obtaining the target image according to the first image, the fourth image, and the fifth image includes: perform color mapping on the fourth image and the fifth image respectively to obtain a first matrix and a second matrix; Perform a multiplication operation on the first matrix and the second matrix to obtain a fused image; Correct the first image based on the fused image to obtain the target image.
3. The image generation method according to claim 2, characterized in that, the step of correcting the first image based on the fused image to obtain the target image includes: Determine gain value information based on the fused image and the first image; Correct the first image according to the gain value information to obtain the target image.
4. The image generation method according to claim 2, characterized in that, the step of correcting the first image based on the fused image to obtain the target image includes: Obtain the global average brightness value of the first image; Based on the regional average brightness value corresponding to each image region in the fused image and the global average brightness value, obtain the brightness difference corresponding to each image region; Compensate the brightness value corresponding to each image region in the first image based on the brightness difference corresponding to each image region to obtain the target image.
5. The image generation method according to claim 4, characterized in that, the step of compensating the brightness value corresponding to each image region in the first image based on the brightness difference corresponding to each image region includes: Determine a first target image region in the first image according to the brightness difference corresponding to each image region; When the brightness difference corresponding to the first target image region is greater than a first threshold, reduce the brightness value corresponding to the first target image region; When the luminance difference corresponding to the first target area is less than a second threshold, enhance the luminance value corresponding to the first target image area.
6. The image generation method according to claim 1, wherein, the image generation device further includes a third camera module, and obtaining the target image according to the first image, the fourth image, and the fifth image includes: identifying the image features of a sixth image collected by the third camera module; determining a second target image area of the first image according to the image features, wherein the second target image area corresponds to a third target image area, and the third target image area is an image area in the sixth image where the image features meet a target condition; updating the color information corresponding to the second target image area based on the fourth image and the fifth image to obtain the target image.
7. The image generation method according to claim 6, wherein, the updating the color information corresponding to the second target image area based on the fourth image and the fifth image to obtain the target image includes: respectively updating the color information of the fourth image and the fifth image to obtain updated color information; determining target spectral information according to the updated color information; determining saturation weight information according to the color saturation information of the second target image area and the target spectral information; updating the color information of the second target image area according to the updated color information and the saturation weight information to obtain the target image.
8. An image generation device, wherein, the image generation device includes a first camera module and a second camera module, and the image generation device includes: an acquisition module, configured to acquire a first image, a second image, and a third image, where the first image is an image acquired by the first camera module, the second image and the third image are both images acquired by the second camera module, the wavelength range corresponding to the first image is 390 nm to 780 nm, the wavelength range corresponding to the second image is 700 nm to 2500 nm, and the wavelength range corresponding to the third image is 200 nm to 800 nm; a generation module, configured to generate a target image according to the first image, the second image, and the third image; the image generation device further includes: a calculation module, configured to perform a difference calculation according to the first image and the second image to obtain a fourth image; the calculation module is further configured to perform a difference calculation according to the first image and the third image to obtain a fifth image; the generation module is further configured to obtain the target image according to the first image, the fourth image, and the fifth image.
9. An electronic device, wherein, comprising: 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 7 are implemented.
Citation Information
Patent Citations
Camera module, electronic equipment and image acquisition method
CN113747014A
Camera module and mobile terminal
CN113840065A