Method for eliminating black level, electronic device and readable storage medium

By calculating the average black level and gradient value of the image sensor and adjusting the image data, the black level problem generated by the image sensor under no-light conditions is solved, and the color performance and dark details of the image are improved.

CN116419078BActive Publication Date: 2026-03-17BYD SEMICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Image sensors generate black levels in the absence of light, causing grids and color casts in the image, affecting the color range and saturation.

Method used

By obtaining the average black level of each color channel of the current frame and the previous frame, calculating the absolute value of the difference and the gradient value, and adjusting the image data to eliminate the black level, the target image is obtained.

Benefits of technology

It eliminates black levels in the image, improves color gamut and saturation, and enhances the representation of details in dark areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116419078B_ABST
    Figure CN116419078B_ABST
Patent Text Reader

Abstract

This disclosure provides a method, electronic device, and readable storage medium for eliminating black levels. The method includes: acquiring a first average value and a second average value of the black level for each color channel in a current frame image, and a third average value and a fourth average value of the black level for each color channel in a previous frame image; determining a first target average value for each color channel based on the absolute value of a first difference between the first and third average values, and determining a second target average value for each color channel based on the absolute value of a second difference between the second and fourth average values; determining a black level gradient value based on the first and second average values ​​for each color channel; and processing the current frame image based on the first target average value, the second target average value, and the black level gradient value to obtain a target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and more specifically, to a method for eliminating black levels, an electronic device, and a readable storage medium. Background Technology

[0002] Image processing typically utilizes image sensors. However, due to inherent structural defects in image sensors, a black level can exist even in the absence of light, outputting a certain voltage and generating a black level. The presence of this black level can cause pixelation and color cast in the output image, and also affect the color gamut and saturation. Therefore, to achieve better color gamut and saturation, it is necessary to eliminate the impact of black levels on the image. Summary of the Invention

[0003] One object of this disclosure is to provide a method for eliminating black levels, which can eliminate the influence of black levels on images, making the color range of the image wider, the saturation better, and the dark details of the image more obvious.

[0004] According to a first aspect of the present disclosure, a method for eliminating black levels is provided, comprising:

[0005] Obtain the first average value and the second average value of the black level of each color channel in the current frame image, and obtain the third average value and the fourth average value of the black level of each color channel in the previous frame image; wherein, the first average value and the third average value are the average black level before the start of exposure, and the second average value and the fourth average value are the average black level from the end of exposure to the end of readout.

[0006] A first target average value for each color channel is determined based on the absolute value of the first difference between the first average value and the third average value, and a second target average value for each color channel is determined based on the absolute value of the second difference between the second average value and the fourth average value.

[0007] The black level gradient value is determined based on the first average value and the second average value of each color channel;

[0008] The current frame image is processed based on the first target average value, the second target average value, and the black level gradient value to obtain the target image.

[0009] Optionally, obtaining the first average value and the second average value of the black level of each color channel in the current frame image includes:

[0010] Obtain the black level indicator and black level data in the current frame image;

[0011] Based on the black level identifier, the black level data corresponding to each color channel is accumulated and the average value is calculated to obtain the first average value and the second average value.

[0012] Optionally, determining a first target average value for each color channel based on the absolute value of the first difference between the first average value and the third average value, and determining a second target average value for each color channel based on the absolute value of the second difference between the second average value and the fourth average value, includes:

[0013] The absolute value of the first difference is compared with a preset threshold, and the first target average value is determined based on the first comparison result.

[0014] The absolute value of the second difference is compared with the preset threshold, and the second target average value is determined based on the second comparison result.

[0015] Optionally, the preset threshold includes a preset first threshold and a preset second threshold, wherein the preset first threshold is greater than the preset second threshold;

[0016] The step of comparing the absolute value of the first difference with the preset threshold and determining the first target average value based on the first comparison result includes:

[0017] If the first comparison result is that the absolute value of the first difference is greater than the preset first threshold, the first average value is determined as the first target average value;

[0018] If the first comparison result is that the absolute value of the first difference is less than the preset first threshold and greater than the preset second threshold, the first target average value is calculated by the first average value and the third average value.

[0019] If the first comparison result is that the absolute value of the first difference is less than the preset second threshold, the third average value is determined as the first target average value.

[0020] Optionally, the preset threshold includes a preset first threshold and a preset second threshold, wherein the preset first threshold is greater than the preset second threshold;

[0021] The step of comparing the absolute value of the second difference with the preset threshold and determining the second target average value based on the second comparison result includes:

[0022] If the second comparison result is that the absolute value of the second difference is greater than the preset first threshold, the second average value is determined as the second target average value;

[0023] If the second comparison result is that the absolute value of the second difference is less than the preset first threshold and greater than the preset second threshold, the second target average value is calculated from the second average value and the fourth average value.

[0024] If the second comparison result is that the absolute value of the second difference is less than the preset second threshold, the fourth average value is determined as the second target average value.

[0025] Optionally, determining the black level gradient value based on the first average value and the second average value of each of the color channels includes:

[0026] Calculate the third difference between the second average and the first average;

[0027] The third difference is subjected to gradient processing to obtain the black level gradient value.

[0028] Optionally, processing the current frame image based on the first target average value, the second target average value, and the black level gradient value to obtain the target image includes:

[0029] The target image is obtained by subtracting the first target average value and the black level gradient value from the original image data of the current frame image.

[0030] According to a second aspect of the present disclosure, an apparatus for eliminating black levels is also provided, comprising:

[0031] The acquisition module is used to acquire the first average value and the second average value of the black level of each color channel in the current frame image, and to acquire the third average value and the fourth average value of the black level of each color channel in the previous frame image; wherein, the first average value and the third average value are the average black level before the start of exposure, and the second average value and the fourth average value are the average black level from the end of exposure to the end of readout.

[0032] The determining module is configured to determine a first target average value for each color channel based on the absolute value of the first difference between the first average value and the third average value, and to determine a second target average value for each color channel based on the absolute value of the second difference between the second average value and the fourth average value; and to determine a black level gradient value based on the first average value and the second average value for each color channel.

[0033] The processing module is used to process the current frame image based on the first target average value, the second target average value, and the black level gradient value to obtain the target image.

[0034] According to a third aspect of the present disclosure, an electronic device is also provided, including a memory and a processor, the memory being configured to store executable instructions; the processor being configured to execute, under the control of the instructions, a method for eliminating black levels according to any one of the first aspects of the present disclosure.

[0035] According to a fourth aspect of the present disclosure, a readable storage medium is also provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method for eliminating black levels as described in any of the first aspects of the present disclosure.

[0036] One beneficial effect of this disclosure is that by acquiring the first and second average values ​​of the black level of each color channel in the current frame image, and the third and fourth average values ​​of the black level of each color channel in the previous frame image; wherein the first and third average values ​​are the average black level before exposure begins, and the second and fourth average values ​​are the average black level from the end of exposure to the end of readout; based on the absolute value of the first difference between the first and third average values, a first target average value for each color channel is determined, and based on the absolute value of the second difference between the second and fourth average values, a second target average value for each color channel is determined; based on the first and second average values ​​for each color channel, a black level gradient value is determined; and the current frame image is processed based on the first target average value, the second target average value, and the black level gradient value to obtain a target image. This eliminates the black levels present in the image, resulting in a wider color gamut, better saturation, and more pronounced detail in the dark areas of the image. Attached Figure Description

[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments of the invention and, together with their description, serve to explain the principles of the invention.

[0038] Figure 1 This is a flowchart illustrating a method for eliminating black levels according to an embodiment of the present disclosure;

[0039] Figure 2 This is a schematic diagram of the image data format in an embodiment of this disclosure;

[0040] Figure 3 This is a schematic diagram illustrating the principle of the method for eliminating black levels according to an embodiment of this disclosure;

[0041] Figure 4 A schematic diagram of the structure of the device for eliminating black levels according to an embodiment of this disclosure;

[0042] Figure 5 This is a schematic diagram of the hardware structure of an exemplary electronic device. Detailed Implementation

[0043] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of the invention.

[0044] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.

[0045] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0046] In all the examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0047] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0048] <Method Implementation>

[0049] Figure 1 This is a flowchart illustrating a method for eliminating black levels according to an embodiment of the present disclosure.

[0050] like Figure 1 As shown, the method for eliminating black levels in this embodiment can be specifically executed by an electronic device.

[0051] Specifically, the method for eliminating black levels in this embodiment may include the following steps 1100 to 1400:

[0052] Step 1100: Obtain the first average value and the second average value of the black level of each color channel in the current frame image, and obtain the third average value and the fourth average value of the black level of each color channel in the previous frame image.

[0053] Wherein, the first average value is the average black level before the exposure of the current frame image begins, the second average value is the average black level from the end of the exposure of the current frame image to the end of the readout, the third average value is the average black level before the exposure of the previous frame image begins, and the fourth average value is the average black level from the end of the exposure of the previous frame image to the end of the readout.

[0054] First, it should be noted that in this embodiment, the black level cancellation operation is performed on each color channel of the current frame image. For example... Figure 2 As shown, the image data of the current frame is arranged in BG / GR, where B is the blue component of the three primary colors, G is the green component of the three primary colors, and R is the red component of the three primary colors. The BG / GR arrangement of the image data is divided into four color channels.

[0055] When the image sensor exposes the current frame image, it outputs several lines of dark level data before and after the output of valid image data, such as... Figure 3 As shown, the image sensor outputs several lines of black level data before the exposure begins, and then outputs several more lines of black level data after the valid data is output, i.e. from the end of the exposure until the readout is complete.

[0056] Understandably, in global exposure mode, the first part of the Dark Row data is closer to the black level values ​​contained in the first few rows of the valid image data, that is, the black level formed before the exposure begins, while the Dark Row data output in the latter part is closer to the black level values ​​contained in the last few rows of the valid image data, including the black level formed before the exposure and the black level accumulated from the end of the exposure to the end of the readout.

[0057] In this embodiment, under global exposure mode, the image sensor is controlled to output raw image data without any processing. Based on the raw image data, the black level identifier and black level data in the current frame image are obtained. According to the black level identifier, the black level data corresponding to each color channel is accumulated and the average value is calculated to obtain the first average value and the second average value.

[0058] In other words, the black level data of each of the four color channels is accumulated and averaged to obtain the first and second average values. Similarly, the black level identifier and black level data in the previous frame image can be obtained. Based on the black level identifier, the black level data corresponding to each color channel in the previous frame image is accumulated and averaged to obtain the third and fourth average values.

[0059] After obtaining the first average, second average, third average, and fourth average, proceed to step 1200:

[0060] Step 1200: Determine the first target average value of each color channel based on the absolute value of the first difference between the first average value and the third average value, and determine the second target average value of each color channel based on the absolute value of the second difference between the second average value and the fourth average value.

[0061] In this step, the absolute value of the difference between the average value of the current frame image and the average value of the four color channels of the previous frame image is calculated, and then compared with a preset threshold to obtain the target average value used to eliminate black levels.

[0062] Specifically, we can first calculate the first difference between the first average value and the third average value, and then take the absolute value of the first difference to obtain the absolute value of the first difference. We can then calculate the second difference between the second average value and the fourth average value, and then take the absolute value of the second difference to obtain the absolute value of the second difference.

[0063] After obtaining the absolute value of the first difference and the absolute value of the second difference, the absolute value of the first difference is compared with a preset threshold, and the first target average value is determined based on the first comparison result. The absolute value of the second difference is then compared with the preset threshold, and the second target average value is determined based on the second comparison result.

[0064] In practical applications, the preset threshold includes a first preset threshold and a second preset threshold, wherein the first preset threshold is greater than the second preset threshold. When the first comparison result is that the absolute value of the first difference is greater than the first preset threshold, the electronic device determines the first average value as the first target average value; when the first comparison result is that the absolute value of the first difference is less than the first preset threshold but greater than the second preset threshold, the first average value and the third average value are calculated to obtain the first target average value; when the first comparison result is that the absolute value of the first difference is less than the second preset threshold, the third average value is determined as the first target average value.

[0065] Similarly, when the second comparison result is that the absolute value of the second difference is greater than the preset first threshold, the electronic device determines the second average value as the second target average value; when the second comparison result is that the absolute value of the second difference is less than the preset first threshold and greater than the preset second threshold, the electronic device calculates the second average value and the fourth average value to obtain the second target average value; when the second comparison result is that the absolute value of the second difference is less than the preset second threshold, the fourth average value is determined as the second target average value.

[0066] Specifically, the first target average value is obtained by calculating the first average value and the third average value, and the second target average value is obtained by calculating the second average value and the fourth average value. Specifically, the first target average value can be obtained by adding or subtracting one from the third average value in the direction of the first average value, and the second target average value can be obtained by adding or subtracting one from the fourth average value in the direction of the second average value.

[0067] For example, when the first average value is greater than the third average value, the electronic device adds one to the third average value to obtain the first target average value; when the first average value is less than the third average value, the electronic device subtracts one from the third average value to obtain the target average value.

[0068] Similarly, when the second average is greater than the fourth average, the electronic device adds one to the fourth average to obtain the second target average; when the second average is less than the fourth average, the electronic device subtracts one from the fourth average to obtain the second target average.

[0069] Step 1300: Determine the black level gradient value based on the first average value and the second average value of each color channel.

[0070] In this step, the electronic device calculates a third difference between the second average value and the first average value; and performs gradient processing on the third difference to obtain the black level gradient value.

[0071] Specifically, taking a color channel as an example, the third difference AVER_D = AVER_B - AVER_F is obtained by subtracting the first average value from the second average value of the color channel. Here, AVER_F represents the first average value and AVER_B represents the second average value.

[0072] In this embodiment, using the row coordinates of the effective image as a reference, the third difference AVER_D can be gradient-processed using the formula AVER_D_D=(AVER_D / Row)*Row_CNT*K, where AVER_D represents the third difference, Row represents the total number of rows in the effective image, Row_CNT represents the row coordinates of the effective image, K represents the adjustment coefficient, and AVER_D_D is the result of the gradient-processed gradient, which is used to restore the linear gradient change of the black level in the image along the row direction in the global exposure mode.

[0073] Step 1400: Process the current frame image based on the first target average value, the second target average value, and the black level gradient value to obtain the target image.

[0074] Specifically, the target image is obtained by subtracting the first target average value and the black level gradient value from the original image data of the current frame image. Subtracting the first target average value from the original data of the current frame image removes the black levels accumulated in the pixels of the image sensor before exposure begins. Subtracting the black level gradient value removes the new black levels formed in the storage capacitor from the end of exposure until readout. This removes both types of black levels contained in each color channel of each row, resulting in a target image with eliminated black levels.

[0075] In one embodiment, after step 1400, the electronic device may further verify the image data of the target image and then output the target image.

[0076] The method for eliminating black levels in this embodiment has been described above with reference to the accompanying drawings. In this embodiment, the first and second average values ​​of the black level of each color channel in the current frame image are obtained, and the third and fourth average values ​​of the black level of each color channel in the previous frame image are obtained. The first and third average values ​​are the average black level before exposure begins, and the second and fourth average values ​​are the average black level from the end of exposure to the end of readout. A first target average value for each color channel is determined based on the absolute value of the first difference between the first and third average values, and a second target average value for each color channel is determined based on the absolute value of the second difference between the second and fourth average values. A black level gradient value is determined based on the first and second average values ​​of each color channel. The current frame image is processed based on the first target average value, the second target average value, and the black level gradient value to obtain a target image. This achieves the purpose of removing black levels accumulated in the pixels of the image sensor before exposure begins, and removing newly formed black levels in the storage capacitor from the end of exposure to the end of readout, eliminating black levels in the image, resulting in a wider color range, better saturation, and more obvious dark detail in the image.

[0077] <Device Embodiment>

[0078] In this embodiment, a device 4000 for eliminating black levels is also provided.

[0079] like Figure 4 As shown, the device 4000 for eliminating black levels in this embodiment may include an acquisition module 4100, a determination module 4200, and a processing module 4300.

[0080] The acquisition module 4100 is used to acquire the first average value and the second average value of the black level of each color channel in the current frame image, and to acquire the third average value and the fourth average value of the black level of each color channel in the previous frame image; wherein the first average value and the third average value are the average black level before the start of exposure, and the second average value and the fourth average value are the average black level from the end of exposure to the end of readout.

[0081] The determining module 4200 is configured to determine a first target average value for each color channel based on the absolute value of the first difference between the first average value and the third average value, and to determine a second target average value for each color channel based on the absolute value of the second difference between the second average value and the fourth average value; and to determine a black level gradient value based on the first average value and the second average value for each color channel.

[0082] The processing module 4300 is used to process the current frame image based on the first target average value, the second target average value and the black level gradient value to obtain the target image.

[0083] In one embodiment, the acquisition module 4100 is specifically used to: acquire the black level identifier and black level data in the current frame image; and calculate the average value by accumulating the black level data corresponding to each color channel according to the black level identifier, so as to obtain the first average value and the second average value.

[0084] In one embodiment, the determining module 4200 is specifically used to compare the absolute value of the first difference with a preset threshold, and determine the first target average value based on the first comparison result; and to compare the absolute value of the second difference with the preset threshold, and determine the second target average value based on the second comparison result.

[0085] In one embodiment, the preset threshold includes a preset first threshold and a preset second threshold, wherein the preset first threshold is greater than the preset second threshold; the determining module 4200 is specifically configured to: determine the first average value as the first target average value when the first comparison result is that the absolute value of the first difference is greater than the preset first threshold; calculate the first target average value by combining the first average value and the third average value when the first comparison result is that the absolute value of the first difference is less than the preset first threshold and greater than the preset second threshold; and determine the third average value as the first target average value when the first comparison result is that the absolute value of the first difference is less than the preset second threshold.

[0086] In one embodiment, the preset threshold includes a preset first threshold and a preset second threshold, wherein the preset first threshold is greater than the preset second threshold; the determining module 4200 is specifically used to calculate the second target average value by calculating the second average value and the fourth average value when the second comparison result is that the absolute value of the second difference is less than the preset first threshold and greater than the preset second threshold; and to determine the fourth average value as the second target average value when the second comparison result is that the absolute value of the second difference is less than the preset second threshold.

[0087] In one embodiment, the determining module 4200 is specifically used to calculate a third difference between the second average value and the first average value; and to perform gradient processing on the third difference to obtain the black level gradient value.

[0088] In one embodiment, the processing module 4300 is specifically used to subtract the first target average value from the original image data of the current frame image and subtract the black level gradient value to obtain the target image.

[0089] The device for eliminating black levels in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0090] <Electronic Device Examples>

[0091] In this embodiment, an electronic device 5000 is also provided.

[0092] like Figure 5 As shown, the electronic device 5000 may include a processor 5100 and a memory 5200, the memory 5200 being used to store executable instructions; the processor 5100 being used to operate the electronic device 5000 to execute instructions according to the above. Figure 1 The method for eliminating black levels described in this embodiment.

[0093] <Media Example>

[0094] This disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the communication address allocation method provided in any of the foregoing embodiments.

[0095] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.

[0096] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0097] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0098] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.

[0099] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0100] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0101] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are equivalent.

[0103] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.

Claims

1. A method of black level elimination, characterized by, The method comprises the following steps: obtaining a first average value and a second average value of a black level of each color channel in a current frame image, and obtaining a third average value and a fourth average value of a black level of each color channel in a previous frame image; wherein the first average value and the third average value are average values of the black level before exposure starts, and the second average value and the fourth average value are average values of the black level from the end of exposure to the completion of readout; determining a first target average value of each color channel according to a first difference absolute value of the first average value and the third average value, and determining a second target average value of each color channel according to a second difference absolute value of the second average value and the fourth average value; determining a black level gradient value according to the first average value and the second average value of each color channel; performing row-by-row processing on the current frame image based on the first target average value and the black level gradient value to obtain a target image; the method of determining the first target average value of each color channel according to the first difference absolute value of the first average value and the third average value, and determining the second target average value of each color channel according to the second difference absolute value of the second average value and the fourth average value, comprises: comparing the first difference absolute value with a preset threshold value, and determining the first target average value according to a first comparison result; comparing the second difference absolute value with the preset threshold value, and determining the second target average value according to a second comparison result; the method of determining the black level gradient value according to the first average value and the second average value of each color channel, comprises: calculating a third difference value between the second average value and the first average value; performing gradient processing on the third difference value to obtain the black level gradient value.

2. The method of claim 1, wherein, the method of obtaining the first average value and the second average value of the black level of each color channel in the current frame image, comprises: obtaining black level identification and black level data in the current frame image; calculating the average value of the black level data corresponding to each color channel respectively after accumulation according to the black level identification, to obtain the first average value and the second average value.

3. The method of claim 1, wherein, the preset threshold value comprises a preset first threshold value and a preset second threshold value, and the preset first threshold value is greater than the preset second threshold value; the method of comparing the first difference absolute value with the preset threshold value, and determining the first target average value according to a first comparison result, comprises: in the case that the first comparison result is that the first difference absolute value is greater than the preset first threshold value, determining the first average value as the first target average value; in the case that the first comparison result is that the first difference absolute value is less than the preset first threshold value and greater than the preset second threshold value, calculating the first target average value from the first average value and the third average value; in the case that the first comparison result is that the first difference absolute value is less than the preset second threshold value, determining the third average value as the first target average value.

4. The method of claim 1, wherein, the preset threshold value comprises a preset first threshold value and a preset second threshold value, and the preset first threshold value is greater than the preset second threshold value; The comparing the second difference absolute value with the preset threshold value, determining the second target average value according to a second comparison result, comprises: In a case that the second comparison result is that the second difference absolute value is greater than the preset first threshold value, determining the second average value as the second target average value; In a case that the second comparison result is that the second difference absolute value is less than the preset first threshold value and greater than the preset second threshold value, calculating the second average value and the fourth average value to obtain the second target average value; In a case that the second comparison result is that the second difference absolute value is less than the preset second threshold value, determining the fourth average value as the second target average value.

5. The method of claim 1, wherein, The processing the current frame image based on the first target average value, the second target average value and the black level gradient value to obtain a target image, comprises: Subtracting the first target average value and the black level gradient value from original image data of the current frame image to obtain the target image.

6. An apparatus for eliminating a black level, characterized by comprising: Comprise: The acquisition module is used for acquiring a first average value and a second average value of a black level of each color channel in a current frame image, and acquiring a third average value and a fourth average value of a black level of each color channel in a previous frame image; wherein the first average value and the third average value are average values of the black level before exposure starts, and the second average value and the fourth average value are average values of the black level from after exposure ends to when readout is completed; The determination module is used for determining a first target average value of each color channel according to a first difference absolute value of the first average value and the third average value, and determining a second target average value of each color channel according to a second difference absolute value of the second average value and the fourth average value; and determining a black level gradient value according to the first average value and the second average value of each color channel; The processing module is used for performing line-by-line processing on the current frame image based on the first target average value and the black level gradient value to obtain a target image; The determination module is specifically used for comparing the first difference absolute value with a preset threshold value, and determining the first target average value according to a first comparison result; and comparing the second difference absolute value with the preset threshold value, and determining the second target average value according to a second comparison result; The determination module is also specifically used for calculating a third difference value between the second average value and the first average value; and performing gradient processing on the third difference value to obtain the black level gradient value. 7.An electronic device comprising a memory and a processor, the memory being configured to store executable instructions, and the processor being configured to execute the instructions to perform the method for eliminating a black level according to any one of claims 1-5.

8. A readable storage medium, characterized by, The readable storage medium stores programs or instructions, and the programs or instructions are executed by a processor to implement the steps of the method for eliminating a black level according to any one of claims 1-5.

Citation Information

Patent Citations

  • Adaptive black level correction method

    CN105578082A

  • Black level correction method and device

    CN111970465A