WO2020019266A1 - 一种图像处理方法及装置 - Google Patents

一种图像处理方法及装置 Download PDF

Info

Publication number
WO2020019266A1
WO2020019266A1 PCT/CN2018/097292 CN2018097292W WO2020019266A1 WO 2020019266 A1 WO2020019266 A1 WO 2020019266A1 CN 2018097292 W CN2018097292 W CN 2018097292W WO 2020019266 A1 WO2020019266 A1 WO 2020019266A1
Authority
WO
WIPO (PCT)
Prior art keywords
brightness
blocks
determining
value
brightness value
Prior art date
Application number
PCT/CN2018/097292
Other languages
English (en)
French (fr)
Inventor
李居珉
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2018/097292 priority Critical patent/WO2020019266A1/zh
Priority to CN201880087278.3A priority patent/CN111630839B/zh
Publication of WO2020019266A1 publication Critical patent/WO2020019266A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene

Definitions

  • the present application relates to the field of image processing, and in particular, to an image processing method and device.
  • Auto exposure is a method for the camera to adjust the brightness of the image.
  • ISO gain of the sensitivity
  • the aperture By controlling the exposure time, the gain of the sensitivity (ISO), and the aperture to achieve the purpose of adjusting the brightness of the image, a good AE
  • the algorithm will try to save all the light and dark details in the scene, so that the captured image or photo has appropriate brightness.
  • the brightness histogram is usually used to count the ratio of bright and dark areas in the image, the peak value of the brightness, or the variance of the brightness value. According to this parameter, whether to enter a high-contrast scene is determined.
  • the image is compensated for exposure and the exposure is increased to increase the overall brightness of the image.
  • a high-contrast scene can refer to the difference in brightness values between the high-luminance area and the low-luminance area in the image, which exceeds the camera. The range that can be captured.
  • the brightness histogram can only reflect the overall lightness and darkness of the image, and cannot determine the specific location of the light and dark areas. For some local areas with higher brightness images (for example, images obtained by shooting a group of scattered point light sources, Or shooting images obtained by lighting the light in a low-light environment, etc.) after performing exposure compensation, the quality of the image or photo will be reduced.
  • the data of the brightness histogram is very sensitive. Usually, a small change in the viewing angle during shooting will affect the brightness distribution of the histogram. Therefore, there will be a certain error when adjusting the brightness of the image based on the above method, resulting in poor results of the final image .
  • Embodiments of the present application provide an image processing method and device, which are used to improve image quality.
  • an image processing method includes: determining each block according to the brightness of each block in a plurality of blocks (for example, 8 ⁇ 8 blocks, 16 ⁇ 16 blocks, etc.) in the current frame image. Located in one of a plurality of brightness ranges (for example, three brightness ranges of highlight, medium, and low brightness); determining a first brightness value according to the brightness of at least one block in the first brightness range, and the first brightness The range has the highest brightness among the plurality of brightness ranges; the second brightness value is determined according to the brightness of at least one block in the second brightness range, and the second brightness range has the lowest brightness among the plurality of brightness ranges; The two brightness values determine the exposure compensation amount; use the exposure compensation amount to perform exposure compensation for the next frame of image.
  • a plurality of brightness ranges for example, three brightness ranges of highlight, medium, and low brightness
  • the calculated exposure compensation amount of the next frame image is related to the position of the light and dark areas in the current frame image. Therefore, when the exposure compensation amount is used to compensate the exposure of the next frame image, the accuracy of the exposure compensation can be improved. Performance, and then improve the quality of the image to improve the user ’s experience with the image.
  • the method before determining that each block is located within a brightness range of the multiple brightness ranges according to the brightness of each block in the multiple blocks of the current frame image, the method further includes: At least one brightness threshold is determined according to the brightness of each of the multiple blocks in the current frame image; multiple brightness ranges are determined according to the at least one brightness threshold.
  • determining multiple brightness thresholds according to the brightness of each block in multiple blocks in the current frame image includes: determining the multiple thresholds according to the brightness of multiple blocks in the current frame image. An average brightness value of each block; and a plurality of brightness thresholds are determined according to the average brightness values of the plurality of blocks.
  • the method before determining that each block is located within a brightness range of the multiple brightness ranges according to the brightness of each of the multiple blocks in the current frame image, the method further includes: Determine the brightness of each of the multiple blocks, where each block includes multiple sub-blocks, and the brightness of each block is obtained from the brightness of the multiple sub-blocks.
  • the determined brightness of each block can reflect the continuity of the brightness in the current frame image, thereby helping to improve the accuracy of subsequent exposure compensation.
  • determining, according to the brightness of each block in multiple blocks in the current frame image, that each block is located in one of the multiple brightness ranges includes: when each of If the brightness of a block falls within the one brightness range, it is determined that each block is located within the one brightness range.
  • determining that each block is located in a brightness range among multiple brightness ranges includes: when each If the brightness of each block falls within the one brightness range, it is determined that each block is located within a preliminary brightness range; each block is down-sampled to determine that each block is located within the one brightness range.
  • the downsampling includes: calculating a mark of a macro block including a plurality of blocks according to a mark of a preliminary brightness range of each block, and determining, according to the mark of the macro block, that a plurality of blocks within the macro block are located in the one brightness range.
  • the method before determining the exposure compensation amount according to the first brightness value and the second brightness value, the method further includes: determining to enter a high-contrast scene according to the first brightness value and the second brightness value. To trigger the operation of determining the exposure compensation amount according to the first brightness value and the second brightness value.
  • determining whether to enter a high-contrast scene and triggering subsequent operations when it is determined to enter a high-contrast scene it is possible to avoid performing an exposure compensation operation without requiring exposure compensation, thereby improving the exposure compensation. accuracy.
  • determining that the current frame image is in a high-contrast scene according to the first brightness value and the second brightness value includes: when the ratio of the first brightness value to the second brightness value is greater than or When it is equal to the first value, it is determined to enter a high-contrast scene; or when the difference between the first brightness value and the second brightness value is greater than or equal to the second value, it is determined to enter a high-contrast scene.
  • two methods for determining entering a high-contrast scene are provided, and the stability of the method for determining entering a high-contrast scene is determined when the ratio of the first brightness value to the second brightness value is greater than or equal to the first value. If the difference between the first brightness value and the second brightness value is greater than or equal to the second value, the operation of determining the way to enter a high contrast scene is simple.
  • a first brightness value is an average brightness value of the at least one block in a first brightness range
  • a second brightness value is the at least one block in a second brightness range.
  • Average brightness value is an average brightness value of any at least one block.
  • the average brightness value of any at least one block may be an average value or a weighted average value of the brightness of the at least one block.
  • determining the exposure compensation amount according to the first brightness value and the second brightness value includes: according to the average brightness value, the first brightness value, the second brightness value, And a ratio of at least one block to the plurality of blocks in the second brightness range to determine an exposure compensation amount.
  • a manner for determining an exposure compensation amount is provided.
  • the multiple blocks are M ⁇ N blocks in the current frame image, and M and N are positive integers.
  • an image processing apparatus includes: a determining unit, configured to determine that each block is located in one of a plurality of brightness ranges according to the brightness of each of a plurality of blocks in the current frame image ; Determining a first brightness value according to the brightness of at least one block in the first brightness range, the first brightness range having the highest brightness among a plurality of brightness ranges; determining a second brightness value according to the brightness of at least one block in the second brightness range The second brightness range has the lowest brightness among a plurality of brightness ranges; an exposure compensation amount is determined according to the first brightness value and the second brightness value; a compensation unit is configured to use the exposure compensation amount to perform exposure compensation for the next frame of image.
  • the determining unit is further configured to determine at least one brightness threshold according to the brightness of each block in multiple blocks in the current frame image; and determine multiple brightness according to the at least one brightness threshold. range.
  • the determining unit is further configured to determine an average brightness value of the multiple blocks according to the brightness of the multiple blocks in the current frame image, and according to the average brightness value of the multiple blocks, Determine multiple brightness thresholds.
  • the determining unit is further configured to determine the brightness of each block in the multiple blocks, where each block includes multiple sub-blocks, and the brightness of each block is determined by the multiple sub-blocks. The brightness is obtained.
  • each block in the multiple blocks in the current frame image it is determined that each block is located in one of the multiple brightness ranges, and the determining unit is specifically configured to: : When the brightness of each block falls within the one brightness range, it is determined that each block is located within the one brightness range.
  • each block is down-sampled to determine that each block is located in the one brightness range within range.
  • the downsampling includes: calculating a mark of a macro block including a plurality of blocks according to a mark of a preliminary brightness range of each block, and determining, according to the mark of the macro block, that a plurality of blocks within the macro block are located in the one brightness range.
  • the determining unit is further configured to: determine to enter a high-contrast scene according to the first brightness value and the second brightness value to trigger determining the exposure compensation according to the first brightness value and the second brightness value Volume of operations.
  • the determining unit is further configured to: when a ratio of the first brightness value to the second brightness value is greater than or equal to the first value, determine to enter a high-contrast scene; or, when the first When the difference between the brightness value and the second brightness value is greater than or equal to the second value, it is determined to enter a high-contrast scene.
  • the first brightness value is an average brightness value of at least one block in the first brightness range
  • the second brightness value is an average brightness value of at least one block in the second brightness range.
  • the determining unit is further configured to: according to the average brightness value, the first brightness value, the second brightness value, and at least one block in the second brightness range of the plurality of blocks and The ratio of multiple blocks determines the amount of exposure compensation.
  • the multiple blocks are M ⁇ N blocks in the current frame image, and M and N are positive integers.
  • an image processing apparatus includes: a processor and an interface; wherein the processor is configured to read a software program in a memory through the interface, and process under the driving of the software program.
  • the operation is as follows: according to the brightness of each block in the multiple blocks in the current frame image, determining that each block is located in one of the multiple brightness ranges; determining the first brightness according to the brightness of at least one block in the first brightness range Value, the first brightness range has the highest brightness among the plurality of brightness ranges; the second brightness value is determined according to the brightness of at least one block in the second brightness range, and the second brightness range has the lowest brightness among the plurality of brightness ranges; A brightness value and a second brightness value determine the exposure compensation amount; the exposure compensation amount is used to perform exposure compensation for the next frame image.
  • the processor further performs the following operations: determining at least one brightness threshold value according to the brightness of each of a plurality of blocks in the current frame image; and determining a plurality of values according to the at least one brightness threshold value. Brightness range.
  • the processor further performs the following operations: determining the average brightness value of the multiple blocks according to the brightness of the multiple blocks in the current frame image; and according to the average brightness value of the multiple blocks To determine multiple brightness thresholds.
  • the processor further performs the following operation: determining the brightness of each of the multiple blocks, where each block includes multiple sub-blocks, and the brightness of each block is determined by the multiple sub-blocks The brightness of the block is obtained.
  • the processor further performs the following operation: determining to enter a high-contrast scene according to the first brightness value and the second brightness value to trigger determining the exposure according to the first brightness value and the second brightness value Compensation operation.
  • the processor when it is determined that each block is located in one of a plurality of brightness ranges according to the brightness of each of the multiple blocks in the current frame image, the processor specifically executes The following operation: when the brightness of each block falls within the one brightness range, it is determined that each block is located within the one brightness range.
  • the processor when it is determined that each block is located in one of a plurality of brightness ranges according to the brightness of each of the multiple blocks in the current frame image, the processor specifically Perform the following operations: when the brightness of each block falls within the one brightness range, determine that each block is within a preliminary brightness range; and down-sampling each block to determine that each block is within the Within a range of brightness.
  • the downsampling includes: calculating a mark of a macro block including a plurality of blocks according to a mark of a preliminary brightness range of each block, and determining, according to the mark of the macro block, that a plurality of blocks within the macro block are located in the one brightness range.
  • the processor further performs the following operation: when the ratio of the first brightness value to the second brightness value is greater than or equal to the first value, determining to enter a high-contrast scene; or, when the first When a difference between a brightness value and a second brightness value is greater than or equal to the second value, it is determined to enter a high-contrast scene.
  • the first brightness value is an average brightness value of at least one block in the first brightness range
  • the second brightness value is an average brightness value of at least one block in the second brightness range.
  • the processor further performs the following operation: according to the average brightness value, the first brightness value, the second brightness value, and at least one block in the second brightness range of the multiple blocks. Ratio to multiple blocks to determine the amount of exposure compensation.
  • the multiple blocks are M ⁇ N blocks in the current frame image, and M and N are positive integers.
  • a chip system includes a processor and a memory.
  • the memory stores codes and data, and the processor runs the code in the memory, so that the chip system executes the first aspect or any one of the first aspect.
  • Image processing methods provided by possible implementations.
  • a readable storage medium stores instructions, and when the readable storage medium runs on a device (such as a computer or a processor), the device executes the first Aspect or the image processing method provided in any possible implementation manner of the first aspect.
  • a computer program product is provided, and when the computer program product runs on a computer or a processor, the computer or processor executes the first aspect or any possible implementation manner of the first aspect.
  • the apparatus, computer storage medium, or computer program product of any one of the image processing methods provided above is used to execute the corresponding methods provided above. Therefore, for the beneficial effects that can be achieved, refer to the above. The beneficial effects in the corresponding corresponding methods provided are not repeated here.
  • FIG. 1 is a schematic structural diagram of an image processing device according to an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of an image processing method according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of multiple blocks in a current frame image according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of brightness of multiple blocks in a current frame image according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of brightness of multiple blocks in a current frame image according to another embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
  • "at least one” means one or more, and “multiple” means two or more.
  • "And / or” describes the association relationship of related objects, and indicates that there can be three kinds of relationships, for example, A and / or B can represent: the case where A exists alone, A and B exist simultaneously, and B exists alone, where A B can be singular or plural.
  • the character “/” generally indicates that the related objects are an "or” relationship.
  • the words “first”, “second” and the like do not limit the number and execution order.
  • FIG. 1 is a schematic structural diagram of an image processing device according to an embodiment of the present application.
  • the image processing device may be a mobile phone, a tablet computer, a video camera, a camera, a computer, a wearable device, a vehicle-mounted device, or a portable device.
  • the above-mentioned devices or the above-mentioned devices with a built-in chip system are collectively referred to as an image processing device in this application.
  • the image processing device is a mobile phone as an example.
  • the mobile phone or a chip system built in the mobile phone includes a memory 101, a processor 102, a sensor component 103, a multimedia component 104, and an input / output interface 105.
  • the memory 101 may be used to store data, software programs, and modules.
  • the memory 101 mainly includes a storage program area and a storage data area.
  • the storage program area may store software programs, including instructions formed by codes, including but not limited to an operating system and at least one function. Required application programs, such as sound playback function, image playback function, etc .; the storage data area can store data created according to the use of the mobile phone, such as audio data, image data, phone book, etc.
  • the memory 101 may be configured to store multiple frames of an image, such as a current frame image, and further include a brightness, a first brightness value, a second brightness value, an exposure compensation amount, and a next brightness value of each block in the current frame image. Frame image, etc.
  • the memory may be a floppy disk, a hard disk such as a built-in hard disk and a mobile hard disk, a magnetic disk, an optical disk, a magneto-optical disk such as CD_ROM, DCD_ROM, non-volatile storage
  • the device is, for example, RAM, ROM, PROM, EPROM, EEPROM, flash memory, or any other form of storage medium known in the technical field.
  • the processor 102 is a control center of the mobile phone, and uses various interfaces and lines to connect various parts of the entire device. By running or executing software programs and / or software modules stored in the memory 101, and calling data stored in the memory 101, Perform various functions of the mobile phone and process data to monitor the mobile phone as a whole.
  • the processor 102 may be configured to execute one or more steps in the method embodiment of the present application.
  • the processor 102 may be configured to perform S200a, S200b, S203a, and S201 to S201 in the following method embodiments. One or more steps in S204.
  • the processor 102 may be a uniprocessor structure, a multiprocessor structure, a single-threaded processor, a multi-threaded processor, and the like; in some feasible embodiments, the processor 102 may include a central processing unit Unit, general purpose processor, digital signal processor, digital signal processor, microcontroller or microprocessor, etc. In addition, the processor 102 may further include other hardware circuits or accelerators, such as application specific integrated circuits, field programmable gate arrays or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logical blocks, modules, and circuits described in connection with the present disclosure. The processor 102 may also be a combination that implements computing functions, such as a combination including one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on.
  • the sensor component 103 includes one or more sensors for providing status evaluation of various aspects of the mobile phone.
  • the sensor component 103 may include a light sensor, such as a CMOS or CCD image sensor, which is used in imaging applications, that is, it becomes a component of a camera or a camera.
  • the sensor component 103 may be configured to support a camera in the multimedia component 104 to obtain a current frame image and a next frame image.
  • the sensor component 103 may further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor. The sensor component 103 can detect the acceleration / deceleration, orientation, open / close state of the mobile phone, relative positioning of the component, or Cell phone temperature changes, etc.
  • the multimedia component 104 provides a screen with an output interface between the mobile phone and the user.
  • the screen may be a touch panel.
  • the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel.
  • the touch sensor may not only sense a boundary of a touch or slide action, but also detect duration and pressure related to the touch or slide operation.
  • the multimedia component 104 further includes at least one camera.
  • the multimedia component 104 includes a front camera and / or a rear camera.
  • the front camera and / or the rear camera can sense an external multimedia signal, which is used to form an image frame.
  • Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
  • the camera in the multimedia component 104 may be used to support acquiring a current frame image and a next frame image.
  • the input / output interface 105 provides an interface between the processor 102 and a peripheral interface module.
  • the peripheral interface module may include a keyboard, a mouse, or a USB (Universal Serial Bus) device.
  • the input interface may be used to obtain the current frame image and the next frame image, etc .; the output interface may be used to output the exposure compensation amount and the next frame image after exposure compensation.
  • the input ⁇ output interface 105 may have only one input ⁇ output interface, or may have multiple input ⁇ output interfaces.
  • the mobile phone may further include an audio component and a communication component, for example, the audio component includes a microphone, and the communication component includes a wireless fidelity (WiFi) module, a Bluetooth module, and the like, which are not described in the embodiment of this application. .
  • WiFi wireless fidelity
  • Bluetooth Bluetooth module
  • FIG. 2 is a schematic flowchart of an image processing method according to an embodiment of the present application. The method may be applied to the image processing device shown in FIG. 1, and may be specifically executed by the processor 102. Referring to FIG. 2, the method includes the following: Steps.
  • the current frame image may include multiple blocks, and each block may include multiple pixels.
  • the current frame image includes M ⁇ N blocks, and M and N are positive integers, that is, the current frame image is divided into M ⁇ N blocks. M and N may be equal or different, for example, the current frame
  • the image may include 8 ⁇ 8 blocks, 16 ⁇ 16 blocks, 32 ⁇ 16 blocks, or 32 ⁇ 32 blocks, etc., which are not specifically limited in this embodiment of the present application.
  • each of the multiple blocks may include multiple pixels, or multiple sub-blocks (each sub-block includes multiple pixels).
  • the brightness of each block can be obtained from the brightness of multiple pixels included in each block, and the brightness of a block can be the average brightness of multiple pixels included in the block.
  • the brightness average value may be a ratio of a sum of brightness of the plurality of pixels to the number of the plurality of pixels, or a sum of weighted brightness of the plurality of pixels and a sum of weights of the plurality of pixels Ratio, or the average brightness value calculated by other methods.
  • the average brightness of the block can be (a1 + a2 + ... + ax) / x.
  • the average brightness value of the block can be (a1 ⁇ b1 + a2 ⁇ b2 + ... + ax ⁇ bx) / (b1 + b2 + ... + bx).
  • the plurality of brightness ranges may include at least two brightness ranges, that is, the plurality of brightness ranges may include two or more than two brightness ranges.
  • the plurality of brightness ranges may include three brightness ranges. Assuming that the brightness can have 256 levels, the three brightness ranges may be sequentially expressed as [0, 80), [80, 160), and [160, 255]. The above values are for example only and are not intended to limit the implementation of the scheme.
  • the image processing device may compare with each luminance range of the plurality of luminance ranges according to the luminance of the block, and when the luminance of the block is greater than or equal to the When the minimum value of a certain brightness range among multiple brightness ranges is less than or equal to the maximum value of the brightness range, it can be determined that the brightness of the block belongs to the brightness range.
  • the brightness of a block among multiple blocks is 70. Since 70 is greater than the minimum value 0 and greater than the maximum value 80 in the brightness range [0, 80), it is determined that the brightness of the block belongs to the brightness range [0, 80). If the brightness of another block is 160, since 160 is equal to 160 in the brightness range [160, 255], it can be determined that the brightness 160 of the block belongs to the brightness range [160, 255].
  • S202 Determine a first brightness value according to the brightness of at least one block in the first brightness range, and determine a second brightness value according to the brightness of at least one block in the second brightness range, where it is assumed that the first brightness range is in multiple brightness ranges Medium has the highest brightness, that is, a high brightness range, and the second brightness range has the lowest brightness, that is, a low brightness range, among a plurality of brightness ranges.
  • each of the plurality of brightness ranges has different brightness.
  • the first brightness range may be [160,255]
  • the second brightness range may be [0,80].
  • the first brightness value may be used to represent the overall brightness of at least one block in the first brightness range
  • the second brightness value may be used to represent the overall brightness of at least one block in the second brightness range.
  • the first brightness value is an average brightness value of at least one block in the first brightness range
  • the second brightness value is an average brightness value of at least one block in the second brightness range.
  • the first brightness value may be a ratio of the sum of the brightness of at least one block in the first brightness range to the number of the at least one block, or the weighted sum of the at least one block and the at least one block. The ratio of the sum of the weights, or the average brightness value calculated by other methods.
  • the second brightness value may be a ratio of a sum of brightness of at least one block in the second brightness range to the number of the at least one block, or a sum of weighted brightness of the at least one block and a sum of weights of the at least one block. Ratio, or the average brightness value calculated by other methods.
  • the specific process of determining the first brightness value and the second brightness value is similar to the specific process of determining the brightness of each block according to the brightness of multiple pixels in the above step S201. For details, refer to the foregoing description. More details.
  • S203 Determine the exposure compensation amount according to the first brightness value and the second brightness value.
  • the exposure compensation function is used to adjust the exposure amount.
  • the exposure amount can be obtained by a camera according to an automatic exposure (AE) algorithm, that is, the exposure amount calculated by the camera through automatic metering during the process of capturing an image. .
  • AE automatic exposure
  • the image processing device determines the exposure compensation amount according to the first brightness value and the second brightness value, including: according to an average brightness value, a first brightness value, a second brightness value, and a second brightness value of a plurality of blocks in the current frame image.
  • a ratio of at least one block in the luminance range to the plurality of blocks determines an exposure compensation amount.
  • the average brightness value of the plurality of blocks may be a ratio of the sum of the brightness of the plurality of blocks and the number of the plurality of blocks, or the sum of the weighted brightness of the plurality of blocks and the weight of the plurality of blocks. Ratio, or the average brightness value calculated by other methods. It should be noted that the specific process of determining the average brightness value of the multiple blocks is similar to the specific process of determining the brightness of each block based on the brightness of multiple pixels in step S201 above. For details, refer to the foregoing description. This will not be repeated here.
  • the ratio of at least one block in the second luminance range to the plurality of blocks can be used to indicate the proportion of the luminance area represented in the second luminance range in the current frame image.
  • the number of the plurality of blocks is 64
  • the exposure compensation amount may be the ratio of the average brightness value W of the multiple blocks to the expected brightness value L. If the exposure compensation amount is expressed as C, the image processing device may use the following formula (1) and (2) determine the exposure compensation amount C.
  • H thd represents the suppression factor
  • H thd is a constant, which can be set according to the actual situation.
  • H thd is a constant, which can be set according to the actual situation.
  • H thd can be obtained by testing or according to the experience of those skilled in the art.
  • the method may further include: S203a.
  • S203a Determine whether to enter a high contrast scene to trigger the operation of S203 according to the first brightness value and the second brightness value.
  • a high-contrast scene can mean that the brightness value between the area with the highest brightness and the area with the lowest brightness in the image differs greatly, beyond the range that the camera can capture.
  • step S203 may be triggered to determine the exposure compensation amount.
  • step S203 may not be triggered, and the execution of this embodiment may be terminated.
  • the image processing device may determine whether to enter a high-contrast scene according to the first brightness value and the second brightness value in the following manner: when the ratio of the first brightness value to the second brightness value is greater than or equal to a preset first value To determine to enter a high-contrast scene; or, when the difference between the first brightness value and the second brightness value is greater than or equal to a preset second value, determine to enter a high-contrast scene. Otherwise, do not enter the high contrast scene.
  • the preset first value and the second value can be set by those skilled in the art in advance, and the specific value can be set according to the actual situation, which is not specifically limited in the embodiment of the present application.
  • the foregoing manner of determining the entry into the high-contrast scene according to the first brightness value and the second brightness value is merely exemplary, and the entry into the high-contrast scene may be determined in other ways, which is not specifically limited in this embodiment of the present application.
  • the next frame image refers to a frame after the current frame image.
  • the current frame image and the next frame image may be images obtained by shooting the same scene. Therefore, the image processing device may use the exposure compensation amount to the next frame. The image is compensated for exposure.
  • the image processing device may perform exposure processing on the next frame image according to the sum of the exposure compensation amount and the exposure amount (that is, the exposure amount obtained by the AE algorithm). For example, the image processing device determines the exposure time and the gain of the sensitivity according to the sum of the exposure compensation amount and the exposure amount, and exposes the next frame of the image according to the determined exposure time and the gain of the sensitivity to achieve the next frame of image Do exposure compensation.
  • the exposure compensation amount to perform exposure compensation on the next frame of image, the brightness of the next frame of image can be increased, thereby improving the details of the darker areas in the image, thereby improving the user's photographing experience.
  • step S201 the method further includes: S200b.
  • the image processing device determines a plurality of brightness ranges.
  • the image processing device determines at least one brightness threshold according to the brightness of each of a plurality of blocks in the current frame image, and determines the multiple brightness ranges according to the at least one brightness threshold.
  • the at least one brightness threshold may include one or more brightness thresholds.
  • the image processing device determines at least one brightness threshold value according to the brightness of each block in the multiple blocks, which may include: determining an average brightness value of the multiple blocks according to the brightness of the multiple blocks in the current frame image; and according to the average brightness value of the multiple blocks. To determine at least one brightness threshold.
  • the average brightness value of the plurality of blocks may be a ratio of the sum of the brightness of the plurality of blocks and the number of the plurality of blocks, or the sum of the weighted brightness of the plurality of blocks and the weight of the plurality of blocks. Ratio, or the average brightness value calculated by other methods. It should be noted that the specific process of determining the average brightness value of the multiple blocks is similar to the specific process of determining the brightness of each block based on the brightness of multiple pixels in step S201 above. For details, refer to the foregoing description. This will not be repeated here.
  • the image processing device determines the at least one brightness threshold according to the average brightness value of the plurality of blocks, which may specifically include: determining the at least one brightness threshold according to the average brightness value and the preset value of the plurality of blocks. For example, if the average brightness value of the multiple blocks is W and the preset value is Q, the image processing device may determine the product of W and Q and the quotient of W and Q as two brightness thresholds.
  • the preset value can be set in advance.
  • the preset value Q can be set to 4.
  • the method for determining the brightness threshold based on the product of W and Q and the quotient of W and Q is only exemplary, and is not The embodiments of the present application constitute a limitation, and the image processing device may also determine at least one brightness threshold in other ways.
  • the image processing device divides the specified brightness length into a plurality of brightness ranges according to the at least one brightness threshold. For example, if the specified brightness length is [0,255] and at least one brightness threshold includes two brightness thresholds of 80 and 160 respectively, the image processing device may divide the specified brightness length [0,255] into Three brightness ranges, [0, 80), [80, 160), and [160, 255]. These three brightness ranges can be used to represent low-light areas, medium-light areas, and high-light areas in the current frame image. .
  • the number of brightness ranges is determined by the number of brightness thresholds. For example, a brightness threshold divides the specified brightness length into two brightness ranges, and so on. This embodiment uses two brightness thresholds and three brightness ranges as examples for illustration, but is not used for limitation. In practical applications, how many brightness ranges are set can be flexibly selected, as long as they are two or more.
  • the above-mentioned specified brightness length may be set in advance, for example, the specified brightness length may be [0,255] or [0,160], etc., which is not specifically limited in this embodiment of the present application.
  • step S201 the method further includes: S200a.
  • S200a Determine the brightness of each of the multiple blocks, where each block includes multiple sub-blocks, and the brightness of each block is obtained from the brightness of the multiple sub-blocks.
  • determining the brightness of each of the multiple blocks may include: the image processing device divides the current frame image into multiple sub-blocks, for example, divides the current frame image into 16 ⁇ 16 sub-blocks and 32 ⁇ 16 sub-blocks Or 32 ⁇ 32 sub-blocks, etc .; multiple sub-blocks obtained by division can be down-sampled to obtain multiple blocks in the current frame image. For example, when four adjacent sub-blocks are determined as one block during down-sampling, 16 The ⁇ 16 sub-blocks are down-sampled into 8 ⁇ 8 blocks. Then, the brightness of each block is determined according to the brightness of a plurality of sub-blocks included in each block.
  • the downsampling is performed directly in 200a, and then the brightness of the block formed after the downsampling is determined according to the brightness of multiple sub-blocks.
  • the determined brightness of a block may be an average brightness value of multiple sub-blocks included in the block.
  • the brightness of one block may be a ratio of the sum of the brightness of the plurality of sub-blocks to the number of the plurality of sub-blocks, or the sum of the weighted brightness of the plurality of sub-blocks and the weight of the plurality of sub-blocks. A ratio of the sum, or an average brightness value of the plurality of sub-blocks calculated by other methods.
  • the image processing device may down-sample the divided sub-blocks once to obtain multiple blocks in the current frame image. It is also possible to perform multiple down-sampling on the divided multiple sub-blocks to obtain multiple blocks in the current frame image, and the number of specific down-sampling is not specifically limited in this embodiment of the present application. For example, downsampling is performed by determining four adjacent sub-blocks as one block. If the current frame image is divided into 32 ⁇ 32 sub-blocks, then 32 ⁇ 32 sub-blocks are down-sampled once to obtain 16 ⁇ 16 blocks. , 16 ⁇ 16 blocks are down-sampled again to obtain 8 ⁇ 8 blocks.
  • downsampling may be performed not only in 200a, but in S201.
  • the non-smoothness can be eliminated by downsampling.
  • Each macroblock after downsampling can include multiple blocks, and each of the The range of brightness in which multiple blocks in a macroblock are located. That is to say, the macroblocks after the downsampling are taken as a whole, and the internal multiple blocks are uniformly determined to belong to the brightness range, instead of determining the brightness range of each block individually.
  • the current frame image is divided into 16 ⁇ 16 blocks as shown in FIG. 3.
  • the preliminary brightness range of each block is confirmed in S201, as described in the previous embodiment corresponding to FIG. 2.
  • the labeled image can be As shown in FIG. 4, in FIG. 4, white is used for highlighting, that is, mark 0, gray is used for medium light, that is, mark 1, and black is used for low light, that is, mark 2.
  • each macroblock includes 4 blocks as an example, if the sum of the marks corresponding to the 4 blocks is less than or equal to 2, the macroblock is determined to be highlighted; if the sum of the marks corresponding to the 4 blocks is greater than 2 If it is less than 4, it is determined that the macro block belongs to medium light; if the sum of the marks corresponding to the 4 blocks is greater than or equal to 4, it is determined that the macro block belongs to low light. For example, determining the luminance range to which each block in any macroblock belongs according to 16 ⁇ 16 blocks is shown in FIG. 5. By downsampling, the brightness range division of each block in an image of a frame becomes more regular and reliable. Comparing FIG. 4 and FIG.
  • the shape formed by one or more blocks in the three brightness ranges in the image is smoother, that is, the boundaries of the three brightness ranges become more natural.
  • Multiple blocks in each macroblock are used as a whole to determine the luminance range to which they belong, so as to finally determine which blocks are included in each of the three luminance ranges, and then S202 is further performed.
  • the image processing device includes a hardware structure and / or a software module corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software by combining the structures and algorithm steps of the examples described in the embodiments disclosed herein. Whether a certain function is performed by hardware or computer software-driven hardware depends on the specific application of the technical solution and design constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules may be implemented in the form of hardware or software functional modules. It should be noted that the division of the modules in the embodiments of the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner.
  • FIG. 6 illustrates a possible structural schematic diagram of the image processing apparatus involved in the foregoing embodiment.
  • the image processing apparatus includes a determination unit 301 and a compensation unit 302.
  • the determining unit 301 is configured to support the device to perform one or more steps in S200a, S200b, S203a, S201 to S203 in the method embodiment, and / or other processes used in the technology described herein; the compensation unit 302 It is used to support the device to execute S204 in the method embodiment.
  • the determination unit 301 and the compensation unit 302 are implemented in software, that is, the software programs corresponding to the determination unit 301 and the compensation unit 302 are included in the memory 101 and the processor 102
  • the software programs including the determination unit 301 and the compensation unit 302 in the memory 101 are run to implement the functions corresponding to the determination unit 301 and the compensation unit 302.
  • the determination unit 301 and the compensation unit 302 when the determination unit 301 and the compensation unit 302 are implemented in hardware, the determination unit 301 and the compensation unit 302 may be hardware circuits or accelerators included in the processor 102 or directly used to replace the processor 102 Each of the determining unit 301 and the compensation unit 302 may be implemented by a hardware circuit or an accelerator, and may include at least one of an electronic circuit, a digital circuit, a logic circuit, or an analog circuit.
  • the compensation unit 302 or the processor 102 implemented in the form of software or hardware may specifically refer to controlling the exposure of a light sensor or a light compensation element through an electrical signal to achieve exposure compensation at an electronic level. The final optical level exposure compensation is performed by a light sensor or light compensation element.
  • the image processing apparatus in the embodiment of the present application is described from the perspective of a modular functional entity, and the image processing apparatus in the embodiment of the present application is described from the perspective of hardware processing.
  • An embodiment of the present application further provides an image processing apparatus.
  • the structure of the image processing apparatus may be as shown in FIG. 1.
  • the processor 102 is configured to process the functions of S200a, S200b, S203a, and S201 to S203 of the image processing method.
  • the processor 102 is configured to determine the brightness of each of a plurality of blocks.
  • each block is located in one of a plurality of brightness ranges according to the brightness of each block in the plurality of blocks, and determine a first brightness value according to the brightness of at least one block in the first brightness range Determining a second brightness value according to the brightness of at least one block in the second brightness range, and determining an exposure compensation amount and the like according to the first brightness value and the second brightness value.
  • the above information output by the input / output interface 105 may be sent to the memory 101 for storage, or may be sent to another processing flow to continue processing, or the current frame image and the next frame image are output. Send it to the display device for display, or send it to the player terminal for playback.
  • This memory can store the current frame image, the brightness of each block in the current frame image, the first brightness value, the second brightness value, the exposure compensation amount and the next frame image, and relevant instructions for configuring the processor, etc. .
  • the sensor component 103 may include a light compensation element, for example, the light compensation element is a light sensor, and the processor 102 may control the exposure time and the gain of the sensitivity of the light sensor, so that the processor 102 may expose the light sensor according to the exposure compensation amount. And sensitivity gain adjustment to achieve the function of exposure compensation for the next frame of image compensation.
  • the light compensation element is a light sensor
  • the processor 102 may control the exposure time and the gain of the sensitivity of the light sensor, so that the processor 102 may expose the light sensor according to the exposure compensation amount.
  • sensitivity gain adjustment to achieve the function of exposure compensation for the next frame of image compensation.
  • An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores instructions, and when it is run on a device (for example, the device may be a microcontroller, a chip, a computer, or a processor, etc.) , The device is caused to perform one or more of steps S200a, S200b, S203a, and S201-S204 of the image processing method.
  • a device for example, the device may be a microcontroller, a chip, a computer, or a processor, etc.
  • the device is caused to perform one or more of steps S200a, S200b, S203a, and S201-S204 of the image processing method.
  • each component module of the image processing device is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in the computer-readable storage medium.
  • the embodiments of the present application further provide a computer program product containing instructions.
  • the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution may be a software product.
  • the computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor therein to execute the embodiments of the present application. All or part of the steps of the method.
  • the first brightness value is determined by the brightness of at least one block in the first brightness range having the highest brightness among the multiple blocks of the current frame image, and the at least one value in the second brightness range having the lowest brightness is at least one.
  • the brightness of a block determines the second brightness value, so as to determine the exposure compensation amount according to the first brightness value and the second brightness value. Therefore, the exposure compensation amount is related to the position of the light and dark areas in the current frame image, so the exposure compensation amount is used to When the next frame of image is subjected to exposure compensation, the accuracy of the exposure compensation can be improved, thereby improving the quality of the image, so as to improve the user's experience of shooting the image.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

本申请提供一种图像处理方法及装置,涉及图像处理领域,用于提高拍摄图像的品质。所述方法包括:根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;根据第一亮度范围内的至少一个块的亮度确定第一亮度值,所述第一亮度范围在所述多个亮度范围中具有最高亮度;根据第二亮度范围内的至少一个块的亮度确定第二亮度值,所述第二亮度范围在所述多个亮度范围中具有最低亮度;根据所述第一亮度值和所述第二亮度值确定曝光补偿量;利用所述曝光补偿量对下一帧图像做曝光补偿。

Description

一种图像处理方法及装置 技术领域
本申请涉及图像处理领域,尤其涉及一种图像处理方法及装置。
背景技术
自动曝光(auto exposure,AE)是相机调节图像亮度的一种方法,通过控制曝光时间(exposure time)、感光度(ISO)的增益和光圈(aperture)以达到调节图像亮度的目的,良好的AE算法会尽量保存被摄景物中所有亮暗的细节,使得拍摄出的图像或照片有合适的亮度。
目前,在通过AE算法调节图像的亮度时,通常是利用亮度直方图统计图像中亮暗区域的比例、亮度的峰值或者亮度值的方差等参数,根据该参数判断是否进入高反差场景,当确定进入高反差场景时,则对图像进行曝光补偿,提高曝光量,以提升图像的整体亮度,这里的高反差场景可以是指图像中高亮度区域与低亮度区域的亮度值差异较大,超出了相机可以捕获的范围。
但是,亮度直方图只能反映图像的整体亮暗程度,并不能确定亮暗区域的具体位置,对于一些局部区域亮度较高的图像(比如,拍摄一群杂散的点光源分散分布得到的图像、或者拍摄灯光在低照度环境中的发光状态得到的图像等)进行曝光补偿后,反而会降低图像或照片的品质。此外,亮度直方图的数据非常敏感,通常拍摄时少许的视角改变就会影响直方图的亮度分布,因此,基于上述方法调节图像亮度时会存在一定的误差,导致最终得到的图像的效果较差。
发明内容
本申请的实施例提供一种图像处理方法及装置,用于提高图像的品质。
为达到上述目的,本申请的实施例采用如下技术方案:
第一方面,提供一种图像处理方法,该方法包括:根据当前帧图像中多个块(比如,8×8个块、16×16个块等)中每个块的亮度,确定每个块位于多个亮度范围(比如,分别表示高亮、中亮和低亮三个亮度范围)中的一个亮度范围内;根据第一亮度范围内的至少一个块的亮度确定第一亮度值,第一亮度范围在多个亮度范围中具有最高亮度;根据第二亮度范围内的至少一个块的亮度确定第二亮度值,第二亮度范围在多个亮度范围中具有最低亮度;根据第一亮度值和第二亮度值确定曝光补偿量;利用曝光补偿量对下一帧图像做曝光补偿。
上述技术方案中,计算出的下一帧图像的曝光补偿量与当前帧图像中亮暗区域的位置有关,从而利用该曝光补偿量对下一帧图像做曝光补偿时,可以提高曝光补偿的准确性,进而提高图像的品质,以提高用户拍摄图像的体验。
在第一方面的一种可能的实现方式中,根据当前帧图像的多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内之前,该方法还包括:根据当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;根据至少一个亮度阈值,确 定多个亮度范围。上述可能的实现方式中,提供了一种简单有效地确定多个亮度范围的方式。
在第一方面的一种可能的实现方式中,根据当前帧图像中多个块中每个块的亮度,确定多个亮度阈值,包括:根据当前帧图像中多个块的亮度,确定该多个块的平均亮度值;根据该多个块的平均亮度值,确定多个亮度阈值。上述可能的实现方式中,提供了一种简单有效地确定多个亮度阈值的方式。
在第一方面的一种可能的实现方式中,根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内之前,该方法还包括:确定该多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由该多个子块的亮度得到。上述可能的实现方式中,确定的每个块的亮度可以体现出当前帧图像中亮度的连续性,从而有助于提高后续曝光补偿的准确性。
在第一方面的一种可能的实现方式中,根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内包括:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于所述一个亮度范围内。
在第一方面的另一种可能的实现方式中,根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内包括:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于一个初步亮度范围内;对每个块进行下采样,确定每个块位于所述一个亮度范围内。例如,所述下采样包括:根据每个块的初步亮度范围的标记计算包括多个块的宏块的标记,根据宏块的标记确定该宏块内的多个块均位于所述一个亮度范围内。
在第一方面的一种可能的实现方式中,根据第一亮度值和第二亮度值确定曝光补偿量之前,该方法还包括:根据第一亮度值和第二亮度值,确定进入高反差场景以触发根据第一亮度值和第二亮度值确定曝光补偿量的操作。上述可能的实现方式中,通过确定是否进入高反差场景,并在确定进入高反差场景时触发后续操作,可以避免在不需要曝光补偿的情况下执行了曝光补偿的操作,从而提高了曝光补偿的准确性。
在第一方面的一种可能的实现方式中,根据第一亮度值和第二亮度值,确定当前帧图像处于高反差场景中,包括:当第一亮度值与第二亮度值的比值大于或等于第一数值时,确定进入高反差场景;或者,当第一亮度值与第二亮度值的差值大于或等于第二数值时,确定进入高反差场景。上述可能的实现方式中,提供了两种确定进入高反差场景的方式,且通过第一亮度值与第二亮度值的比值大于或等于第一数值时确定进入高反差场景的方式的稳定性较高,通过第一亮度值与第二亮度值的差值大于或等于第二数值时确定进入高反差场景的方式的操作简单。
在第一方面的一种可能的实现方式中,第一亮度值为第一亮度范围内的所述至少一个块的平均亮度值,第二亮度值为第二亮度范围内的所述至少一个块的平均亮度值。可选的,任意至少一个块的亮度平均值可以是所述至少一个块亮度的平均值或加权平均值。
在第一方面的一种可能的实现方式中,根据第一亮度值和第二亮度值确定曝光补偿量,包括:根据该多个块的平均亮度值、第一亮度值、第二亮度值、以及第二亮度范围内的至少一个块与该多个块的比例,确定曝光补偿量。上述可能的实现方式中, 提供了一种确定曝光补偿量的方式。
在第一方面的一种可能的实现方式中,该多个块是当前帧图像中的M×N个块,M和N为正整数。
第二方面,提供一种图像处理装置,该装置包括:确定单元,用于根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;根据第一亮度范围内的至少一个块的亮度确定第一亮度值,第一亮度范围在多个亮度范围中具有最高亮度;根据第二亮度范围内的至少一个块的亮度确定第二亮度值,第二亮度范围在多个亮度范围中具有最低亮度;根据第一亮度值和第二亮度值确定曝光补偿量;补偿单元,用于利用曝光补偿量对下一帧图像做曝光补偿。
在第二方面的一种可能的实现方式中,确定单元还用于:根据当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;根据至少一个亮度阈值,确定多个亮度范围。
在第二方面的一种可能的实现方式中,确定单元还用于:根据当前帧图像中多个块的亮度,确定该多个块的平均亮度值;根据该多个块的平均亮度值,确定多个亮度阈值。
在第二方面的一种可能的实现方式中,确定单元还用于:确定该多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由该多个子块的亮度得到。
在第二方面的一种可能的实现方式中,在根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内,确定单元具体用于:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于所述一个亮度范围内。
在第二方面的另一种可能的实现方式中,在根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内,确定单元具体用于:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于一个初步亮度范围内;对每个块进行下采样,确定每个块位于所述一个亮度范围内。例如,所述下采样包括:根据每个块的初步亮度范围的标记计算包括多个块的宏块的标记,根据宏块的标记确定该宏块内的多个块均位于所述一个亮度范围内。
在第二方面的一种可能的实现方式中,确定单元还用于:根据第一亮度值和第二亮度值,确定进入高反差场景以触发根据第一亮度值和第二亮度值确定曝光补偿量的操作。
在第二方面的一种可能的实现方式中,确定单元还用于:当第一亮度值与第二亮度值的比值大于或等于第一数值时,确定进入高反差场景;或者,当第一亮度值与第二亮度值的差值大于或等于第二数值时,确定进入高反差场景。
在第二方面的一种可能的实现方式中,第一亮度值为第一亮度范围内的至少一个块的平均亮度值,第二亮度值为第二亮度范围内的至少一个块的平均亮度值。
在第二方面的一种可能的实现方式中,确定单元还用于:根据该多个块的平均亮度值、第一亮度值、第二亮度值、以及第二亮度范围内的至少一个块与多个块的比例,确定曝光补偿量。
在第二方面的一种可能的实现方式中,该多个块是当前帧图像中的M×N个块,M和N为正整数。
第三方面,提供一种图像处理装置,该装置包括:处理器和接口;其中,处理器,被配置为通过所述接口读取存储器中的软件程序,并在所述软件程序的驱动下处理如下操作:根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;根据第一亮度范围内的至少一个块的亮度确定第一亮度值,第一亮度范围在多个亮度范围中具有最高亮度;根据第二亮度范围内的至少一个块的亮度确定第二亮度值,第二亮度范围在多个亮度范围中具有最低亮度;根据第一亮度值和第二亮度值确定曝光补偿量;利用曝光补偿量对下一帧图像做曝光补偿。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:根据当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;根据至少一个亮度阈值,确定多个亮度范围。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:根据当前帧图像中多个块的亮度,确定该多个块的平均亮度值;根据该多个块的平均亮度值,确定多个亮度阈值。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:确定该多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由该多个子块的亮度得到。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:根据第一亮度值和第二亮度值,确定进入高反差场景以触发根据第一亮度值和第二亮度值确定曝光补偿量的操作。
在第三方面的一种可能的实现方式中,在根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内时,处理器具体执行以下操作:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于所述一个亮度范围内。
在第三方面的另一种可能的实现方式中,在根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内时,处理器具体执行以下操作:当所述每个块的亮度落入所述一个亮度范围内,则确定所述每个块位于一个初步亮度范围内;对每个块进行下采样,确定每个块位于所述一个亮度范围内。例如,所述下采样包括:根据每个块的初步亮度范围的标记计算包括多个块的宏块的标记,根据宏块的标记确定该宏块内的多个块均位于所述一个亮度范围内。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:当第一亮度值与第二亮度值的比值大于或等于第一数值时,确定进入高反差场景;或者,当第一亮度值与第二亮度值的差值大于或等于第二数值时,确定进入高反差场景。
在第三方面的一种可能的实现方式中,第一亮度值为第一亮度范围内的至少一个块的平均亮度值,第二亮度值为第二亮度范围内的至少一个块的平均亮度值。
在第三方面的一种可能的实现方式中,处理器还执行以下操作:根据该多个块的平均亮度值、第一亮度值、第二亮度值、以及第二亮度范围内的至少一个块与多个块的比例,确定曝光补偿量。
在第三方面的一种可能的实现方式中,该多个块是当前帧图像中的M×N个块,M和N为正整数。
第四方面,提供一种芯片系统,该芯片系统包括处理器和存储器,存储器存储代 码和数据,处理器运行存储器中的代码,以使该芯片系统执行第一方面或者第一方面的任一项可能的实现方式所提供的图像处理方法。
第五方面,提供一种可读存储介质,所述可读存储介质中存储有指令,当所述可读存储介质在设备(如计算机或处理器)上运行时,使得所述设备执行第一方面或者第一方面的任一项可能的实现方式所提供的图像处理方法。
第六方面,提供一种计算机程序产品,当所述计算机程序产品在计算机或处理器上运行时,使得所述计算机或处理器执行第一方面或者第一方面的任一项可能的实现方式所提供的图像处理方法。
可以理解地,上述提供的任一种图像处理方法的装置、计算机存储介质或者计算机程序产品均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种图像处理设备的结构示意图;
图2为本申请实施例提供的一种图像处理方法的流程示意图;
图3为本申请实施例提供的一种当前帧图像中多个块的示意图;
图4为本申请实施例提供的一种当前帧图像中多个块的亮度示意图;
图5为本申请实施例提供的另一种当前帧图像中多个块的亮度示意图;
图6为本申请实施例提供的一种图像处理装置的结构示意图。
具体实施方式
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。另外,在本申请的实施例中,“第一”、“第二”等字样并不对数量和执行次序进行限定。
图1为本申请实施例提供的一种图像处理设备的结构示意图,该图像处理设备可以为手机、平板电脑、摄像机、照相机、计算机、可穿戴设备、车载设备或便携式设备等。为方便描述,本申请中将上面提到的设备或者内置芯片系统的上述设备统称为图像处理设备。本申请实施例以该图像处理设备为手机为例进行说明,该手机或者内置于手机的芯片系统包括:存储器101、处理器102、传感器组件103、多媒体组件104以及输入\输出接口105。
下面结合图1对手机或者内置于手机的芯片系统的各个构成部件进行具体的介绍:
存储器101可用于存储数据、软件程序以及模块;主要包括存储程序区和存储数据区,其中,存储程序区可存储软件程序,包括以代码形成的指令,包括但不限于操作系统、至少一个功能所需的应用程序,比如声音播放功能、图像播放功能等;存储数据区可存储根据手机的使用所创建的数据,比如音频数据、图像数据、电话本等。在本申请实施例中,存储器101可用于存储多帧图像,例如当前帧图像,以及进一步包括当前帧图像中每个块的亮度、第一亮度值、第二亮度值、曝光补偿量和下一帧图 像等。在一些可行的实施例中,可以有一个存储器,也可以有多个存储器;该存储器可以是软盘,硬盘如内置硬盘和移动硬盘,磁盘,光盘,磁光盘如CD_ROM、DCD_ROM,非易失性存储设备如RAM、ROM、PROM、EPROM、EEPROM、闪存、或者技术领域内所公知的任意其他形式的存储介质。
处理器102是手机的控制中心,利用各种接口和线路连接整个设备的各个部分,通过运行或执行存储在存储器101内的软件程序和/或软件模块,以及调用存储在存储器101内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在本申请实施例中,处理器102可用于执行本申请方法实施例中的一个或者多个步骤,比如,处理器102可用于执行下述方法实施例中的S200a、S200b、S203a、以及S201至S204中的一个或者多个步骤。在一些可行的实施例中,处理器102可以是单处理器结构、多处理器结构、单线程处理器以及多线程处理器等;在一些可行的实施例中,处理器102可以包括中央处理器单元、通用处理器、数字信号处理器、数字信号处理器、微控制器或微处理器等。除此以外,处理器102还可进一步包括其他硬件电路或加速器,如专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器102也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。
传感器组件103包括一个或多个传感器,用于为手机提供各个方面的状态评估。其中,传感器组件103可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用,即成为相机或摄像头的组成部分。在本申请实施例中,传感器组件103可用于支持多媒体组件104中的摄像头获取当前帧图像和下一帧图像等。此外,传感器组件103还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器,通过传感器组件103可以检测到手机的加速/减速、方位、打开/关闭状态,组件的相对定位,或手机的温度变化等。
多媒体组件104在手机和用户之间提供一个输出接口的屏幕,该屏幕可以为触摸面板,且当该屏幕为触摸面板时,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。此外,多媒体组件104还包括至少一个摄像头,比如,多媒体组件104包括一个前置摄像头和/或后置摄像头。当手机处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以感应外部的多媒体信号,该信号被用于形成图像帧。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。在本申请实施例中,多媒体组件104中的摄像头可用于支持获取当前帧图像和下一帧图像等。
输入\输出接口105为处理器102和外围接口模块之间提供接口,比如,外围接口模块可以包括键盘、鼠标、或USB(通用串行总线)设备等。在本申请实施例中,输入接口可用于获取当前帧图像和下一帧图像等;输出接口可用于输出曝光补偿量以及曝光补偿后的下一帧图像等。在一种可能的实现方式中,输入\输出接口105可以只有一个输入\输出接口,也可以有多个输入\输出接口。
尽管未示出,手机还可以包括音频组件和通信组件等,比如,音频组件包括麦克风,通信组件包括无线保真(Wireless Fidelity,WiFi)模块、蓝牙模块等,本申请实施例在此不再赘述。本领域技术人员可以理解,图1中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
图2为本申请实施例提供的一种图像处理方法的流程示意图,该方法可应用于图1所示的图像处理设备中,具体可以由处理器102执行,参见图2,该方法包括以下几个步骤。
S201:根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内。其中,当前帧图像可以包括多个块(block),每个块可以包括多个像素点。可选的,当前帧图像包括M×N个块,M和N均为正整数,即当前帧图像被划分为M×N个块,M和N可以相等,也可以不等,比如,当前帧图像可以包括8×8个块、16×16个块、32×16个块或者32×32个块等,本申请实施例对此不作具体限定。
另外,该多个块中的每个块可以包括多个像素点,或者多个子块(每个子块包括多个像素点)。以每个块包括多个像素点为例,则每个块的亮度可以由每个块包括的多个像素点的亮度得到,一个块的亮度可以是该块包括的多个像素点的亮度平均值,该亮度平均值可以是该多个像素点的亮度之和与该多个像素点的数量的比值、或者是该多个像素点的加权亮度之和与该多个像素点的权重之和的比值,或者是通过其他方法计算得到的亮度平均值等。比如,假设每个块包括x个像素点,且x个像素点的亮度依次为a1、a2、……、ax,则该块的亮度平均值可以为(a1+a2+…+ax)/x。当通过加权亮度确定该亮度平均值时,假设x个像素点对应的加权值依次为b1、b2、……、bx,则该块的亮度平均值可以为(a1×b1+a2×b2+…+ax×bx)/(b1+b2+…+bx)。
再者,该多个亮度范围可以包括至少两个亮度范围,即该多个亮度范围可以包括两个或者两个以上的亮度范围。比如,该多个亮度范围可以包括三个亮度范围,假设亮度可以有256个级别,则三个亮度范围且可以依次表示为[0,80)、[80,160)和[160,255]。以上数值仅用于举例,不用于限定方案的实施。
具体的,对于当前帧图像中多个块中的每个块,图像处理设备可以根据该块的亮度与该多个亮度范围中的每个亮度范围进行比较,当该块的亮度大于或等于该多个亮度范围中某一亮度范围的最小值、且小于或等于该亮度范围的最大值时,可以确定该块的亮度属于该亮度范围内。
比如,假设多个块中某一块的亮度为70,由于70大于亮度范围[0,80)中的最小值0、且大于最大值80,则确定该块的亮度属于亮度范围[0,80)内,即属于低亮度范围;若另一块的亮度为160,由于160与亮度范围[160,255]中的160相等,则可以确定该块的亮度160属于亮度范围[160,255]内。
S202:根据第一亮度范围内的至少一个块的亮度确定第一亮度值,根据第二亮度范围内的至少一个块的亮度确定第二亮度值,其中,假设第一亮度范围在多个亮度范围中具有最高亮度,即高亮度范围,第二亮度范围在多个亮度范围中具有最低亮度,即低亮度范围。
其中,多个亮度范围分别具有不同的亮度。比如,在三个亮度范围[0,80]、[80,160]和[160,255]中,第一亮度范围可以是[160,255],第二亮度范围可以是[0,80]。
第一亮度值可以用于表示第一亮度范围内的至少一个块的整体亮度,第二亮度值可以用于表示第二亮度范围内的至少一个块的整体亮度。可选的,第一亮度值为第一亮度范围内的至少一个块的平均亮度值,第二亮度值为第二亮度范围内的至少一个块的平均亮度值。
需要说明的是,第一亮度值可以是第一亮度范围内的至少一个块的亮度之和与该至少一个块的数量的比值、或者是该至少一个块的加权亮度之和与该至少一个块的权重之和的比值,或者是通过其他方法计算得到的亮度平均值等。第二亮度值可以是第二亮度范围内的至少一个块的亮度之和与该至少一个块的数量的比值、或者是该至少一个块的加权亮度之和与该至少一个块的权重之和的比值,或者是通过其他方法计算得到的亮度平均值等。其中,确定第一亮度值和第二亮度值的具体过程与上述步骤S201中根据多个像素点的亮度确定每个块的亮度的具体过程类似,具体参见上述描述,本申请实施例在此不再赘述。
S203:根据第一亮度值和第二亮度值确定曝光补偿量。其中,曝光补偿量的作用是用于调整曝光量,该曝光量可以是相机根据自动曝光(auto exposure,AE)算法得到的,即相机在拍摄图像的过程中通过自动测光计算得到的曝光量。
可选的,图像处理设备根据第一亮度值和第二亮度值确定曝光补偿量,包括:根据当前帧图像中多个块的平均亮度值、第一亮度值、第二亮度值、以及第二亮度范围内的至少一个块与该多个块的比例,确定曝光补偿量。
其中,该多个块的平均亮度值可以是该多个块的亮度之和与该多个块的数量的比值、或者是该多个块的加权亮度之和与该多个块的权重之和的比值,或者是通过其他方法计算得到的亮度平均值等。需要说明的是,确定该多个块的平均亮度值的具体过程与上述步骤S201中根据多个像素点的亮度确定每个块的亮度的具体过程类似,具体参见上述描述,本申请实施例在此不再赘述。
第二亮度范围内的至少一个块与该多个块的比例可以用于表示第二亮度范围所表示的亮度区域在当前帧图像中的比例,比如,该多个块的数量为64,第二亮度范围内的至少一个块的数量为8,则该比例为8/64=1/8。
具体的,若该多个块的平均亮度值表示为W、第一亮度值表示为H、第二亮度值表示为D、第二亮度范围内的至少一个块与该多个块的比例表示为α,期望的亮度值表示为L,则曝光补偿量可以为该多个块的平均亮度值W与期望的亮度值L的比值,若曝光补偿量表示为C,则图像处理设备可以根据如下公式(1)和(2)确定曝光补偿量C。
Figure PCTCN2018097292-appb-000001
Figure PCTCN2018097292-appb-000002
式中,H thd表示抑制因子,H thd为常数,可以根据实际情况自行设定,当设定的抑制因子H thd的值较大时,得到的图像的亮度较高,当设定的抑制因子H thd的值较小时, 得到的图像的亮度较低。H thd可以通过测试或依照本领域技术人员的经验获得。
进一步的,在S203之前,该方法还可以包括:S203a。
S203a:根据第一亮度值和第二亮度值,确定是否进入高反差场景以触发S203的操作。高反差场景可以是指图像中具有最高亮度的区域与具有最低亮度的区域之间的亮度值差异较大,超出了相机可以捕获的范围。当然,本实施例也可以不必执行S203a,而在执行S202之后自动进入S203。
也即是,图像处理设备在通过S202确定第一亮度值和第二亮度值之后,根据第一亮度值和第二亮度值确定是否进入高反差场景。当确定进入高反差场景时可触发步骤S203以确定曝光补偿量,当确定未进入高反差场景时可不触发步骤S203,可终止本实施例的执行。
具体的,图像处理设备可以通过以下方式根据第一亮度值和第二亮度值,确定是否进入高反差场景:当第一亮度值与第二亮度值的比值大于或等于预设的第一数值时,确定进入高反差场景;或者,当第一亮度值与第二亮度值的差值大于或等于预设的第二数值时,确定进入高反差场景。否则,不进入高反差场景。
需要说明的是,预设的第一数值和第二数值可以事先由本领域技术人员设置,且具体的数值大小可以根据实际情况进行设定,本申请实施例对此不做具体限定。另外,上述根据第一亮度值和第二亮度值,确定进入高反差场景的方式仅为示例性的,还可以通过其他方式确定进入高反差场景,本申请实施例对此同样不做具体限定。
S204:利用曝光补偿量对下一帧图像做曝光补偿。其中,下一帧图像是指当前帧图像之后的一帧图像,当前帧图像和下一帧图像可以是对同一场景进行拍摄得到的图像,因此,图像处理设备可以利用曝光补偿量对下一帧图像做曝光补偿。
具体的,图像处理设备可以根据曝光补偿量和曝光量(即AE算法得到的曝光量)之和,对下一帧图像进行曝光处理。比如,图像处理设备根据曝光补偿量和曝光量之和,确定曝光时间和感光度的增益,并按照确定的曝光时间和感光度的增益对下一帧图像进行曝光,以实现对下一帧图像做曝光补偿。通过利用曝光补偿量对下一帧图像做曝光补偿,可以提高下一帧图像的亮度,从而提高图像中亮度较暗区域的细节,进而提高用户的拍照体验。
进一步的,参见图2,在步骤S201之前,该方法还包括:S200b。
S200b:图像处理设备确定多个亮度范围。可选的,图像处理设备根据当前帧图像中多个块中每个块的亮度确定至少一个亮度阈值,根据至少一个亮度阈值确定该多个亮度范围。
至少一个亮度阈值可以包括一个或者多个亮度阈值。图像处理设备根据多个块中每个块的亮度确定至少一个亮度阈值,可以包括:根据当前帧图像中多个块的亮度,确定多个块的平均亮度值;根据多个块的平均亮度值,确定至少一个亮度阈值。
其中,该多个块的平均亮度值可以是该多个块的亮度之和与该多个块的数量的比值、或者是该多个块的加权亮度之和与该多个块的权重之和的比值,或者是通过其他方法计算得到的亮度平均值等。需要说明的是,确定该多个块的平均亮度值的具体过程与上述步骤S201中根据多个像素点的亮度确定每个块的亮度的具体过程类似,具体参见上述描述,本申请实施例在此不再赘述。
另外,图像处理设备根据多个块的平均亮度值,确定至少一个亮度阈值,具体可以包括:根据多个块的平均亮度值和预设数值,确定至少一个亮度阈值。比如,该多个块的平均亮度值为W、预设数值为Q,则图像处理设备可以将W与Q的乘积、以及W与Q的商确定为两个亮度阈值。
需要说明的是,预设数值可以事先设置,比如,预设数值Q可以设置为4,上述根据W与Q的乘积、以及W与Q的商确定亮度阈值的方法仅为示例性的,并不对本申请实施例构成限定,图像处理设备还可以通过其他方式确定至少一个亮度阈值。
在确定至少一个亮度阈值后,图像处理设备根据至少一个亮度阈值将指定亮度长度划分为多个亮度范围。比如,指定亮度长度为[0,255],至少一个亮度阈值包括两个亮度阈值且分别为80和160,则图像处理设备可以根据亮度阈值80、160将指定亮度长度[0,255]划分为三个亮度范围,分别为[0,80)、[80,160)和[160,255],这三个亮度范围可以用于表示当前帧图像中的低亮区域、中亮区域和高亮区域。亮度范围的数量由亮度阈值数量决定。例如,一个亮度阈值将指定亮度长度划分为两个亮度范围,一次类推。本实施例以两个亮度阈值和三个亮度范围为例作说明,但不用于限定。实际应用中,设置多少个亮度范围可以灵活选择,只要大于等于两个均可。
需要说明的是,上述指定亮度长度可以事先设置,比如,指定亮度长度可以为[0,255]或者[0,160]等,本申请实施例对此不作具体限定。
进一步的,参见图2,在步骤S201之前,该方法还包括:S200a。
S200a:确定该多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由该多个子块的亮度得到。
具体的,确定该多个块中每个块的亮度,可以包括:图像处理设备将当前帧图像划分为多个子块,比如,将当前帧图像划分为16×16个子块、32×16个子块、或者32×32个子块等;可以对划分得到的多个子块进行下采样,得到当前帧图像中的多个块,比如,下采样时将相邻的四个子块确定为一个块,则16×16个子块下采样后即为8×8个块。然后,根据每个块中包括的多个子块的亮度确定每个块的亮度。因此,本方案是直接在200a中执行下采样,然后根据多个子块的亮度确定下采样后形成的块的亮度。在一种可选实施方式中,被确定的一个块的亮度可以是该块包括的多个子块的平均亮度值。可选的,一个块的亮度可以是所述多个子块的亮度之和与所述多个子块的数量的比值、或者是所述多个子块的加权亮度之和与所述多个子块的权重之和的比值,或者是通过其他方法计算得到的所述多个子块的亮度平均值等。需要说明的是,确定一个块的亮度的具体过程与上述步骤S201中根据多个像素点的亮度确定每个块的亮度的具体过程类似,具体参见上述描述,本申请实施例在此不再赘述。
另外,对划分得到的多个子块进行下采样,得到当前帧图像中的多个块时,图像处理设备可以对划分得到的多个子块进行一次下采样即得到当前帧图像中的多个块,也可以对划分得到的多个子块进行多次下采样后得到当前帧图像中的多个块,具体下采样的次数本申请实施例对此不做具体限定。比如,通过将相邻的四个子块确定为一个块的方式进行下采样,若当前帧图像被划分得到32×32个子块,则对32×32个子块进行一次下采样得到16×16个块,对16×16个块再进行一次下采样得到8×8个块。
在一种可选的实现方式中,可以不仅在200a中执行下采样,而是在S201中执行 下采样。例如,按照图2在实施例的S201来确定每个块的亮度范围后,可通过下采样消除不平滑,下采样后的每个宏块可包括多个块,并在S201中进一步确定每个宏块中的多个块所处于的亮度范围。也即是说,下采样之后的宏块被作为一个整体,其内部的多个块被统一确定所属的亮度范围,而不是单独确定每一个块的亮度范围。这里以该多个亮度范围包括三个亮度范围(比如,高亮、中亮和低亮)为例,假设当前帧图像划分得到如图3所示的16×16个块。首先,在S201中确认每个块的初步亮度范围,如之前图2对应的实施例的描述。为便于观察,这里可以对每个块的亮度属于三个亮度范围中哪个亮度范围进行标记,假设高亮/中亮/低亮分别对应的标记为0/1/2,则标记后的图像可以如图4所示,图4中以白色表示高亮,即标记0、以灰色表示中亮,即标记1、以黑色表示低亮,即标记2。其次,进一步下采样来最终确定每个块的亮度范围。在下采样的时候,假设每4个块成为一个宏块,则将16×16个块变为8×8个宏块,在确定每个宏块属于三个亮度范围中的哪个亮度范围时,可以根据每个宏块中所包括的该多个块对应的标记之和确定该宏块整体所属的亮度范围,该和被视为是宏块的标记。比如,以每个宏块包括4个块为例,若该4个块对应的标记之和小于或等于2,则确定该宏块属于高亮;若该4个块对应的标记之和大于2且小于4,则确定该宏块属于中亮;若该4个块对应的标记之和大于或等于4,则确定该宏块属于低亮。例如,根据16×16个块确定任一宏块中每个块所属的亮度范围如图5所示。通过下采样,一个帧的图像内各个块的亮度范围划分变得更加规整和可靠。对比图4和图5,图像内的三个亮度范围内的一个或多个块所组成的形状更加平滑,即三个亮度范围的边界变得更自然。每个宏块内的多个块被作为一个整体确定其所属于的亮度范围,从而最终确定三个亮度范围内各自包括了哪些块,从而进一步执行S202,方法具体进一步参照前面实施例介绍。
上述主要从图像处理设备的角度对本申请实施例提供的图像处理方法进行了介绍。可以理解的是,该图像处理设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的结构及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对应的图像处理装置进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图6示出了上述实施例中所涉及的图像处理装置的一种可能的结构示意图。该图像处理装置包括:确定单元301和补偿单元302。其中,确定单元301用于支持该装置执行方法实施例中的S200a、S200b、S203a、S201至S203中的一个或者多个步骤,和/或用于本文所描述的技术的其他过程;补偿单元302用于支持该装置执行方法实施例中的S204。具体的,结合图1,在 一种实现方案中,当确定单元301和补偿单元302通过软件形式实现时,即确定单元301和补偿单元302所对应的软件程序包括在存储器101中,处理器102通过运行存储器101中的包括确定单元301和补偿单元302在内的软件程序以实现确定单元301和补偿单元302对应的功能。在另一种实现方案中,当确定单元301和补偿单元302通过硬件形式实现时,确定单元301和补偿单元302可以是处理器102中包括的硬件电路或加速器或者被直接用于取代处理器102,确定单元301和补偿单元302的每个具体可由硬件电路或加速器实现,可包括电子线路、数字电路、逻辑电路、或模拟电路中至少一种。此外,通过软件形式或者硬件形式实现的补偿单元302或者处理器102,在具体做曝光补偿时,可以是指通过电信号控制光传感器或光补偿元件的曝光,以实现电子层面的曝光补偿,而最终光学层面的曝光补偿是由光传感器或光补偿元件执行的。
上面从模块化功能实体的角度对本申请实施例中的一种图像处理装置进行描述,下面从硬件处理的角度对本申请实施例中的一种图像处理装置进行描述。
本申请实施例还提供的一种图像处理装置,该图像处理装置的结构可以如图1所示。在本申请实施例中,处理器102被配置为可处理上述图像处理方法的S200a、S200b、S203a、S201至S203部分的功能,比如,处理器102用于确定多个块中每个块的亮度,确定多个亮度范围,根据多个块中每个块的亮度确定每个块位于多个亮度范围中的一个亮度范围内,根据第一亮度范围内的至少一个块的亮度确定第一亮度值,根据第二亮度范围内的至少一个块的亮度确定第二亮度值,以及根据第一亮度值和第二亮度值确定曝光补偿量等。
在一些可行的实施例中,该输入\输出接口105输出的以上信息可以送到存储器101中存储,也可以送到另外的处理流程中继续进行处理,或者输出的当前帧图像和下一帧图像送到显示设备进行显示、送到播放器终端进行播放等。
存储器101:该存储器中可存储上述当前帧图像、当前帧图像中每个块的亮度、第一亮度值、第二亮度值、曝光补偿量和下一帧图像、以及配置处理器的相关指令等。
传感器组件103中可以包括光补偿元件,比如,光补偿元件为光传感器,处理器102可以控制光传感器的曝光时间和感光度的增益,从而处理器102可以根据曝光补偿量对光传感器的曝光时间和感光度的增益进行调整,实现利用曝光补偿量对下一帧图像进行曝光补偿的功能。
本申请实施例提供的上述图像处理装置的各组成部分分别用于实现相对应的前述图像处理方法的各步骤的功能,由于在前述的图像处理方法实施例中,已经对各步骤进行了详细说明,在此不再赘述。
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在一个设备(比如,该设备可以是单片机,芯片、计算机或处理器等)上运行时,使得该设备执行上述图像处理方法的S200a、S200b、S203a、S201-S204中的一个或多个步骤。上述图像处理装置的各组成模块如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在所述计算机可读取存储介质中。
基于这样的理解,本申请实施例还提供一种包含指令的计算机程序产品,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可 以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或其中的处理器执行本申请各个实施例所述方法的全部或部分步骤。
在本申请实施例中,通过当前帧图像的多个块中,位于具有最高亮度的第一亮度范围内的至少一个块的亮度确定第一亮度值,具有最低亮度的第二亮度范围内的至少一个块的亮度确定第二亮度值,从而根据第一亮度值和第二亮度值确定曝光补偿量,因此该曝光补偿量与当前帧图像中亮暗区域的位置有关,从而利用该曝光补偿量对下一帧图像做曝光补偿时,可以提高曝光补偿的准确性,进而提高图像的品质,以提高用户拍摄图像的体验。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (27)

  1. 一种图像处理方法,其特征在于,所述方法包括:
    根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;
    根据第一亮度范围内的至少一个块的亮度确定第一亮度值,所述第一亮度范围在所述多个亮度范围中具有最高亮度;
    根据第二亮度范围内的至少一个块的亮度确定第二亮度值,所述第二亮度范围在所述多个亮度范围中具有最低亮度;
    根据所述第一亮度值和所述第二亮度值确定曝光补偿量;
    利用所述曝光补偿量对下一帧图像做曝光补偿。
  2. 根据权利要求1所述的图像处理方法,其特征在于,所述根据当前帧图像的多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内之前,所述方法还包括:
    根据所述当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;
    根据所述至少一个亮度阈值,确定所述多个亮度范围。
  3. 根据权利要求2所述的图像处理方法,其特征在于,所述根据所述当前帧图像中多个块中每个块的亮度,确定多个亮度阈值,包括:
    根据所述当前帧图像中多个块的亮度,确定所述多个块的平均亮度值;
    根据所述多个块的平均亮度值,确定多个亮度阈值。
  4. 根据权利要求1-3任一项所述的图像处理方法,其特征在于,所述根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内之前,所述方法还包括:
    确定所述多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由所述多个子块的亮度得到。
  5. 根据权利要求1-4任一项所述的图像处理方法,其特征在于,所述根据所述第一亮度值和所述第二亮度值确定曝光补偿量之前,所述方法还包括:
    根据所述第一亮度值和所述第二亮度值,确定进入高反差场景以触发根据所述第一亮度值和所述第二亮度值确定所述曝光补偿量的操作。
  6. 根据权利要求5所述的图像处理方法,其特征在于,所述根据所述第一亮度值和所述第二亮度值,确定所述当前帧图像处于高反差场景中,包括:
    当所述第一亮度值与所述第二亮度值的比值大于或等于第一数值时,确定进入所述高反差场景;或者,
    当所述第一亮度值与所述第二亮度值的差值大于或等于第二数值时,确定进入所述高反差场景。
  7. 根据权利要求1-6任一项所述的图像处理方法,其特征在于,所述第一亮度值为所述第一亮度范围内的所述至少一个块的平均亮度值,所述第二亮度值为所述第二亮度范围内的所述至少一个块的平均亮度值。
  8. 根据权利要求1-7任一项所述的图像处理方法,其特征在于,所述根据所述第 一亮度值和所述第二亮度值确定曝光补偿量,包括:
    根据所述多个块的平均亮度值、所述第一亮度值、所述第二亮度值、以及所述第二亮度范围内的所述至少一个块与所述多个块的比例,确定所述曝光补偿量。
  9. 根据权利要求1-8任一项所述的图像处理方法,其特征在于,所述多个块是所述当前帧图像中的M×N个块,M和N为正整数。
  10. 一种图像处理装置,其特征在于,所述装置包括:
    确定单元,用于根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;
    根据第一亮度范围内的至少一个块的亮度确定第一亮度值,所述第一亮度范围在所述多个亮度范围中具有最高亮度;
    根据第二亮度范围内的至少一个块的亮度确定第二亮度值,所述第二亮度范围在所述多个亮度范围中具有最低亮度;
    根据所述第一亮度值和所述第二亮度值确定曝光补偿量;
    补偿单元,用于利用所述曝光补偿量对下一帧图像做曝光补偿。
  11. 根据权利要求10所述的图像处理装置,其特征在于,所述确定单元,还用于:
    根据所述当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;
    根据所述至少一个亮度阈值,确定所述多个亮度范围。
  12. 根据权利要求11所述的图像处理装置,其特征在于,所述确定单元,还用于:
    根据所述当前帧图像中多个块的亮度,确定所述多个块的平均亮度值;
    根据所述多个块的平均亮度值,确定多个亮度阈值。
  13. 根据权利要求10-12任一项所述的图像处理装置,其特征在于,所述确定单元,还用于:
    确定所述多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由所述多个子块的亮度得到。
  14. 根据权利要求10-13任一项所述的图像处理装置,其特征在于,所述确定单元,还用于:
    根据所述第一亮度值和所述第二亮度值,确定进入高反差场景以触发根据所述第一亮度值和所述第二亮度值确定所述曝光补偿量的操作。
  15. 根据权利要求14所述的图像处理装置,其特征在于,所述确定单元,还用于:
    当所述第一亮度值与所述第二亮度值的比值大于或等于第一数值时,确定进入所述高反差场景;或者,
    当所述第一亮度值与所述第二亮度值的差值大于或等于第二数值时,确定进入所述高反差场景。
  16. 根据权利要求10-15任一项所述的图像处理装置,其特征在于,所述第一亮度值为所述第一亮度范围内的所述至少一个块的平均亮度值,所述第二亮度值为所述第二亮度范围内的所述至少一个块的平均亮度值。
  17. 根据权利要求10-16任一项所述的图像处理装置,其特征在于,所述确定单元,还用于:
    根据所述多个块的平均亮度值、所述第一亮度值、所述第二亮度值、以及所述第 二亮度范围内的所述至少一个块与所述多个块的比例,确定所述曝光补偿量。
  18. 根据权利要求10-17任一项所述的图像处理装置,其特征在于,所述多个块是所述当前帧图像中的M×N个块,M和N为正整数。
  19. 一种图像处理装置,其特征在于,所述装置包括:处理器和接口;
    所述处理器,被配置为通过所述接口读取存储器中的软件程序,并在所述软件程序的驱动下处理如下操作:
    根据当前帧图像中多个块中每个块的亮度,确定每个块位于多个亮度范围中的一个亮度范围内;
    根据第一亮度范围内的至少一个块的亮度确定第一亮度值,所述第一亮度范围在所述多个亮度范围中具有最高亮度;
    根据第二亮度范围内的至少一个块的亮度确定第二亮度值,所述第二亮度范围在所述多个亮度范围中具有最低亮度;
    根据所述第一亮度值和所述第二亮度值确定曝光补偿量;
    利用所述曝光补偿量对下一帧图像做曝光补偿。
  20. 根据权利要求19所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    根据所述当前帧图像中多个块中每个块的亮度,确定至少一个亮度阈值;
    根据所述至少一个亮度阈值,确定所述多个亮度范围。
  21. 根据权利要求20所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    根据所述当前帧图像中多个块的亮度,确定所述多个块的平均亮度值;
    根据所述多个块的平均亮度值,确定多个亮度阈值。
  22. 根据权利要求19-21任一项所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    确定所述多个块中每个块的亮度,其中每个块包括多个子块,每个块的亮度由所述多个子块的亮度得到。
  23. 根据权利要求19-22任一项所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    根据所述第一亮度值和所述第二亮度值,确定进入高反差场景以触发根据所述第一亮度值和所述第二亮度值确定所述曝光补偿量的操作。
  24. 根据权利要求23所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    当所述第一亮度值与所述第二亮度值的比值大于或等于第一数值时,确定进入所述高反差场景;或者,
    当所述第一亮度值与所述第二亮度值的差值大于或等于第二数值时,确定进入所述高反差场景。
  25. 根据权利要求19-24任一项所述的图像处理装置,其特征在于,所述第一亮度值为所述第一亮度范围内的所述至少一个块的平均亮度值,所述第二亮度值为所述第二亮度范围内的所述至少一个块的平均亮度值。
  26. 根据权利要求19-25任一项所述的图像处理装置,其特征在于,所述处理器还执行以下操作:
    根据所述多个块的平均亮度值、所述第一亮度值、所述第二亮度值、以及所述第二亮度范围内的所述至少一个块与所述多个块的比例,确定所述曝光补偿量。
  27. 根据权利要求19-26任一项所述的图像处理装置,其特征在于,所述多个块是所述当前帧图像中的M×N个块,M和N为正整数。
PCT/CN2018/097292 2018-07-26 2018-07-26 一种图像处理方法及装置 WO2020019266A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/097292 WO2020019266A1 (zh) 2018-07-26 2018-07-26 一种图像处理方法及装置
CN201880087278.3A CN111630839B (zh) 2018-07-26 2018-07-26 一种图像处理方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/097292 WO2020019266A1 (zh) 2018-07-26 2018-07-26 一种图像处理方法及装置

Publications (1)

Publication Number Publication Date
WO2020019266A1 true WO2020019266A1 (zh) 2020-01-30

Family

ID=69182099

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097292 WO2020019266A1 (zh) 2018-07-26 2018-07-26 一种图像处理方法及装置

Country Status (2)

Country Link
CN (1) CN111630839B (zh)
WO (1) WO2020019266A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113364994B (zh) * 2021-08-11 2021-11-12 浙江芯昇电子技术有限公司 一种背光补偿方法及背光补偿电路

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102368809A (zh) * 2011-09-02 2012-03-07 深圳市先河系统技术有限公司 曝光补偿装置和方法、以及红外摄像机
CN103957362A (zh) * 2014-05-05 2014-07-30 广东欧珀移动通信有限公司 一种自动调整相机曝光效果的方法及系统
US20140307117A1 (en) * 2013-04-15 2014-10-16 Htc Corporation Automatic exposure control for sequential images
CN105208281A (zh) * 2015-10-09 2015-12-30 广东欧珀移动通信有限公司 一种夜景拍摄方法及装置
CN105959585A (zh) * 2016-05-12 2016-09-21 深圳众思科技有限公司 多级逆光检测方法及装置

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5127317B2 (ja) * 2007-06-25 2013-01-23 三洋電機株式会社 カメラ
CN104038703A (zh) * 2014-05-26 2014-09-10 四川长虹电器股份有限公司 数字摄像机感光自适应控制方法
CN104125410B (zh) * 2014-07-02 2017-04-12 深圳英飞拓科技股份有限公司 一种全景视频多镜头曝光补偿方法及其装置
CN104301624B (zh) * 2014-10-30 2018-04-03 青岛海信移动通信技术股份有限公司 一种图像拍摄亮度控制方法及装置
CN105827995B (zh) * 2016-03-30 2018-03-30 深圳金三立视频科技股份有限公司 基于直方图的自动曝光方法及系统
CN106791472B (zh) * 2016-12-29 2019-07-30 努比亚技术有限公司 一种曝光方法及终端
CN106847150B (zh) * 2017-01-04 2020-11-13 捷开通讯(深圳)有限公司 调节显示屏亮度的装置及方法
CN106791475B (zh) * 2017-01-23 2019-08-27 上海兴芯微电子科技有限公司 曝光调整方法及所适用的车载摄像装置
CN107438163B (zh) * 2017-07-31 2020-07-07 努比亚技术有限公司 一种拍照方法、终端及计算机可读存储介质
CN107463051B (zh) * 2017-08-25 2020-04-24 维沃移动通信有限公司 一种曝光方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102368809A (zh) * 2011-09-02 2012-03-07 深圳市先河系统技术有限公司 曝光补偿装置和方法、以及红外摄像机
US20140307117A1 (en) * 2013-04-15 2014-10-16 Htc Corporation Automatic exposure control for sequential images
CN103957362A (zh) * 2014-05-05 2014-07-30 广东欧珀移动通信有限公司 一种自动调整相机曝光效果的方法及系统
CN105208281A (zh) * 2015-10-09 2015-12-30 广东欧珀移动通信有限公司 一种夜景拍摄方法及装置
CN105959585A (zh) * 2016-05-12 2016-09-21 深圳众思科技有限公司 多级逆光检测方法及装置

Also Published As

Publication number Publication date
CN111630839A (zh) 2020-09-04
CN111630839B (zh) 2021-08-31

Similar Documents

Publication Publication Date Title
EP3624439B1 (en) Imaging processing method for camera module in night scene, electronic device and storage medium
CN111028189B (zh) 图像处理方法、装置、存储介质及电子设备
CN108322646B (zh) 图像处理方法、装置、存储介质及电子设备
CN110445988B (zh) 图像处理方法、装置、存储介质及电子设备
CN109547701B (zh) 图像拍摄方法、装置、存储介质及电子设备
WO2020034737A1 (zh) 成像控制方法、装置、电子设备以及计算机可读存储介质
US11532076B2 (en) Image processing method, electronic device and storage medium
WO2020034735A1 (en) Imaging control method and electronic device
US20200045219A1 (en) Control method, control apparatus, imaging device, and electronic device
CN111028190A (zh) 图像处理方法、装置、存储介质及电子设备
CN110445989B (zh) 图像处理方法、装置、存储介质及电子设备
US20120081579A1 (en) High Dynamic Range Transition
CN109005369B (zh) 曝光控制方法、装置、电子设备以及计算机可读存储介质
CN107105172B (zh) 一种用于对焦的方法和装置
CN113132695B (zh) 镜头阴影校正方法、装置及电子设备
WO2020034739A1 (zh) 控制方法、装置、电子设备和计算机可读存储介质
JP2014123797A (ja) 撮像制御装置、撮像システム、撮像制御方法およびプログラム
CN111405185B (zh) 一种摄像机变倍控制方法、装置、电子设备及存储介质
US8212891B2 (en) Apparatus, methods and computer readable storage mediums
CN116416122A (zh) 图像处理方法及其相关设备
WO2020019266A1 (zh) 一种图像处理方法及装置
CN112584057B (zh) 一种光照度检测方法和装置
WO2015192545A1 (zh) 拍照的方法、装置及计算机存储介质
CN111586280B (zh) 拍摄方法、装置、终端及可读存储介质
CN109672829B (zh) 图像亮度的调整方法、装置、存储介质及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18927599

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18927599

Country of ref document: EP

Kind code of ref document: A1