CN114022375A - Image processing method, image processing device, electronic equipment and computer readable storage medium - Google Patents

Image processing method, image processing device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN114022375A
CN114022375A CN202111292994.5A CN202111292994A CN114022375A CN 114022375 A CN114022375 A CN 114022375A CN 202111292994 A CN202111292994 A CN 202111292994A CN 114022375 A CN114022375 A CN 114022375A
Authority
CN
China
Prior art keywords
image
mean value
image block
channel mean
correlation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111292994.5A
Other languages
Chinese (zh)
Inventor
姚沁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lumi United Technology Co Ltd
Original Assignee
Lumi United Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lumi United Technology Co Ltd filed Critical Lumi United Technology Co Ltd
Priority to CN202111292994.5A priority Critical patent/CN114022375A/en
Publication of CN114022375A publication Critical patent/CN114022375A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application provides an image processing method and device, electronic equipment and a computer readable storage medium, and relates to the field of image processing. The method comprises the steps of determining a color channel mean value and an image characteristic parameter corresponding to each image block according to a plurality of image blocks obtained by blocking an image to be processed, calculating the correlation corresponding to each image block through the image characteristic parameter, selecting the color channel mean value corresponding to the image block of which the correlation meets a threshold value to participate in the calculation of a gain value, and performing image correction processing on each pixel point in the image to be processed based on the gain value obtained through calculation, so that the image color after the image correction processing is closer to the color of a real object, and a better image correction effect is ensured when a large-area single color appears in the image.

Description

Image processing method, image processing device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of image processing, and in particular, to an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium.
Background
Due to different spectral characteristics of different illumination, under illumination with different color temperatures, the object has different color tones, the higher the color temperature of the light source is, the more blue the object is, and the lower the color temperature of the light source is, the more yellow the object is. Therefore, correction processing is required for images taken under light sources of different color temperatures.
In the prior art, a gray world method can be adopted to perform image correction processing, and the method mainly calculates gains according to the mean values of three color channels (Red, Green and Blue) of the whole image and corrects the image according to the gains. However, when a single color of a large area appears in an image, the effect of image correction using the gray-scale world method is poor.
Disclosure of Invention
In view of the above, an object of the present application is to provide an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium, so as to solve the problem in the prior art that when a single color with a large area appears in a picture, an image correction effect is poor.
In order to achieve the above purpose, the embodiments of the present application employ the following technical solutions:
in a first aspect, the present application provides an image processing method, comprising:
determining a color channel mean value and an image characteristic parameter corresponding to each image block for a plurality of image blocks obtained by blocking the image to be processed; the image characteristic parameters represent the information richness of the image blocks;
calculating the correlation corresponding to each image block according to the image characteristic parameters;
determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block of which the correlation meets the threshold, and determining a gain value corresponding to the image to be processed according to the target color channel mean value;
and carrying out image correction processing on each pixel point in the image to be processed based on the gain value.
In a second aspect, the present application provides an image processing apparatus comprising:
the characteristic parameter calculation module is used for determining a color channel mean value and an image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by blocking the image to be processed; the image characteristic parameters represent the information richness of the image blocks;
the correlation calculation module is used for calculating the correlation corresponding to each image block according to the image characteristic parameters;
the gain calculation module is used for determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block of which the correlation meets the threshold, and determining a gain value corresponding to the image to be processed according to the target color channel mean value;
and the image correction module is used for carrying out image correction processing on each pixel point in the image to be processed based on the gain value.
In an optional embodiment, the correlation calculation module is configured to determine, according to an image feature parameter of each image block, a correlation between each image block and an image block adjacent to the image block in a preset direction, so as to obtain a correlation corresponding to each image block; and determining the correlation of the image block adjacent to the tail end image block in the opposite direction of the preset direction as the correlation corresponding to the tail end image block aiming at the tail end image block in the preset direction.
In an optional embodiment, the gain calculating module is configured to add a first identifier to the image block if the correlation of the image block meets the threshold; if the correlation of the image block does not meet the threshold, adding a second identifier to the image block; determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier; and the image block added with the first identifier represents an image block with rich image colors.
In an optional embodiment, the gain calculation module is configured to determine a target red channel mean value corresponding to the image to be processed according to a red channel mean value corresponding to the image block to which the first identifier is added; determining a target green channel mean value corresponding to the image to be processed according to the green channel mean value corresponding to the image block added with the first identifier; and determining a target blue channel mean value corresponding to the image to be processed according to the blue channel mean value corresponding to the image block added with the first identifier.
In an alternative embodiment, the target color channel mean value includes a target red channel mean value, a target green channel mean value, and a target blue channel mean value, and the gain calculation module is configured to calculate a sum of the target red channel mean value, the target green channel mean value, and the target blue channel mean value; calculating a red channel gain value corresponding to the image to be processed according to the sum value and the target red channel mean value; calculating a green channel gain value corresponding to the image to be processed according to the sum value and the target green channel mean value; and calculating a blue channel gain value corresponding to the image to be processed according to the sum value and the target blue channel mean value.
In an optional embodiment, the image correction module is configured to perform gain correction on each pixel point in a red channel according to the red channel gain value; performing gain correction on each pixel point in the green channel according to the green channel gain value; and performing gain correction on each pixel point in the blue channel according to the blue channel gain value.
In an optional embodiment, the image characteristic parameters include a color channel standard deviation, and the characteristic parameter calculation module is configured to perform mean value calculation on color channel values corresponding to all pixel points in each image block to obtain a color channel mean value corresponding to each image block; and calculating the standard deviation of the color channel corresponding to each image block according to the average value of the color channel corresponding to each image block and the color channel values corresponding to all the pixel points in each image block.
In a third aspect, the present application provides an electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the image processing method according to any of the preceding embodiments.
In a fourth aspect, the present application provides a computer-readable storage medium on which a computer program is stored, which computer program, when executed by a processor, implements the steps of the image processing method according to any of the preceding embodiments.
The image processing method, the image processing device, the electronic device and the computer-readable storage medium provided by the embodiment of the application determine the color channel mean value and the image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by partitioning an image to be processed, calculate the correlation corresponding to each image block through the image characteristic parameter, select the color channel mean value corresponding to the image block of which the correlation meets a threshold value to participate in the calculation of the gain value, and can select the color channel mean value corresponding to the image block of which the information abundance meets the condition to participate in the calculation of the gain value when a large-area single color appears in the image because the image characteristic parameter can represent the information abundance of the image block, so as to obtain a more accurate gain value, and perform image correction processing on each pixel point in the image to be processed based on the calculated gain value, so that the color of the image after the image correction processing is closer to the color of a real object, thereby ensuring better image correction effect when a large area of single color appears in the image.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
FIG. 1 is a schematic diagram illustrating an application environment of an image processing method provided by an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating another application environment of an image processing method provided by an embodiment of the present application;
FIG. 3 is a flow chart of an image processing method provided by an embodiment of the present application;
FIG. 4 is a schematic flow chart illustrating an image processing method according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram showing a comparison of an original image with a white balance corrected image;
FIG. 6 is a functional block diagram of an image processing apparatus according to an embodiment of the present application;
fig. 7 shows a hardware structure block diagram of an electronic device provided in an embodiment of the present application.
Icon: 10-an intelligent home system; 100-a subset of devices; 200-a gateway device; 300-a server; 400-a terminal device; 500-a router; 600-an image processing apparatus; 610-feature parameter calculation module; 620-correlation calculation module; 630-a gain calculation module; 640-an image correction module; 111-a processor; 112-a storage medium; 113-a memory; 114-input-output interface; 115-wired or wireless network interface; 116-a power supply; 1121 — operating system; 1122-data; 1123-application program.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic diagram of an application environment suitable for the embodiment of the present application. Fig. 1 provides an intelligent home system 10, where the intelligent home system 10 includes a sub-device 100, a gateway device 200 connected to the sub-device 100, and a server 300 connected to the gateway device 200. Wherein the number of the child devices 100 may be at least one and the number of the gateway device 200 may be at least one. When the number of gateway apparatuses 200 is plural, communication connection may be performed between different gateway apparatuses 200.
In this embodiment, the gateway device 200 may be an intelligent gateway controlled by an intelligent home, and may implement functions such as system information acquisition, information input, information output, centralized control, remote control, and linkage control. The gateway device 200 may be responsible for specific security alarm, appliance control, and power consumption information acquisition. The gateway device 200 can also perform information interaction with products such as an intelligent interactive terminal in a wireless manner. The gateway device 200 is also equipped with wireless routing capabilities, as well as superior wireless performance, network security, and coverage area. The sub-device 100 connected to the gateway device 200 may perform information and instruction interaction with the gateway device 200. The gateway device 200 and the sub-device 100 may be connected through communication methods such as bluetooth, WiFi (Wireless-Fidelity), ZigBee, and the like, and of course, the connection method between the gateway device 200 and the sub-device 100 may not be limited in this embodiment of the application.
In this embodiment, the sub-device 100 may include various intelligent devices, sensing devices, detection devices, and the like, which are disposed in an indoor space, such as a smart television, a smart refrigerator, a smart air conditioner, a smart door lock, a temperature and humidity sensor, a pressure sensor, a smoke sensor, a human body sensor, a door and window sensor, a smart switch, a socket, an electric lamp, an infrared emitting device, a camera device, and the like.
In this embodiment, the server 300 may be a server such as a local server or a cloud server, and a specific server type may not be limited in this embodiment of the application. The server 300 connected to the gateway apparatus 200 may wirelessly interact with the gateway apparatus 200. The gateway devices 200 disposed in different indoor spaces may be communicatively connected to the same server 300 through a network to perform information interaction between the server 300 and the gateway device 200.
Optionally, the smart home system 10 may further include a terminal device 400. The terminal device 400 may include a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), and the like, which are not limited herein. The terminal device 400 can interact information with the server 300 in a wireless mode such as 2G/3G/4G/5G/WiFi and the like. Of course, the connection mode between the terminal device 400 and the server 300 may not be limited in the embodiment of the present application. In some embodiments, the terminal device 400 may also be used for interaction with a user, so that the user may wirelessly communicate with the gateway device 200 via the terminal device 400 based on the router 500. In addition, the user may add one account information at the same time at the gateway device 200 and the terminal device 400, and the information synchronization between the gateway device 200 and the terminal device 400 is realized through the account information.
The terminal device 400 is provided with a corresponding App, when system configuration is performed, at least one gateway device 200 needs to be added to the App, when other sub-devices 100 are added, a sub-device adding button in an App interface is clicked, and the gateway device 200 which needs to be accessed by the sub-device 100 is selected in the adding interface, so that the sub-device 100 is added to the ZigBee network corresponding to the gateway device 200, and the ZigBee network is formed by the sub-device 100 and the gateway device 200 which are added together.
When the App is in the same local area network as the router 500 and the gateway device 200, the App may interact with the gateway device 200 and the child devices 100 connected to the gateway device 200 through a local area network path, and may also interact with the gateway device 200 and the child devices 100 connected to the gateway device 200 through a wide area network path.
When the App is not in the same local area network as the router 500 and the gateway apparatus 200, the App interacts with the gateway apparatus 200 and the child apparatuses 100 connected to the gateway apparatus 200 through a wide area network path.
In some embodiments, the user may set different trigger scenarios or automated linkages through the App of the terminal device 400. As one manner, the terminal device 400 may upload the scenario configuration information or the automation scheme to the server 300, so that when the trigger condition of the trigger scenario or the automation is reached, the server 300 may find a device corresponding to an execution action in the scenario configuration information or the automation scheme according to the stored scenario configuration information or the automation scheme, so as to notify the device to perform the execution action to meet the execution result of the trigger scenario or the automation. Alternatively, the server 300 may also send the scenario configuration information or the automation scheme to the gateway device 200, and the gateway device 200 finds a device corresponding to an execution action in the scenario configuration information or the automation scheme according to the stored scenario configuration information or the automation scheme. Meanwhile, the gateway device 200 may feed back the device's execution back to the server 300.
Automation (or automated linkage) is a linkage application built between the gateway device 200 or the sub-devices 100 connected to the gateway device 200; the automation comprises a trigger condition and an execution action, the devices in the automation comprise a trigger device and a controlled device (or an execution device), the trigger device and the controlled device are in communication connection through the gateway device 200, and when the trigger device meets the trigger condition, the gateway device 200 controls the controlled device to execute the corresponding execution action.
The triggering device may be a variety of sensors such as a pressure sensor, a temperature sensor, a humidity sensor, a door and window sensor, a smoke sensor, or the like.
The controlled device can be various switches, sockets, electric lamps, infrared emitting devices or camera devices and the like. The triggering device and the controlled device may be the same device.
The automation will be described below by way of an example. As shown in fig. 2, assume that the user sets an automatic linkage that automatically turns on the light when the door or window is opened, and the condition of this scene is that the door or window is opened and the execution action is that the intelligent switch controls the light bulb to turn on the light. Based on the application scene, a door and window sensor is set as a trigger device, and an intelligent switch connected with a bulb is set as a controlled device. The specific execution principle is as follows:
if the automatic execution is performed locally on the gateway device 200 through the lan path, the door/window sensor senses that the door/window is opened, the event is reported to the gateway device 200, and after receiving the event that the door/window is opened, the gateway device 200 finds the corresponding device for executing the action according to the stored scene configuration information, in this embodiment, the corresponding device is an intelligent switch, and notifies the intelligent switch to turn on the light, so that the automatic linkage of the automatic light turning on when the door/window is opened is realized.
If the automatic execution is performed on the server 300 through the wan path, the door and window sensor senses that the door and window is opened, the time is reported to the gateway device 200, the gateway device 200 reports the event to the server 300 (cloud) after receiving the event that the door and window is opened, the server 300 finds the corresponding device performing the action according to the stored scene configuration information, in this embodiment, the device is an intelligent switch, and the server notifies the intelligent switch to turn on the light through the gateway device 200.
When the lamp is turned on, a successful lamp turning-on message is fed back to the gateway device 200, after the gateway device 200 knows the successful lamp turning-on, the current time, the corresponding scene id, and the successful or failed message are reported to the server 300, and the server 300 is responsible for storing the current time, the corresponding scene id, and the successful or failed message.
Embodiments in the present application will be described in detail below with reference to the accompanying drawings.
Fig. 3 is a schematic flow chart of an image processing method according to an embodiment of the present disclosure. It should be noted that the image processing method according to the embodiment of the present application is not limited by fig. 3 and the following specific sequence, and it should be understood that, in other embodiments, the sequence of some steps in the image processing method according to the present application may be interchanged according to actual needs, or some steps in the image processing method may be omitted or deleted. The image processing method can be applied to electronic equipment, and the electronic equipment can be various intelligent equipment with an image acquisition function, such as a camera, an intelligent door lock with a camera shooting function and the like. The specific flow shown in fig. 3 will be described in detail below.
Step S301, determining a color channel mean value and an image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by blocking an image to be processed; the image characteristic parameters represent the information richness of the image blocks.
In this embodiment, the image block refers to a block image with a preset size obtained by segmenting an image to be processed. When the electronic device divides the image to be processed into blocks, the image is preferably an integral multiple of the width and the height of the image, and an appropriate size needs to be selected, the single color block cannot be selected due to too large blocks, and the single color block can be easily judged if the blocks are too small.
For example, a preset size of 16 × 16 (unit pixels) corresponding to the block image may be set, and then after the block processing is performed on the image to be processed, a plurality of image blocks with a size of 16 × 16 pixels may be obtained.
For example, when the image to be processed is an RGB image, there are three color channels, where R is a red channel, G is a green channel, and B is a blue channel, each color channel stores information of color elements in the image, and colors in all the color channels are superimposed and mixed to generate colors of pixels in the image.
In this embodiment, the color channel mean value corresponding to the image block may be obtained by performing mean value calculation on pixels of different color channels in the image block; the image characteristic parameters can be parameters reflecting the characteristics of the image blocks, and the information richness of the image blocks can be represented through the size of the image characteristic parameters. For example, when the image information of an image block is rich, the value of the image characteristic parameter corresponding to the image block is larger, and when the image information of the image block is more single, the value of the image characteristic parameter corresponding to the image block is smaller.
The image characteristic parameters can specifically be the basic parameter information of the image such as standard deviation, image information entropy, variance and the like, and all of the basic parameter information can reflect the information richness of the image block.
Step S302, calculating the correlation corresponding to each image block according to the image characteristic parameters.
In this embodiment, after determining the image characteristic parameters corresponding to each image block, the electronic device may calculate the correlation corresponding to each image block according to the image characteristic parameters, and by calculating the correlation corresponding to each image block, it is convenient to subsequently select the color channel mean value corresponding to the image block whose correlation meets the condition to participate in the calculation of the gain value.
Step S303, determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block of which the correlation meets the threshold, and determining a gain value corresponding to the image to be processed according to the target color channel mean value.
In this embodiment, after calculating the correlation corresponding to each image block, the electronic device compares the correlation corresponding to each image block with a set threshold, so as to determine the image block whose correlation satisfies the threshold, further perform weighted average calculation based on the color channel mean value corresponding to the image block whose correlation satisfies the threshold, obtain a target color channel mean value corresponding to the image to be processed, and calculate the gain value corresponding to the image to be processed according to the target color channel mean value.
Because the correlation is obtained by calculating according to the image characteristic parameters of the image blocks, and the image characteristic parameters can reflect the information abundance degree of the image blocks, the color channel mean value corresponding to the image block of which the correlation meets the threshold value is selected to participate in the calculation of the gain value, and actually the color channel mean value corresponding to the image block of which the information abundance degree meets the condition is selected to participate in the calculation of the gain value, so that a more accurate gain value can be obtained, and thus, when a large-area single color appears in the image, the influence of the large-area single color on the gain calculation can be effectively eliminated, and the accuracy of the gain calculation is effectively improved.
And step S304, carrying out image correction processing on each pixel point in the image to be processed based on the gain value.
In this embodiment, the electronic device selects the color channel mean value corresponding to the image block whose correlation satisfies the threshold to participate in the calculation of the gain value, so that the color channel mean value corresponding to the image block whose information abundance satisfies the condition is selected to participate in the calculation of the gain value.
The image correction processing in this embodiment may be white balance correction processing performed on an image to be processed, so that the image after the image correction processing has a better white balance effect.
The image processing method provided by the embodiment of the application determines the color channel mean value and the image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by partitioning an image to be processed, calculates the correlation corresponding to each image block through the image characteristic parameter, selects the color channel mean value corresponding to the image block of which the correlation meets the threshold to participate in the calculation of the gain value, and can select the color channel mean value corresponding to the image block of which the information abundance meets the condition to participate in the calculation of the gain value when a large-area single color appears in the image because the image characteristic parameter can represent the information abundance of the image block, so as to obtain a more accurate gain value, and then performs image correction processing on each pixel point in the image to be processed based on the calculated gain value, so that the color of the image after the image correction processing is closer to the color of a real object, thereby ensuring better image correction effect when a large area of single color appears in the image. In addition, the image processing method adopts a small calculation amount of algorithm and an execution speed block, and keeps the advantage of very high execution speed of the gray world algorithm.
In an embodiment, the image characteristic parameter may include a color channel standard deviation, where the color channel standard deviation may be understood as a corresponding standard deviation of each image block on different color channels; when the image information of the image block is rich, the standard deviation corresponding to the image block is larger, and when the image information of the image block is more single, the standard deviation corresponding to the image block is smaller. Referring to fig. 4, in the case that the image characteristic parameter is a color channel standard deviation, the step S301 may include the following sub-steps:
in the substep S3011, for a plurality of image blocks obtained by blocking an image to be processed, mean values of color channel values corresponding to all pixel points in each image block are calculated to obtain a color channel mean value corresponding to each image block.
In this embodiment, taking an example that an image to be processed has three color channels (R, G, B), a color channel value corresponding to each pixel point includes a red channel value, a green channel value, and a blue channel value, and a color channel mean value corresponding to each pixel block includes a red channel mean value, a green channel mean value, and a blue channel mean value.
For example, assuming that each image block includes 16 × 16 pixels, the electronic device may obtain a red channel mean value R corresponding to each image block by performing mean value calculation on a red channel value, a green channel value, and a blue channel value corresponding to each pixel point in each image block respectivelyi,jGreen channel mean Gi,jBlue channel mean Bi,j
And a substep S3012, calculating a color channel standard deviation corresponding to each image block according to the color channel mean value corresponding to each image block and the color channel values corresponding to all the pixel points in each image block.
In this embodiment, since the color channel standard deviation refers to a standard deviation of each image block corresponding to different color channels, the color channel standard deviation corresponding to each image block may include a red channel standard deviation, a green channel standard deviation, and a blue channel standard deviation, when the electronic device calculates the red channel standard deviation corresponding to each image block, the electronic device may calculate a sum of squares of the differences after subtracting a red channel mean from a red channel value corresponding to each pixel point in the image block, and then calculate a square root of the calculated mean, so as to obtain the red channel standard deviation corresponding to the image block.
An example is given below, and a calculation process of the standard deviation is described, assuming that there are 4 pixels in a certain image block, and the red channel values of the 4 pixels are 1, 2, and 3, respectively, then the red channel average value of the image block is (1+2+2+3)/4 ═ 2, and the sum of squares (1-2) of the differences between the red channel value and the red channel average value corresponding to each pixel point is calculated2+(2-2)2+(2-2)2+(3-2)22, the average value 2/4 is obtained as 0.5, and then the square root is obtained for 0.5, so as to obtain the red channel standard deviation corresponding to the image block.
Similarly, when calculating the standard deviation of the green channel, after subtracting the mean value of the green channel from the green channel value corresponding to each pixel point in the image block, calculating the sum of squares of the difference values, then calculating the mean value, and performing square root calculation on the calculated mean value to obtain the standard deviation of the green channel corresponding to the image block; when calculating the standard deviation of the blue channel, after subtracting the average value of the blue channel from the blue channel value corresponding to each pixel point in the image block, calculating the sum of squares of the difference values, then calculating the average value, and performing square root calculation on the calculated average value, so as to obtain the standard deviation of the blue channel corresponding to the image block.
Therefore, according to the image processing method provided by the embodiment of the application, the color channel mean value and the color channel standard deviation corresponding to each image block are calculated, and the standard deviation can reflect the information abundance degree of the image block more accurately, so that the color channel mean value corresponding to the image block with the information abundance degree meeting the condition can be selected according to the color channel standard deviation to participate in the calculation of the gain value, thereby effectively improving the accuracy of the gain calculation and avoiding the problem of gain deviation under the condition of large-area single color in the image.
In an embodiment, when calculating the correlation corresponding to each image block, the correlation between two adjacent image blocks in a preset direction may be used as the correlation corresponding to each image block, and based on this, the step S302 may include the following sub-steps: determining the correlation between each image block and the adjacent image blocks in the preset direction according to the image characteristic parameters of each image block to obtain the correlation corresponding to each image block; and determining the correlation of the image block adjacent to the tail end image block in the opposite direction of the preset direction as the correlation corresponding to the tail end image block aiming at the tail end image block in the preset direction.
In this embodiment, the preset direction may be set according to actual needs, for example, for any image to be processed, a direction from left to right in the horizontal direction may be set as the preset direction, and an image block adjacent to the preset direction may be understood as an image block adjacent to the right side of the current image block.
However, the image block at the end in the preset direction, i.e. the image block located at the rightmost side in the horizontal direction, has no adjacent image block at the right side, and the correlation cannot be calculated according to the correlation between the image block adjacent to the image block in the preset direction, so in this embodiment, the correlation between the image block adjacent to the left side of the image block at the end in the horizontal direction (i.e. the image block adjacent to the image block in the opposite direction of the preset direction) is determined as the correlation corresponding to the image block at the end.
An embodiment of calculating the correlation is given below by taking as an example that the image characteristic parameter comprises R, G, B standard deviations on three color channels. Suppose that the standard deviations of the image blocks on the R, G, B three color channels are SR respectivelyi,j、SGi,j、SBi,jAnd i and j represent coordinate values of the image block, the coordinate values can be calculated according to a formula
Figure BDA0003335331940000121
Calculating the correlation of each image block; di,jRepresenting the correlation of image blocks with coordinates i, j.
Taking i as a vertical coordinate and j as a horizontal coordinate as an example, it can be known from the above correlation calculation formula that when calculating the correlation of each image block, the image feature parameters of two adjacent image blocks in the horizontal direction from left to right are actually used as the basis. Assuming that the image to be processed becomes 4 x 4 after being partitioned, the value range of i is 1-4, the value range of j is 1-3, the value of the correlation of the last image block (the terminal image block) in the transverse direction is the same as that of the image block adjacent to the left side of the terminal image block in the transverse direction, namely D1,4=D1,3,D2,4=D2,3,D3,4=D3,3,D4,4=D4,3
As can be seen, in this embodiment, the correlation between each image block and the adjacent image block in the preset direction is determined according to the image characteristic parameter of each image block, so as to obtain the correlation corresponding to each image block, and for the terminal image block in the preset direction, the correlation of the image block adjacent to the terminal image block in the opposite direction to the preset direction is determined as the correlation corresponding to the terminal image block. Therefore, the degree of correlation between the image block and the adjacent image block can be judged based on the magnitude of the correlation corresponding to the image block, and whether the image block is a single color block or not can be further conveniently judged.
In an embodiment, the electronic device obtains a target color channel mean value corresponding to the image to be processed based on the color channel mean value corresponding to the image block whose correlation satisfies the threshold, and specifically includes the following sub-steps:
if the correlation of the image block meets a threshold, adding a first identifier to the image block; if the correlation of the image block does not meet the threshold, adding a second identifier to the image block; determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier; the image blocks added with the first marks represent image blocks with rich colors of the image.
That is, after calculating the correlation of each image block, the electronic device may compare the correlation with a threshold, and add an identifier to each image block according to the comparison result. If the correlation of the image block meets a threshold, adding a first identifier to the image block; and if the correlation of the image block does not meet the threshold, adding a second identifier to the image block. The method is used for indicating whether an image block is a single color block or not by adding different identifications to the image block.
Wherein the threshold value is set according to actual needs, for example, set to 0.12. When the correlation of the image block is greater than or equal to a threshold, the correlation of the image block is considered to satisfy the threshold; when the correlation of the image block is smaller than the threshold, the correlation of the image block is considered not to satisfy the threshold. The first identification indicates that the image block is not a single color block, so that the image block added with the first identification indicates that the image color of the image block is rich; the second flag indicates that the image block is a single color block, for example, the first flag may be set to 1, and the second flag may be set to 0.
Assuming that the threshold is T, the first flag is 1, and the second flag is 0, the flag corresponding to each image block may be represented as:
Figure BDA0003335331940000141
i.e. according to the correlation of each image blockDi,jCan set up the corresponding mark Si,j. Since the value of the correlation of the terminal image block in the preset direction is the same as the value of the image block adjacent to the terminal image block in the opposite direction of the preset direction, the identifier of the terminal image block in the preset direction is also the same as the value of the image block adjacent to the terminal image block in the opposite direction of the preset direction. For example, S1,31, then S1,4Is also 1.
After the corresponding identification is added to the image block, calculating to obtain a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identification, and calculating to obtain a gain value corresponding to the image to be processed according to the target color channel mean value. The image blocks added with the first identification represent the image blocks with rich colors in the image, so that the selection of the image blocks with rich colors in the image to be processed is realized to participate in the calculation of the gain value so as to obtain more accurate gain value, thereby effectively avoiding the problem of gain deviation caused by the existence of a large area of single color in the image and improving the accuracy of the calculation of the gain value.
In an embodiment, since the color channel mean values include a red channel mean value, a green channel mean value, and a blue channel mean value, the target color channel mean value corresponding to the image to be processed correspondingly includes a target red channel mean value, a target green channel mean value, and a target blue channel mean value, and based on this, the electronic device determines the target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier, which may specifically include the following sub-steps:
determining a target red channel mean value corresponding to the image to be processed according to the red channel mean value corresponding to the image block added with the first identifier; determining a target green channel mean value corresponding to the image to be processed according to the green channel mean value corresponding to the image block added with the first identifier; and determining a target blue channel mean value corresponding to the image to be processed according to the blue channel mean value corresponding to the image block added with the first identifier.
As an embodiment, the method may be performed according to the corresponding identifier of each image block and the color channel meanAnd performing weighted average calculation to obtain a target color channel average value corresponding to the image to be processed. In particular, in the correlation D according to each image blocki,jAdding corresponding identification S for image blocki,jThen, the mark S can be markedi,jAs a weight value, the red channel mean value R corresponding to each image blocki,jPerforming weighted average calculation to obtain a red channel weighted average (namely a target red channel average) corresponding to the image to be processed; will mark Si,jAs a weight value, the green channel mean value G corresponding to each image blocki,jPerforming weighted average calculation to obtain a green channel weighted average (namely a target green channel average) corresponding to the image to be processed; will mark Si,jAs a weight value, the blue channel mean value B corresponding to each image blocki,jAnd performing weighted average calculation to obtain a blue channel weighted average (namely a target blue channel average) corresponding to the image to be processed.
For example, it can be based on a formula
Figure BDA0003335331940000151
Calculating a red channel weighted average value corresponding to the image to be processed; according to the formula
Figure BDA0003335331940000152
Calculating a green channel weighted average value corresponding to the image to be processed; according to the formula
Figure BDA0003335331940000153
Calculating a blue channel weighted average value corresponding to the image to be processed; wherein i and j represent coordinate values of the image block, Si,jRepresenting the identity, R, of the image blocki,jRepresenting the red channel mean, G, corresponding to the image blocki,jRepresenting the green channel mean, B, corresponding to the image blocki,jRepresenting a blue channel mean value corresponding to the image block; WR represents a target red channel mean value (i.e., a red channel weighted average value) corresponding to the image to be processed; WG represents a target green channel mean value (namely a green channel weighted average value) corresponding to the image to be processed; WB represents the target blue channel mean (i.e. blue channel weighted average) corresponding to the image to be processed)。
According to the WR, WG and WB calculation formulas, under the condition that the first identifier is 1 and the second identifier is 0, when weighted average calculation is carried out according to the identifiers corresponding to the image blocks and the color channel mean value, only the image block added with the first identifier actually participates in the calculation of the gain value, and the image block added with the first identifier represents the image block with rich colors of the image, so that the selection of the image block with rich colors (the image block added with the first identifier) in the image to be processed participates in the calculation of the gain value is realized, the problem of gain deviation caused under the condition that a large area of single color exists in the image is effectively avoided, and the accuracy of the calculation of the gain value is improved.
In one embodiment, after the target red channel mean value, the target green channel mean value and the target blue channel mean value corresponding to the image to be processed are calculated, the gain values corresponding to the image to be processed on R, G, B three channels may be calculated according to the following sub-steps:
calculating the sum of the target red channel mean value, the target green channel mean value and the target blue channel mean value; calculating a red channel gain value corresponding to the image to be processed according to the sum value and the target red channel mean value; calculating a green channel gain value corresponding to the image to be processed according to the sum value and the target green channel mean value; and calculating a blue channel gain value corresponding to the image to be processed according to the sum value and the target blue channel mean value.
For example, after calculating the sum of the target red channel mean value WR, the target green channel mean value WG, and the target blue channel mean value WB (i.e., WR + WG + WB), the sum may be calculated according to the formula
Figure BDA0003335331940000161
Calculating a red channel gain value corresponding to the image to be processed; according to the formula
Figure BDA0003335331940000162
Calculating a green channel gain value corresponding to the image to be processed; according to the formula
Figure BDA0003335331940000163
And calculating a blue channel gain value corresponding to the image to be processed. Wherein R isgainIndicates the gain value of the red channel, GgainRepresenting the green channel gain value, BgainRepresenting the blue channel gain value.
In an embodiment, after calculating a red channel gain value, a green channel gain value, and a blue channel gain value corresponding to the image to be processed, the step S304 may perform gain correction on each pixel point in the image to be processed based on the red channel gain value, the green channel gain value, and the blue channel gain value, that is, the following sub-steps are included:
performing gain correction on each pixel point in the red channel according to the red channel gain value; performing gain correction on each pixel point in the green channel according to the green channel gain value; and performing gain correction on each pixel point in the blue channel according to the blue channel gain value.
For example, the color channel value of each pixel point in the collected original image to be processed is respectively represented as Rin(Red channel value), Gin(Green channel value), Bin(blue channel value), respectively representing the color channel value of each pixel point in the image after gain correction as Rout、Gout、BoutThen the gain value R of the red channel corresponding to the image to be processed is obtained through calculationgainGreen channel gain value GgainAnd blue channel gain value BgainThen, gain correction can be performed on each pixel point in the R, G, B three channels as follows:
Figure BDA0003335331940000171
after the gain correction is completed, the red channel value, the green channel value and the blue channel value of each pixel point are adjusted to be in the range of [0, 255], and then the image after white balance correction can be obtained. As shown in fig. 5, (a) shows the acquired original image, and (b) shows the image obtained by white balance correcting the original image, it can be seen from comparing (a) and (b) that the image after white balance correction is closer to the color of the real object, and a better white balance effect can be obtained even when a single color with a large area appears in the image.
It should be noted that, taking an electronic device as a camera as an example, colors of images acquired by the camera may be different at different color temperatures in one day, in the case of white light, values of three color channels (R, G, B) of the images are the same, a ratio of R/G, B/G is also the same, and when the ratio of R/G to B/G is different, it indicates that the color temperature has changed, and at this time, the camera needs to call a white balance interface to perform white balance correction on the images.
It should be understood that, for the automatic white balance, no matter whether the color temperature changes or not and no matter how much the color temperature changes, as long as the camera collects the image, the white balance interface can be called, so as to realize the real-time white balance correction of the image, for example, the automatic white balance can be realized by the camera on the intelligent door lock, the network camera such as the household intelligent camera, etc. For the automatic white balance, the manual judgment and setting are needed, and the manual calling is needed when the white balance interface is needed, for example, a single-lens reflex camera can manually select a correction gear, when a user dials a gear switch, the white balance interface is started to correct, and when the user dials the gear switch, the white balance interface is closed.
It should be noted that, in practical applications, the white balance corrected image may be output by the electronic device to the APP of the terminal device 400 in real time for display, and for the electronic device with a display screen, for example, a screen device such as an intelligent door lock with a display screen, a camera, etc., the white balance corrected image may also be directly displayed on its own screen.
Next, an application of the image processing method in a door lock scene will be described, taking the door lock scene as an example. The user utilizes the App of installation on terminal equipment 400 to add gateway device 200 to add into the zigBee network that this gateway device 200 corresponds with as the sub-equipment with intelligent lock, door and window sensor, intelligence switch etc. and constitute zigBee LAN with gateway device 200 together, the user has set up the automatic scheme that door and window opened automatic turn-on light, and when door and window sensor detected that intelligent lock was opened, intelligence switch can control the bulb of being connected rather than turn-on light. Be provided with the camera on the intelligence lock, this camera can shoot the real-time scene of the regional scope of making a video recording, and the image information of shooing can show on the intelligence lock, also can be shown by the APP that the image information that the intelligence lock will shoot sent terminal equipment 400 through LAN route or wide area network route, and the user of being convenient for looks over the real-time scene of the regional scope of making a video recording in real time. The intelligent door lock can also utilize image information shot by the camera to identify a target object (for example, face identification), and when the target object is identified to be in the range of the shooting area, the intelligent door lock can be automatically opened.
In order to enable the image shot by the camera to accurately reflect the real color condition of the shot object and improve the color cast condition which may occur in the shot picture, the camera calls a white balance interface when collecting the image, and the real-time white balance correction of the image is realized. The process of white balance correction of the acquired image by the camera is as follows: (1) partitioning an image to be processed into small blocks of 16 × 16 (unit pixels) one by one;
(2) the average value (R) of the pixels of R, G, B three channels is calculated for each small blocki,j、Gi,j、Bi,j) And standard deviation (SR)i,j、SGi,j、SBi,j);
(3) Calculating the correlation D of each small block according to the standard deviation of R, G, B color channels corresponding to each small blocki,j
Figure BDA0003335331940000181
(4) According to the correlation Di,jSetting a mark S for each small blocki,j
Figure BDA0003335331940000182
I.e. the correlation Di,jComparing with a set threshold value T to determine whether the flag is 0 or 1, the block flag 1 indicating that it is not a single color block, the color block flag 0 indicating a single color block, the flag of the endmost block in the lateral direction indicating the block adjacent to the endmost block in the lateral directionThe identities being of the same value, e.g. S1,3Is 1, then S1,4Is also 1;
(5) according to the corresponding mark of each small block and R, G, B three-channel pixel average value (R)i,j、Gi,j、Bi,j) The calculation of the red channel weighted average WR, the green channel weighted average WG, and the blue channel weighted average WB based on the standard deviation weighting is performed,
Figure BDA0003335331940000191
Figure BDA0003335331940000192
(6) calculating the gain values of three channels of the to-be-processed image R, G, B, and the gain value of the red channel
Figure BDA0003335331940000193
Green channel gain value
Figure BDA0003335331940000194
Blue channel gain value
Figure BDA0003335331940000195
(7) According to the gain values of R, G, B three channels, gain correction is respectively carried out on each pixel point (720 x 1280) in R, G, B three channels, namely
Figure BDA0003335331940000196
Thereby obtaining the color channel value R of each pixel point in the image after gain correctionout、Gout、BoutFinally, R is addedout、Gout、BoutAdjusted to [0, 255]Within the range of (3), an image after white balance correction can be obtained.
After the camera carries out white balance correction with the image of gathering, the image after white balance correction can be shown by the APP that terminal equipment 400 was sent through LAN route or wide area network route to the intelligent lock, if have the display screen on the intelligent lock, then the image after white balance correction also can show on the intelligent lock. The intelligent door lock can also carry out face recognition according to the image after white balance correction or send the image after white balance correction to server 300 through the wide area network route and carry out face recognition, when discerning the target people's face, opens the lock automatically, and door and window sensor senses the lock and opens this moment, reports this incident to gateway equipment 200, and gateway equipment 200 notifies intelligent switch to turn on the light to realize that door and window opens the automatic scheme of opening the light.
It can be seen that the image processing method provided by this embodiment provides an automatic white balance algorithm based on standard deviation weighting, when image information is rich, the image standard deviation is large, when an image is single, the standard deviation is small, and according to this principle, a colorful image block in the image is selected to calculate R, G, B three-channel gain values, which effectively solves the problem that the gray world algorithm in the prior art is poor in effect when a large area of single color is in the image, and the whole white balance correction process has a small calculation amount and a high execution speed, thereby not only maintaining the advantage of high execution speed of the gray world algorithm, but also eliminating the influence of the large area of single color in the image on the white balance effect.
In order to perform the corresponding steps in the above embodiments and various possible modes, an implementation mode of the image processing apparatus is given below. Referring to fig. 6, a functional block diagram of an image processing apparatus 600 according to an embodiment of the invention is shown. It should be noted that the image processing apparatus 600 provided in the present embodiment has the same basic principle and technical effect as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and reference may be made to the corresponding contents in the above embodiments. The image processing apparatus 600 includes a feature parameter calculation module 610, a correlation calculation module 620, a gain calculation module 630, and an image correction module 640.
The feature parameter calculating module 610 is configured to determine, for a plurality of image blocks obtained by blocking an image to be processed, a color channel mean value and an image feature parameter corresponding to each image block; the image characteristic parameters represent the information richness of the image blocks.
It is understood that the feature parameter calculation module 610 may perform the above step S301.
The correlation calculating module 620 is configured to calculate a correlation corresponding to each image block according to the image characteristic parameters.
It is understood that the correlation calculation module 620 may perform the above step S302.
The gain calculating module 630 is configured to determine a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block whose correlation satisfies the threshold, and determine a gain value corresponding to the image to be processed according to the target color channel mean value.
It is understood that the gain calculating module 630 may perform the step S303.
The image correction module 640 is configured to perform image correction processing on each pixel point in the image to be processed based on the gain value.
It is understood that the image correction module 640 may perform the above step S304.
Optionally, the image characteristic parameter includes a color channel standard deviation, and the characteristic parameter calculating module 610 may be configured to perform mean value calculation on color channel values corresponding to all pixel points in each image block to obtain a color channel mean value corresponding to each image block, for a plurality of image blocks obtained by blocking an image to be processed; and calculating the color channel standard deviation corresponding to each image block according to the color channel mean value corresponding to each image block and the color channel values corresponding to all the pixel points in each image block.
It is understood that the feature parameter calculation module 610 may perform the sub-steps S3011 and S3012.
Optionally, the correlation calculation module 620 may be specifically configured to determine, according to the image characteristic parameter of each image block, a correlation between each image block and an adjacent image block in the preset direction, so as to obtain a correlation corresponding to each image block; and determining the correlation of the image block adjacent to the tail end image block in the opposite direction of the preset direction as the correlation corresponding to the tail end image block aiming at the tail end image block in the preset direction.
Optionally, the gain calculating module 630 may be configured to add a first identifier to the image block if the correlation of the image block satisfies a threshold; if the correlation of the image block does not meet the threshold, adding a second identifier to the image block; determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier; the image blocks added with the first marks represent image blocks with rich colors of the image.
The gain calculation module 630 is specifically configured to determine a target red channel mean value corresponding to the image to be processed according to the red channel mean value corresponding to the image block to which the first identifier is added; determining a target green channel mean value corresponding to the image to be processed according to the green channel mean value corresponding to the image block added with the first identifier; and determining a target blue channel mean value corresponding to the image to be processed according to the blue channel mean value corresponding to the image block added with the first identifier.
Optionally, the target color channel mean value includes a target red channel mean value, a target green channel mean value, and a target blue channel mean value, and the gain calculation module 630 is further specifically configured to calculate a sum of the target red channel mean value, the target green channel mean value, and the target blue channel mean value; calculating a red channel gain value corresponding to the image to be processed according to the sum value and the target red channel mean value; calculating a green channel gain value corresponding to the image to be processed according to the sum value and the target green channel mean value; and calculating a blue channel gain value corresponding to the image to be processed according to the sum value and the target blue channel mean value.
Optionally, the image correction module 640 may be configured to perform gain correction on each pixel point in the red channel according to the red channel gain value; performing gain correction on each pixel point in the green channel according to the green channel gain value; and performing gain correction on each pixel point in the blue channel according to the blue channel gain value.
It can be seen that in the image processing apparatus 600 provided in this embodiment of the application, the characteristic parameter calculating module 610 determines, for a plurality of image blocks obtained by partitioning an image to be processed, a color channel mean value and an image characteristic parameter corresponding to each image block, the correlation calculating module 620 calculates the correlation corresponding to each image block according to the image characteristic parameter, the gain calculating module 630 selects the color channel mean value corresponding to the image block whose correlation satisfies a threshold to participate in the calculation of the gain value, since the image characteristic parameter can represent the information abundance of the image block, when a large-area single color appears in the image, the color channel mean value corresponding to the image block whose information abundance satisfies a condition can be selected to participate in the calculation of the gain value, so as to obtain a more accurate gain value, so that the image correcting module 640 performs image correction processing on each pixel point in the image to be processed based on the calculated gain value, the image color after the image correction processing is closer to the color of a real object, so that a good image correction effect is ensured when a large-area single color appears in the image.
The electronic device provided by the embodiment of the present application may include a processor and a memory, where at least one instruction, at least one program, a code set, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the image processing method provided by the above method embodiment.
The memory may be used to store software programs and modules, and the processor may execute various functional applications and data processing by operating the software programs and modules stored in the memory. The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs needed by functions and the like; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory may also include a memory controller to provide the processor access to the memory.
Fig. 7 is a block diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure. As shown in fig. 7, the electronic device may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 111 (the processor 111 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 113 for storing data, and one or more storage media 112 (e.g., one or more mass storage devices) for storing applications 1123 or data 1122. The memory 113 and the storage medium 112 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 112 may include one or more modules, each of which may include a sequence of instructions operating on an electronic device. Further, the processor 111 may be arranged to communicate with the storage medium 112 to execute a series of instruction operations in the storage medium 112 on the electronic device. The electronic device may also include one or more power supplies 116, one or more wired or wireless network interfaces 115, one or more input-output interfaces 114, and/or one or more operating systems 1121, such as windows server, MacOSXTM, unix, linux, FreeBSDTM, and the like.
The input output interface 114 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the electronic device. In one example, the input/output interface 114 includes a network adapter (NIC) that can be connected to other network devices through a base station to communicate with the internet. In one example, the input/output interface 114 can be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 7 is merely an illustration and is not intended to limit the structure of the electronic device. For example, the electronic device may also include more or fewer components than shown in FIG. 7, or have a different configuration than shown in FIG. 7.
The electronic device provided by the embodiment of the application determines the color channel mean value and the image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by partitioning an image to be processed, calculates the correlation corresponding to each image block through the image characteristic parameter, selects the color channel mean value corresponding to the image block of which the correlation meets the threshold to participate in the calculation of the gain value, and can select the color channel mean value corresponding to the image block of which the information abundance meets the condition to participate in the calculation of the gain value when a large-area single color appears in the image because the image characteristic parameter can represent the information abundance of the image block, so as to obtain a more accurate gain value, and then performs image correction processing on each pixel point in the image to be processed based on the gain value obtained by calculation, so that the image color after the image correction processing is closer to the color of a real object, thereby ensuring that when the large-area single color appears in the image, has better image correction effect.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the processes of the embodiment of the image processing method, and can achieve the same technical effects, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It is noted that, herein, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a gateway, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. An image processing method, characterized in that the method comprises:
determining a color channel mean value and an image characteristic parameter corresponding to each image block for a plurality of image blocks obtained by blocking the image to be processed; the image characteristic parameters represent the information richness of the image blocks;
calculating the correlation corresponding to each image block according to the image characteristic parameters;
determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block of which the correlation meets the threshold, and determining a gain value corresponding to the image to be processed according to the target color channel mean value;
and carrying out image correction processing on each pixel point in the image to be processed based on the gain value.
2. The method according to claim 1, wherein the calculating the correlation corresponding to each image block according to the image characteristic parameters comprises:
determining the correlation between each image block and the adjacent image blocks in the preset direction according to the image characteristic parameters of each image block to obtain the correlation corresponding to each image block;
and determining the correlation of the image block adjacent to the tail end image block in the opposite direction of the preset direction as the correlation corresponding to the tail end image block aiming at the tail end image block in the preset direction.
3. The method according to claim 1, wherein the determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block whose correlation satisfies the threshold includes:
if the correlation of the image block meets the threshold, adding a first identifier to the image block;
if the correlation of the image block does not meet the threshold, adding a second identifier to the image block;
determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier; and the image block added with the first identifier represents an image block with rich image colors.
4. The method according to claim 3, wherein the determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block added with the first identifier includes:
determining a target red channel mean value corresponding to the image to be processed according to the red channel mean value corresponding to the image block added with the first identifier;
determining a target green channel mean value corresponding to the image to be processed according to the green channel mean value corresponding to the image block added with the first identifier;
and determining a target blue channel mean value corresponding to the image to be processed according to the blue channel mean value corresponding to the image block added with the first identifier.
5. The method of claim 1, wherein the target color channel mean value comprises a target red channel mean value, a target green channel mean value, and a target blue channel mean value, and wherein determining the corresponding gain value of the image to be processed according to the target color channel mean value comprises:
calculating a sum of the target red channel mean, the target green channel mean, and the target blue channel mean;
calculating a red channel gain value corresponding to the image to be processed according to the sum value and the target red channel mean value;
calculating a green channel gain value corresponding to the image to be processed according to the sum value and the target green channel mean value;
and calculating a blue channel gain value corresponding to the image to be processed according to the sum value and the target blue channel mean value.
6. The method according to claim 5, wherein the performing image correction processing on each pixel point in the image to be processed based on the gain value comprises:
performing gain correction on each pixel point in the red channel according to the red channel gain value;
performing gain correction on each pixel point in the green channel according to the green channel gain value;
and performing gain correction on each pixel point in the blue channel according to the blue channel gain value.
7. The method according to any one of claims 1 to 6, wherein the image characteristic parameters include a color channel standard deviation, and the determining, for a plurality of image blocks obtained by blocking the image to be processed, a color channel mean value and an image characteristic parameter corresponding to each image block includes:
carrying out mean value calculation on the color channel values corresponding to all the pixel points in each image block to obtain the color channel mean value corresponding to each image block;
and calculating the standard deviation of the color channel corresponding to each image block according to the average value of the color channel corresponding to each image block and the color channel values corresponding to all the pixel points in each image block.
8. An image processing apparatus, characterized in that the apparatus comprises:
the characteristic parameter calculation module is used for determining a color channel mean value and an image characteristic parameter corresponding to each image block aiming at a plurality of image blocks obtained by blocking the image to be processed; the image characteristic parameters represent the information richness of the image blocks;
the correlation calculation module is used for calculating the correlation corresponding to each image block according to the image characteristic parameters;
the gain calculation module is used for determining a target color channel mean value corresponding to the image to be processed according to the color channel mean value corresponding to the image block of which the correlation meets the threshold, and determining a gain value corresponding to the image to be processed according to the target color channel mean value;
and the image correction module is used for carrying out image correction processing on each pixel point in the image to be processed based on the gain value.
9. An electronic device, comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the image processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the image processing method according to any one of claims 1 to 7.
CN202111292994.5A 2021-11-03 2021-11-03 Image processing method, image processing device, electronic equipment and computer readable storage medium Pending CN114022375A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111292994.5A CN114022375A (en) 2021-11-03 2021-11-03 Image processing method, image processing device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111292994.5A CN114022375A (en) 2021-11-03 2021-11-03 Image processing method, image processing device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114022375A true CN114022375A (en) 2022-02-08

Family

ID=80059981

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111292994.5A Pending CN114022375A (en) 2021-11-03 2021-11-03 Image processing method, image processing device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114022375A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115082358A (en) * 2022-07-21 2022-09-20 深圳思谋信息科技有限公司 Image enhancement method and device, computer equipment and storage medium
CN115278217A (en) * 2022-07-21 2022-11-01 深圳市震有软件科技有限公司 Image picture detection method and device, electronic equipment and storage medium
CN116385375A (en) * 2023-03-17 2023-07-04 银河航天(北京)网络技术有限公司 Forest defect area detection method and device based on remote sensing image and storage medium
CN116915964A (en) * 2023-09-13 2023-10-20 北京智芯微电子科技有限公司 Gray world white balance correction method, device, equipment, chip and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115082358A (en) * 2022-07-21 2022-09-20 深圳思谋信息科技有限公司 Image enhancement method and device, computer equipment and storage medium
CN115278217A (en) * 2022-07-21 2022-11-01 深圳市震有软件科技有限公司 Image picture detection method and device, electronic equipment and storage medium
CN116385375A (en) * 2023-03-17 2023-07-04 银河航天(北京)网络技术有限公司 Forest defect area detection method and device based on remote sensing image and storage medium
CN116385375B (en) * 2023-03-17 2023-10-20 银河航天(北京)网络技术有限公司 Forest defect area detection method and device based on remote sensing image and storage medium
CN116915964A (en) * 2023-09-13 2023-10-20 北京智芯微电子科技有限公司 Gray world white balance correction method, device, equipment, chip and storage medium
CN116915964B (en) * 2023-09-13 2024-01-23 北京智芯微电子科技有限公司 Gray world white balance correction method, device, equipment, chip and storage medium

Similar Documents

Publication Publication Date Title
CN114022375A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
US11595579B2 (en) Systems and methods for automatic exposure in high dynamic range video capture systems
CN104360599B (en) Wired home control method, equipment and system based on LED light device
WO2019085597A1 (en) Method, apparatus and system for controlling device
CN110535732B (en) Equipment control method and device, electronic equipment and storage medium
CN109918273B (en) Data display method and device, terminal equipment and storage medium
JP4708192B2 (en) Dynamic camera color correction device and video search device using the same
CN111121237B (en) Air conditioner, control method thereof, server, and computer-readable storage medium
US10135631B2 (en) Electric equipment management apparatus, electric equipment management method, and electric equipment management system
CN109729332A (en) A kind of automatic white balance antidote and system
CN106094558A (en) Intelligent home furnishing control method and intelligent domestic system
CN104113690A (en) Method for photo-taking correction based on intelligent lamp
KR102314903B1 (en) Method And Apparatus for Controlling Building Based on Image
CN113452980A (en) Image processing method, terminal and storage medium
CN105912632A (en) Device service recommending method and device
CN110751607A (en) Skin color correction method and device, storage medium and electronic device
CN114727461A (en) Light control system based on intelligent home
CN115567778A (en) Automatic focusing method and device, electronic equipment and storage medium
US20200029016A1 (en) Moving object monitoring device and moving object monitoring system
WO2023015993A1 (en) Chromaticity information determination method and related electronic device
CN117710718A (en) Method, apparatus, device and computer readable storage medium for identifying check-in state
US11172119B2 (en) Device with a camera and a screen enabling control of light output characteristics
CN116233381A (en) Color correction method and device, electronic equipment and storage medium
CN113325750A (en) Scene intelligent adjusting method, system, device and storage medium
CN113965767A (en) Indoor live broadcast method, terminal equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination