Image saturation adjustment method, device, computer equipment and storage medium
By dividing the image into matrix partitions, pooling and convolution processing, calculating the addition coefficients and performing mean filtering, the color spot problem caused by uneven saturation distribution is solved, and the soft and natural adjustment of the image is achieved.
Patent Information
- Application Number
- CN202111631217.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-28
AI Technical Summary
The prior art cannot effectively solve the problem that pictures with uneven saturation distribution are prone to color spots after adjustment.
By dividing the image to be adjusted into several matrix partitions, performing pooling and convolution processing, the addition coefficients of each matrix partition are calculated, and the mean filtering process is performed based on these coefficients to adjust the saturation of the image.
It realizes the protection of high-saturation parts while improving saturation, making the image softer and more natural, avoiding plaque problems, and the steps are simple and the edges are smoother.
Smart Images

Figure CN114494036B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an image saturation adjustment method, device, computer equipment and storage medium. Background Art
[0002] The saturation of a color refers to the brightness of the color, also known as purity. In color science, primary colors have the highest saturation. As the saturation decreases, the color becomes dull until it becomes achromatic, that is, a color that loses its hue. As a carrier of information, color not only depends on the design form, but also serves as a subject to complete the process of information communication. For art design, the use and design of color is an important part. In practical applications, colors are divided into three basic categories according to the saturation values: low saturation contrast, medium saturation contrast, and high saturation contrast, as well as a derivative category of saturation combination contrast.
[0003] In image processing, it is usually necessary to adjust the saturation of the image. The commonly used saturation adjustment method is matrix control adjustment. Matrix control adjustment is based on the synchronous increase and decrease of all colors. For images with uneven saturation distribution, color spots are prone to occur.
[0004] The saturation adjustment method provided by the prior art cannot solve the problem that color spots are easily generated after adjustment of a picture with uneven saturation distribution, and this problem needs to be solved. Summary of the invention
[0005] In view of this, the embodiments of the present application provide an image saturation adjustment method, apparatus, computer device and storage medium, which can solve the problem that the saturation adjustment method provided by the prior art cannot solve the problem that color spots are prone to appear after adjustment of the picture with uneven saturation distribution.
[0006] A first aspect of an embodiment of the present application provides a method for adjusting image saturation, including:
[0007] Get the saturation of each pixel of the image to be adjusted;
[0008] Dividing the image to be adjusted into a plurality of matrix partitions, and performing pooling processing on each matrix partition to obtain a first matrix;
[0009] Performing a moving convolution process on the first matrix according to a preset first convolution kernel to obtain a second matrix;
[0010] Obtaining an addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and a preset saturation change slope;
[0011] Based on the addition coefficients corresponding to the matrix partitions, mean filtering is performed on each matrix partition to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
[0012] In a possible implementation manner of the first aspect, the image to be adjusted is divided into a plurality of matrix partitions, and the matrix partitions obtained by the division are preferably n*n matrices.
[0013] For example, for an input image with 16 rows and 16 columns, if the matrix partition is selected as 4*4, then after dividing the matrix partition, 16 matrix partitions with 4 rows and 4 columns in total are obtained.
[0014] It should be understood that this is merely an exemplary description and is not used to limit the size of the matrix partition; the number of rows and columns of the matrix partition are not necessarily equal.
[0015] A second aspect of an embodiment of the present application provides a potential customer identification device, including:
[0016] A saturation acquisition module is used to obtain the saturation of each pixel of the image to be adjusted;
[0017] A pooling processing module, used for dividing the image to be adjusted into a plurality of matrix partitions, and performing a pooling process on each matrix partition to obtain a first matrix;
[0018] A convolution processing module, used for performing a moving convolution process on the first matrix according to a preset first convolution kernel to obtain a second matrix;
[0019] An addition coefficient calculation module, used for obtaining the addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and a preset saturation change slope;
[0020] The filtering module is used to perform mean filtering on each matrix partition based on the addition coefficient corresponding to the matrix partition, so as to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
[0021] A third aspect of an embodiment of the present application provides a terminal device, which includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the image saturation adjustment method as described in any one of the first aspects above are implemented.
[0022] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, comprising: storing a computer program, characterized in that when the computer program is executed by a processor, the steps of the image saturation adjustment method as described in any one of the above-mentioned first aspects are implemented.
[0023] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by means of convolution, the saturation of adjacent areas is evenly adjusted, different gains are given to different saturations, and while the saturation is improved, the high-saturation part is protected, so that the resulting image is softer and more natural than the traditional adjustment method, avoiding the problem of patchiness; at the same time, the adjustment method of the present application has simple steps; by performing two mean filtering on the saturation, the edge transition is made smoother; the picture is partitioned, the convolution kernel changes with the picture area, and the saturation effect after gain is more natural; in addition, the addition coefficient can also be deformed, the maximum gain multiple can be controlled, and the adjustable range can be planned. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0025] Figure 1 It is a schematic diagram of the implementation process of the image saturation adjustment method provided in the embodiment of the present application;
[0026] Figure 2 It is a schematic diagram of a process flow of obtaining the saturation of each pixel point of an image to be adjusted by the image saturation adjustment method provided in an embodiment of the present application;
[0027] Figure 3 It is a trend diagram of the slope of the addition coefficient changing with the saturation in the image saturation adjustment method provided in the embodiment of the present application;
[0028] Figure 4 It is a schematic diagram of the implementation flow of the image saturation adjustment method provided in an embodiment of the present application, which performs mean filtering processing on each matrix partition based on the addition coefficient corresponding to the matrix partition;
[0029] Figure 5 is a structural schematic diagram of an image saturation adjustment device provided in an embodiment of the present application;
[0030] Figure 6 It is a schematic diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0032] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0033] Figure 1 The following is a flowchart of the method for identifying potential customers provided in the first embodiment of the present application, which is described in detail as follows: A method for adjusting image saturation, the method for adjusting image saturation comprising steps S102 to S110:
[0034] Step S102, obtaining the saturation of each pixel of the image to be adjusted.
[0035] In the present application, the saturation of a pixel can be directly read or calculated.
[0036] Step S104: divide the image to be adjusted into a plurality of matrix partitions, and perform pooling processing on each matrix partition to obtain a first matrix.
[0037] In the present application, the image to be adjusted is divided into several matrix partitions, and the matrix partitions obtained by division are preferably n*n matrices, as shown in Table 1. For an input image with 16 rows and 16 columns, if the matrix partition is selected as 4*4, then after dividing the matrix partition, 16 matrix partitions with 4 rows and 4 columns are obtained, as shown in Table 2. It can be understood that this is only an exemplary description and is not used to limit the size of the matrix partition; the number of rows and columns of the matrix partition are not necessarily equal.
[0038] Table 1: Saturation of each pixel
[0039]
[0040]
[0041] Table 2: Input image matrix partitioning results
[0042]
[0043] In the present application, pooling processing is to set the saturation values of all pixels in the same matrix partition to the same value, and the same value can be determined by a variety of methods. Pooling processing can reduce the amount of data processing and increase the processing speed.
[0044] Step S106: Perform moving convolution processing on the first matrix according to a preset first convolution kernel to obtain a second matrix.
[0045] In this application, mobile convolution belongs to the prior art, and this application will not go into details about the process of mobile convolution.
[0046] Step S108, obtaining the addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and the preset saturation change slope.
[0047] In the present application, the first matrix and the second matrix are related to the saturation of all pixels of the entire image. For all matrix partitions, the first matrix and the second matrix only need to be calculated once, which simplifies the calculation amount of image adjustment and improves the operation speed of the method provided in the present application.
[0048] Step S110 , performing mean filtering processing on each matrix partition based on the addition coefficient corresponding to the matrix partition, to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
[0049] The present application uses convolution to evenly adjust the saturation of adjacent areas, give different gains to different saturations, and protect the high-saturation part while improving the saturation, so that the resulting image is softer and more natural than the traditional adjustment method, avoiding the problem of patchiness; at the same time, the adjustment method of the present application has simple steps; by performing two mean filters on the saturation, the edge transition is smoother; the picture is partitioned and the convolution kernel changes with the picture area, and the saturation effect after gain is more natural; in addition, the addition coefficient can also be deformed to control the maximum gain multiple and plan the adjustable range.
[0050] like Figure 2 As shown, in one embodiment of the present application, the step of obtaining the saturation of each pixel of the image to be adjusted includes steps S202 to S206:
[0051] Step S202, obtaining the R pixel value, G pixel value and B pixel value of each pixel point in the image to be adjusted.
[0052] In the present application, the R pixel value, G pixel value and B pixel value of each pixel point in the image to be adjusted can be obtained from the image information.
[0053] Step S204, calculating the difference between the maximum pixel value and the minimum pixel value among the R pixel value, the G pixel value and the B pixel value of each pixel point.
[0054] Step S206, multiplying the ratio of the difference value of each pixel point to its corresponding maximum pixel value by a preset coefficient to obtain the saturation of each pixel point of the image to be adjusted.
[0055] In the present application, for an image in RGB mode, the R pixel value, G pixel value and B pixel value of each pixel are obtained, and the formula S = (MAX(RGB)-MIN(RGB))*100 / MAX(RGB) is used to calculate the difference between the maximum pixel value and the minimum pixel value among the R pixel value, G pixel value and B pixel value of each pixel, and multiply it by a preset coefficient of 100, and the result is rounded to obtain the saturation S of the pixel. Table 1 shows an input image with 256 pixels, and the values in the figure are the saturation of each pixel obtained after processing.
[0056] In one embodiment of the present application, performing pooling processing on each matrix partition to obtain a first matrix includes:
[0057] Perform maximum pooling on each matrix partition;
[0058] The results of the partition pooling processing of each matrix are aggregated to obtain the first matrix.
[0059] In this application, 4*4max non-repetitive pooling can be used, that is, each matrix partition is pooled separately, and the rule used for pooling is: take the maximum value of the saturation of all pixels in the matrix partition as the result of the pooling of each pixel. The first matrix can be obtained by summarizing the results of the pooling of each matrix partition; each element in the first matrix is equal to the pooling result of the corresponding matrix partition, for example, the value of the second row and second column in the first matrix is 54, which corresponds to the pooling result of the bold matrix partition in Table 1 and Table 2.
[0060] The first matrix is specifically:
[0061] The coordinates of the first matrix are expressed as:
[0062]
[0063] In one embodiment of the present application, the size of the first convolution kernel is 2*2, and the first matrix is subjected to mobile convolution processing according to the preset first convolution kernel to obtain the second matrix, including:
[0064] According to the first convolution kernel, a moving convolution process with a step size of 1 is performed on each first matrix to obtain the second matrix.
[0065] Optionally, the first convolution kernel is:
[0066]
[0067] In this application, the first matrix is convolved with a step size of 1 using the first convolution kernel, that is:
[0068]
[0069] Get the second 3*3 matrix:
[0070]
[0071] The coordinates of the second matrix are expressed as:
[0072]
[0073] In one embodiment of the present application, obtaining the addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and the preset saturation change slope includes:
[0074] Calculate the average value of the difference between the result after the pooling processing of each matrix partition and the corresponding element of the second matrix to obtain the average difference of each matrix partition;
[0075] The addition coefficient corresponding to each matrix partition is calculated according to the mean difference of each matrix partition and the preset saturation change slope.
[0076] In this application, the mean of each convolution window is included in multiple windows. For example, the mean 54 at the position g(x, y) in the first matrix is included in the convolution windows corresponding to the mean 59.5, 56.5, 56.5 and 53.25 in the second matrix. The final mean difference only needs to average all the mean differences, which can be calculated by the following formula:
[0077]
[0078] For the mean value 54 at the position of g(x,y) (ie, the matrix partition in bold in Tables 1 and 2), θ=2.813.
[0079] Final bonus factor:
[0080]
[0081] Among them: μ is the saturation change slope. By adjusting the saturation change slope, the purpose of adjusting the saturation intensity can be achieved; θ is the average saturation difference in the current window. The larger the value, the greater the saturation level between the current area and the surrounding area, the more the calculated addition coefficient, and the greater the gain for low saturation. Figure 3 The changing trend of the slope of the addition coefficient with saturation is shown.
[0082] like Figure 4As shown, in one embodiment of the present application, the mean filtering is performed on each matrix partition based on the addition coefficient corresponding to the matrix partition to obtain the target image after saturation adjustment corresponding to the image to be adjusted, including steps S402 to S408:
[0083] Step S402, obtaining a second convolution kernel according to the addition coefficient.
[0084] In this application, a 3*3 kernel k2 is constructed according to the obtained addition coefficient Ψ:
[0085]
[0086] When θ=2.813, K2 is:
[0087]
[0088] Step S404: for each matrix partition, a third matrix is obtained with each pixel point in the matrix partition as the center.
[0089] In this application, taking the bold matrix partition in Table 1 as an example, its input pixels are:
[0090]
[0091] With each pixel point in the matrix partition as the center, 16 3*3 third matrices can be obtained.
[0092] Step S406, calculate the dot product of each third matrix and the second convolution kernel to obtain the saturation value of the corresponding pixel after mean filtering.
[0093] In the present application, each third matrix is dot-multiplied with the kernel K2 to obtain the saturation value of each pixel point in the matrix partition after mean filtering.
[0094] Step S408, summarizing the mean filtering processing results of each matrix partition to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
[0095] In this application, illustratively, the results of the summary are shown in the following 4*4 table:
[0096] 52 47 44 46 53 47 45 47 54 48 47 47 54 50 49 45
[0097] Corresponding to the method of the above embodiment, Figure 5 A structural block diagram of an image saturation adjustment device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown. Figure 5 The potential customer identification device of the example may be an execution subject of the image saturation adjustment method provided in the aforementioned embodiment.
[0098] Reference Figure 5 , the image saturation adjustment device comprises:
[0099] The saturation acquisition module 501 is used to acquire the saturation of each pixel of the image to be adjusted;
[0100] A pooling processing module 502, used for dividing the image to be adjusted into a plurality of matrix partitions, and performing a pooling process on each matrix partition to obtain a first matrix;
[0101] A convolution processing module 503, configured to perform a moving convolution process on the first matrix according to a preset first convolution kernel to obtain a second matrix;
[0102] An addition coefficient calculation module 504, used to obtain the addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and a preset saturation change slope;
[0103] The filtering module 505 is used to perform mean filtering on each matrix partition based on the addition coefficient corresponding to the matrix partition, so as to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
[0104] The process of each module in the image saturation adjustment device provided in the embodiment of the present application realizing its own function can be specifically referred to the aforementioned Figure 1 The description of the illustrated embodiment will not be repeated here.
[0105] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0106] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0107] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0108] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0109] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish descriptions, and cannot be understood as indicating or suggesting relative importance. It should also be understood that although the terms "first", "second", etc. are used to describe various elements in some embodiments of the present application in the text, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, the first table can be named as the second table, and similarly, the second table can be named as the first table without departing from the scope of the various described embodiments. The first table and the second table are both tables, but they are not the same table.
[0110] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0111] The image saturation adjustment method provided in the embodiment of the present application can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific type of the terminal device.
[0112] For example, the terminal device can be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a vehicle networking terminal, a computer, a laptop computer, a handheld communication device, a handheld computing device, a satellite wireless device, a wireless modem card, a TV set top box (STB), a customer premises equipment (CPE) and / or other devices for communicating on a wireless system and a next-generation communication system, such as a mobile terminal in a 5G network or a mobile terminal in a future evolved Public Land Mobile Network (PLMN) network, etc.
[0113] As an example but not limitation, when the terminal device is a wearable device, the wearable device can also be a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not just hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are fully functional, large in size, and can achieve complete or partial functions without relying on smartphones, such as smart watches or smart glasses, as well as those that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.
[0114] Figure 6 Schematic diagram of the structure of a terminal device provided by an embodiment of the present application. Figure 6 As shown, the terminal device 6 of this embodiment includes: at least one processor 60 ( Figure 6 Only one is shown in the figure), a memory 61, in which a computer program 62 that can be run on the processor 60 is stored. When the processor 60 executes the computer program 62, the steps in the above-mentioned various potential customer identification method embodiments are implemented, such as Figure 1 Alternatively, when the processor 60 executes the computer program 62, the functions of each module / unit in the above-mentioned device embodiments are realized, for example, Figure 5Functions of modules 501 to 504 are shown.
[0115] The terminal device 6 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 It is only an example of the terminal device 6 and does not constitute a limitation of the terminal device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include an input sending device, a network access device, a bus, etc.
[0116] The processor 60 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0117] In some embodiments, the memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 61 may also be used to temporarily store data that has been sent or is to be sent.
[0118] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0119] An embodiment of the present application also provides a terminal device, which includes at least one memory, at least one processor, and a computer program stored in the at least one memory and executable on the at least one processor, wherein when the processor executes the computer program, the terminal device implements the steps in any of the above-mentioned method embodiments.
[0120] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0121] An embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0122] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0123] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0124] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for adjusting image saturation, characterized in that: The image saturation adjustment method comprises: Get the saturation of each pixel of the image to be adjusted; Dividing the image to be adjusted into a plurality of matrix partitions, and performing pooling processing on each matrix partition to obtain a first matrix; Performing a moving convolution process on the first matrix according to a preset first convolution kernel to obtain a second matrix; Obtaining an addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and a preset saturation change slope; Performing mean filtering on each matrix partition based on the addition coefficient corresponding to the matrix partition, to obtain a target image after saturation adjustment corresponding to the image to be adjusted; The step of obtaining the addition coefficients corresponding to the matrix partitions according to the first matrix, the second matrix and the preset saturation change slope includes: Calculate the average value of the difference between the result after the pooling processing of each matrix partition and the corresponding element of the second matrix to obtain the average difference of each matrix partition; The addition coefficient corresponding to each matrix partition is calculated according to the mean difference of each matrix partition and the preset saturation change slope; The step of performing mean filtering on each matrix partition based on the addition coefficient corresponding to the matrix partition to obtain a target image after saturation adjustment corresponding to the image to be adjusted includes: Obtaining a second convolution kernel according to the addition coefficient; For each matrix partition, a third matrix is obtained with each pixel point in the matrix partition as the center; Calculate the dot product of each third matrix and the second convolution kernel to obtain the saturation value of the corresponding pixel after mean filtering; The mean filtering results of each matrix partition are summarized to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
2. The image saturation adjustment method according to claim 1, characterized in that: The step of obtaining the saturation of each pixel of the image to be adjusted includes: Obtaining the R pixel value, G pixel value and B pixel value of each pixel point in the image to be adjusted; Calculate the difference between the maximum pixel value and the minimum pixel value among the R pixel value, the G pixel value and the B pixel value of each pixel point; The saturation of each pixel point in the image to be adjusted is obtained by multiplying the ratio of the difference value of each pixel point to its corresponding maximum pixel value by a preset coefficient.
3. The image saturation adjustment method according to claim 1, wherein: The performing pooling processing on each matrix partition to obtain a first matrix includes: Perform maximum pooling on each matrix partition; The results of the partition pooling processing of each matrix are aggregated to obtain the first matrix.
4. The image saturation adjustment method according to claim 1, characterized in that: The size of the first convolution kernel is 2*2, and the first matrix is subjected to mobile convolution processing according to the preset first convolution kernel to obtain a second matrix, including: According to the first convolution kernel, a moving convolution process with a step size of 1 is performed on each first matrix to obtain the second matrix.
5. The image saturation adjustment method according to claim 4, characterized in that: The first convolution kernel is:
6. An image saturation adjustment device, characterized in that: The image saturation adjustment device comprises: A saturation acquisition module is used to obtain the saturation of each pixel of the image to be adjusted; A pooling processing module, used for dividing the image to be adjusted into a plurality of matrix partitions, and performing a pooling process on each matrix partition to obtain a first matrix; A convolution processing module, used for performing a moving convolution process on the first matrix according to a preset first convolution kernel to obtain a second matrix; An addition coefficient calculation module, used for obtaining the addition coefficient corresponding to each matrix partition according to the first matrix, the second matrix and a preset saturation change slope; A filtering module, used for performing mean filtering on each matrix partition based on the addition coefficient corresponding to the matrix partition, to obtain a target image after saturation adjustment corresponding to the image to be adjusted; The addition coefficient calculation module is specifically used to: calculate the average value of the difference between the result of the pooling process of each matrix partition and the corresponding element of the second matrix to obtain the mean difference of each matrix partition; calculate the addition coefficient corresponding to each matrix partition according to the mean difference of each matrix partition and the preset saturation change slope; The filtering module is specifically used for: Obtaining a second convolution kernel according to the addition coefficient; For each matrix partition, a third matrix is obtained with each pixel point in the matrix partition as the center; Calculate the dot product of each third matrix and the second convolution kernel to obtain the saturation value of the corresponding pixel after mean filtering; The mean filtering results of each matrix partition are summarized to obtain a target image after saturation adjustment corresponding to the image to be adjusted.
7. A terminal device, characterized in that: The terminal device includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the image saturation adjustment method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image saturation adjustment method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and device for automatically adjusting chroma and saturation
CN101621702A
Method and system for adjusting image saturation
CN101729913A