WO2022246663A1 - Image processing method, device and system, and storage medium - Google Patents

Image processing method, device and system, and storage medium Download PDF

Info

Publication number
WO2022246663A1
WO2022246663A1 PCT/CN2021/095871 CN2021095871W WO2022246663A1 WO 2022246663 A1 WO2022246663 A1 WO 2022246663A1 CN 2021095871 W CN2021095871 W CN 2021095871W WO 2022246663 A1 WO2022246663 A1 WO 2022246663A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
histogram
image block
flat area
block
Prior art date
Application number
PCT/CN2021/095871
Other languages
French (fr)
Chinese (zh)
Inventor
席迎来
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2021/095871 priority Critical patent/WO2022246663A1/en
Publication of WO2022246663A1 publication Critical patent/WO2022246663A1/en

Links

Images

Classifications

    • G06T5/92
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Definitions

  • the present application relates to the technical field of image processing, and in particular to an image processing method, device, system and storage medium.
  • image and video content tends to be popularized, and users' demands for editing images and videos are increasing day by day.
  • Image/video editors have become a popular software APP on mobile terminals, providing personalized tools for image/video lovers to freely edit. Due to the variety of image/video material acquisition devices and shooting environments are also very different, usually the visual effect of image/video material cannot be 100% satisfactory, and basic quality such as lighting, contrast, color temperature, and saturation need to be adjusted.
  • the present application provides an image processing method, device, system and storage medium, aiming to solve technical problems such as image distortion easily caused by existing image/video adjustment methods.
  • the embodiment of the present application provides an image processing method, including:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the determining the flat area in the image to be processed includes:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • the calculating the histogram of the flat area includes:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the acquiring the target image of each image block in the flat area according to the histogram of the flat area includes:
  • the target image of each image block in the flat area is acquired.
  • the determining the histogram of each image block in the flat area according to the histogram of the flat area includes:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the determining the histogram of each image block in the flat area according to the histogram of the flat area includes:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the method also includes:
  • the target image of each image block outside the flat area is acquired.
  • acquiring the target image of the image block according to the histogram of the image block includes:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • the method also includes:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of pixel values in the image block includes:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • the method also includes:
  • the smoothing the clipping threshold corresponding to the histogram of the adjacent image block includes:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block includes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the determining the target image of the image block according to the mapping function corresponding to the image block includes:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • the acquisition of images to be processed includes:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the embodiment of the present application provides an image processing device, including one or more processors, working individually or jointly, for performing the following steps:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the processor executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • the processor executes the calculation of the histogram of the flat area, it is used to execute:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the target image of each image block in the flat area is acquired.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the processor is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • the processor is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • the processor is also used for:
  • the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • the processor executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the embodiment of the present application provides a terminal device, which is characterized in that it includes one or more processors, working individually or jointly, to perform the following steps:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the processor executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • the processor executes the calculation of the histogram of the flat area, it is used to execute:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is used to execute:
  • the target image of each image block in the flat area is acquired.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the processor is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • the processor is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • the processor is also used for:
  • the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the pixel values after equalization processing of the non-central pixels.
  • the processor executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the embodiment of the present application provides a movable platform, the movable platform is equipped with a photographing device, and the photographing device is used to acquire images;
  • processors working individually or jointly, for performing the following steps:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the processor executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • the processor executes the calculation of the histogram of the flat area, it is used to execute:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the target image of each image block in the flat area is acquired.
  • the processor executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is used to execute:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the processor is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • the processor is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • the processor is also used for:
  • the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • the processor executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the embodiment of the present application provides an image processing system, including a shooting device and a display device, and also includes one or more processors, working individually or jointly, for performing the following steps to process the shooting
  • the image acquired by the device is processed by:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the display device can display the image processed by the processor.
  • the processor executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • the processor executes the calculation of the histogram of the flat area, it is used to execute:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the target image of each image block in the flat area is acquired.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the processor is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • the processor is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • the processor is also used for:
  • the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • the processor executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the above method.
  • Embodiments of the present application provide an image processing method, device, system, and storage medium, by using adjacent image blocks whose sum of information entropy is less than or equal to a preset threshold as a class, that is, a flat area, to realize image processing in an image Blocks are classified more intelligently to prevent different objects from being divided into the same area, and then according to the histogram of the flat area, such image blocks with certain similarities are processed, and the image blocks in the flat area are stretched more evenly , to prevent distortion, can reduce image distortion, and the processing effect is better.
  • a preset threshold as a class
  • FIG. 1 is a schematic flow diagram of an image processing method provided in an embodiment of the present application
  • Fig. 2 is a schematic diagram of an application scene of an image processing method in an embodiment
  • Fig. 3 is a schematic diagram of dividing an image to be processed into a plurality of image blocks in an embodiment
  • Fig. 4 is a schematic diagram of a flat area in an image to be processed in an embodiment
  • Fig. 5 is a schematic diagram of an image to be processed in an embodiment
  • Fig. 6 is a schematic diagram of an image to be processed after image processing in one embodiment
  • Fig. 7 is a schematic diagram of a processed image of an image to be processed in another embodiment
  • Fig. 8 is a schematic diagram of clipping a histogram in an embodiment
  • Fig. 9 is a schematic diagram of clipping thresholds corresponding to different image blocks in an embodiment
  • Fig. 10 is a schematic diagram of image blocks adjacent to different pixels in an embodiment
  • Fig. 11 is a schematic block diagram of an image processing device provided by an embodiment of the present application.
  • Fig. 12 is a schematic block diagram of a mobile platform provided by an embodiment of the present application.
  • Fig. 13 is a schematic block diagram of an image processing system provided by an embodiment of the present application.
  • Fig. 14 is a schematic block diagram of a terminal device provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of an image processing method provided in an embodiment of the present application.
  • the image processing method can be applied in an image processing device or an image processing system, and is used for processing an image according to a histogram of the image, and the like.
  • the image processing equipment includes, for example, at least one of an image signal processor (Image Signal Processor, ISP), a digital signal processor (Digital Signal Processor, DSP), and an application processor (Application Processor, AP), and of course it is not limited to Therefore, for example, a SoC (System on Chip, System on Chip) chip may be included.
  • an image signal processor Image Signal Processor, ISP
  • a digital signal processor Digital Signal Processor, DSP
  • AP Application Processor
  • SoC System on Chip, System on Chip
  • the image processing device may or may not include an image sensor.
  • the image processing system includes, for example, at least one of a terminal device, a mobile platform, and a server.
  • a terminal device may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote control, etc.; At least one of people and vehicles.
  • the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone.
  • the server may be an individual server, or may be a server cluster.
  • the camera device 110 carried by the movable platform 100 acquires images in real time, and processes the images according to the image processing method; terminal device 200.
  • the terminal device 200 may be, for example, a mobile phone, a computer, FPV (First Person View, first-person perspective) glasses, and the like.
  • the display device 210 included in the terminal device 200 can display images received from the mobile platform 100 for viewing by the user.
  • the camera device 110 mounted on the mobile platform 100 acquires images in real time, and sends the acquired images to the terminal device 200 communicatively connected to the mobile platform 100 .
  • the terminal device 200 processes the image received from the mobile platform 100 according to the image processing method, and can also display the processed image for the user to watch.
  • the terminal device acquires images through the equipped camera, or acquires locally stored images, or acquires images from the server, and processes the acquired images according to the image processing method, and can also display the processed images, for users to view.
  • the image processing method of the embodiment of the present application includes step S110 to step S130.
  • the image to be processed can be stored locally, or collected in real time by the camera, or obtained from other devices through a communication link, and the image to be processed can be an independent image or a video stream
  • the images in are not limited to this.
  • the acquiring the image to be processed includes: acquiring the image to be processed in the HSL (Hue, Saturation, Lightness) domain or HSV (Hue, Saturation, Value, hue, saturation, lightness) The pending image for the domain.
  • HSL Human, Saturation, Lightness
  • HSV Human, Saturation, Value, hue, saturation, lightness
  • the image to be processed can be RGB (Red, Green, Blue, red, green, blue) domain, CMY/CMYK (Cyan, Magenta, Yellow, Black, cyan, magenta, yellow, black) domain, Lab (Lightness means brightness, a is from dark green (low brightness value) to gray (medium brightness value) to bright pink (high brightness value), b is from bright blue (low brightness value) to gray (medium brightness value) ) to yellow (high brightness value)) domain or YUV/YCbCr (Y represents brightness, U represents chroma, V represents density, Cb represents the degree of offset to blue, Cr represents the degree of offset to red) domain image.
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • the image processing method may process the saturation component of the image to be processed, or the image processing method may process the saturation component of the image to be processed, or the image processing method may Process the saturation component and brightness component of the image to be processed.
  • the brightness component may be the brightness (Lightness) component of the image to be processed in the HSL domain, or may be the value (Value) component of the image to be processed in the HSV domain, and of course it is not limited thereto.
  • the image to be processed is converted into an image to be processed in the HSL domain or an image to be processed in the HSV domain, and then at least one component is processed; after the processing is completed, it can also be converted to the original color space (domain) Image.
  • converting the image to be processed to the HSL domain and processing the brightness and saturation components can ensure that the contrast and color of the image are well stretched, corrected to an appropriate range, and avoid the RGB domain histogram Chromatic aberration caused by equalization.
  • the image to be processed is divided into multiple image blocks with multiple rows and multiple columns, for example, 8 rows and 8 columns with 64 image blocks in total, as shown in FIG. 3 .
  • the sizes of the divided image blocks are all the same, that is, the image to be processed is evenly divided into a plurality of image blocks.
  • the image to be processed can be extended horizontally to an integer multiple of the number of columns, if the width of the image to be processed cannot be divided by the preset If the number of rows of the image block is evenly divided, the image to be processed can be extended to an integer multiple of the number of rows in the vertical direction.
  • the sizes of the multiple divided image blocks may also be different, for example, the sizes of the multiple divided image blocks may be determined according to the composition of the image to be processed.
  • the object distances corresponding to the pixels in the flat area are approximately the same.
  • the flat area in the image to be processed may include sky, water, road, wall, etc.
  • the flat area is, for example, a background area.
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, and all the image blocks in the flat area
  • the sum of the information entropies of the image blocks is less than or equal to the preset threshold.
  • the image blocks in the image are classified more intelligently, and the adjacent image blocks whose sum of information entropy is less than or equal to the preset threshold are regarded as a class, that is, the flat area, and the image blocks in the same flat area have similarity, grayscale Image characteristics such as color, texture, etc. have no or small mutations, such as the grayscale of each pixel in an image block in the same flat area is in the same or similar grayscale range. It can prevent image blocks with different image properties from being divided into one flat area, thereby preventing distortion phenomena such as distortion between areas with different image properties in the processed image.
  • the information entropy of an image is a statistical form of a feature, which reflects the average amount of information in the image.
  • the information entropy of the image block can be one-dimensional entropy or two-dimensional entropy, wherein the one-dimensional entropy represents the amount of information contained in the aggregation characteristics of the grayscale distribution of the image block, based on the one-dimensional entropy
  • the two-dimensional entropy of the image block can be obtained by introducing a feature quantity that can reflect the spatial characteristics of the gray distribution.
  • each image block in the image to be processed determines the information entropy of each image block; if the sum of the information entropy of at least two adjacent image blocks is less than or equal to the preset threshold , determining that the at least two adjacent image blocks are located in the same flat area.
  • a preset component of each image block is calculated, such as a histogram of a brightness component, and information entropy of each image block is determined according to the histogram.
  • the information entropy H of the image block is determined according to the following formula:
  • 0 to 255 is the range of the preset component, and of course it is not limited thereto, i represents any value within the range, p i is the probability that the value i within the range appears in the image block , p i can be determined according to the histogram of the image block.
  • multiple adjacent image blocks can be combined to obtain the flat area, for example, if the sum of the information entropy of adjacent image blocks is less than or equal to the preset threshold, then These image blocks can be merged, if the sum of the information entropy of these image blocks and the information entropy of adjacent image blocks of these image blocks is still less than or equal to the preset threshold, then these image blocks and these image blocks Adjacent image blocks are merged until the information entropy is equal to or greater than the preset threshold, and it can be determined that the flat area is obtained from the merged image blocks.
  • Fig. 4 house, tower and sky are included in the image to be processed, it is determined that the flat area in the image to be processed includes the sky on the left side of the upper half of the tower and the sky on the right side, and the image blocks in the two sky areas are all Not adjacent, can be determined as two flat areas.
  • the image to be processed includes the wall and the sky. If the image characteristics of the wall and the sky are different, they can be divided into two flat areas. If the wall and the sky are adjacent, the two flat areas can also be adjacent. If the wall and the sky are not adjacent, then the two flat areas divided are not adjacent. Of course, if the image properties of the walls and the sky are the same and the walls and the sky are adjacent, the adjacent walls and the sky can be divided into a flat region.
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the histogram of each image block in the flat area is superimposed, and the superimposed histogram is divided by the number of image blocks in the flat area to obtain the histogram of the flat area.
  • the histogram of the image block is prone to peaks.
  • the histogram of the flat area in the embodiment of the present application can be obtained by superimposing the histograms of multiple image blocks in the flat area, which can prevent The histogram is spiked, so image processing works better based on the histogram of said flat areas.
  • each image block in the flat area is processed through histogram equalization to obtain a corresponding target image.
  • the acquiring the target image of each image block in the flat area according to the histogram of the flat area includes: determining the histogram of each image block in the flat area according to the histogram of the flat area Figure: Acquiring the target image of each image block in the flat area according to the histogram of each image block in the flat area.
  • a mapping function corresponding to the image block is determined according to the histogram of the image block in the flat area, and a target image of the image block is determined according to the mapping function corresponding to the image block.
  • the histogram of the image block is clipped, and the mapping function corresponding to the image block is determined according to the clipped histogram, and the mapping function is used to indicate the preset component of the image block and the image
  • the mapping relationship between the preset components of the target image of the block, so the target image of the image block can be determined according to the mapping function.
  • the histograms of different image blocks in the same flat area determined according to the histograms of the flat area are all the same.
  • the histogram of the flat area is used as the histogram of each image block in the flat area. It can be understood that the histogram of each image block in the flat area may be the histogram of the flat area.
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • the histogram of a single image block in a flat area tends to have peaks, and processing the image block according to the histogram of a single image block may easily cause image distortion, for example, an excessive increase in local contrast may be caused.
  • the histogram of each image block in the flat area is determined according to the histogram of the flat area, and the histogram of the entire flat area can be obtained from the histograms of multiple image blocks in the flat area The images are superimposed, so the histogram is not prone to peaks, which can reduce image distortion and improve the processing effect.
  • the method further includes: calculating a histogram of each image block outside the flat area in the image to be processed; obtaining the flat area according to the histogram of each image block outside the flat area.
  • mapping function corresponding to the image block outside the flat area can also be determined according to the histogram of each image block outside the flat area, and according to the mapping function corresponding to the image block outside the flat area , determine the target image of the image block outside the flat area.
  • the information entropy of the image blocks outside the flat area is larger, or the information entropy of adjacent image blocks is larger although the information entropy is smaller.
  • the processed image of the image to be processed can be obtained, as shown in FIG. 5
  • the image to be processed is the processed image of the image to be processed, the contrast and color of the image have been stretched in a better range, corrected to a suitable range, and the image distortion has been reduced, such as reducing localized image distortion in flat areas.
  • performing clipping processing on the histogram according to a clipping threshold corresponding to the histogram of the image block includes: determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold; According to the quotient of the area and the horizontal width of the histogram, determine the rising height of the amplitude in the histogram; if the amplitude in the histogram is lower than the difference between the clipping threshold and the rising height, according to The ascent height increases the magnitude; and/or, if the magnitude in the histogram is higher than the difference between the clipping threshold and the ascent height, setting the magnitude as the clipping threshold.
  • the area in the histogram of the image block whose magnitude is higher than the clipping threshold can be uniformly distributed on the horizontal width of the histogram, and the horizontal width is determined according to the range of the preset component , to determine the rising height of the partial amplitude before the clipping process, and the rising height is used to lift the amplitude in the histogram lower than the difference between the clipping threshold and the rising height during the clipping process, so that the clipping process
  • the total area of the front and back histograms is constant, but of course it is not limited to this.
  • the clipping threshold corresponding to the histogram of the image block is expressed as ClipLimit
  • the area of the part in the histogram higher than ClipLimit is expressed as totalExcess
  • the amplitude in the histogram is greater than ClipLimit, set the amplitude directly to ClipLimit; if the amplitude in the histogram is greater than or equal to upper and less than or equal to ClipLimit, set the amplitude to ClipLimit; if the amplitude in the histogram is smaller than upper, increase the amplitude to the rising height L.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold of the histogram in Fig. 6 is smaller than the clipping threshold of the histogram in Fig. 7, when the clipping threshold is small, the contrast and The stretching of the color is not enough, and the image toning effect is not obvious enough; when the clipping threshold is large, the contrast and color stretching of the flat area of the image, such as the box in Figure 7, is excessive, and the image toning effect is somewhat abrupt, such as As shown in Figure 7, the contrast stretching to the sky is overly exaggerated. It can be seen that the size of the clipping threshold has a great influence on the effect of image processing. By determining different histogram clipping thresholds for different image blocks in the image to be processed, it can be ensured that each region in the image to be processed can be properly processed, such as contrast stretching, and the effect of image processing is better .
  • the clipping threshold corresponding to the histogram of the image block outside the flat area is greater than the clipping threshold corresponding to the histogram of the image block in the flat area, so the stretching degree of the non-flat area can be guaranteed. And image toning effect, it can also prevent the contrast and color stretching in flat areas, and ensure that each area gets the appropriate contrast stretching.
  • the method further includes: determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block; Or the distribution parameters of the pixel values in the image block, and determine the clipping threshold corresponding to the histogram. Therefore, the adaptive adjustment of the clipping thresholds of different image blocks can be realized.
  • the cropping threshold is positively correlated with the information entropy of the image block, which can improve the contrast and color stretching of the image block with larger information entropy, and the effect of image toning is more obvious, and reduces the impact on image blocks with smaller information entropy.
  • the contrast and color stretching of image blocks prevents excessive stretching.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation.
  • the clipping threshold corresponding to the histogram of the image block may be adjusted according to the degree of dispersion of pixel values in the image block, and image blocks with a higher degree of dispersion may be more stretched.
  • the distribution parameter of pixel values in the image includes an average value of pixel values in the image block, and the clipping threshold is negatively correlated with the average value.
  • An image block with a lower average value of pixel values in the image block can be more stretched.
  • the quotient of the standard deviation and the mean value of the pixel values in the image block may be multiplied by a preset weight coefficient and added to the information entropy of the image block to obtain the clipping threshold corresponding to the histogram.
  • the clipping threshold ClipLimit corresponding to the histogram of the image block can be determined according to the following formula:
  • represents the standard deviation of the pixel values in the image block
  • represents the mean value of the pixel values in the image block
  • the quotient of ⁇ and ⁇ can be used to indicate the image dynamic range of the image block
  • represents the preset coefficient , used to adjust the weight of the information entropy of the image block and the dynamic range of the image, for example, the value of ⁇ is 1 to 5, such as 3.
  • FIG. 9 is a schematic diagram of clipping thresholds corresponding to the histograms of different image blocks in the image to be processed, and image blocks with richer details have higher clipping thresholds.
  • the method further includes: smoothing the clipping thresholds corresponding to the histograms of adjacent image blocks.
  • the clipping thresholds corresponding to the histograms of adjacent image blocks may be smoothed by mean filtering, but of course it is not limited thereto. Prevent certain block effects in the processed image when the clipping thresholds of adjacent image blocks differ greatly.
  • the mapping function of the corresponding image block can be determined according to the clipped histogram, and the processed image of the image to be processed can be determined according to the mapping function of each image in the image to be processed.
  • the determining the target image of the image block according to the mapping function corresponding to the image block includes: determining the equalized pixel of the central pixel of the image block according to the mapping function corresponding to the image block value; determine the preset number of image blocks adjacent to the non-central pixel of the image block; determine the preset number of pixels corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks value; performing interpolation processing on the preset number of pixel values to obtain the equalized pixel value of the non-central pixel. Through interpolation processing, the computational load of image processing can be reduced.
  • histogram equalization can be performed on the central pixel of the image block, and the image to be processed can be determined by interpolating the mapping function of the local neighborhood of any pixel in the image to be processed The mapping function of any pixel in the image to perform histogram equalization on the remaining pixels except the central pixel of each image block.
  • the pixel value after equalization processing of the central pixel 11 of each image block is determined according to the pixel value of the central pixel 11 and the mapping function of the image block;
  • the image blocks adjacent to the non-central pixel 12 include Four, four pixel values can be determined according to the pixel values of the non-central pixel 12 and the four mapping functions corresponding to the image blocks adjacent to the non-central pixel 12, and bilinear interpolation can be performed on the four pixel values to determine
  • the non-central pixel 12 equalizes the pixel value after processing;
  • the image block adjacent to the non-central pixel 13 in the image block at the edge of the image to be processed and not in the four corners includes two, which can be based on the non-central pixel 13
  • the pixel value and the two mapping functions corresponding to the image blocks adjacent to the non-central pixel 13 determine two pixel values, and performing linear interpolation on the two pixel values can determine the equalized pixel value of the non-central pixel 13;
  • a processed image of the image to be processed can be obtained according to the target image after equalization processing of all image blocks.
  • image processing is performed on the brightness component of the image to be processed, and image processing is performed on the saturation component of the image to be processed, and the color space is changed according to the brightness component and saturation component after image processing to obtain RGB Image in color space, get exposure, contrast, color corrected image.
  • both the brightness component and the saturation component of the image to be processed are mapped to an integer in the interval [0, 255], and then histogram equalization processing is performed, and the brightness component and saturation component after the histogram equalization processing are A float renormalized to the interval [0, 1].
  • the image processing method provided by the embodiment of the present application realizes more intelligent classification of the image blocks in the image by taking the adjacent image blocks whose sum of information entropy is less than or equal to the preset threshold as a class, that is, the flat area, to prevent Divide different objects in the same area, and then process such image blocks with certain similarities according to the histogram of the flat area, stretch the image blocks in the flat area more evenly, prevent distortion, and reduce image distortion. Handling is better.
  • the image processing method can provide simple and fast intelligent image color adjustment, and can quickly generate a primary color adjustment effect with only a very simple interaction. For example, the user only needs to click the color adjustment button to directly correct the exposure and color of the screen to a normal level, realize one-click adjustment of image quality, and achieve basically satisfactory results.
  • This method can not only process images quickly, but also be suitable for real-time processing of high-definition video.
  • the exemplary image processing method can be conveniently configured on the editor APP of the mobile terminal, and can realize high-resolution video, such as real-time grading processing of 1080P video, so that users can edit images or videos as they like anytime, anywhere. Smart color editing. The interaction is simpler, the implementation is more convenient, and the flexibility is stronger, which greatly reduces the user's threshold for use.
  • FIG. 11 is a schematic block diagram of an image processing device 400 provided by an embodiment of this specification.
  • the image processing device 400 includes one or more processors 401 working individually or jointly for executing the steps of the image processing method of the foregoing embodiments.
  • the image processing device includes at least one of an image signal processor (Image Signal Processor, ISP), a digital signal processor (Digital Signal Processor, DSP), an application processor (Application Processor, AP), and of course Not limited thereto, for example, a SoC (System on Chip, System on Chip) chip may be included. It should be noted that the image processing device may or may not include an image sensor.
  • ISP Image Signal Processor
  • DSP Digital Signal Processor
  • AP Application Processor
  • SoC System on Chip, System on Chip
  • the processor 401 is used for:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the processor 401 executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • processor 401 executes the calculation of the histogram of the flat area, it is configured to:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor 401 executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the target image of each image block in the flat area is acquired.
  • the processor 401 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor 401 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • processor 401 is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor 401 executes acquiring the target image of the image block according to the histogram of the image block, it is used to execute:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • processor 401 is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor 401 determines the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • processor 401 is also used for:
  • the processor 401 executes the smoothing processing on the clipping threshold corresponding to the histogram of the adjacent image block, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor 401 executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor 401 executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • processor 401 executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • FIG. 12 is a schematic block diagram of a mobile platform 500 provided in another embodiment of this specification.
  • the mobile platform 500 may include at least one of an unmanned aerial vehicle, a cloud platform, an unmanned vehicle, and the like.
  • the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone.
  • the photographing device 510 can be mounted on the movable platform 500 , and the photographing device 510 is used to acquire images, and the movable platform 500 can process the images acquired by the photographing device 510 .
  • the mobile platform 500 also includes one or more processors 501, and the one or more processors 501 can work individually or jointly to execute the steps of the image processing method of the foregoing embodiments.
  • the processor 501 is used for:
  • the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
  • the target image of each image block in the flat area is acquired according to the histogram of the flat area.
  • the processor 501 executes the determining the flat area in the image to be processed, it is configured to:
  • the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  • processor 501 executes the calculation of the histogram of the flat area, it is configured to:
  • the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  • the processor 501 executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the target image of each image block in the flat area is acquired.
  • the processor 501 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is used as the histogram of each image block in the flat area.
  • the processor 501 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
  • the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  • processor 501 is also used for:
  • the target image of each image block outside the flat area is acquired.
  • the processor 501 acquires the target image of the image block according to the histogram of the image block, it is configured to:
  • the target image of the image block is determined according to the mapping function corresponding to the image block.
  • the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  • the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
  • processor 501 is also used for:
  • a clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  • the clipping threshold is positively correlated with the information entropy of the image block.
  • the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation;
  • the distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  • the processor 501 executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
  • the quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  • processor 501 is also used for:
  • the processor 501 executes the smoothing processing on the clipping threshold corresponding to the histogram of the adjacent image block, it is used to execute:
  • the clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  • the processor 501 executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
  • the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  • the processor 501 executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
  • Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  • processor 501 executes the acquisition of the image to be processed, it is used to execute:
  • the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  • FIG. 13 is a schematic block diagram of an image processing system 600 provided in another embodiment of this specification.
  • the image processing system 600 includes, for example, at least one of a terminal device, a mobile platform, and a server.
  • a terminal device may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote control, etc.; At least one of people and vehicles.
  • the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone.
  • the server may be an individual server, or may be a server cluster.
  • the image processing system 600 includes a photographing device 610 and a display device 620 , and also includes one or more processors 601 .
  • one or more processors 601 may be mounted on the camera device 610 and/or the display device 620 .
  • One or more processors 601 may work individually or jointly to execute the steps of the image processing method of the foregoing embodiments, so as to process the image acquired by the photographing device 610 .
  • the display device 620 can display the image processed by the processor 601 .
  • FIG. 14 is a schematic block diagram of a terminal device 700 provided in another embodiment of this specification.
  • the terminal device 700 may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote controller, and the like.
  • the terminal device 700 includes one or more processors 701, and the one or more processors 701 can work individually or jointly to execute the steps of the image processing method of the foregoing embodiments.
  • An embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the image processing method provided in the above-mentioned embodiment step.
  • the computer-readable storage medium may be an internal storage unit of the system, device, or removable platform described in any of the foregoing embodiments, such as a hard disk or memory of the removable platform.
  • the computer-readable storage medium can also be an external storage device of the system, device or removable platform, such as a plug-in hard disk equipped on the removable platform, a smart memory card (Smart Media Card, SMC), a security Digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.

Abstract

An image processing method, comprising: acquiring an image to be processed (S110); dividing said image into a plurality of image blocks (S120); determining a flat area in said image (S130); calculating a histogram of the flat area (S140); and acquiring a target image of each image block in the flat area according to the histogram of the flat area (S150). According to the present application, an image can be processed according to a histogram of the image. Also provided are a device, a system, and a storage medium.

Description

图像处理方法、设备、系统和存储介质Image processing method, device, system and storage medium 技术领域technical field
本申请涉及图像处理技术领域,尤其涉及一种图像处理方法、设备、系统和存储介质。The present application relates to the technical field of image processing, and in particular to an image processing method, device, system and storage medium.
背景技术Background technique
随着互联网技术的发展,图像、视频内容趋向于大众化,用户对图像、视频进行编辑的需求日益增长。图像/视频编辑器当前已经在移动终端成为流行的软件APP,为图像/视频爱好者自由编辑提供个性化的工具。由于图像/视频素材的采集设备多种多样,拍摄的环境也千差万别,通常图像/视频素材的视觉效果不能达到100%满意,需要调节光照,对比度,色温,饱和度等基本画质。With the development of Internet technology, image and video content tends to be popularized, and users' demands for editing images and videos are increasing day by day. Image/video editors have become a popular software APP on mobile terminals, providing personalized tools for image/video lovers to freely edit. Due to the variety of image/video material acquisition devices and shooting environments are also very different, usually the visual effect of image/video material cannot be 100% satisfactory, and basic quality such as lighting, contrast, color temperature, and saturation need to be adjusted.
现有的图像调节方法通常对图像整体直接做拉伸等处理,或以固定的方式划分为多个图像块并对划分得到的每个图像块进行拉伸等处理,但是对图像整体直接拉伸会改变整个图像的对比度,在很多情况下这样做的效果并不好,而分块后再处理容易使图像块局部的对比度拉伸过大,导致图像失真;虽然有些方法将图像划分为多个较小的图像块后将部分较小的图像块归类为较大的图像块,然后对较大的图像块进行拉伸等处理,但是较大的图像块会包括不同的物体,在拉伸后不同物体的邻接处会产生畸变,也会导致图像失真等现象。Existing image adjustment methods usually stretch the whole image directly, or divide it into multiple image blocks in a fixed way and stretch each divided image block, but stretch the whole image directly. It will change the contrast of the whole image. In many cases, the effect of doing so is not good, and after block processing, it is easy to stretch the local contrast of the image block too much, resulting in image distortion; although some methods divide the image into multiple After the smaller image blocks, some smaller image blocks are classified into larger image blocks, and then the larger image blocks are stretched, but the larger image blocks will include different objects. After that, the adjacency of different objects will produce distortion, which will also lead to image distortion and other phenomena.
发明内容Contents of the invention
本申请提供了一种图像处理方法、设备、系统和存储介质,旨在解决现有的图像/视频的调节方法,容易导致图像失真等技术问题。The present application provides an image processing method, device, system and storage medium, aiming to solve technical problems such as image distortion easily caused by existing image/video adjustment methods.
第一方面,本申请实施例提供了一种图像处理方法,包括:In the first aspect, the embodiment of the present application provides an image processing method, including:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,所述确定所述待处理图像中的平坦区域,包括:Optionally, the determining the flat area in the image to be processed includes:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,所述计算所述平坦区域的直方图,包括:Optionally, the calculating the histogram of the flat area includes:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像,包括:Optionally, the acquiring the target image of each image block in the flat area according to the histogram of the flat area includes:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图,包括:Optionally, the determining the histogram of each image block in the flat area according to the histogram of the flat area includes:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图,包括:Optionally, the determining the histogram of each image block in the flat area according to the histogram of the flat area includes:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,所述方法还包括:Optionally, the method also includes:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,根据所述图像块的直方图获取所述图像块的目标图像,包括:Optionally, acquiring the target image of the image block according to the histogram of the image block includes:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,所述方法还包括:Optionally, the method also includes:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值,包括:Optionally, the determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of pixel values in the image block includes:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,所述方法还包括:Optionally, the method also includes:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理,包括:Optionally, the smoothing the clipping threshold corresponding to the histogram of the adjacent image block includes:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理,包括:Optionally, performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block includes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升 高度;Determine the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,所述根据所述图像块对应的映射函数,确定所述图像块的目标图像,包括:Optionally, the determining the target image of the image block according to the mapping function corresponding to the image block includes:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,所述获取待处理图像,包括:Optionally, the acquisition of images to be processed includes:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
第二方面,本申请实施例提供了一种图像处理设备,包括一个或多个处理器,单独地或共同地工作,用于执行如下步骤:In the second aspect, the embodiment of the present application provides an image processing device, including one or more processors, working individually or jointly, for performing the following steps:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,所述处理器执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,所述处理器执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor executes the calculation of the histogram of the flat area, it is used to execute:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像时,用于执行:Optionally, when the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,所述处理器执行根据所述图像块的直方图获取所述图像块的目标图像时,用于执行:Optionally, when the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,所述处理器执行所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,所述处理器还用于:Optionally, the processor is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,所述处理器执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,所述处理器执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,所述处理器执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,所述处理器执行所述获取待处理图像时,用于执行:Optionally, when the processor executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
第三方面,本申请实施例提供了一种终端设备,其特征在于,包括一个或多个处理器,单独地或共同地工作,用于执行如下步骤:In a third aspect, the embodiment of the present application provides a terminal device, which is characterized in that it includes one or more processors, working individually or jointly, to perform the following steps:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,所述处理器执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,所述处理器执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor executes the calculation of the histogram of the flat area, it is used to execute:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图获取所述平坦区 域内每个图像块的目标图像时,用于执行:Optionally, when the processor executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is used to execute:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,所述处理器执行根据所述图像块的直方图获取所述图像块的目标图像时,用于执行:Optionally, when the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,所述处理器执行所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,所述处理器还用于:Optionally, the processor is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,所述处理器执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,所述处理器执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,所述处理器执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后 的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the pixel values after equalization processing of the non-central pixels.
可选的,所述处理器执行所述获取待处理图像时,用于执行:Optionally, when the processor executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
第四方面,本申请实施例提供了一种可移动平台,所述可移动平台上搭载拍摄装置,所述拍摄装置用于获取图像;In a fourth aspect, the embodiment of the present application provides a movable platform, the movable platform is equipped with a photographing device, and the photographing device is used to acquire images;
还包括一个或多个处理器,单独地或共同地工作,用于执行如下步骤:Also included is one or more processors, working individually or jointly, for performing the following steps:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,所述处理器执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,所述处理器执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor executes the calculation of the histogram of the flat area, it is used to execute:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像时,用于执行:Optionally, when the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区 域内每个图像块的直方图时,用于执行:Optionally, when the processor executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is used to execute:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,所述处理器执行根据所述图像块的直方图获取所述图像块的目标图像时,用于执行:Optionally, when the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,所述处理器执行所述根据所述图像块的信息熵和/或所述图像块中 像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,所述处理器还用于:Optionally, the processor is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,所述处理器执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,所述处理器执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,所述处理器执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,所述处理器执行所述获取待处理图像时,用于执行:Optionally, when the processor executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
第五方面,本申请实施例提供了一种图像处理系统,包括拍摄装置和显示装置,还包括一个或多个处理器,单独地或共同地工作,用于执行如下步骤,以对所述拍摄装置获取的图像进行处理:In the fifth aspect, the embodiment of the present application provides an image processing system, including a shooting device and a display device, and also includes one or more processors, working individually or jointly, for performing the following steps to process the shooting The image acquired by the device is processed by:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像;acquiring a target image of each image block in the flat area according to the histogram of the flat area;
所述显示装置能够显示所述处理器处理后的图像。The display device can display the image processed by the processor.
可选的,所述处理器执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,所述处理器执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor executes the calculation of the histogram of the flat area, it is used to execute:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像时,用于执行:Optionally, when the processor executes the step of obtaining the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,所述处理器执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor performs the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,所述处理器执行根据所述图像块的直方图获取所述图像块的目标图像时,用于执行:Optionally, when the processor acquires the target image of the image block according to the histogram of the image block, it is configured to:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,所述处理器还用于:Optionally, the processor is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,所述处理器执行所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,所述处理器还用于:Optionally, the processor is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,所述处理器执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor executes the smoothing processing on the clipping thresholds corresponding to the histograms of adjacent image blocks, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,所述处理器执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,所述处理器执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,所述处理器执行所述获取待处理图像时,用于执行:Optionally, when the processor executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
第六方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器实现上述的方法。In a sixth aspect, the embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the above method.
本申请实施例提供了一种图像处理方法、设备、系统和存储介质,通过把 信息熵之和小于或等于预设门限的相邻图像块作为一类,即平坦区域,实现将图像中的图像块进行更智能的归类,防止将不同的物体划分在同一区域中,然后根据平坦区域的直方图对这类有一定相似性的图像块进行处理,对平坦区域中的图像块拉伸更均匀,防止畸变,可以降低图像失真,处理效果更好。Embodiments of the present application provide an image processing method, device, system, and storage medium, by using adjacent image blocks whose sum of information entropy is less than or equal to a preset threshold as a class, that is, a flat area, to realize image processing in an image Blocks are classified more intelligently to prevent different objects from being divided into the same area, and then according to the histogram of the flat area, such image blocks with certain similarities are processed, and the image blocks in the flat area are stretched more evenly , to prevent distortion, can reduce image distortion, and the processing effect is better.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请实施例的公开内容。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the disclosure content of the embodiments of the present application.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. Those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.
图1是本申请实施例提供的一种图像处理方法的流程示意图;FIG. 1 is a schematic flow diagram of an image processing method provided in an embodiment of the present application;
图2是一实施方式中图像处理方法应用场景的示意图;Fig. 2 is a schematic diagram of an application scene of an image processing method in an embodiment;
图3是一实施方式中待处理图像划分为多个图像块的示意图;Fig. 3 is a schematic diagram of dividing an image to be processed into a plurality of image blocks in an embodiment;
图4是一实施方式中待处理图像中的平坦区域的示意图;Fig. 4 is a schematic diagram of a flat area in an image to be processed in an embodiment;
图5是一实施方式中待处理图像的示意图;Fig. 5 is a schematic diagram of an image to be processed in an embodiment;
图6是一实施方式中待处理图像处理后的图像的示意图;Fig. 6 is a schematic diagram of an image to be processed after image processing in one embodiment;
图7是另一实施方式中待处理图像处理后的图像的示意图;Fig. 7 is a schematic diagram of a processed image of an image to be processed in another embodiment;
图8是一实施方式中裁剪直方图的示意图;Fig. 8 is a schematic diagram of clipping a histogram in an embodiment;
图9是一实施方式中不同图像块对应的裁剪阈值的示意图;Fig. 9 is a schematic diagram of clipping thresholds corresponding to different image blocks in an embodiment;
图10是一实施方式中不同像素邻近的图像块的示意图;Fig. 10 is a schematic diagram of image blocks adjacent to different pixels in an embodiment;
图11是本申请实施例提供的一种图像处理设备的示意性框图;Fig. 11 is a schematic block diagram of an image processing device provided by an embodiment of the present application;
图12是本申请实施例提供的一种可移动平台的示意性框图;Fig. 12 is a schematic block diagram of a mobile platform provided by an embodiment of the present application;
图13是本申请实施例提供的一种图像处理系统的示意性框图;Fig. 13 is a schematic block diagram of an image processing system provided by an embodiment of the present application;
图14是本申请实施例提供的一种终端设备的示意性框图。Fig. 14 is a schematic block diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清 楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
附图中所示的流程图仅是示例说明,不是必须包括所有的内容和操作/步骤,也不是必须按所描述的顺序执行。例如,有的操作/步骤还可以分解、组合或部分合并,因此实际执行的顺序有可能根据实际情况改变。The flow charts shown in the drawings are just illustrations, and do not necessarily include all contents and operations/steps, nor must they be performed in the order described. For example, some operations/steps can be decomposed, combined or partly combined, so the actual order of execution may be changed according to the actual situation.
下面结合附图,对本申请的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some implementations of the present application will be described in detail below in conjunction with the accompanying drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.
请参阅图1,图1是本申请实施例提供的一种图像处理方法的流程示意图。所述图像处理方法可以应用在图像处理设备或图像处理系统中,用于根据图像的直方图对图像进行处理等过程。Please refer to FIG. 1 . FIG. 1 is a schematic flowchart of an image processing method provided in an embodiment of the present application. The image processing method can be applied in an image processing device or an image processing system, and is used for processing an image according to a histogram of the image, and the like.
其中,图像处理设备例如包括图像信号处理器(Image Signal Processor,ISP)、数字信号处理器(Digital Signal Processor,DSP)、应用处理器(Application Processor,AP)中的至少一种,当然也不限于此,例如可以包括SoC(片上系统,System on Chip)芯片。需要说明的是,图像处理设备可以包括图像传感器,也可以不包括图像传感器。Wherein, the image processing equipment includes, for example, at least one of an image signal processor (Image Signal Processor, ISP), a digital signal processor (Digital Signal Processor, DSP), and an application processor (Application Processor, AP), and of course it is not limited to Therefore, for example, a SoC (System on Chip, System on Chip) chip may be included. It should be noted that the image processing device may or may not include an image sensor.
其中,图像处理系统例如包括终端设备、可移动平台、服务器中的至少一种。举例而言,终端设备可以包括手机、相机、摄影机、平板电脑、笔记本电脑、个人数字助理、穿戴式设备、遥控器等中的至少一项;可移动平台可以包括无人飞行器、云台、无人车等中的至少一种。进一步而言,无人飞行器可以为旋翼型无人机,例如四旋翼无人机、六旋翼无人机、八旋翼无人机,也可以是固定翼无人机。示例性的,服务器可以为单独的服务器,也可以是服务器集群。Wherein, the image processing system includes, for example, at least one of a terminal device, a mobile platform, and a server. For example, a terminal device may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote control, etc.; At least one of people and vehicles. Furthermore, the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone. Exemplarily, the server may be an individual server, or may be a server cluster.
在一些应用场景中,如图2所示,可移动平台100搭载的摄像装置110实时获取图像,并根据图像处理方法对图像进行处理;然后将处理后的图像发送给与可移动平台100通信连接的终端设备200。终端设备200例如可以为手机、电脑、FPV(First Person View,第一人称主视角)眼镜等。终端设备200包括的显示装置210可以显示从可移动平台100接收的图像,以供用户观看。In some application scenarios, as shown in Figure 2, the camera device 110 carried by the movable platform 100 acquires images in real time, and processes the images according to the image processing method; terminal device 200. The terminal device 200 may be, for example, a mobile phone, a computer, FPV (First Person View, first-person perspective) glasses, and the like. The display device 210 included in the terminal device 200 can display images received from the mobile platform 100 for viewing by the user.
在另一些应用场景中,如图2所示,可移动平台100搭载的摄像装置110 实时获取图像,并将获取的图像发送给与可移动平台100通信连接的终端设备200。终端设备200根据图像处理方法对从可移动平台100接收的图像进行处理,还可以显示处理后的图像,以供用户观看。In other application scenarios, as shown in FIG. 2 , the camera device 110 mounted on the mobile platform 100 acquires images in real time, and sends the acquired images to the terminal device 200 communicatively connected to the mobile platform 100 . The terminal device 200 processes the image received from the mobile platform 100 according to the image processing method, and can also display the processed image for the user to watch.
在其他一些实施方式中,终端设备通过搭载的拍摄装置获取图像,或者获取本地存储的图像,或者从服务器获取图像,以及根据图像处理方法对获取的图像进行处理,还可以显示处理后的图像,以供用户观看。In some other implementations, the terminal device acquires images through the equipped camera, or acquires locally stored images, or acquires images from the server, and processes the acquired images according to the image processing method, and can also display the processed images, for users to view.
如图1所示,本申请实施例的图像处理方法包括步骤S110至步骤S130。As shown in FIG. 1 , the image processing method of the embodiment of the present application includes step S110 to step S130.
S110、获取待处理图像。S110. Acquire an image to be processed.
需要说明的是,待处理图像可以是本地存储的,或者是通过拍摄装置实时采集的、还可以是通过通信链路从其他设备获取的,待处理图像可以为独立的图像,也可以是视频流中的图像,当然也不限于此。It should be noted that the image to be processed can be stored locally, or collected in real time by the camera, or obtained from other devices through a communication link, and the image to be processed can be an independent image or a video stream The images in , of course, are not limited to this.
可选的,所述获取待处理图像,包括:获取HSL(Hue,Saturation,Lightness,色相、饱和度、亮度)域的待处理图像或HSV(Hue,Saturation,Value,色相、饱和度、明度)域的待处理图像。当然也不限于此,待处理图像可以为RGB(Red,Green,Blue,红、绿、蓝)域、CMY/CMYK(Cyan,Magenta,Yellow,Black,青、洋红、黄,黑)域、Lab(Lightness表示亮度,a是从深绿色(低亮度值)到灰色(中亮度值)再到亮粉红色(高亮度值),b是从亮蓝色(低亮度值)到灰色(中亮度值)再到黄色(高亮度值))域或者YUV/YCbCr(Y表示亮度,U表示色度,V表示浓度,Cb表示对蓝色的偏移程度、Cr表示对红色的偏移程度)域的图像。Optionally, the acquiring the image to be processed includes: acquiring the image to be processed in the HSL (Hue, Saturation, Lightness) domain or HSV (Hue, Saturation, Value, hue, saturation, lightness) The pending image for the domain. Of course it is not limited to this, the image to be processed can be RGB (Red, Green, Blue, red, green, blue) domain, CMY/CMYK (Cyan, Magenta, Yellow, Black, cyan, magenta, yellow, black) domain, Lab (Lightness means brightness, a is from dark green (low brightness value) to gray (medium brightness value) to bright pink (high brightness value), b is from bright blue (low brightness value) to gray (medium brightness value) ) to yellow (high brightness value)) domain or YUV/YCbCr (Y represents brightness, U represents chroma, V represents density, Cb represents the degree of offset to blue, Cr represents the degree of offset to red) domain image.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。例如,所述图像处理方法可以对所述待处理图像的饱和度分量进行处理,或者,所述图像处理方法可以对所述待处理图像的饱亮度分量进行处理,或者,所述图像处理方法可以对所述待处理图像的饱和度分量和亮度分量进行处理。举例而言,亮度分量可以为HSL域的待处理图像的亮度(Lightness)分量,也可以为HSV域的待处理图像的明度(Value)分量,当然也不限于此。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component. For example, the image processing method may process the saturation component of the image to be processed, or the image processing method may process the saturation component of the image to be processed, or the image processing method may Process the saturation component and brightness component of the image to be processed. For example, the brightness component may be the brightness (Lightness) component of the image to be processed in the HSL domain, or may be the value (Value) component of the image to be processed in the HSV domain, and of course it is not limited thereto.
可选的,将所述待处理图像转换为HSL域的待处理图像或HSV域的待处理图像,然后对其中至少一种分量进行处理;处理完成后还可以转换至原来的颜 色空间(域)的图像。举例而言,将待处理图像转换到HSL域,对亮度分量和饱和度分量进行处理,可以保证图像的对比度和颜色都得到较好的范围拉伸,校正到合适的范围,避免RGB域直方图均衡带来的色差。Optionally, the image to be processed is converted into an image to be processed in the HSL domain or an image to be processed in the HSV domain, and then at least one component is processed; after the processing is completed, it can also be converted to the original color space (domain) Image. For example, converting the image to be processed to the HSL domain and processing the brightness and saturation components can ensure that the contrast and color of the image are well stretched, corrected to an appropriate range, and avoid the RGB domain histogram Chromatic aberration caused by equalization.
S120、将所述待处理图像划分为多个图像块。S120. Divide the image to be processed into multiple image blocks.
可选的,将所述待处理图像划分为多行多列的多个图像块,例如分为8行8列共64个图像块,如图3所示。Optionally, the image to be processed is divided into multiple image blocks with multiple rows and multiple columns, for example, 8 rows and 8 columns with 64 image blocks in total, as shown in FIG. 3 .
可选的,划分得到的多个图像块的大小均相同,即将所述待处理图像均匀划分为多个图像块。可选的,如果待处理图像的长不能被预设的图像块的列数整除,则可以对待处理图像沿水平方向进行扩展至列数的整数倍,如果待处理图像的宽不能被预设的图像块的行数整除,则可以对待处理图像沿垂直方向进行扩展至行数的整数倍。当然在其他一些实施方式中,划分得到的多个图像块的大小也可以不相同,例如可以根据待处理图像的构图确定划分的多个图像块的大小。Optionally, the sizes of the divided image blocks are all the same, that is, the image to be processed is evenly divided into a plurality of image blocks. Optionally, if the length of the image to be processed cannot be divisible by the preset number of columns of the image block, the image to be processed can be extended horizontally to an integer multiple of the number of columns, if the width of the image to be processed cannot be divided by the preset If the number of rows of the image block is evenly divided, the image to be processed can be extended to an integer multiple of the number of rows in the vertical direction. Of course, in some other implementation manners, the sizes of the multiple divided image blocks may also be different, for example, the sizes of the multiple divided image blocks may be determined according to the composition of the image to be processed.
S130、确定所述待处理图像中的平坦区域。S130. Determine a flat area in the image to be processed.
举例而言,平坦区域中各像素点对应的物距大致相同。所述待处理图像中的平坦区域可以包括天空、水面、路面、墙面等,在一些实施方式中,平坦区域例如为背景区域。For example, the object distances corresponding to the pixels in the flat area are approximately the same. The flat area in the image to be processed may include sky, water, road, wall, etc. In some implementations, the flat area is, for example, a background area.
具体的,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限。将图像中的图像块进行更智能的归类,把信息熵之和小于或等于预设门限的相邻图像块作为一类,即平坦区域,同一平坦区域内的图像块具有相似性,灰度、颜色、纹理等图像特性没有突变或者突变较小,如同一平坦区域内的图像块中各像素的灰度处于相同或相近的灰度范围。可以防止将具有不同图像特性的图像块划分在一个平坦区域中,从而可以防止处理后的图像中具有不同图像特性的区域之间的畸变等失真现象。Specifically, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, and all the image blocks in the flat area The sum of the information entropies of the image blocks is less than or equal to the preset threshold. The image blocks in the image are classified more intelligently, and the adjacent image blocks whose sum of information entropy is less than or equal to the preset threshold are regarded as a class, that is, the flat area, and the image blocks in the same flat area have similarity, grayscale Image characteristics such as color, texture, etc. have no or small mutations, such as the grayscale of each pixel in an image block in the same flat area is in the same or similar grayscale range. It can prevent image blocks with different image properties from being divided into one flat area, thereby preventing distortion phenomena such as distortion between areas with different image properties in the processed image.
图像的信息熵是一种特征的统计形式,它反映了图像中平均信息量的多少。所述图像块的信息熵可以是一维熵也可以是二维熵,其中,一维熵表示所述图像块的中灰度分布的聚集特征所包含的信息量,在一维熵的基础上引入能够反映灰度分布空间特征的特征量可以得到所述图像块的二维熵。The information entropy of an image is a statistical form of a feature, which reflects the average amount of information in the image. The information entropy of the image block can be one-dimensional entropy or two-dimensional entropy, wherein the one-dimensional entropy represents the amount of information contained in the aggregation characteristics of the grayscale distribution of the image block, based on the one-dimensional entropy The two-dimensional entropy of the image block can be obtained by introducing a feature quantity that can reflect the spatial characteristics of the gray distribution.
可选的,根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。Optionally, according to the histogram of each image block in the image to be processed, determine the information entropy of each image block; if the sum of the information entropy of at least two adjacent image blocks is less than or equal to the preset threshold , determining that the at least two adjacent image blocks are located in the same flat area.
可选的,计算每个图像块的预设分量,如亮度分量的直方图,根据所述直方图确定每个图像块的信息熵。举例而言,所述图像块的信息熵H根据下式确定:Optionally, a preset component of each image block is calculated, such as a histogram of a brightness component, and information entropy of each image block is determined according to the histogram. For example, the information entropy H of the image block is determined according to the following formula:
Figure PCTCN2021095871-appb-000001
Figure PCTCN2021095871-appb-000001
其中,0至255为所述预设分量的范围,当然也不限于此,i表示所述范围内的任一值,p i是所述范围内的值i在所述图像块中出现的概率,p i可以根据所述图像块的直方图确定。根据所述图像块的信息熵,可以将相邻的多个图像块合并得到所述平坦区域,举例而言,如果相邻的图像块的信息熵之和小于或等于所述预设门限,则可以将这些图像块合并,若这些图像块的信息熵与这些图像块的相邻的图像块的信息熵之和仍小于或等于所述预设门限,则将所述这些图像块与这些图像块的相邻的图像块合并,直至信息熵等于或大于所述预设门限,可以确定合并的图像块得到所述平坦区域。 Wherein, 0 to 255 is the range of the preset component, and of course it is not limited thereto, i represents any value within the range, p i is the probability that the value i within the range appears in the image block , p i can be determined according to the histogram of the image block. According to the information entropy of the image block, multiple adjacent image blocks can be combined to obtain the flat area, for example, if the sum of the information entropy of adjacent image blocks is less than or equal to the preset threshold, then These image blocks can be merged, if the sum of the information entropy of these image blocks and the information entropy of adjacent image blocks of these image blocks is still less than or equal to the preset threshold, then these image blocks and these image blocks Adjacent image blocks are merged until the information entropy is equal to or greater than the preset threshold, and it can be determined that the flat area is obtained from the merged image blocks.
请参阅图4,待处理图像中包括房屋、塔和天空,确定所述待处理图像中的平坦区域包括塔上半部分左侧的天空和右侧的天空,两个天空区域中的图像块均不相邻,可以确定为两个平坦区域。Please refer to Fig. 4, house, tower and sky are included in the image to be processed, it is determined that the flat area in the image to be processed includes the sky on the left side of the upper half of the tower and the sky on the right side, and the image blocks in the two sky areas are all Not adjacent, can be determined as two flat areas.
需要说明的是,待处理图像中的平坦区域可以为一个也可以为多个,不同的平坦区域可以相邻也可以不相邻。举例而言,待处理图像中包括墙壁和天空,如果墙壁和天空的图像特性不同,可以被划分为两个平坦区域,如果墙壁和天空相邻,则划分的两个平坦区域也可以相邻,如果墙壁和天空不相邻,则划分的两个平坦区域不相邻。当然,如果墙壁和天空的图像特性相同且墙壁和天空相邻,则相邻的墙壁和天空可以划分为一个平坦区域。It should be noted that there may be one or more flat areas in the image to be processed, and different flat areas may or may not be adjacent. For example, the image to be processed includes the wall and the sky. If the image characteristics of the wall and the sky are different, they can be divided into two flat areas. If the wall and the sky are adjacent, the two flat areas can also be adjacent. If the wall and the sky are not adjacent, then the two flat areas divided are not adjacent. Of course, if the image properties of the walls and the sky are the same and the walls and the sky are adjacent, the adjacent walls and the sky can be divided into a flat region.
S140、计算所述平坦区域的直方图。S140. Calculate the histogram of the flat area.
可选的,对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。当然也不限于此,例如对所述平坦区域内每个图像块的直方图 进行叠加,叠加后的直方图除以所述平坦区域中图像块的个数,得到所述平坦区域的直方图。Optionally, the histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area. Of course it is not limited to this, for example, the histogram of each image block in the flat area is superimposed, and the superimposed histogram is divided by the number of image blocks in the flat area to obtain the histogram of the flat area.
对于所述平坦区域内的单个图像块,所述图像块的直方图容易出现尖峰,本申请实施例的平坦区域的直方图可以由平坦区域内的多个图像块的直方图叠加得到,可以防止直方图出现尖峰,因此根据所述平坦区域的直方图对图像处理的效果更好。For a single image block in the flat area, the histogram of the image block is prone to peaks. The histogram of the flat area in the embodiment of the present application can be obtained by superimposing the histograms of multiple image blocks in the flat area, which can prevent The histogram is spiked, so image processing works better based on the histogram of said flat areas.
S150、根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。S150. Acquire a target image of each image block in the flat area according to the histogram of the flat area.
可选的,通过直方图均衡对所述平坦区域内的每个图像块进行处理,得到对应的目标图像。Optionally, each image block in the flat area is processed through histogram equalization to obtain a corresponding target image.
可选的,所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像,包括:根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。Optionally, the acquiring the target image of each image block in the flat area according to the histogram of the flat area includes: determining the histogram of each image block in the flat area according to the histogram of the flat area Figure: Acquiring the target image of each image block in the flat area according to the histogram of each image block in the flat area.
可选的,根据所述平坦区域中图像块的直方图确定所述图像块对应的映射函数,以及根据所述图像块对应的映射函数,确定所述图像块的目标图像。Optionally, a mapping function corresponding to the image block is determined according to the histogram of the image block in the flat area, and a target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,对所述图像块的直方图进行裁剪,根据裁剪后的直方图确定所述图像块对应的映射函数,所述映射函数用于指示所述图像块的预设分量和所述图像块的目标图像的预设分量之间的映射关系,因此可以根据所述映射函数确定所述图像块的目标图像。Optionally, the histogram of the image block is clipped, and the mapping function corresponding to the image block is determined according to the clipped histogram, and the mapping function is used to indicate the preset component of the image block and the image The mapping relationship between the preset components of the target image of the block, so the target image of the image block can be determined according to the mapping function.
在一些实施方式中,根据所述平坦区域的直方图确定的同一平坦区域内的不同图像块的直方图均相同。In some embodiments, the histograms of different image blocks in the same flat area determined according to the histograms of the flat area are all the same.
可选的,将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。可以理解的,所述平坦区域内每个图像块的直方图可以为所述平坦区域的直方图。Optionally, the histogram of the flat area is used as the histogram of each image block in the flat area. It can be understood that the histogram of each image block in the flat area may be the histogram of the flat area.
可选的,根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。Optionally, according to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
通常平坦区域内单个图像块的直方图容易出现尖峰,根据单个图像块的直方图对图像块进行处理,容易引起图像失真,例如引起局部对比度提高过大。 在本申请实施例中,根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图,而整个平坦区域的直方图可以由所述平坦区域内的多个图像块的直方图叠加得到,因此直方图不容易出现尖峰,可以降低图像失真,处理效果更好。Generally, the histogram of a single image block in a flat area tends to have peaks, and processing the image block according to the histogram of a single image block may easily cause image distortion, for example, an excessive increase in local contrast may be caused. In the embodiment of the present application, the histogram of each image block in the flat area is determined according to the histogram of the flat area, and the histogram of the entire flat area can be obtained from the histograms of multiple image blocks in the flat area The images are superimposed, so the histogram is not prone to peaks, which can reduce image distortion and improve the processing effect.
可选的,所述方法还包括:计算所述待处理图像中所述平坦区域之外每个图像块的直方图;根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。Optionally, the method further includes: calculating a histogram of each image block outside the flat area in the image to be processed; obtaining the flat area according to the histogram of each image block outside the flat area. The target image for each image patch outside the region.
可以理解的,还可以根据所述平坦区域之外每个图像块的直方图确定所述平坦区域之外的图像块对应的映射函数,以及根据所述平坦区域之外的图像块对应的映射函数,确定所述平坦区域之外的图像块的目标图像。It can be understood that the mapping function corresponding to the image block outside the flat area can also be determined according to the histogram of each image block outside the flat area, and according to the mapping function corresponding to the image block outside the flat area , determine the target image of the image block outside the flat area.
平坦区域之外的图像块的信息熵较大,或者虽然信息熵较小但相邻的图像块的信息熵均较大。通过根据所述平坦区域之外每个图像块的各自的直方图对所述每个图像块进行处理,可以保留所述平坦区域之外的图像块的目标图像的细节。The information entropy of the image blocks outside the flat area is larger, or the information entropy of adjacent image blocks is larger although the information entropy is smaller. By processing each image block outside the flat area according to its respective histogram, the details of the target image of the image blocks outside the flat area can be preserved.
可选的,根据所述平坦区域内每个图像块的目标图像,以及所述平坦区域之外的图像块的目标图像,可以得到所述待处理图像处理后的图像,如图5所示为所述待处理图像,如图6和图7所示为待处理图像处理后的图像,图像的对比度和颜色都得到较好的范围拉伸,校正到合适的范围,降低了图像失真,例如降低了平坦区域局部的图像失真。Optionally, according to the target image of each image block in the flat area and the target image of the image blocks outside the flat area, the processed image of the image to be processed can be obtained, as shown in FIG. 5 The image to be processed, as shown in Figure 6 and Figure 7, is the processed image of the image to be processed, the contrast and color of the image have been stretched in a better range, corrected to a suitable range, and the image distortion has been reduced, such as reducing localized image distortion in flat areas.
可选的,根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;以及对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数。通过对所述图像块的直方图进行裁剪处理,使裁剪处理后的直方图的幅值均等于或小于所述裁剪阈值,可以防止根据未裁剪的直方图对所述图像块进行处理,如进行直方图均衡时对局部的对比度提高过大,导致图像失真和噪声放大。Optionally, performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block; and performing equalization processing on the clipped histogram to obtain a mapping function corresponding to the image block. By clipping the histogram of the image block so that the amplitudes of the clipped histograms are all equal to or smaller than the clipping threshold, it is possible to prevent the image block from being processed according to the uncropped histogram, such as performing When the histogram is equalized, the local contrast is increased too much, resulting in image distortion and noise amplification.
可选的,所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理,包括:确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升 高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。Optionally, performing clipping processing on the histogram according to a clipping threshold corresponding to the histogram of the image block includes: determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold; According to the quotient of the area and the horizontal width of the histogram, determine the rising height of the amplitude in the histogram; if the amplitude in the histogram is lower than the difference between the clipping threshold and the rising height, according to The ascent height increases the magnitude; and/or, if the magnitude in the histogram is higher than the difference between the clipping threshold and the ascent height, setting the magnitude as the clipping threshold.
请参阅图8,可以将所述图像块的直方图中幅值高于所述裁剪阈值的面积均匀分布在所述直方图的横向宽度上,所述横向宽度根据所述预设分量的范围确定,以确定裁剪处理前时部分幅值的上升高度,所述上升高度用于在裁剪处理时抬升所述直方图中低于所述裁剪阈值与所述上升高度之差的幅值,从而裁剪处理前后的直方图的总面积不变,当然也不限于此。Please refer to FIG. 8 , the area in the histogram of the image block whose magnitude is higher than the clipping threshold can be uniformly distributed on the horizontal width of the histogram, and the horizontal width is determined according to the range of the preset component , to determine the rising height of the partial amplitude before the clipping process, and the rising height is used to lift the amplitude in the histogram lower than the difference between the clipping threshold and the rising height during the clipping process, so that the clipping process The total area of the front and back histograms is constant, but of course it is not limited to this.
示例性的,所述图像块的直方图对应的裁剪阈值表示为ClipLimit,所述直方图中高于ClipLimit的部分的面积表示为totalExcess,将面积totalExcess除以所述直方图的横向宽度,得到所述上升高度L=totalExcess÷N,以所述裁剪阈值与所述上升高度之差upper=ClipLimit-L为界限对所述直方图进行裁剪。举例而言,所述直方图中的幅值若大于ClipLimit,直接将所述幅值置为ClipLimit;所述直方图中的幅值若大于等于upper且小于等于ClipLimit,将所述幅值置为ClipLimit;所述直方图中的幅值若小于upper,将所述幅值提高所述上升高度L。Exemplarily, the clipping threshold corresponding to the histogram of the image block is expressed as ClipLimit, and the area of the part in the histogram higher than ClipLimit is expressed as totalExcess, and the area totalExcess is divided by the horizontal width of the histogram to obtain the Rising height L=totalExcess÷N, the histogram is clipped with the difference between the clipping threshold and the rising height upper=ClipLimit−L as a limit. For example, if the amplitude in the histogram is greater than ClipLimit, set the amplitude directly to ClipLimit; if the amplitude in the histogram is greater than or equal to upper and less than or equal to ClipLimit, set the amplitude to ClipLimit; if the amplitude in the histogram is smaller than upper, increase the amplitude to the rising height L.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
请参阅图6和图7,图6中直方图的裁剪阈值小于图7中直方图的裁剪阈值,当裁剪阈值较小时,对图像局部细节区域,如图6中方框示出的区域的对比度和颜色的拉伸不够,图像调色效果不够明显;当裁剪阈值较大时,对图像平坦区域,如图7中方框是处的区域的对比度和颜色拉伸过度,图像调色效果有些突兀,如图7所示,对天空的对比度拉伸过于夸张。由此可知裁剪阈值的大小对图像处理的效果影响很大。通过对所述待处理图像中不同的图像块确定不同的直方图裁剪阈值,可以保证所述待处理图像中的每个区域都能得到合适的处理,如对比度拉伸,图像处理的效果更好。Please refer to Fig. 6 and Fig. 7, the clipping threshold of the histogram in Fig. 6 is smaller than the clipping threshold of the histogram in Fig. 7, when the clipping threshold is small, the contrast and The stretching of the color is not enough, and the image toning effect is not obvious enough; when the clipping threshold is large, the contrast and color stretching of the flat area of the image, such as the box in Figure 7, is excessive, and the image toning effect is somewhat abrupt, such as As shown in Figure 7, the contrast stretching to the sky is overly exaggerated. It can be seen that the size of the clipping threshold has a great influence on the effect of image processing. By determining different histogram clipping thresholds for different image blocks in the image to be processed, it can be ensured that each region in the image to be processed can be properly processed, such as contrast stretching, and the effect of image processing is better .
在一些实施方式中,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值,因此既可以保证非平坦区域的拉伸度和图像调色效果,还可以防止平坦区域的对比度和颜色拉伸过度,保证每个区域都得到合适的对比度拉伸。In some implementations, the clipping threshold corresponding to the histogram of the image block outside the flat area is greater than the clipping threshold corresponding to the histogram of the image block in the flat area, so the stretching degree of the non-flat area can be guaranteed. And image toning effect, it can also prevent the contrast and color stretching in flat areas, and ensure that each area gets the appropriate contrast stretching.
可选的,所述方法还包括:根据所述图像块的直方图确定所述图像块的信 息熵和/或所述图像块中像素值的分布参数;根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。从而可以实现不同图像块的裁剪阈值的自适应调整。Optionally, the method further includes: determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block; Or the distribution parameters of the pixel values in the image block, and determine the clipping threshold corresponding to the histogram. Therefore, the adaptive adjustment of the clipping thresholds of different image blocks can be realized.
可选的,所述裁剪阈值与所述图像块的信息熵正相关,可以提高对信息熵较大的图像块的对比度和颜色的拉伸,图像调色效果更明显,降低对信息熵较小的图像块的对比度和颜色的拉伸,防止拉伸过度。Optionally, the cropping threshold is positively correlated with the information entropy of the image block, which can improve the contrast and color stretching of the image block with larger information entropy, and the effect of image toning is more obvious, and reduces the impact on image blocks with smaller information entropy. The contrast and color stretching of image blocks prevents excessive stretching.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关。可以根据图像块中像素值的离散程度调整所述图像块的直方图对应的裁剪阈值,离散程度较高的图像块可以进行较多的拉伸。Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation. The clipping threshold corresponding to the histogram of the image block may be adjusted according to the degree of dispersion of pixel values in the image block, and image blocks with a higher degree of dispersion may be more stretched.
可选的,所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。图像块中像素值的均值较低的图像块可以进行较多的拉伸。Optionally, the distribution parameter of pixel values in the image includes an average value of pixel values in the image block, and the clipping threshold is negatively correlated with the average value. An image block with a lower average value of pixel values in the image block can be more stretched.
可选的,可以将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。Optionally, the quotient of the standard deviation and the mean value of the pixel values in the image block may be multiplied by a preset weight coefficient and added to the information entropy of the image block to obtain the clipping threshold corresponding to the histogram.
举例而言,所述图像块的直方图对应的裁剪阈值ClipLimit可以根据下式确定:For example, the clipping threshold ClipLimit corresponding to the histogram of the image block can be determined according to the following formula:
Figure PCTCN2021095871-appb-000002
Figure PCTCN2021095871-appb-000002
其中,σ表示所述图像块中像素值的标准差,μ表示所述图像块中像素值的均值,σ与μ的商可以用于指示所述图像块的图像动态范围,α表示预设系数,用于调节所述图像块的信息熵和所述图像动态范围的权重,举例而言,α的值为1至5,例如为3。Among them, σ represents the standard deviation of the pixel values in the image block, μ represents the mean value of the pixel values in the image block, the quotient of σ and μ can be used to indicate the image dynamic range of the image block, and α represents the preset coefficient , used to adjust the weight of the information entropy of the image block and the dynamic range of the image, for example, the value of α is 1 to 5, such as 3.
如图9所示为所述待处理图像中不同图像块的直方图对应的裁剪阈值的示意图,细节越丰富的图像块对应的裁剪阈值越高。FIG. 9 is a schematic diagram of clipping thresholds corresponding to the histograms of different image blocks in the image to be processed, and image blocks with richer details have higher clipping thresholds.
可选的,所述方法还包括:对相邻图像块的直方图对应的裁剪阈值进行平滑处理。举例而言,可以通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理,当然也不限于此。防止相邻图像块的裁剪阈值相差较大时处理后的图像出现一定的块效应。Optionally, the method further includes: smoothing the clipping thresholds corresponding to the histograms of adjacent image blocks. For example, the clipping thresholds corresponding to the histograms of adjacent image blocks may be smoothed by mean filtering, but of course it is not limited thereto. Prevent certain block effects in the processed image when the clipping thresholds of adjacent image blocks differ greatly.
根据裁剪后的直方图可以确定对应图像块的映射函数,根据所述待处理图像中每个图像的映射函数,可以确定所述待处理图像处理后的图像。可选的,所述根据所述图像块对应的映射函数,确定所述图像块的目标图像,包括:根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;确定与所述图像块的非中心像素邻近的预设数目的图像块;根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。通过插值处理,可以降低图像处理的运算量。The mapping function of the corresponding image block can be determined according to the clipped histogram, and the processed image of the image to be processed can be determined according to the mapping function of each image in the image to be processed. Optionally, the determining the target image of the image block according to the mapping function corresponding to the image block includes: determining the equalized pixel of the central pixel of the image block according to the mapping function corresponding to the image block value; determine the preset number of image blocks adjacent to the non-central pixel of the image block; determine the preset number of pixels corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks value; performing interpolation processing on the preset number of pixel values to obtain the equalized pixel value of the non-central pixel. Through interpolation processing, the computational load of image processing can be reduced.
根据所述图像块的映射函数可以对所述图像块的中心像素进行直方图均衡化,通过对所述待处理图像中任一像素的局部邻域的映射函数进行插值可以确定所述待处理图像中任一像素的映射函数,以对除每个图像块的中心像素外的其余像素进行直方图均衡化。According to the mapping function of the image block, histogram equalization can be performed on the central pixel of the image block, and the image to be processed can be determined by interpolating the mapping function of the local neighborhood of any pixel in the image to be processed The mapping function of any pixel in the image to perform histogram equalization on the remaining pixels except the central pixel of each image block.
请参阅图10,每个所述图像块的中心像素11均衡处理后的像素值根据所述中心像素11的像素值和所述图像块的映射函数确定;与非中心像素12邻近的图像块包括四个,可以根据所述非中心像素12的像素值和与非中心像素12邻近的图像块对应的四个映射函数确定四个像素值,对所述四个像素值进行双线性插值可以确定所述非中心像素12均衡处理后的像素值;所述待处理图像边缘且不在四个角的图像块中的非中心像素13邻近的图像块包括两个,可以根据所述非中心像素13的像素值和与非中心像素13邻近的图像块对应的两个映射函数确定两个像素值,对所述两个个像素值进行线性插值可以确定所述非中心像素13均衡处理后的像素值;位于所述待处理图像四个角的图像块中的非中心像素14邻近的图像块包括一个,即与所述非中心像素14对角线相邻的图像块,根据所述非中心像素14的像素值和所述图像块对应的映射函数可以确定所述非中心像素14均衡处理后的像素值。Referring to Fig. 10, the pixel value after equalization processing of the central pixel 11 of each image block is determined according to the pixel value of the central pixel 11 and the mapping function of the image block; the image blocks adjacent to the non-central pixel 12 include Four, four pixel values can be determined according to the pixel values of the non-central pixel 12 and the four mapping functions corresponding to the image blocks adjacent to the non-central pixel 12, and bilinear interpolation can be performed on the four pixel values to determine The non-central pixel 12 equalizes the pixel value after processing; the image block adjacent to the non-central pixel 13 in the image block at the edge of the image to be processed and not in the four corners includes two, which can be based on the non-central pixel 13 The pixel value and the two mapping functions corresponding to the image blocks adjacent to the non-central pixel 13 determine two pixel values, and performing linear interpolation on the two pixel values can determine the equalized pixel value of the non-central pixel 13; The image blocks adjacent to the non-central pixel 14 in the image blocks at the four corners of the image to be processed include one, that is, the image block diagonally adjacent to the non-central pixel 14, according to the non-central pixel 14 The pixel value and the mapping function corresponding to the image block can determine the equalized pixel value of the non-central pixel 14 .
根据所有图像块均衡处理后的目标图像,可以得到所述待处理图像处理后的图像。示例性的,对所述待处理图像的亮度分量进行图像处理,以及对所述待处理图像的饱和度分量进行图像处理,根据图像处理后的亮度分量和饱和度分量进行色彩空间变化,得到RGB色彩空间的图像,得到曝光、对比度,色彩校正后的图像。分别对S(饱和度)和L(亮度)通道进行直方图均衡操作,来 分别实现图像色彩和对比度的调整。A processed image of the image to be processed can be obtained according to the target image after equalization processing of all image blocks. Exemplarily, image processing is performed on the brightness component of the image to be processed, and image processing is performed on the saturation component of the image to be processed, and the color space is changed according to the brightness component and saturation component after image processing to obtain RGB Image in color space, get exposure, contrast, color corrected image. Perform histogram equalization operations on the S (saturation) and L (brightness) channels respectively to adjust the image color and contrast.
可选的,将所述待处理图像的亮度分量和饱和度分量都映射成[0,255]的区间的整数,然后进行直方图均衡处理,将直方图均衡处理后的亮度分量和饱和度分量重新归一化为[0,1]的区间的浮点数。Optionally, both the brightness component and the saturation component of the image to be processed are mapped to an integer in the interval [0, 255], and then histogram equalization processing is performed, and the brightness component and saturation component after the histogram equalization processing are A float renormalized to the interval [0, 1].
本申请实施例提供的图像处理方法,通过把信息熵之和小于或等于预设门限的相邻图像块作为一类,即平坦区域,实现将图像中的图像块进行更智能的归类,防止将不同的物体划分在同一区域中,然后根据平坦区域的直方图对这类有一定相似性的图像块进行处理,对平坦区域中的图像块拉伸更均匀,防止畸变,可以降低图像失真,处理效果更好。The image processing method provided by the embodiment of the present application realizes more intelligent classification of the image blocks in the image by taking the adjacent image blocks whose sum of information entropy is less than or equal to the preset threshold as a class, that is, the flat area, to prevent Divide different objects in the same area, and then process such image blocks with certain similarities according to the histogram of the flat area, stretch the image blocks in the flat area more evenly, prevent distortion, and reduce image distortion. Handling is better.
在一些实施方式中,所述图像处理方法可以实现提供简易快捷的图像智能调色,只需要很简单的交互就能快速的生成一级调色效果。例如只需要用户用点击一下调色按钮,就能直接将画面的曝光、色彩校正至一个正常水准,实现画质的一键调整,达到基本满意的效果。该方法不仅可以快速处理图像,也可以适用于高清视频的实时处理。示例性的所述图像处理方法可以方便的配置到移动终端的编辑器APP上,能够实现高分辨率视频,如1080P视频的实时调色处理,使得用户能够随时随地,随心所欲的对图像或视频进行智能调色编辑。交互更简单,实现更方便,灵活性更强,大大降低用户的使用门槛。In some embodiments, the image processing method can provide simple and fast intelligent image color adjustment, and can quickly generate a primary color adjustment effect with only a very simple interaction. For example, the user only needs to click the color adjustment button to directly correct the exposure and color of the screen to a normal level, realize one-click adjustment of image quality, and achieve basically satisfactory results. This method can not only process images quickly, but also be suitable for real-time processing of high-definition video. The exemplary image processing method can be conveniently configured on the editor APP of the mobile terminal, and can realize high-resolution video, such as real-time grading processing of 1080P video, so that users can edit images or videos as they like anytime, anywhere. Smart color editing. The interaction is simpler, the implementation is more convenient, and the flexibility is stronger, which greatly reduces the user's threshold for use.
请参阅图11,图11是本说明书一实施例提供的图像处理设备400的示意性框图。该图像处理设备400包括一个或多个处理器401,单独地或共同地工作,用于执行前述实施例的图像处理方法的步骤。Please refer to FIG. 11 . FIG. 11 is a schematic block diagram of an image processing device 400 provided by an embodiment of this specification. The image processing device 400 includes one or more processors 401 working individually or jointly for executing the steps of the image processing method of the foregoing embodiments.
示例性的,图像处理设备例如包括图像信号处理器(Image Signal Processor,ISP)、数字信号处理器(Digital Signal Processor,DSP)、应用处理器(Application Processor,AP)中的至少一种,当然也不限于此,例如可以包括SoC(片上系统,System on Chip)芯片。需要说明的是,图像处理设备可以包括图像传感器,也可以不包括图像传感器。Exemplarily, the image processing device includes at least one of an image signal processor (Image Signal Processor, ISP), a digital signal processor (Digital Signal Processor, DSP), an application processor (Application Processor, AP), and of course Not limited thereto, for example, a SoC (System on Chip, System on Chip) chip may be included. It should be noted that the image processing device may or may not include an image sensor.
具体的,处理器401用于:Specifically, the processor 401 is used for:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像 块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,处理器401执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor 401 executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,处理器401执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor 401 executes the calculation of the histogram of the flat area, it is configured to:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,处理器401执行所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像时,用于执行:Optionally, when the processor 401 executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,处理器401执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor 401 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,处理器401执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor 401 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,处理器401还用于:Optionally, the processor 401 is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,处理器401执行根据所述图像块的直方图获取所述图像块的目标 图像时,用于执行:Optionally, when the processor 401 executes acquiring the target image of the image block according to the histogram of the image block, it is used to execute:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,处理器401还用于:Optionally, the processor 401 is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,处理器401执行所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor 401 determines the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,处理器401还用于:Optionally, the processor 401 is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,处理器401执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor 401 executes the smoothing processing on the clipping threshold corresponding to the histogram of the adjacent image block, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,处理器401执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor 401 executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,处理器401执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor 401 executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,处理器401执行所述获取待处理图像时,用于执行:Optionally, when the processor 401 executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
本说明书实施例提供的图像处理设备的具体原理和实现方式均与前述实施例的图像处理方法类似,此处不再赘述。The specific principle and implementation manner of the image processing device provided in the embodiment of this specification are similar to the image processing method in the foregoing embodiment, and will not be repeated here.
请参阅图12,图12是本说明书另一实施例提供的一种可移动平台500的示意性框图。可移动平台500可以包括无人飞行器、云台、无人车等中的至少一种。进一步而言,无人飞行器可以为旋翼型无人机,例如四旋翼无人机、六旋翼无人机、八旋翼无人机,也可以是固定翼无人机。可移动平台500上能够搭载拍摄装置510,拍摄装置510用于获取图像,可移动平台500能够处理拍摄装置510获取的图像。Please refer to FIG. 12 . FIG. 12 is a schematic block diagram of a mobile platform 500 provided in another embodiment of this specification. The mobile platform 500 may include at least one of an unmanned aerial vehicle, a cloud platform, an unmanned vehicle, and the like. Furthermore, the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone. The photographing device 510 can be mounted on the movable platform 500 , and the photographing device 510 is used to acquire images, and the movable platform 500 can process the images acquired by the photographing device 510 .
可移动平台500还包括一个或多个处理器501,一个或多个处理器501可单独地或共同地工作,用于执行前述实施例的图像处理方法的步骤。The mobile platform 500 also includes one or more processors 501, and the one or more processors 501 can work individually or jointly to execute the steps of the image processing method of the foregoing embodiments.
具体的,处理器501用于:Specifically, the processor 501 is used for:
获取待处理图像;Get the image to be processed;
将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
计算所述平坦区域的直方图;Computing a histogram of said flat area;
根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
可选的,处理器501执行所述确定所述待处理图像中的平坦区域时,用于执行:Optionally, when the processor 501 executes the determining the flat area in the image to be processed, it is configured to:
根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
可选的,处理器501执行所述计算所述平坦区域的直方图时,用于执行:Optionally, when the processor 501 executes the calculation of the histogram of the flat area, it is configured to:
对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
可选的,处理器501执行所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像时,用于执行:Optionally, when the processor 501 executes the acquisition of the target image of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
可选的,处理器501执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor 501 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
可选的,处理器501执行所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图时,用于执行:Optionally, when the processor 501 executes the determining the histogram of each image block in the flat area according to the histogram of the flat area, it is configured to:
根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
可选的,处理器501还用于:Optionally, the processor 501 is also used for:
计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
可选的,处理器501执行根据所述图像块的直方图获取所述图像块的目标图像时,用于执行:Optionally, when the processor 501 acquires the target image of the image block according to the histogram of the image block, it is configured to:
根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
可选的,至少有两个图像块的直方图对应的裁剪阈值不同。Optionally, the clipping thresholds corresponding to the histograms of at least two image blocks are different.
可选的,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。Optionally, the clipping threshold corresponding to the histogram of the image blocks outside the flat area is greater than the clipping threshold corresponding to the histogram of the image blocks in the flat area.
可选的,处理器501还用于:Optionally, the processor 501 is also used for:
根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
可选的,所述裁剪阈值与所述图像块的信息熵正相关。Optionally, the clipping threshold is positively correlated with the information entropy of the image block.
可选的,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或Optionally, the distribution parameter of pixel values in the image block includes a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and/or
所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
可选的,处理器501执行所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值时,用于执行:Optionally, when the processor 501 executes determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block, it is used to execute:
将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
可选的,处理器501还用于:Optionally, the processor 501 is also used for:
对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
可选的,处理器501执行所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理时,用于执行:Optionally, when the processor 501 executes the smoothing processing on the clipping threshold corresponding to the histogram of the adjacent image block, it is used to execute:
通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
可选的,处理器501执行所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理时,用于执行:Optionally, the processor 501 executes the clipping threshold corresponding to the histogram of the image block, and when clipping the histogram, executes:
确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
可选的,处理器501执行所述根据所述图像块对应的映射函数,确定所述图像块的目标图像时,用于执行:Optionally, when the processor 501 executes the mapping function corresponding to the image block to determine the target image of the image block, it is used to execute:
根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
可选的,处理器501执行所述获取待处理图像时,用于执行:Optionally, when the processor 501 executes the acquisition of the image to be processed, it is used to execute:
获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
可选的,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。Optionally, the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
本说明书实施例提供的可移动平台的具体原理和实现方式均与前述实施例的图像处理方法类似,此处不再赘述。The specific principles and implementations of the movable platform provided in the embodiments of this specification are similar to the image processing methods in the foregoing embodiments, and will not be repeated here.
请参阅图13,图13是本说明书另一实施例提供的图像处理系统600的示意性框图。Please refer to FIG. 13 . FIG. 13 is a schematic block diagram of an image processing system 600 provided in another embodiment of this specification.
图像处理系统600统例如包括终端设备、可移动平台、服务器中的至少一种。举例而言,终端设备可以包括手机、相机、摄影机、平板电脑、笔记本电脑、个人数字助理、穿戴式设备、遥控器等中的至少一项;可移动平台可以包括无人飞行器、云台、无人车等中的至少一种。进一步而言,无人飞行器可以 为旋翼型无人机,例如四旋翼无人机、六旋翼无人机、八旋翼无人机,也可以是固定翼无人机。示例性的,服务器可以为单独的服务器,也可以是服务器集群。The image processing system 600 includes, for example, at least one of a terminal device, a mobile platform, and a server. For example, a terminal device may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote control, etc.; At least one of people and vehicles. Furthermore, the unmanned aerial vehicle may be a rotor-type drone, such as a quad-rotor drone, a hexacopter drone, an octo-rotor drone, or a fixed-wing drone. Exemplarily, the server may be an individual server, or may be a server cluster.
图像处理系统600包括拍摄装置610和显示装置620,还包括一个或多个处理器601。在一些实施方式中,一个或多个处理器601可以搭载于拍摄装置610和/或显示装置620上。The image processing system 600 includes a photographing device 610 and a display device 620 , and also includes one or more processors 601 . In some implementations, one or more processors 601 may be mounted on the camera device 610 and/or the display device 620 .
一个或多个处理器601可单独地或共同地工作,用于执行前述实施例的图像处理方法的步骤,以对拍摄装置610获取的图像进行处理。显示装置620能够显示处理器601处理后的图像。One or more processors 601 may work individually or jointly to execute the steps of the image processing method of the foregoing embodiments, so as to process the image acquired by the photographing device 610 . The display device 620 can display the image processed by the processor 601 .
本说明书实施例提供的图像处理系统的具体原理和实现方式均与前述实施例的图像处理方法类似,此处不再赘述。The specific principles and implementations of the image processing system provided in the embodiments of this specification are similar to the image processing methods in the foregoing embodiments, and will not be repeated here.
请参阅图14,图14是本说明书另一实施例提供的终端设备700的示意性框图。Please refer to FIG. 14 , which is a schematic block diagram of a terminal device 700 provided in another embodiment of this specification.
终端设备700可以包括手机、相机、摄影机、平板电脑、笔记本电脑、个人数字助理、穿戴式设备、遥控器等中的至少一项。The terminal device 700 may include at least one of a mobile phone, a camera, a video camera, a tablet computer, a notebook computer, a personal digital assistant, a wearable device, a remote controller, and the like.
终端设备700包括一个或多个处理器701,一个或多个处理器701可单独地或共同地工作,用于执行前述实施例的图像处理方法的步骤。The terminal device 700 includes one or more processors 701, and the one or more processors 701 can work individually or jointly to execute the steps of the image processing method of the foregoing embodiments.
本说明书实施例提供的图像处理系统的具体原理和实现方式均与前述实施例的图像处理方法类似,此处不再赘述。The specific principles and implementations of the image processing system provided in the embodiments of this specification are similar to the image processing methods in the foregoing embodiments, and will not be repeated here.
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器实现上述实施例提供的图像处理方法的步骤。An embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the image processing method provided in the above-mentioned embodiment step.
其中,所述计算机可读存储介质可以是前述任一实施例所述的系统、设备或可移动平台的内部存储单元,例如所述可移动平台的硬盘或内存。所述计算机可读存储介质也可以是所述系统、设备或可移动平台的外部存储设备,例如所述可移动平台上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。Wherein, the computer-readable storage medium may be an internal storage unit of the system, device, or removable platform described in any of the foregoing embodiments, such as a hard disk or memory of the removable platform. The computer-readable storage medium can also be an external storage device of the system, device or removable platform, such as a plug-in hard disk equipped on the removable platform, a smart memory card (Smart Media Card, SMC), a security Digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.
应当理解,在此本申请中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。It should be understood that the terminology used in this application is for the purpose of describing particular embodiments only and is not intended to limit the application.
还应当理解,在本申请和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be understood that the term "and/or" used in this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the application, but the scope of protection of the application is not limited thereto. Any person familiar with the technical field can easily think of various equivalents within the scope of the technology disclosed in the application. Modifications or replacements, these modifications or replacements shall be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (24)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, characterized in that, comprising:
    获取待处理图像;Get the image to be processed;
    将所述待处理图像划分为多个图像块;dividing the image to be processed into a plurality of image blocks;
    确定所述待处理图像中的平坦区域,所述平坦区域包括至少两个所述图像块,且在所述平坦区域内,每个所述图像块存在至少一个与其相邻的所述图像块,所述平坦区域内全部所述图像块的信息熵之和小于或等于预设门限;determining a flat area in the image to be processed, the flat area includes at least two image blocks, and in the flat area, each image block has at least one adjacent image block, The sum of the information entropies of all the image blocks in the flat area is less than or equal to a preset threshold;
    计算所述平坦区域的直方图;Computing a histogram of said flat area;
    根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像。The target image of each image block in the flat area is acquired according to the histogram of the flat area.
  2. 根据权利要求1所述的图像处理方法,其特征在于,所述确定所述待处理图像中的平坦区域,包括:The image processing method according to claim 1, wherein said determining the flat area in the image to be processed comprises:
    根据所述待处理图像中每个图像块的直方图,确定每个图像块的信息熵;Determine the information entropy of each image block according to the histogram of each image block in the image to be processed;
    若至少两个相邻的图像块的信息熵之和小于或等于所述预设门限,确定所述至少两个相邻的图像块位于同一个平坦区域。If the sum of the information entropies of at least two adjacent image blocks is less than or equal to the preset threshold, it is determined that the at least two adjacent image blocks are located in the same flat area.
  3. 根据权利要求2所述的图像处理方法,其特征在于,所述计算所述平坦区域的直方图,包括:The image processing method according to claim 2, wherein said calculating the histogram of said flat region comprises:
    对所述平坦区域内每个图像块的直方图进行叠加,得到所述平坦区域的直方图。The histogram of each image block in the flat area is superimposed to obtain the histogram of the flat area.
  4. 根据权利要求1-3中任一项所述的图像处理方法,其特征在于,所述根据所述平坦区域的直方图获取所述平坦区域内每个图像块的目标图像,包括:The image processing method according to any one of claims 1-3, wherein said obtaining the target image of each image block in the flat area according to the histogram of the flat area comprises:
    根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图;determining the histogram of each image block in the flat area according to the histogram of the flat area;
    根据所述平坦区域内每个图像块的直方图,获取所述平坦区域内每个图像块的目标图像。According to the histogram of each image block in the flat area, the target image of each image block in the flat area is acquired.
  5. 根据权利要求4所述的图像处理方法,其特征在于,所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图,包括:The image processing method according to claim 4, wherein said determining the histogram of each image block in the flat area according to the histogram of the flat area comprises:
    将所述平坦区域的直方图作为所述平坦区域内每个图像块的直方图。The histogram of the flat area is used as the histogram of each image block in the flat area.
  6. 根据权利要求4所述的图像处理方法,其特征在于,所述根据所述平坦区域的直方图确定所述平坦区域内每个图像块的直方图,包括:The image processing method according to claim 4, wherein said determining the histogram of each image block in the flat area according to the histogram of the flat area comprises:
    根据所述平坦区域中图像块的数目,对所述平坦区域的直方图进行划分,得到所述平坦区域内每个图像块的直方图。According to the number of image blocks in the flat area, the histogram of the flat area is divided to obtain the histogram of each image block in the flat area.
  7. 根据权利要求4所述的图像处理方法,其特征在于,所述方法还包括:The image processing method according to claim 4, wherein the method further comprises:
    计算所述待处理图像中所述平坦区域之外每个图像块的直方图;calculating the histogram of each image block outside the flat area in the image to be processed;
    根据所述平坦区域之外每个图像块的直方图,获取所述平坦区域之外每个图像块的目标图像。According to the histogram of each image block outside the flat area, the target image of each image block outside the flat area is acquired.
  8. 根据权利要求4-7中任一项所述的图像处理方法,其特征在于,根据所述图像块的直方图获取所述图像块的目标图像,包括:The image processing method according to any one of claims 4-7, wherein acquiring the target image of the image block according to the histogram of the image block comprises:
    根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理;performing clipping processing on the histogram according to the clipping threshold corresponding to the histogram of the image block;
    对裁剪处理后的直方图进行均衡处理,得到所述图像块对应的映射函数;performing equalization processing on the cropped histogram to obtain a mapping function corresponding to the image block;
    根据所述图像块对应的映射函数,确定所述图像块的目标图像。The target image of the image block is determined according to the mapping function corresponding to the image block.
  9. 根据权利要求8所述的图像处理方法,其特征在于,至少有两个图像块的直方图对应的裁剪阈值不同。The image processing method according to claim 8, wherein the clipping thresholds corresponding to the histograms of at least two image blocks are different.
  10. 根据权利要求9所述的图像处理方法,其特征在于,所述平坦区域之外的图像块的直方图对应的裁剪阈值大于所述平坦区域中的图像块的直方图对应的裁剪阈值。The image processing method according to claim 9, wherein the clipping threshold corresponding to the histogram of the image block outside the flat area is greater than the clipping threshold corresponding to the histogram of the image block in the flat area.
  11. 根据权利要求8-10中任一项所述的图像处理方法,其特征在于,所述方法还包括:The image processing method according to any one of claims 8-10, wherein the method further comprises:
    根据所述图像块的直方图确定所述图像块的信息熵和/或所述图像块中像素值的分布参数;determining information entropy of the image block and/or distribution parameters of pixel values in the image block according to the histogram of the image block;
    根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值。A clipping threshold corresponding to the histogram is determined according to information entropy of the image block and/or a distribution parameter of pixel values in the image block.
  12. 根据权利要求11所述的图像处理方法,其特征在于,所述裁剪阈值与所述图像块的信息熵正相关。The image processing method according to claim 11, wherein the clipping threshold is positively correlated with the information entropy of the image block.
  13. 根据权利要求11所述的图像处理方法,其特征在于,所述图像块中像素值的分布参数包括所述图像块中像素值的标准差,所述裁剪阈值与所述标准差正相关;和/或The image processing method according to claim 11, wherein the distribution parameter of pixel values in the image block comprises a standard deviation of pixel values in the image block, and the clipping threshold is positively correlated with the standard deviation; and /or
    所述图像中像素值的分布参数包括所述图像块中像素值的均值,所述裁剪阈值与所述均值负相关。The distribution parameters of the pixel values in the image include the mean value of the pixel values in the image block, and the clipping threshold is negatively correlated with the mean value.
  14. 根据权利要求11所述的图像处理方法,其特征在于,所述根据所述图像块的信息熵和/或所述图像块中像素值的分布参数,确定所述直方图对应的裁剪阈值,包括:The image processing method according to claim 11, wherein the determining the clipping threshold corresponding to the histogram according to the information entropy of the image block and/or the distribution parameters of the pixel values in the image block includes :
    将所述图像块中像素值的标准差与均值之商,乘以预设的权重系数,并加上所述图像块的信息熵,得到所述直方图对应的裁剪阈值。The quotient of the standard deviation and the mean value of the pixel values in the image block is multiplied by a preset weight coefficient, and the information entropy of the image block is added to obtain the clipping threshold corresponding to the histogram.
  15. 根据权利要求8-14中任一项所述的图像处理方法,其特征在于,所述方法还包括:The image processing method according to any one of claims 8-14, wherein the method further comprises:
    对相邻图像块的直方图对应的裁剪阈值进行平滑处理。Smooth the clipping thresholds corresponding to the histograms of adjacent image blocks.
  16. 根据权利要求15所述的图像处理方法,其特征在于,所述对相邻图像块的直方图对应的裁剪阈值进行平滑处理,包括:The image processing method according to claim 15, wherein said smoothing the clipping thresholds corresponding to the histograms of adjacent image blocks comprises:
    通过均值滤波,对相邻图像块的直方图对应的裁剪阈值进行平滑处理。The clipping thresholds corresponding to the histograms of adjacent image blocks are smoothed by mean filtering.
  17. 根据权利要求8-16中任一项所述的图像处理方法,其特征在于,所述根据所述图像块的直方图对应的裁剪阈值,对所述直方图进行裁剪处理,包括:The image processing method according to any one of claims 8-16, wherein the clipping processing of the histogram according to the clipping threshold corresponding to the histogram of the image block includes:
    确定所述图像块的直方图中幅值高于所述裁剪阈值的面积;determining an area in the histogram of the image block whose magnitude is higher than the clipping threshold;
    根据所述面积与所述直方图横向宽度之商,确定所述直方图中幅值的上升高度;determining the rising height of the amplitude in the histogram according to the quotient of the area and the horizontal width of the histogram;
    若所述直方图中的幅值低于所述裁剪阈值与所述上升高度之差,根据所述上升高度增加所述幅值;和/或,若所述直方图中的幅值高于所述裁剪阈值与所述上升高度之差,将所述幅值置为所述裁剪阈值。If the magnitude in the histogram is lower than the difference between the clipping threshold and the rise height, increase the magnitude according to the rise height; and/or, if the magnitude in the histogram is higher than the The difference between the clipping threshold and the rising height, and set the amplitude as the clipping threshold.
  18. 根据权利要求8-16中任一项所述的图像处理方法,其特征在于,所述根据所述图像块对应的映射函数,确定所述图像块的目标图像,包括:The image processing method according to any one of claims 8-16, wherein the determining the target image of the image block according to the mapping function corresponding to the image block includes:
    根据所述图像块对应的映射函数,确定所述图像块的中心像素均衡处理后的像素值;Determine the equalized pixel value of the center pixel of the image block according to the mapping function corresponding to the image block;
    确定与所述图像块的非中心像素邻近的预设数目的图像块;determining a preset number of image blocks adjacent to non-central pixels of the image block;
    根据所述预设数目的图像块对应的映射函数,确定所述非中心像素对应的所述预设数目个像素值;determining the preset number of pixel values corresponding to the non-central pixel according to the mapping function corresponding to the preset number of image blocks;
    对所述预设数目个像素值进行插值处理,得到所述非中心像素均衡处理后的像素值。Interpolation processing is performed on the preset number of pixel values to obtain the equalized pixel values of the non-central pixels.
  19. 根据权利要求1-18中任一项所述的图像处理方法,其特征在于,所述 获取待处理图像,包括:The image processing method according to any one of claims 1-18, wherein said acquiring the image to be processed comprises:
    获取HSL域的待处理图像或HSV域的待处理图像。Get the image to be processed in the HSL domain or the image to be processed in the HSV domain.
  20. 根据权利要求19所述的图像处理方法,其特征在于,所述图像处理方法对所述待处理图像的以下至少一种分量进行处理:饱和度分量、亮度分量。The image processing method according to claim 19, characterized in that the image processing method processes at least one of the following components of the image to be processed: a saturation component and a brightness component.
  21. 一种图像处理设备,其特征在于,包括一个或多个处理器,单独地或共同地工作,用于执行如权利要求1-20中任一项所述的图像处理方法的步骤。An image processing device, characterized by comprising one or more processors working individually or jointly to execute the steps of the image processing method according to any one of claims 1-20.
  22. 一种终端设备,其特征在于,包括一个或多个处理器,单独地或共同地工作,用于执行如权利要求1-20中任一项所述的图像处理方法的步骤。A terminal device, characterized by comprising one or more processors working individually or jointly to execute the steps of the image processing method according to any one of claims 1-20.
  23. 一种图像处理系统,其特征在于,包括拍摄装置和显示装置;An image processing system, characterized in that it includes a photographing device and a display device;
    还包括一个或多个处理器,单独地或共同地工作,用于执行如权利要求1-20中任一项所述的图像处理方法的步骤,以对所述拍摄装置获取的图像进行处理;It also includes one or more processors, working individually or jointly, for executing the steps of the image processing method according to any one of claims 1-20, so as to process the image acquired by the shooting device;
    所述显示装置能够显示所述处理器处理后的图像。The display device can display the image processed by the processor.
  24. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器实现如权利要求1-20中任一项所述的图像处理方法。A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements any one of claims 1-20. The image processing method described above.
PCT/CN2021/095871 2021-05-25 2021-05-25 Image processing method, device and system, and storage medium WO2022246663A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/095871 WO2022246663A1 (en) 2021-05-25 2021-05-25 Image processing method, device and system, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/095871 WO2022246663A1 (en) 2021-05-25 2021-05-25 Image processing method, device and system, and storage medium

Publications (1)

Publication Number Publication Date
WO2022246663A1 true WO2022246663A1 (en) 2022-12-01

Family

ID=84229301

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/095871 WO2022246663A1 (en) 2021-05-25 2021-05-25 Image processing method, device and system, and storage medium

Country Status (1)

Country Link
WO (1) WO2022246663A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110157247A1 (en) * 2009-12-25 2011-06-30 Hitachi Consumer Electronics Co., Ltd. Display Apparatus and Control Circuit of the Same
CN107330863A (en) * 2017-05-27 2017-11-07 浙江大学 A kind of image de-noising method estimated based on noise
CN109003249A (en) * 2017-06-07 2018-12-14 展讯通信(天津)有限公司 Enhance the method, apparatus and terminal of image detail
CN110807750A (en) * 2019-11-14 2020-02-18 青岛海信电器股份有限公司 Image processing method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110157247A1 (en) * 2009-12-25 2011-06-30 Hitachi Consumer Electronics Co., Ltd. Display Apparatus and Control Circuit of the Same
CN107330863A (en) * 2017-05-27 2017-11-07 浙江大学 A kind of image de-noising method estimated based on noise
CN109003249A (en) * 2017-06-07 2018-12-14 展讯通信(天津)有限公司 Enhance the method, apparatus and terminal of image detail
CN110807750A (en) * 2019-11-14 2020-02-18 青岛海信电器股份有限公司 Image processing method and apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANG XUEDIAN, YANG FAN; CHANG MIN: "Image Enhancement Algorithm Based on Entropy Statistical Histogram of Image Information", BAOZHUANG GONGCHENG - PACKAGING ENGINEERING, ZHONGGUO BINGQI GONGYE DI-59 YANJIUSUO, CN, vol. 41, no. 13, 15 July 2020 (2020-07-15), CN , pages 251 - 260, XP093008472, ISSN: 1001-3563, DOI: 10.19554/j.cnki.1001-3563.2020.13.036 *

Similar Documents

Publication Publication Date Title
US9767544B2 (en) Scene adaptive brightness/contrast enhancement
WO2018082185A1 (en) Image processing method and device
CN106780311B (en) Rapid face image beautifying method combining skin roughness
US8723982B2 (en) Image processing device, storage medium, and image processing method that corrects saturation, specific color and spatial frequency of an obtained image
JP4870617B2 (en) Image data automatic mapping method and image processing device
US9842382B2 (en) Method and device for removing haze in single image
WO2020125631A1 (en) Video compression method and apparatus, and computer-readable storage medium
TWI473039B (en) Method and image processing device for image dynamic range compression with local contrast enhancement
CN105915909B (en) A kind of high dynamic range images layered compression method
US8970746B2 (en) Image processing device, storage medium, and image processing method for correcting an image
US20100278423A1 (en) Methods and systems for contrast enhancement
US20160335750A1 (en) Adaptive contrast in image processing and display
JP2007310887A (en) Automatic mapping method of image data, and image processing device
KR20180048627A (en) Method and apparatus for reverse tone mapping
CN106570838A (en) Image brightness optimization method and device
US20130329135A1 (en) Real time denoising of video
US8331695B1 (en) Integrated circuit having a circuit for and method of updating parameters associated with a background estimation portion of a video frame
WO2021128498A1 (en) Image adaptive noise reduction method and apparatus
WO2018100950A1 (en) Image processing device, digital camera, image processing program, and recording medium
CN112788322B (en) Adaptive white balance processing method, device, medium, and electronic apparatus
CN114998122A (en) Low-illumination image enhancement method
CN111476744A (en) Underwater image enhancement method based on classification and atmospheric imaging model
US8351724B2 (en) Blue sky color detection technique
US11082613B2 (en) Image adjusting method and image adjusting device
JP5327766B2 (en) Memory color correction in digital images

Legal Events

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

Ref document number: 21942247

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE