Image shadow correction method and device, storage medium and electronic equipment
By employing at least two storage modules in an electronic device to perform a ping-pong operation, intra-frame configuration of gain information is achieved, solving the problem of low frame rate in image processing in the prior art and realizing high frame rate image output.
Patent Information
- Application Number
- CN202111028171.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-02
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2041-09-02
AI Technical Summary
Existing technologies struggle to meet high frame rate requirements in image processing, resulting in low frame rates for image processing in electronic devices. This is primarily because gain information is configured between frames, which fails to meet the shadow correction requirements of high frame rates.
At least two storage modules are used to perform a ping-pong operation. The first gain information of the image to be corrected is read for shadow correction processing, and the second gain information of the next frame image is written into another storage module to realize the intra-frame configuration of gain information.
The frame rate of image processing has been increased, enabling high frame rate output of electronic devices and ensuring uninterrupted image processing.
Smart Images

Figure CN115767285B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, specifically to an image shadow correction method, apparatus, storage medium, and electronic device. Background Technology
[0002] In recent years, with the rapid development of internet technology and the upgrading of device hardware, electronic devices have become increasingly feature-rich, and more and more users are using them for entertainment activities, such as taking pictures or videos. When taking pictures or videos, the image quality is determined by both the imaging hardware and software algorithms within the electronic device. The core components of the imaging hardware include lenses and image sensors.
[0003] Due to the inherent optical characteristics of the lens, the edge areas of the image sensor's image area receive less light than the central area, resulting in inconsistent brightness between the center and corners of the image. To address this issue, shadow correction is required on the captured images. Since the gain value for shadow correction generally changes with external environmental factors, such as light source intensity, the gain information for the next frame needs to be configured before shadow correction. Current shadow correction schemes often rely on registers to configure gain information. This typically involves configuring the gain information for the next frame after processing one frame, which makes it difficult to meet high frame rate requirements, resulting in low image processing frame rates for electronic devices. Summary of the Invention
[0004] This application provides an image shadow correction method, apparatus, storage medium, and electronic device, which can improve the image processing frame rate of the electronic device.
[0005] In a first aspect, embodiments of this application provide an image shadow correction method, including:
[0006] Obtain the image to be corrected;
[0007] A ping-pong operation is performed using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0008] Secondly, embodiments of this application also provide an image shadow correction device, comprising:
[0009] The image acquisition module is used to acquire the image to be corrected.
[0010] A shadow correction module is used to perform a ping-pong operation using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0011] Thirdly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when run on a computer, causes the computer to perform an image shadow correction method as provided in any embodiment of this application.
[0012] Fourthly, embodiments of this application also provide an electronic device, including a processor and a storage module, wherein the storage module has a computer program, and the processor executes the image shadow correction method as provided in any embodiment of this application by calling the computer program.
[0013] The technical solution provided in this application acquires an image to be corrected, performs a ping-pong operation using at least two storage modules, reads first gain information of the image to be corrected from one of the at least two storage modules, uses the first gain information to perform shadow correction processing on the image to be corrected, and writes second gain information of the next frame of the image to be corrected into the other of the at least two storage modules. This solution, by employing a ping-pong operation on at least two storage modules, achieves intra-frame configuration of gain information, improves the frame rate of image processing, and thus enables high frame rate image output from electronic devices. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a schematic diagram of the first process of the image shadow correction method provided in the embodiments of this application.
[0016] Figure 2 This is a schematic diagram of image segmentation in the image shadow correction method provided in the embodiments of this application.
[0017] Figure 3 This is a schematic diagram of the ping-pong operation in the image shadow correction method provided in the embodiments of this application.
[0018] Figure 4This is a schematic diagram illustrating the reading of gain information for one channel in the image shadow correction method provided in this application embodiment.
[0019] Figure 5 This is a schematic diagram of the image shadow correction device provided in an embodiment of this application.
[0020] Figure 6 This is a schematic diagram of a first structure of an electronic device provided in an embodiment of this application.
[0021] Figure 7 This is a schematic diagram of a second structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.
[0023] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0024] This application provides an image shadow correction method. The subject executing this image shadow correction method can be the image shadow correction device provided in this application, or an electronic device integrating the image shadow correction device. The image shadow correction device can be implemented in hardware or software. The electronic device can be a smartphone, tablet computer, PDA, laptop computer, or desktop computer, etc.
[0025] Please see Figure 1 , Figure 1 This is a schematic diagram of a first flowchart of the image shadow correction method provided in this application embodiment. The specific flow of the image shadow correction method provided in this application embodiment can be as follows:
[0026] 101. Obtain the image to be corrected.
[0027] This application applies to an electronic device, which includes an image sensor, at least two storage modules, and an image processor. The image sensor captures and outputs a raw image, which may be in RAW format. The at least two storage modules store gain information used for shadow correction processing of the image. The image processor receives the raw image to be corrected (i.e., the image to be corrected) from the image sensor, reads the corresponding gain information from the storage modules, and performs shadow correction processing on the image to be corrected based on the gain information.
[0028] The image processor can be an ISP (Image Signal Processor).
[0029] RAW format images (i.e., Bayer images with the .raw extension) are the raw data from a CMOS (Complementary Metal Oxide Semiconductor) or CCD (Charge-Coupled Device) image sensor, which converts the captured light source signals into digital signals. Raw RAW image data has higher grayscale levels and preserves complete data information. The RGB (Red, Green, Blue) colors in RAW image data can be arranged in various ways, such as RGGB, GRBG, GBRG, and BGGR. In other words, a single frame of RAW format image to be corrected typically includes pixel data from four channels. Therefore, when performing shadow correction on the image, shadow correction processing needs to be performed on the pixel data of each of the four channels separately. Taking the RGGB arrangement as an example, a frame of RAW format image to be corrected includes pixel data from four channels: R, G, G, and B. When calculating gain information, it is necessary to calculate the gain information corresponding to each channel separately. During shadow correction processing, for the pixel data of each channel, shadow correction processing is performed based on the gain information corresponding to that channel.
[0030] It should be noted that the solution of this application embodiment can be applied to scenarios such as taking photos or recording videos. Specifically, when taking a photo using an electronic device, a preview image is displayed in the viewfinder. The preview content is a sequence of multiple images continuously captured by the image sensor, and each frame of the image needs to undergo shadow correction processing. The image sensor outputs a series of consecutive frames of images to be corrected, and the image processor, using the solution of this application embodiment, receives these consecutive frames of images to be corrected and performs shadow correction processing on each of them.
[0031] 102. Perform a ping-pong operation using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and write the second gain information of the next frame of the image to be corrected into the other storage module of the at least two storage modules.
[0032] The following description uses an electronic device with two storage modules as an example to illustrate the specific implementation of the ping-pong operation in this application embodiment. It is understood that in other embodiments, the electronic device may also include three or more storage modules; therefore, the gain information of three or more consecutive frames of images to be corrected can be stored respectively in three or more storage modules.
[0033] Furthermore, it should be noted that a storage module in the embodiments of this application can be a separate memory, or it can be a specific memory address segment within a memory as a module. Taking a storage module as a separate memory as an example, the memory can be of any type; for example, at least two storage modules can be SRAM (Static Random-Access Memory). In one embodiment, the electronic device of this application embodiment is provided with two SRAMs, denoted as SRAM1 and SRAM2, which are used to store gain information.
[0034] In this embodiment, the solution uses a block-based approach to achieve shadow correction. For example, the image to be corrected is divided into a×b blocks. For each block, a gain value is calculated. Thus, a×b gain values can be calculated for one frame of the image to be corrected. These a×b gain values can be stored in a storage module in the form of a table and are referred to as gain information.
[0035] Please see Figure 2 , Figure 2 This diagram illustrates image segmentation in the image shadow correction method provided in this application. Since the original image is typically cropped, the shaded area represents the actual size of the processed image after the cropping operation. In this diagram, the image to be corrected is uniformly segmented. In other embodiments, non-uniform segmentation can be used; for example, the blocks in the central region of the image can be relatively larger, while the blocks near the image edges can be relatively smaller.
[0036] The values of 'a' and 'b' are pre-configured as needed. The size of the two memories can be set to the maximum size according to the requirements of image segmentation. For example, if the image is divided into a maximum of 28×20 blocks, the size of the two memories can be customized to store 28×20×C gain values, where C is the number of channels, for example, C=4. These two memories can also be used when the number of blocks is a<28 and b<20.
[0037] The image sensor of the electronic device continuously exposes and outputs RAW format images to be corrected. For each frame of the image to be corrected, the image processor reads the gain information from memory and performs shadow correction processing on it. Simultaneously, while performing shadow correction processing on the current frame, the gain information for the next frame can be configured and stored. Once the shadow correction processing for the current frame is complete, shadow correction processing for the next frame can begin without waiting. This intra-frame configuration and storage is implemented using a ping-pong operation between two memories; that is, a read operation on one memory is simultaneously a write operation on the other, and the read and write operations do not interfere with each other.
[0038] In some embodiments, performing a ping-pong operation using at least two storage modules includes: performing a ping-pong operation on at least two storage modules according to the value of a selection signal, wherein the value of the selection signal is alternately set to a first preset value and a second preset value according to the frequency of image shadow correction processing, and the first preset value is different from the second preset value.
[0039] In this embodiment, the image processor determines which of the two memories to read gain information from based on a pre-configured selection signal. The configuration frequency of this selection signal is consistent with the frequency of the image shadow correction processing; that is, the value of the selection signal is alternately set to a first preset value and a second preset value according to the frequency of the image shadow correction processing, and the first preset value is different from the second preset value.
[0040] Please see Figure 3 , Figure 3This is a schematic diagram of the ping-pong operation in the image shadow correction method provided in this application embodiment. A read operation is performed on one memory while a write operation is performed on another memory; the read and write operations do not interfere with each other. For example, in one embodiment, the value of a selection signal is determined; when the value of the selection signal is a first preset value, the first gain information of the image to be corrected is read from the first storage module to perform shadow correction processing on the image to be corrected, and simultaneously the second gain information of the next frame of the image to be corrected is written to the second storage module; when the value of the selection signal is a second preset value, the first gain information of the image to be corrected is read from the second storage module to perform shadow correction processing on the image to be corrected, and simultaneously the second gain information of the next frame of the image to be corrected is written to the first storage module.
[0041] For example, with the initial value of the selection signal at 0, the image processor reads the gain information of the first frame of the image to be corrected from the first memory SRAM1. Simultaneously, it writes the gain information of the second frame of the image to be corrected into the second memory SRAM2 via the bus. Once the first frame of the image to be corrected is processed, the value of the selection signal is set to 1. The image processor then processes the second frame of the image to be corrected. At this point, the value of the selection signal is 1, so the image processor reads the gain information of the second frame of the image to be corrected from the second memory SRAM2. Simultaneously, it writes the gain information of the third frame of the image to be corrected into the first memory SRAM1. This ping-pong operation is repeated continuously. This ensures that the image processor continuously retrieves gain information from memory, thus enabling uninterrupted shadow correction processing of multiple consecutive frames of the image to be corrected.
[0042] Next, the method of image shadow correction will be described. In one embodiment, reading the first gain information of the image to be corrected from the first storage module to perform shadow correction processing on the image to be corrected includes: determining the coordinates of the pixel to be corrected in the image to be corrected; reading the first gain value at the corresponding position from the first gain information in the first storage module; and performing shadow correction processing on the pixel to be corrected based on the first gain value.
[0043] When performing shadow correction on an image to be corrected, the image processor can process n pixels per cycle, where n ≥ 1. For example, if n = 4, it can process pixels of one pixel unit per cycle. For RAW format images, taking the RGGB arrangement as an example, one pixel unit includes four pixels: R, G, G, and B. The image processor can simultaneously read the first gain information corresponding to these four pixels from the corresponding memory.
[0044] The gain information of the image to be corrected is written into the processor during the shadow correction processing of the previous frame of the image to be corrected. The writing method is as follows:
[0045] In one embodiment, the image to be corrected is a RAW format image, and the first storage module and the second storage module include multiple storage units; writing the second gain information of the next frame image of the image to be corrected into another storage module of at least two storage modules includes: calculating the second gain information of the next frame image of the image to be corrected on multiple channels respectively; for each channel, storing the second gain information of the channel into the storage unit corresponding to the channel in the second storage module.
[0046] For RAW format images, taking the RGGB arrangement as an example, four adjacent R, G, G, B pixels form a pixel unit. Therefore, one frame of an image contains pixel data from four channels: R, G, G, and B. Please refer to [link / reference]. Figure 4 , Figure 4 This diagram illustrates the reading of gain information for one channel in the image shadow correction method provided in this application. A pixel unit includes four channels: R, G, G, and B, denoted as channel 0, channel 1, channel 2, and channel 3, respectively. Therefore, when calculating the gain information of a frame of an image to be corrected, the gain information for each channel can be calculated separately, and the gain information for each channel can be stored as a gain information table, resulting in four gain information tables. For example... Figure 4 As shown, channel 0 corresponds to gain information table 0, channel 1 corresponds to gain information table 1, channel 2 corresponds to gain information table 2, and channel 3 corresponds to gain information table 3. Taking the first memory as an example, the first memory may include multiple storage units, for example, four storage units, denoted as storage unit 0, storage unit 1, storage unit 2, and storage unit 3. The four gain information tables are stored in the four storage units respectively. When the image processor performs shadow correction processing by processing four pixels per cycle, it can simultaneously read the gain values corresponding to the four pixels R, G, G, and B from the four gain information tables of the four processing units. When reading the gain value corresponding to the pixel to be corrected in the image to be corrected, the coordinates of the pixel to be corrected in the image to be corrected are first determined. Based on the coordinates, the first gain value at the corresponding position is read from the first gain information in the first storage module. That is, the block where the pixel to be corrected is located is determined based on the coordinates, and then the gain value of the block is determined. Since image block processing is performed when calculating gain information, in order to improve the accuracy of shadow correction, interpolation processing is generally required after obtaining the first gain value. Then, based on the position of the pixel to be corrected in the block, its corresponding second gain value is obtained, and shadow correction processing is performed on the pixel to be corrected based on the second gain value.
[0047] For example, in one embodiment, reading a first gain value at a coordinate location includes: reading multiple first gain values around the coordinate location. Based on the first gain value, performing shadow correction processing on the pixel value of the pixel to be corrected includes: performing bilinear interpolation based on the multiple first gain values to obtain a second gain value corresponding to the pixel to be corrected; multiplying the pixel value of the pixel to be corrected by the second gain value to obtain the pixel to be corrected after shadow correction processing.
[0048] In this embodiment, multiple first gain values around the coordinate location are read. For example, the block containing the pixel to be corrected is determined based on the coordinates, and m×m first gain values (m ≥ 2) of the block and its surrounding area are obtained from the corresponding gain information table. For example, in one embodiment, m = 4, so a total of 16 first gain values are obtained. Bilinear interpolation is performed based on these 16 gain values to obtain a second gain value corresponding to the pixel to be corrected. The pixel value of the pixel to be corrected is multiplied by the second gain value to obtain the pixel to be corrected after shadow correction.
[0049] For a gain value in a gain information, the gain value corresponds to all the pixels in a block. Please refer to the above for the image block division method, which will not be repeated here.
[0050] Furthermore, it should be noted that the calculation method for gain information described above is the same as that in existing technologies, and will not be repeated here. The calculation of gain information can be performed by a central processing unit (CPU) or an image processor (IPL).
[0051] In one embodiment, at least two storage modules are single-port SRAMs. When the memory used to store gain information is a single-port memory, it means that read and write operations cannot be performed simultaneously; one operation can only be performed after the other has been completed. In this case, the ping-pong operation method of this embodiment can achieve intra-frame configuration of gain information, ensuring that the image processor continuously retrieves gain information from the memory, and thus continuously performs shadow correction processing on multiple consecutive frames of images to be corrected.
[0052] In practice, this application is not limited by the execution order of the described steps. Without causing conflicts, some steps may be performed in other orders or simultaneously.
[0053] As can be seen from the above, the image shadow correction method provided in this application acquires an image to be corrected, performs a ping-pong operation using at least two storage modules, reads the first gain information of the image to be corrected from one of the at least two storage modules, uses the first gain information to perform shadow correction processing on the image to be corrected, and writes the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules. The solution in this application, by employing a ping-pong operation on at least two storage modules, achieves intra-frame configuration of gain information, improves the frame rate of image processing, and thus enables high frame rate image output from electronic devices.
[0054] In one embodiment, an image shadow correction device is also provided. See also... Figure 5 , Figure 5 This is a schematic diagram of the structure of the image shadow correction device 300 provided in an embodiment of this application. The image shadow correction device 300 is applied to an electronic device and includes an image acquisition module 301 and a shadow correction module 302, as detailed below:
[0055] Image acquisition module 301 is used to acquire the image to be corrected;
[0056] The shadow correction module 302 is used to perform a ping-pong operation using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0057] In some embodiments, the shadow correction module 302 is further configured to: perform a ping-pong operation on the at least two storage modules according to the value of the selection signal, wherein the value of the selection signal is alternately set to a first preset value and a second preset value according to the frequency of image shadow correction processing, and the first preset value is different from the second preset value.
[0058] In some embodiments, the at least two storage modules include a first storage module and a second storage module; the shadow correction module 302 is further configured to:
[0059] In some embodiments, the shadow correction module 302 is further configured to: determine the value of the selection signal;
[0060] When the value of the selection signal is a first preset value, the first gain information of the image to be corrected is read from the first storage module to perform shadow correction processing on the image to be corrected, and at the same time, the second gain information of the next frame of the image to be corrected is written into the second storage module.
[0061] When the value of the selection signal is a second preset value, the first gain information of the image to be corrected is read from the second storage module to perform shadow correction processing on the image to be corrected, and at the same time, the second gain information of the next frame of the image to be corrected is written into the first storage module.
[0062] In some embodiments, the shadow correction module 302 is further configured to: determine the coordinates of the pixel points to be corrected in the image to be corrected;
[0063] Read the first gain value at the position corresponding to the coordinate from the first gain information in the first storage module;
[0064] Based on the first gain value, shadow correction processing is performed on the pixel to be corrected.
[0065] In some embodiments, the shadow correction module 302 is further configured to: read a plurality of first gain values around the location of the coordinates; and perform bilinear interpolation based on the plurality of first gain values to obtain a second gain value corresponding to the pixel to be corrected.
[0066] Multiply the pixel value of the pixel to be corrected by the second gain value to obtain the pixel to be corrected after shadow correction processing.
[0067] In some embodiments, the image to be corrected is a RAW format image, and the first storage module and the second storage module include multiple storage units; the shadow correction module 302 is further configured to: calculate the second gain information of the next frame image of the image to be corrected on multiple channels respectively;
[0068] For each channel, the second gain information of the channel is stored in the storage unit corresponding to the channel in the second storage module.
[0069] In some embodiments, the at least two storage modules are single-port static random access memories.
[0070] It should be noted that the image shadow correction device provided in this application embodiment and the image shadow correction method in the above embodiment belong to the same concept. The image shadow correction device can implement any of the methods provided in the image shadow correction method embodiment. For details of its implementation process, please refer to the image shadow correction method embodiment, which will not be repeated here.
[0071] As can be seen from the above, the image shadow correction device proposed in this application acquires an image to be corrected, performs a ping-pong operation using at least two storage modules, reads the first gain information of the image to be corrected from one of the at least two storage modules, uses the first gain information to perform shadow correction processing on the image to be corrected, and writes the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules. The solution in this application, by employing a ping-pong operation on at least two storage modules, achieves intra-frame configuration of gain information, improves the frame rate of image processing, and thus enables high frame rate image output from electronic devices.
[0072] This application also provides an electronic device. The electronic device may be a smartphone, tablet computer, or similar device. Please refer to... Figure 6 , Figure 6 This is a schematic diagram of a first structure of an electronic device provided in an embodiment of this application. The electronic device 400 includes a processor 401 and a memory 402. The processor 401 and the memory 402 are electrically connected.
[0073] The processor 401 is the control center of the electronic device 400. It connects various parts of the electronic device through various interfaces and lines. By running or calling computer programs stored in the memory 402 and calling data stored in the memory 402, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole.
[0074] Memory 402 can be used to store computer programs and data. The computer programs stored in memory 402 contain instructions that can be executed in the processor. The computer programs can be composed of various functional modules. The processor 401 executes various functional applications and data processing by calling the computer programs stored in memory 402.
[0075] In this embodiment, the processor 401 in the electronic device 400 loads the instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to realize various functions:
[0076] Obtain the image to be corrected;
[0077] A ping-pong operation is performed using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0078] The at least two storage modules can be a portion of the storage units of memory 402, or they can be two separate memories independent of memory 402. Figure 6 (Not shown).
[0079] In some embodiments, please refer to Figure 7 , Figure 7 This is a second structural schematic diagram of the electronic device provided in an embodiment of this application. The electronic device 400 further includes: a radio frequency circuit 403, a display screen 404, a control circuit 405, an input unit 406, an audio circuit 407, a sensor 408, and a power supply 409. The processor 401 is electrically connected to the radio frequency circuit 403, the display screen 404, the control circuit 405, the input unit 406, the audio circuit 407, the sensor 408, and the power supply 409.
[0080] The radio frequency circuit 403 is used to transmit and receive radio frequency signals to communicate with network devices or other electronic devices via wireless communication.
[0081] The display screen 404 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic devices, which can be composed of images, text, icons, videos, and any combination thereof.
[0082] The control circuit 405 is electrically connected to the display screen 404 and is used to control the display screen 404 to display information.
[0083] The input unit 406 can be used to receive input numeric or character information or user characteristic information (such as fingerprints), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. The input unit 406 may include a fingerprint recognition module.
[0084] The audio circuit 407 provides an audio interface between the user and the electronic device via a speaker and a microphone. The audio circuit 407 includes a microphone, which is electrically connected to the processor 401. The microphone is used to receive voice information input by the user.
[0085] Sensor 408 is used to collect information about the external environment. Sensor 408 may include one or more sensors such as an ambient light sensor, an accelerometer, and a gyroscope.
[0086] The power supply 409 is used to supply power to the various components of the electronic device 400. In some embodiments, the power supply 409 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system.
[0087] Although not shown in the figure, electronic device 400 may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0088] In this embodiment, the processor 401 in the electronic device 400 loads the instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to realize various functions:
[0089] Obtain the image to be corrected;
[0090] A ping-pong operation is performed using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0091] As can be seen from the above, this application provides an electronic device that acquires an image to be corrected, performs a ping-pong operation using at least two memories, reads first gain information of the image to be corrected from one of the at least two memories, uses the first gain information to perform shadow correction processing on the image to be corrected, and writes second gain information of the next frame of the image to be corrected into the other of the at least two memories. The solution of this application, by employing a ping-pong operation on at least two memories, achieves intra-frame configuration of gain information, improves the frame rate of image processing, and thus enables high frame rate image output from the electronic device.
[0092] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run on a computer, the computer executes the image shadow correction method described in any of the above embodiments. For example, the computer program can perform the following steps:
[0093] Obtain the image to be corrected;
[0094] A ping-pong operation is performed using at least two storage modules to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and to write the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules.
[0095] It should be noted that those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, which may include, but is not limited to, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0096] Furthermore, the terms "first," "second," and "third," etc., used in this application are used to distinguish different objects, not to describe a specific order. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments may also include steps or modules not listed, or some embodiments may include other steps or modules inherent to these processes, methods, products, or devices.
[0097] The image shadow correction method, apparatus, storage medium, and electronic device provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An image shadow correction method, characterized in that, include: Obtain the image to be corrected; A ping-pong operation is performed using at least two storage modules. The ping-pong operation is performed on the at least two storage modules according to the value of the selection signal. The configuration frequency of the selection signal is consistent with the frequency of the image shadow correction processing. The first gain information of the image to be corrected is read from one of the at least two storage modules to perform shadow correction processing on the image to be corrected. At the same time, the second gain information of the next frame of the image to be corrected is written into the other storage module of the at least two storage modules.
2. The method as described in claim 1, characterized in that, The method of using at least two storage modules to perform ping-pong operations includes: The value of the selection signal is alternately set to a first preset value and a second preset value according to the frequency of image shadow correction processing, wherein the first preset value and the second preset value are different.
3. The method as described in claim 2, characterized in that, The at least two storage modules include a first storage module and a second storage module; the step of performing a ping-pong operation on the at least two storage modules according to the value of the selection signal, to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected, and simultaneously writing the second gain information of the next frame of the image to be corrected into the other of the at least two storage modules, includes: Determine the value of the selection signal; When the value of the selection signal is a first preset value, the first gain information of the image to be corrected is read from the first storage module to perform shadow correction processing on the image to be corrected, and at the same time, the second gain information of the next frame of the image to be corrected is written into the second storage module. When the value of the selection signal is a second preset value, the first gain information of the image to be corrected is read from the second storage module to perform shadow correction processing on the image to be corrected, and at the same time, the second gain information of the next frame of the image to be corrected is written into the first storage module.
4. The method as described in claim 3, characterized in that, The step of reading the first gain information of the image to be corrected from the first storage module to perform shadow correction processing on the image to be corrected includes: Determine the coordinates of the pixels to be corrected in the image to be corrected; Read the first gain value at the position corresponding to the coordinate from the first gain information in the first storage module; Based on the first gain value, shadow correction processing is performed on the pixel to be corrected.
5. The method as described in claim 4, characterized in that, The step of reading the first gain value at the position corresponding to the coordinates includes: Read multiple first gain values around the location of the coordinates; The step of performing shadow correction processing on the pixels to be corrected based on the first gain value includes: Based on the plurality of first gain values, bilinear interpolation is performed to obtain a second gain value corresponding to the pixel to be corrected. Multiply the pixel value of the pixel to be corrected by the second gain value to obtain the pixel to be corrected after shadow correction processing.
6. The method according to any one of claims 3 to 5, characterized in that, The image to be corrected is a RAW format image, and the first storage module and the second storage module include multiple storage units; The step of writing the second gain information of the next frame of the image to be corrected into another storage module of the at least two storage modules includes: Calculate the second gain information of the next frame of the image to be corrected on multiple channels; For each channel, the second gain information of the channel is stored in the storage unit corresponding to the channel in the second storage module.
7. The method according to any one of claims 1 to 5, characterized in that, Both of the at least two storage modules are single-port static random access memories.
8. An image shadow correction device, characterized in that, include: The image acquisition module is used to acquire the image to be corrected. A shadow correction module is used to perform a ping-pong operation using at least two storage modules. Based on the value of a selection signal, the module performs the ping-pong operation on the at least two storage modules. The configuration frequency of the selection signal is consistent with the frequency of the image shadow correction processing. This allows the module to read the first gain information of the image to be corrected from one of the at least two storage modules to perform shadow correction processing on the image to be corrected. Simultaneously, the module writes the second gain information of the next frame of the image to be corrected into the other storage module.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is run on a computer, it causes the computer to perform the image shadow correction method as described in any one of claims 1 to 7.
10. An electronic device comprising a processor and a memory, the memory storing a computer program, characterized in that, The processor executes the image shadow correction method as described in any one of claims 1 to 7 by invoking the computer program.
Citation Information
Patent Citations
Image recognition processing method and device
CN110874632A
Method and device for adjusting pixel brightness and electronic equipment
CN111953953A
Image processing method and device
CN112995505A