Search

US-12627895-B2 - Exposure compensation method and apparatus, and electronic device

US12627895B2US 12627895 B2US12627895 B2US 12627895B2US-12627895-B2

Abstract

This application discloses an exposure compensation method and apparatus, and an electronic device, and pertains to the field of photographing technologies. The exposure compensation method includes: obtaining a target image block of a preview image in a shooting preview screen; and performing exposure compensation on the preview image based on scene type probability of the target image block; or performing exposure compensation on the preview image based on reflectivity of the target image block.

Inventors

  • Yafei HU

Assignees

  • VIVO MOBILE COMMUNICATION CO., LTD.

Dates

Publication Date
20260512
Application Date
20240126
Priority Date
20210726

Claims (10)

  1. 1 . An exposure compensation method, comprising: obtaining a target image block of a preview image in a shooting preview screen; and performing exposure compensation on the preview image based on scene type probability of the target image block; or performing exposure compensation on the preview image based on reflectivity of the target image block; wherein the performing exposure compensation on the preview image based on scene type probability of the target image block comprises: extracting features of the target image block at different scales, performing multilevel nonlinear transformation on the features, and outputting a weighted sum of the features; calculating the scene type probability of the target image block based on the weighted sum of the features; determining a scene ty of the target image lock sed the scene type probability, wherein the scene type comprises a first scene, a second scene, and a third scene; and performing exposure compensation on the preview image based on the scene type of the target image block; wherein the performing exposure compensation on the preview image based on scene type of the target image block comprises: determining an initial exposure value; and in a case that the scene type of the target image block is the first scene, increasing a preset exposure value on the basis of the initial exposure value; in a case that the scene type of the target image block is the second scene, decreasing the preset exposure value on the basis of the initial exposure value; and in a case that the scene type of the target image block is the third scene, using the initial exposure value for exposure; wherein before the performing exposure compensation on the preview image based on reflectivity of the target image block, the method further comprises: extracting features of the target image block at different scales, and splicing the extracted features with a class feature of the target image block on a channel to obtain fused features; performing multilevel nonlinear transformation on the fused features, and outputting a weighted sum of the fused features; and calculating reflectivity of a subject in the target image block based on the weighted sum of the fused features, and determining the reflectivity of the subject as the reflectivity of the target image block.
  2. 2 . The method according to claim 1 , the performing exposure compensation on the preview image based on reflectivity of the target image block comprises: determining an initial exposure value; determining, based on the reflectivity of the target image block, a target adjustment amount on the basis of the initial exposure value; and performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount.
  3. 3 . The method according to claim 2 , the performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount comprises: in a case that the reflectivity of the target image block is greater than reflectivity of a gray card, increasing the target adjustment amount on the basis of the initial exposure value; in a case that the reflectivity of the target image block is less than reflectivity of a gray card, decreasing the target adjustment amount on the basis of the initial exposure value; and in a case that the reflectivity of the target image block is equal to reflectivity of a gray card, using the initial exposure value for exposure.
  4. 4 . An electronic device, comprising a processor, a memory, and a program or an instruction stored in the memory and executable on the processor, wherein the program or the instruction, when executed by the processor, causes the electronic device to implement: obtaining a target image block of a preview image in a shooting preview screen; and performing exposure compensation on the preview image based on scene type probability of the target image block; or performing exposure compensation on the preview image based on reflectivity of the target image block; wherein the performing exposure compensation on the preview image based on scene type probability of the target image block comprises: extracting features of the target image block at different scales, performing multilevel nonlinear transformation on the features, and outputting a weighted sum of the features; calculating the scene type probability of the target image block based on the weighted sum of the features; determining a scene type of the target image block based on the scene type probability, wherein the scene type comprises a first scene, a second scene, and a third scene; and performing exposure compensation on the preview image based on the scene type of the target image block; wherein the performing exposure compensation on the preview image based on a scene type of the target image block comprises: determining an initial exp sure value; and in a case that the scene type of the target image block is the first scene, increasing a preset exposure value on the basis of the initial exposure value; in a case that the scene type of the target image block is the second scene, decreasing the preset exposure value on the basis of the initial exposure value; and in a case that the scene type of the target image block is the third scene, using the initial exposure value for exposure; wherein the program or the instruction, when executed by the processor, further causes the electronic device to implement; before the performing exposure compensation on the preview image based on reflectivity of the target image block, extracting features of the target image block at different scales, and splicing the extracted features with a class feature of the target image block on a channel to obtain fused features; performing multilevel nonlinear transformation on the fused features, and outputting a weighted sum of the fused features; and calculating reflectivity of a subject in the target image block based on the weighted sum of the fused features, and determining the reflectivity of the subject as the reflectivity of the target image block.
  5. 5 . The electronic device according to claim 4 , the performing exposure compensation on the preview image based on reflectivity of the target image block comprises: determining an initial exposure value; determining, based on the reflectivity of the target image block, a target adjustment amount on the basis of the initial exposure value; and performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount.
  6. 6 . The electronic device according to claim 5 , the performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount comprises: in a case that the reflectivity of the target image block is greater than reflectivity of a gray card, increasing the target adjustment amount on the basis of the initial exposure value; in a case that the reflectivity of the target image block is less than reflectivity of a gray card, decreasing the target adjustment amount on the basis of the initial exposure value; and in a case that the reflectivity of the target image block is equal to reflectivity of a gray card, using the initial exposure value for exposure.
  7. 7 . A chip, comprising a processor and a communications interface, wherein the communications interface is coupled to the processor, and the processor is configured to run a program or an instruction, to implement steps of the exposure compensation method according to claim 1 .
  8. 8 . A non-transitory readable storage medium, wherein the non-transitory readable storage medium stores a program or an instruction, and the program or the instruction is executed by a processor to implement: obtaining a target image block of a preview image in a shooting preview screen; and performing exposure compensation on the preview image based on scene type probability of the target image block; or performing exposure compensation on the preview image based on reflectivity of the target image block; wherein the performing exposure compensation on the preview image based on scene type probability of the image block comprises: extracting features of the target image block at different scales, performing multilevel nonlinear transformation on the features, and outputting a weighted sum of the features; calculating the scene type probability of the target image block based on the weighted sum of the features; determining a scene type of the target image block based on the scene type probability, wherein the scene type comprises a first scene, a second scene, and a third scene; and performing exposure compensation on the preview image based on the scene type of the target image block; wherein the performing exposure compensation on the preview image based on a scene type of the target image block comprises: determining an initial exposure value; and in a case that the scene type of the target image block is the first scene, increasing a preset exposure value on the basis of the initial exposure value; in a case that the scene type of the target image block is the second scene, decreasing the preset exposure value on the basis of the initial exposure value; and in a case that the scene type of the target image block is the third scene, using the initial exposure value for exposure; wherein the program or the instruction is further executed by a processor to implement; before the performing exposure compensation on the preview image based on reflectivity of the target image block, extracting features of the target image block at different scales, and splicing the extracted features with a class feature of the target image block on a channel to obtain fused features; performing multilevel nonlinear transformation on the fused features, and outputting a weighted sum of the fused features; and calculating reflectivity of a subject in the target image block based on the weighted sum of the fused features, and determining the reflectivity of the subject as the reflectivity of the target image block.
  9. 9 . The non-transitory readable storage medium according to claim 8 , the performing exposure compensation on the preview image based on reflectivity of the target image block comprises: determining an initial exposure value; determining, based on the reflectivity of the target image block, a target adjustment amount on the basis of the initial exposure value; and performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount.
  10. 10 . The non-transitory readable storage medium according to claim 9 , the performing exposure compensation on the preview image based on the initial exposure value and the target adjustment amount comprises: in a case that the reflectivity of the target image block is greater than reflectivity of a gray card, increasing the target adjustment amount on the basis of the initial exposure value; in a case that the reflectivity of the target image block is less than reflectivity of a gray card, decreasing the target adjustment amount on the basis of the initial exposure value; and in a case that the reflectivity of the target image block is equal to reflectivity of a gray card, using the initial exposure value for exposure.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation application of International Application No. PCT/CN2022/107299, filed on Jul. 22, 2022. International Application No. PCT/CN2022/107299 claims priority to Chinese Patent Application No. 202110843442.2, filed on Jul. 26, 2021 in China. Each of the above-listed applications is incorporated herein by reference in its entirety. TECHNICAL FIELD This application pertains to the field of photographing technologies, and in particular, to an exposure compensation method and apparatus, and an electronic device. BACKGROUND At present, the auto exposure control (AEC) technology is based on the gray world hypothesis. In the gray world hypothesis, it is generally considered that reflectivity of a gray card (namely, 18%) is medium gray. A specific principle of the AEC technology is: based on different metering modes (such as spot metering, partial metering, evaluation metering, center metering), a luminance value of a metering area is calculated, an exposure parameter (such as sensitivity, an aperture size, and a shutter speed) is gradually adjusted to make the calculated luminance value of the metering area close to medium gray, and when this condition is met, the AEC algorithm converges. In this case, a user can complete automatic exposure photographing after giving a photographing instruction. However, when the AEC technology is used for exposure compensation, a natural scene with rich colors generally conforms to the gray world hypothesis, and when the AEC technology is used for exposure of such a scene, pictures with good visual effects can usually be obtained. However, many other scenes, such as bright scenes such as the snow-covered landscape and shopping malls, or dark scenes such as black cars and sunlight-projected forests, do not conform to the gray world hypothesis. Using the AEC technology for such scenes will make the bright scenes or dark scenes in the real world appear gray and hazy, details are distorted, and visual effects of the captured photos are poor. SUMMARY According to a first aspect, an embodiment of this application provides an exposure compensation method, and the method includes: obtaining a target image block of a preview image in a shooting preview screen; andperforming exposure compensation on the preview image based on scene type probability of the target image block; orperforming exposure compensation on the preview image based on reflectivity of the target image block. According to a second aspect, an embodiment of this application provides an exposure compensation apparatus, and the apparatus includes: an obtaining module, configured to obtain a target image block of a preview image in a shooting preview screen; anda compensation module, configured to: perform exposure compensation on the preview image based on scene type probability of the target image block; or perform exposure compensation on the preview image based on reflectivity of the target image block. According to a third aspect, an embodiment of this application provides an electronic device. The electronic device includes a processor, a memory, and a program or an instruction stored in the memory and executable on the processor, where the program or the instruction is executed by the processor to implement steps of the method according to the first aspect. According to a fourth aspect, an embodiment of this application provides a readable storage medium. The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by a processor, steps of the method according to the first aspect are implemented. According to a fifth aspect, an embodiment of this application provides a chip. The chip includes a processor and a communications interface, the communications interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement the method according to the first aspect. According to a sixth aspect, an embodiment of this application provides a computer program product. The program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement the method according to the first aspect. According to a seventh aspect, a communication device is provided, configured to perform steps of the method according to the first aspect. BRIEF DESCRIPTION OF DRAWINGS FIG. 1 is a schematic flowchart of an exposure compensation method according to an embodiment of this application; FIG. 2 is a schematic diagram of a structure of a first neural network according to an embodiment of this application; FIG. 3 is a schematic diagram of a structure of a second neural network according to an embodiment of this application; FIG. 4 is a schematic diagram of a structure of an exposure compensation apparatus according to an embodiment of this application; FIG. 5 is a schematic diagram of a structure of an electronic device