Filter processing method and device

By obtaining the color average value and grayscale histogram of the reference picture, extracting the dark and bright areas for filter processing, the problem that the image filter processing in the prior art does not meet user needs is solved, and the adaptive adjustment of the filter effect and the consistency of the visual effect is achieved.

CN114648459BActive Publication Date: 2025-07-25GAODING XIAMEN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210307112.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2025-07-25
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

In the prior art, image processing software cannot perform image filter processing according to user needs, resulting in inconsistent picture style and background after processing, affecting visual effects.

Method used

By obtaining the color average value and grayscale histogram in the specified area of the reference picture, filtering the picture to be processed, dark and bright areas are extracted, and transparency and color values are mixed, and brightness parameters are adjusted to achieve adaptive changes in the filter effect.

Benefits of technology

The consistency between the pictures and reference pictures after filter processing is achieved in terms of brightness, contrast, etc., improve processing efficiency, enhance the fusion effect between the pictures and the background, and improve the overall visual effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648459B_ABST
    Figure CN114648459B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a filter processing method and apparatus, belonging to the technical field of image processing, and solving the problem in the prior art that image filter processing cannot be performed according to user requirements. The method includes: obtaining a reference picture and a picture to be processed; performing filter processing on the picture to be processed according to the average color value in a specified area of the reference picture and the grayscale histogram of the reference picture, so as to obtain a result picture after filter processing. The embodiment of the present invention is applicable to performing filter effect processing on pictures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly to a filter processing method and apparatus. Background Art

[0002] Currently, most image processing software provides the function of picture filters, generally by providing pre-set filter templates, such as warm color filters, cold color filters, vintage filters, black and white filters, etc. Users can determine the filter effects they want by selecting different filter templates. However, the current filter functions generally produce similar effects when applied to different pictures, and users can only process pictures using the filter effects provided by the filter templates, and cannot perform targeted filter processing according to their own needs. Summary of the Invention

[0003] The purpose of the embodiments of the present invention is to provide a filter processing method and apparatus, which solve the problem in the prior art that image filter processing cannot be performed according to user needs, and realize that the filter effect of an image can be adaptively changed according to the style and effect of a reference picture provided by the user.

[0004] To achieve the above purpose, the embodiments of the present invention provide a filter processing method, which includes: obtaining a reference picture and a picture to be processed; performing filter processing on the picture to be processed according to the color average value in a specified area of the reference picture and the grayscale histogram of the reference picture to obtain a result picture after filter processing.

[0005] Further, the specified area in the reference picture includes a first specified area and a second specified area, where the first specified area is the area where the grayscale values are distributed in the first percentile in the grayscale map corresponding to the reference picture, and the second specified area is the area where the grayscale values are distributed in the second percentile in the grayscale map corresponding to the reference picture; the color average value includes a first color value corresponding to the first specified area and a second color value corresponding to the second specified area.

[0006] Further, the color average value is the quotient of the RGB sum of all pixels in the specified area in the RGB color space and the total number of pixels in this area.

[0007] Further, the filter processing of the image to be processed according to the average color value in the specified area of the reference image and the grayscale histogram of the reference image to obtain the filtered result image includes: extracting the dark area and the bright area in the image to be processed according to the specified area of the reference image; using the first color value and the grayscale value of the grayscale image corresponding to the dark area to perform filter processing on the dark area in the image to be processed to obtain a first intermediate image; using the second color value and the grayscale value of the grayscale image corresponding to the bright area to perform filter processing on the first intermediate image to obtain a second intermediate image; obtaining the brightness parameter of the second intermediate image according to the grayscale histogram of the second intermediate image and the grayscale histogram of the reference image; and assigning the brightness parameter to the brightness value in the LAB color space corresponding to the second intermediate image to obtain the filtered result image.

[0008] Further, the extracting the dark area and the bright area in the image to be processed according to the specified area of the reference image includes: taking the area where the grayscale values in the grayscale image corresponding to the image to be processed are distributed in the first front percentile as the dark area; and taking the area where the grayscale values in the grayscale image corresponding to the image to be processed are distributed in the second back percentile as the bright area.

[0009] Further, the using the first color value and the grayscale value of the grayscale image corresponding to the dark area to perform filter processing on the dark area in the image to be processed to obtain a first intermediate image includes: inverting the grayscale value of each pixel in the grayscale image corresponding to the dark area, converting the inverted grayscale value into an alpha value, and setting the alpha values in the areas outside the dark area to zero to obtain the first alpha channel value of the image to be processed; and performing superposition and alpha channel mixing processing on the RGB color space values of the image to be processed according to the first color value and the first alpha channel value to obtain a first intermediate image.

[0010] Further, the performing superposition and alpha channel mixing processing on the RGB color space values of the image to be processed according to the first color value and the first alpha channel value to obtain a first intermediate image includes: performing normalization processing on the first color value and the RGB color space values of the image to be processed respectively; according to obtaining the color value of the i-th channel of the j-th pixel of the first intermediate image where, colour1 i is the color value of the i-th channel of the first color value after normalization processing, alpha1 jis the first transparency channel value of the j-th pixel, is the i-th channel color value of the j-th pixel of the image to be processed after normalization, where i is the R, G, or B channel.

[0011] Further, the step of using the second color value and the gray value of the grayscale image corresponding to the bright region to perform a filter process on the first transitional image to obtain a second transitional image includes: converting the gray value of the grayscale image corresponding to the bright region into a transparency value, and setting the transparency values in the regions outside the bright region to zero to obtain the second transparency channel value of the image to be processed; performing superposition and transparency channel mixing processing on the RGB color space values of the first transitional image according to the second color value and the second transparency channel value to obtain the second transitional image.

[0012] Further, the step of performing superposition and transparency channel mixing processing on the RGB color space values of the first transitional image according to the second color value and the second transparency channel value to obtain the second transitional image includes: performing normalization processing on the second color value and the RGB color space values of the first transitional image respectively; according to to obtain the i-th channel color value of the j-th pixel of the second transitional image where, colour2 i is the i-th channel color value of the second color value after normalization, alpha2 j is the second transparency channel value of the j-th pixel, is the i-th channel color value of the j-th pixel of the first transitional image after normalization, where i is the R, G, or B channel.

[0013] Further, the step of obtaining the brightness parameter of the second transitional image according to the gray histogram of the second transitional image and the gray histogram of the reference image includes:

[0014] Obtaining the mean and standard deviation of the gray histogram of the second transitional image, and the mean and standard deviation of the gray histogram of the reference image; according to img2_L j =(img2_gray j -img2_gray_mean)×(ref_gray_std÷img2_gray_std)+ref_gray_mean, to obtain the brightness parameter img2_L of the j-th pixel of the second transitional image j , where, img2_gray jis the grayscale value of the j-th pixel of the second transition picture, img2_gray_mean is the mean of the grayscale histogram of the second transition picture, img2_gray_std is the standard deviation of the grayscale histogram of the second transition picture, ref_gray_std is the standard deviation of the grayscale histogram of the reference picture, and ref_gray_mean is the mean of the grayscale histogram of the reference picture.

[0015] Correspondingly, an embodiment of the present invention further provides a filter processing device, including: an acquisition module for acquiring a reference picture and a picture to be processed; a filter module for performing filter processing on the picture to be processed according to the average color value in a specified area of the reference picture and the grayscale histogram of the reference picture to obtain a filtered result picture.

[0016] In addition, an embodiment of the present invention further provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to cause a machine to execute the filter processing method described in the above embodiment.

[0017] Through the above technical solution, filter processing is performed on the picture to be processed according to the average color value in the specified area of the acquired reference picture and the grayscale histogram of the reference picture to obtain a filtered result picture. The embodiment of the present invention solves the problem in the prior art that picture filter processing cannot be performed according to user requirements, and realizes that the filter effect of the picture can be adaptively changed according to the style and effect of the reference picture provided by the user.

[0018] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent specific implementation part. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification, and are used to explain the embodiments of the present invention together with the following specific implementation manners, but do not constitute a limitation to the embodiments of the present invention. In the drawings:

[0020] Figure 1 is a schematic flowchart of a filter processing method provided by an embodiment of the present invention;

[0021] Figure 2 is an example grayscale diagram of a reference picture provided by an embodiment of the present invention;

[0022] Figure 3 is an example dark area diagram of a reference picture provided by an embodiment of the present invention;

[0023] Figure 4 is an example bright area diagram of a reference picture provided by an embodiment of the present invention;

[0024] Figure 5 It is a schematic flowchart of the filter processing for the picture to be processed provided by the embodiment of the present invention;

[0025] Figure 6 It is an example diagram of the grayscale image of the picture to be processed provided by the embodiment of the present invention;

[0026] Figure 7 It is an example diagram of the dark area of the picture to be processed provided by the embodiment of the present invention;

[0027] Figure 8 It is an example diagram of the bright area of the picture to be processed provided by the embodiment of the present invention;

[0028] Figure 9 It is a schematic structural diagram of a filter processing device provided by the embodiment of the present invention. Detailed implementation manners

[0029] The following will describe in detail the specific implementation manners of the embodiments of the present invention with reference to the accompanying drawings. It should be understood that the specific implementation manners described herein are only used to illustrate and explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention.

[0030] In the filter processing in the prior art, it generally depends on a preset filter template for processing. However, when a user wants to perform filter processing on a local picture according to the style of a certain reference picture, it is often necessary to switch different filter templates, view the processing effects, and select a style similar to the reference picture from them. In fact, a result similar to the style of the reference picture cannot be obtained, which not only wastes time but also cannot obtain a good visual effect. Especially when the picture to be processed is to be put into an advertising poster, even if the picture to be processed is processed through a filter template, due to the inconsistent style between the processed picture and the background of the poster, the fusion effect between the picture and the background is not good, giving a feeling of abruptness, seriously affecting the overall visual effect of the advertising poster. Therefore, in the embodiment of the present invention, a method is proposed to perform filter processing on the picture to be processed according to the reference picture provided by the user, so that the picture after filter processing can be consistent with the reference picture in terms of brightness, contrast, etc., further meeting the user's requirements and improving the processing efficiency.

[0031] Figure 1 It is a schematic flowchart of a filter processing method provided by the embodiment of the present invention. As Figure 1 shown, the method includes the following steps:

[0032] Step 101, obtain a reference picture and a picture to be processed;

[0033] Step 102: Perform filter processing on the image to be processed according to the color average value in the specified area of the reference image and the grayscale histogram of the reference image, and obtain the result image after filter processing.

[0034] Among them, the specified area in the reference image includes a first specified area and a second specified area. The first specified area is the area where the grayscale values are distributed in the first percentile in the grayscale image corresponding to the reference image. For example, the area where the grayscale values are distributed in the first 20% percentile is the first specified area, which can also be called the dark area. The second specified area is the area where the grayscale values are distributed in the second percentile in the grayscale image corresponding to the reference image. For example, the area where the grayscale values are distributed in the last 70% percentile is the second specified area, which can also be called the bright area. The color average value includes a first color value corresponding to the first specified area and a second color value corresponding to the second specified area. That is, the quotient of the sum of the RGB values of all pixels in the dark area of the reference image in the RGB color space and the total number of pixels in this area is the first color value corresponding to the dark area of the reference image. Similarly, the quotient of the sum of the RGB values of all pixels in the bright area of the reference image in the RGB color space and the total number of pixels in this area is the second color value corresponding to the bright area of the reference image. The above-mentioned first percentile and second percentile can be set according to specific actual needs, and are only provided as examples in the embodiments of the present invention.

[0035] In the embodiments of the present invention, taking Figure 2 the grayscale image of the reference image shown as an example, among them, the first specified area of the reference image, that is, the dark area, is the white area shown as Figure 3 shown, and the second specified area of the reference image, that is, the bright area, is the white area shown as Figure 4 shown. By the above method, the areas where the pixels to be calculated are located are obtained. Then, by calculating the color average values of the dark area and the bright area of the reference image, the second color value and the second color value can be obtained.

[0036] The above step 102 is implemented through the following specific implementation manners. As Figure 5 shown, it includes the following steps:

[0037] Step 201: Extract the dark area and the bright area in the image to be processed according to the specified area of the reference image.

[0038] Among them, for the selection of the dark and bright regions of the to-be-processed image, refer to the selection of the specified region of the reference image. Among them, the region where the gray values in the grayscale image corresponding to the to-be-processed image are distributed in the first first percentile is used as the dark region. For example, when the first first percentile corresponding to the first specified region in the reference image is the first 20%, the first first percentile corresponding to the dark region of the to-be-processed image is also the first 20%. Similarly, the region where the gray values in the grayscale image corresponding to the to-be-processed image are distributed in the second second percentile is used as the bright region. When the second second percentile corresponding to the second specified region in the reference image is the last 70%, the second second percentile corresponding to the bright region of the to-be-processed image is also the last 70%. In the embodiments of the present invention, taking Figure 6 the grayscale image of the to-be-processed image shown as an example, among them, the dark region of the to-be-processed image is the white region shown as Figure 7 and the bright region of the to-be-processed image is the white region shown as Figure 8 shown.

[0039] Step 202, use the first color value and the gray values of the grayscale image corresponding to the dark region to perform a filter process on the dark region in the to-be-processed image to obtain a first transition image.

[0040] Among them, take the inverse of the gray value of each pixel in the grayscale image corresponding to the dark region, and convert the inverted gray value into a transparency value. At the same time, set the transparency values in the regions outside the dark region to zero to obtain the first transparency channel value of the to-be-processed image. Specifically, since the maximum gray value in the grayscale image is 255, subtract the gray value of each pixel in the grayscale image corresponding to the dark region from 255 to obtain the inverted gray value. Then, perform a normalization process on the inverted gray value, that is, take the quotient of the gray value of each pixel value in the dark region and 255 to obtain a transparency value with a value range of 0 to 1. In addition, set the transparency value of each pixel in the region outside the dark region to zero to obtain the first transparency channel value of the to-be-processed image with a value range of 0 to 1.

[0041] Then, according to the first color value and the first transparency channel value, perform superposition and transparency channel mixing processing on the RGB color space values of the image to be processed, to obtain a first transitional image. First, perform normalization processing on the first color value and the RGB color space values of the image to be processed respectively. Specifically, divide the RGB channel color values in the RGB color space of the first color value by 255 respectively, to obtain the normalized numerical range of the first color value from 0 to 1. Similarly, divide the RGB channel color values of each pixel in the image to be processed by 255 respectively, to obtain the RGB channel color values of each pixel in the image to be processed with the normalized numerical range from 0 to 1.

[0042] After that, according to the following formula (1), obtain the i-th channel color value of the j-th pixel of the first transitional image

[0043]

[0044] where, colour1 i is the i-th channel color value of the first color value after normalization processing, alpha1 j is the first transparency channel value of the j-th pixel, is the i-th channel color value of the j-th pixel of the image to be processed after normalization processing, and i is the R, G, B channels.

[0045] Step 203, use the second color value and the gray values of the grayscale image corresponding to the bright area to perform a filter process on the first transitional image, to obtain a second transitional image.

[0046] Among them, convert the gray values of the grayscale image corresponding to the bright area into transparency values, and set the transparency values in the areas outside the bright area to zero, to obtain the second transparency channel value of the image to be processed. Specifically, since the maximum gray value in the grayscale image is 255, perform normalization processing on the gray value of each pixel in the grayscale image corresponding to the bright area, that is, take the quotient of the gray value of each pixel in the bright area and 255, so as to obtain the transparency value with the numerical range from 0 to 1. In addition, set the transparency value of each pixel in the area outside the bright area to zero, so as to obtain the second transparency channel value of the image to be processed with the value range from 0 to 1.

[0047] Then, based on the second color value and the second transparency channel value, perform superposition and transparency channel mixing processing on the RGB color space values of the first transitional image to obtain a second transitional image. First, perform normalization processing on the second color value and the RGB color space values of the first transitional image respectively. Specifically, divide the RGB channel color values in the RGB color space of the second color value by 255 respectively to obtain a second color value with a normalized value range from 0 to 1. Similarly, divide the RGB channel color values of each pixel in the first transitional image by 255 respectively to obtain the RGB channel color values of each pixel in the first transitional image with a normalized value range from 0 to 1.

[0048] After that, according to formula (2), obtain the color value of the i-th channel of the j-th pixel of the second transitional image

[0049]

[0050] where, colour2 i is the color value of the i-th channel of the second color value after normalization processing, alpha2 j is the second transparency channel value of the j-th pixel, is the color value of the i-th channel of the j-th pixel of the first transitional image after normalization processing, and i is the R, G, B channels.

[0051] Step 204, obtain the brightness parameter of the second transitional image according to the grayscale histogram of the second transitional image and the grayscale histogram of the reference image.

[0052] Among them, obtain the mean and standard deviation of the grayscale histogram of the second transitional image, and the mean and standard deviation of the grayscale histogram of the reference image.

[0053] Then, according to the following formula (3), obtain the brightness parameter img2_L of the j-th pixel of the second transitional image j :

[0054] img2_L j =(ing2_gray j -img2_gray_mean)×(ref_gray_std÷img2_gray_std)+ref_gray_mean Formula (3)

[0055] where, img2_gray jis the gray value of the j-th pixel of the second transition picture, img2_gray_mean is the mean of the gray histogram of the second transition picture, img2_gray_std is the standard deviation of the gray histogram of the second transition picture, ref_gray_std is the standard deviation of the gray histogram of the reference picture, and ref_gray_mean is the mean of the gray histogram of the reference picture.

[0056] Step 205, assign the brightness parameter to the brightness value in the LAB color space corresponding to the second transition picture to obtain the result picture after filter processing.

[0057] Specifically, assign the brightness parameter corresponding to each pixel in the second transition picture obtained in step 204 to the brightness value in the LAB color space corresponding to the second transition picture, so as to obtain the result picture after filter processing corresponding to the picture to be processed.

[0058] Through the embodiments of the present invention, the filter effect can be realized based on the reference picture provided by the user, so that the picture to be processed can be adaptively processed according to the reference picture, and the picture after filtering can have information such as brightness, contrast, highlights, and shadows similar to those of the reference picture. In addition, without the user screening the filter template, the picture after filter processing can be better integrated into the target background, so that the overall visual effect of the entire picture is more unified.

[0059] Correspondingly, Figure 9 is a schematic structural diagram of a filter processing device provided by an embodiment of the present invention. As Figure 9 shown, the device 90 includes: an acquisition module 91, configured to acquire a reference picture and a picture to be processed; a filter module 92, configured to perform filter processing on the picture to be processed according to the color average value in the specified area of the reference picture and the gray histogram of the reference picture, and obtain a result picture after filter processing.

[0060] Wherein, the specified area in the reference picture includes a first specified area and a second specified area, wherein the first specified area is the area where the gray value distribution is in the first percentile in the gray picture corresponding to the reference picture, and the second specified area is the area where the gray value distribution is in the second percentile in the gray picture corresponding to the reference picture; the color average value includes a first color value corresponding to the first specified area and a second color value corresponding to the second specified area.

[0061] Further, the filter module 92 includes:

[0062] An area determination sub-module 21, configured to extract the dark area and the bright area in the picture to be processed according to the specified area of the reference picture;

[0063] The dark area processing sub-module 22 is used to perform a filter process on the dark area in the picture to be processed by using the first color value and the gray value of the gray scale map corresponding to the dark area, so as to obtain a first transition picture;

[0064] The bright area processing sub-module 23 is used to perform a filter process on the first transition picture by using the second color value and the gray value of the gray scale map corresponding to the bright area, so as to obtain a second transition picture;

[0065] The brightness parameter determination sub-module 24 is used to obtain the brightness parameter of the second transition picture according to the gray histogram of the second transition picture and the gray histogram of the reference picture;

[0066] The result determination sub-module 25 is used to assign the brightness parameter to the brightness value in the LAB color space corresponding to the second transition picture, so as to obtain the result picture after the filter process.

[0067] Further, the area determination sub-module 21 is specifically used for:

[0068] Regarding the area where the gray value in the gray scale map corresponding to the picture to be processed is distributed in the first percentile as the dark area; regarding the area where the gray value in the gray scale map corresponding to the picture to be processed is distributed in the second percentile as the bright area.

[0069] Further, the dark area processing sub-module 22 is specifically used for:

[0070] Taking the inverse of the gray value of each pixel in the gray scale map corresponding to the dark area, converting the inverted gray value into a transparency value, and setting the transparency value in the area outside the dark area to zero at the same time, so as to obtain the first transparency channel value of the picture to be processed; performing superposition and transparency channel mixing processing on the RGB color space value of the picture to be processed according to the first color value and the first transparency channel value, so as to obtain a first transition picture.

[0071] Further, the dark area processing sub-module 22 is also used for:

[0072] Performing normalization processing on the first color value and the RGB color space value of the picture to be processed respectively; according to Obtaining the color value of the i-th channel of the j-th pixel of the first transition picture where, colour1 i is the color value of the i-th channel of the first color value after normalization processing, alpha1 jis the first transparency channel value of the j-th pixel, is the i-th channel color value of the j-th pixel of the to-be-processed picture after normalization processing, where i is the R, G, or B channel.

[0073] Further, the bright area processing sub-module 23 is specifically configured to:

[0074] Convert the gray value of the grayscale image corresponding to the bright area into a transparency value, and set the transparency values in the areas outside the bright area to zero to obtain the second transparency channel value of the to-be-processed picture; according to the second color value and the second transparency channel value, perform superposition and transparency channel mixing processing on the RGB color space values of the first transition picture to obtain a second transition picture.

[0075] Further, the bright area processing sub-module 23 is also configured to:

[0076] Perform normalization processing on the second color value and the RGB color space values of the first transition picture respectively; according to to obtain the i-th channel color value of the j-th pixel of the second transition picture where, colour2 i is the i-th channel color value of the second color value after normalization processing, alpha2 j is the second transparency channel value of the j-th pixel, is the i-th channel color value of the j-th pixel of the first transition picture after normalization processing, where i is the R, G, or B channel.

[0077] Further, the brightness parameter determination sub-module 24 is specifically configured to:

[0078] Obtain the mean and standard deviation of the grayscale histogram of the second transition picture, and the mean and standard deviation of the grayscale histogram of the reference picture; according to img2_L j =(img2_gray j -img2_gray_mean)×(ref_gray_std÷img2_gray_std)+ref_gray_mean, to obtain the brightness parameter img2_L of the j-th pixel of the second transition picture j , where, img2_gray jis the gray value of the j-th pixel of the second transitional picture, img2_gray_mean is the mean of the gray histogram of the second transitional picture, img2_gray_std is the standard deviation of the gray histogram of the second transitional picture, ref_gray_std is the standard deviation of the gray histogram of the reference picture, and ref_gray_mean is the mean of the gray histogram of the reference picture.

[0079] The specific working principle and benefits of the filter processing device provided by the embodiments of the present invention are similar to those of the filter processing method provided by the embodiments of the present invention, and will not be elaborated here.

[0080] In addition, on the other hand, the embodiments of the present invention further provide a machine-readable storage medium, on which instructions are stored, and the instructions are used to make a machine execute the filter processing method described in the above embodiments.

[0081] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0082] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocks Figure 1 a device for the functions specified in one block or multiple blocks.

[0083] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements in the process Figure 1 one process or multiple processes and / or blocks Figure 1 a device for the functions specified in one block or multiple blocks.

[0084] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 steps for implementing the functions specified in one block or multiple blocks.

[0085] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0086] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.

[0087] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0088] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.

[0089] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0090] The above are only the embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A filter processing method, characterized in that, Including: Obtaining a reference picture and a picture to be processed; Performing a filter process on the picture to be processed according to the average color value within a specified area in the reference picture and the grayscale histogram of the reference picture, to obtain a result picture after the filter process, wherein, the specified area in the reference picture includes a first specified area and a second specified area, wherein, the first specified area is the area where the grayscale values are distributed in the first percentile at the front in the grayscale picture corresponding to the reference picture, and the second specified area is the area where the grayscale values are distributed in the second percentile at the back in the grayscale picture corresponding to the reference picture; the average color value includes a first color value corresponding to the first specified area and a second color value corresponding to the second specified area, The performing a filter process on the picture to be processed according to the average color value within a specified area in the reference picture and the grayscale histogram of the reference picture, to obtain a result picture after the filter process includes: Extracting a dark area and a bright area in the picture to be processed according to the specified area of the reference picture; Performing a filter process on the dark area in the picture to be processed by using the first color value and the grayscale value of the grayscale picture corresponding to the dark area, to obtain a first transitional picture; Performing a filter process on the first transitional picture by using the second color value and the grayscale value of the grayscale picture corresponding to the bright area, to obtain a second transitional picture; Obtaining the brightness parameter of the second transitional picture according to the grayscale histogram of the second transitional picture and the grayscale histogram of the reference picture; Assigning the brightness parameter to the brightness value in the LAB color space corresponding to the second transitional picture, to obtain the result picture after the filter process.

2. The filter processing method according to claim 1, wherein The extracting a dark area and a bright area in the picture to be processed according to the specified area of the reference picture includes: Taking the area where the grayscale values are distributed in the first percentile at the front in the grayscale picture corresponding to the picture to be processed as the dark area; Taking the area where the grayscale values are distributed in the second percentile at the back in the grayscale picture corresponding to the picture to be processed as the bright area.

3. The filter processing method according to claim 1, wherein The performing a filter process on the dark area in the picture to be processed by using the first color value and the grayscale value of the grayscale picture corresponding to the dark area, to obtain a first transitional picture includes: Inverting the grayscale value of each pixel in the grayscale picture corresponding to the dark area, and converting the inverted grayscale value into an alpha value, and at the same time setting the alpha values in the areas outside the dark area to zero, to obtain the first alpha channel value of the picture to be processed; Performing superposition and alpha channel mixing processing on the RGB color space values of the picture to be processed according to the first color value and the first alpha channel value, to obtain a first transitional picture.

4. The filter processing method according to claim 3, wherein The performing superposition and alpha channel mixing processing on the RGB color space values of the picture to be processed according to the first color value and the first alpha channel value, to obtain a first transitional picture includes: Normalizing the first color value and the RGB color space values of the picture to be processed respectively; According to obtain the color value of the i-th channel of the j-th pixel of the first transitional picture where colour1 i is the color value of the i-th channel of the first color value after normalization, and alpha1 j is the first transparency channel value of the j-th pixel, is the color value of the i-th channel of the j-th pixel of the picture to be processed after normalization, and i is the R, G, B channels.

5. The filter processing method according to claim 1, wherein Performing a filter process on the first transitional picture by using the second color value and the gray scale values of the gray scale picture corresponding to the bright part area to obtain a second transitional picture includes: Converting the gray scale values of the gray scale picture corresponding to the bright part area into transparency values, and setting the transparency values in the areas outside the bright part area to zero to obtain the second transparency channel value of the picture to be processed; Performing superposition and transparency channel mixing processing on the RGB color space values of the first transitional picture according to the second color value and the second transparency channel value to obtain a second transitional picture.

6. The filter processing method according to claim 5, wherein The performing superposition and transparency channel mixing processing on the RGB color space values of the first transitional picture according to the second color value and the second transparency channel value to obtain a second transitional picture includes: Performing normalization processing on the second color value and the RGB color space values of the first transitional picture respectively; According to obtain the color value of the i-th channel of the j-th pixel of the second transitional picture where colour2 i is the color value of the i-th channel of the second color value after normalization processing, and alpha2 j is the second transparency channel value of the j-th pixel, is the color value of the i-th channel of the j-th pixel of the first transitional picture after normalization processing, and i is the R, G, B channels.

7. The filter processing method according to claim 1, wherein The obtaining the brightness parameter of the second transitional picture according to the gray scale histogram of the second transitional picture and the gray scale histogram of the reference picture includes: Obtaining the mean and standard deviation of the gray scale histogram of the second transitional picture, and the mean and standard deviation of the gray scale histogram of the reference picture; According to img2_L j =(img2_gray j -img2_gray_mean)×(ref_gray_std÷img2_gray_std)+ref_gray_mean, the brightness parameter img2_L of the j-th pixel of the second intermediate image is obtained j , where img2_gray j is the grayscale value of the j-th pixel of the second intermediate image, img2_gray_mean is the mean of the grayscale histogram of the second intermediate image, img2_gray_std is the standard deviation of the grayscale histogram of the second intermediate image, ref_gray_std is the standard deviation of the grayscale histogram of the reference image, and ref_gray_mean is the mean of the grayscale histogram of the reference image.

8. A filter processing device, characterized in that, Includes: An obtaining module, configured to obtain a reference picture and a picture to be processed; A filter module, configured to perform a filter process on the picture to be processed according to the color average value in a specified area of the reference picture and the gray scale histogram of the reference picture to obtain a result picture after the filter process, wherein the specified area in the reference picture includes a first specified area and a second specified area, wherein the first specified area is an area where the gray scale values are distributed in the first percentile at the front in the gray scale picture corresponding to the reference picture, and the second specified area is an area where the gray scale values are distributed in the second percentile at the back in the gray scale picture corresponding to the reference picture; the color average value includes a first color value corresponding to the first specified area and a second color value corresponding to the second specified area, wherein the filter module includes: An area determination sub-module, configured to extract a dark part area and a bright part area in the picture to be processed according to the specified area of the reference picture; A dark part area processing sub-module, configured to perform a filter process on the dark part area in the picture to be processed by using the first color value and the gray scale values of the gray scale picture corresponding to the dark part area to obtain a first transitional picture; A bright part area processing sub-module, configured to perform a filter process on the first transitional picture by using the second color value and the gray scale values of the gray scale picture corresponding to the bright part area to obtain a second transitional picture; A brightness parameter determination sub-module, configured to obtain the brightness parameter of the second transitional picture according to the gray scale histogram of the second transitional picture and the gray scale histogram of the reference picture; A result determination sub-module, configured to assign the brightness parameter to the brightness value in the LAB color space corresponding to the second transitional picture to obtain a result picture after the filter process.

Citation Information

Patent Citations

  • Image processing method and device

    CN111031242A