Image color adjustment method, apparatus, device, medium, and product
Patent Information
- Application Number
- CN202511478723.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2045-10-15
AI Technical Summary
但图像中天空区域中往往会存在大量云层,云层的边界区域常和天空的属性数据存在重合,因此在对图像调整时云层的属性数据也会发生变化而使得云层看起来更蓝,影响了色彩精调的效果
[0025]上述图像色彩调整方法、装置、设备、介质和产品,根据待调整图像中每一像素点分别在不同颜色空间下的属性数据,确定像素点在对应颜色空间下的候选类型,从而根据每一像素点在不同颜色空间下的候选类型确定像素点的目标类型,可见本实施例基于像素点在不同颜色空间下的候选类型确定目标类型,提供了一种交叉验证方式,可以提高像素点所属类型的识别准确性,避免因单一方式导致像素点所属类型的识别不准确而使得去云处理不合理,因此本实施例可以提高天空区域的识别准确性。单独对天空区域进行色彩调整,而不必对整个待调整图像进行色彩调整,从而避免在对待调整图像调整时云层的属性数据也会发生变化而使得云层看起来更蓝,因此本实施例可以提高色彩调整的效果。
Smart Images

Figure CN121258857B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image color adjustment method, apparatus, device, medium, and product. Background Technology
[0002] When processing images captured by mobile phones, industrial cameras, network cameras, tablet computer cameras, game console cameras, video smartwatches, security cameras, or camera modules, it is often necessary to adjust the colors of the sky area separately to achieve a pleasing sky color.
[0003] Currently, when color adjustments are needed for the sky, the attribute data of the entire image is often adjusted. However, there are often many clouds in the sky area of an image, and the boundary areas of the clouds often overlap with the attribute data of the sky. Therefore, when adjusting the image, the attribute data of the clouds will also change, making the clouds appear bluer and affecting the effect of fine-tuning the color. Summary of the Invention
[0004] Therefore, it is necessary to provide an image color adjustment method, apparatus, device, medium, and product to address the aforementioned technical problems and improve the color fine-tuning effect.
[0005] In a first aspect, this application provides an image color adjustment method, including:
[0006] Obtain the image to be adjusted;
[0007] Based on the attribute data of each pixel in the image to be adjusted in different color spaces, determine the candidate type of the pixel in the corresponding color space.
[0008] The target type of a pixel is determined based on the candidate types of each pixel in different color spaces.
[0009] Based on the pixels whose target type is white cloud, perform cloud removal processing on the image to be adjusted to obtain the sky region;
[0010] The sky region is color-adjusted based on the target attribute data of each pixel in the preset color space.
[0011] In one embodiment, the color space includes the RGB color space; determining the candidate type of a pixel in a corresponding color space based on the attribute data of each pixel in the image to be adjusted in different color spaces includes: determining the category feature data of the pixel based on the attribute data of each pixel in the image to be adjusted in the RGB color space; and determining the candidate type of the pixel in the RGB color space based on the category feature data of the pixel.
[0012] In one embodiment, determining the candidate type of a pixel in the RGB color space based on the pixel's category feature data includes: determining the candidate type of a pixel in the RGB color space based on the magnitude relationship between the pixel's category feature data and a preset type threshold; and / or, determining the candidate type of a pixel in the RGB color space based on the difference between the pixel's category feature data and the category feature data of a reference pixel, and the candidate type of the reference pixel; wherein the reference pixel is a neighboring pixel with a known candidate type in the adjacent row of the pixel.
[0013] In one embodiment, the color space includes the hue, saturation, and lightness HSV color space; determining the candidate type of a pixel in a corresponding color space based on the attribute data of each pixel in the image to be adjusted under different color spaces includes: determining the candidate type of a pixel in the HSV color space based on the relationship between the attribute data of each pixel in the image to be adjusted under different color attributes in the HSV color space and the attribute data range of the corresponding color attributes.
[0014] In one embodiment, the sky region includes at least one non-overlapping region block; the sky region is color-adjusted based on the target attribute data of each pixel in the sky region under a preset color space, including: determining an adjustment offset for the sky region based on the target attribute data of each pixel in the sky region under the preset color space and the expected adjustment effect; for each region block, determining a target weight for the region block based on the target attribute data of at least two pixels in the region block, and / or the block height information of the region block; and color-adjusting the region block based on the adjustment offset and the target weight of the region block.
[0015] In one embodiment, determining the target weight of a region block based on target attribute data of at least two pixels in the region block and / or the block height information of the region block includes: determining the mean of the target attributes of the region block based on the target attribute data of at least two pixels in the region block; selecting the maximum or minimum value from the mean of the target attributes of each region block; determining a first weight of the region block based on the maximum or minimum value and the mean of the target attributes of the region block; determining a second weight of the region block based on the block height information of the region block; and determining the target weight of the region block based on the first weight and / or the second weight of the region block.
[0016] Secondly, this application also provides an image color adjustment device, comprising:
[0017] The image acquisition module is used to acquire the image to be adjusted.
[0018] The first determining module is used to determine the candidate type of a pixel in a corresponding color space based on the attribute data of each pixel in the image to be adjusted in different color spaces.
[0019] The second determining module is used to determine the target type of a pixel based on the candidate types of each pixel in different color spaces.
[0020] The cloud removal module is used to remove clouds from the image to be adjusted based on the target type of each pixel that belongs to the cloud type, so as to obtain the sky area.
[0021] The color adjustment module is used to adjust the color of the sky area based on the target attribute data of each pixel in the sky area under the preset color space.
[0022] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method provided in the first aspect.
[0023] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect.
[0024] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in the first aspect.
[0025] The aforementioned image color adjustment methods, apparatuses, devices, media, and products determine the candidate types of each pixel in the image to be adjusted in different color spaces based on the attribute data of each pixel in different color spaces. Then, based on the candidate types of each pixel in different color spaces, the target type of the pixel is determined. This embodiment provides a cross-validation method to determine the target type based on the candidate types of pixels in different color spaces, which can improve the accuracy of pixel type identification and avoid unreasonable cloud removal processing due to inaccurate identification of pixel type caused by a single method. Therefore, this embodiment can improve the identification accuracy of the sky region. By adjusting the color of the sky region separately, without adjusting the color of the entire image to be adjusted, the attribute data of the clouds will also change during the adjustment of the image to be adjusted, making the clouds appear bluer. Therefore, this embodiment can improve the effect of color adjustment. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart illustrating an image color adjustment method in one embodiment;
[0028] Figure 2 This is a flowchart illustrating the candidate type determination steps in one embodiment;
[0029] Figure 3 This is a flowchart illustrating the candidate type determination steps in one embodiment;
[0030] Figure 4 This is a flowchart illustrating the candidate type determination steps in one embodiment;
[0031] Figure 5 This is a flowchart illustrating the candidate type determination steps in one embodiment;
[0032] Figure 6 This is a flowchart illustrating the color adjustment steps in one embodiment;
[0033] Figure 7 This is a flowchart illustrating the target weight determination step in one embodiment;
[0034] Figure 8 This is a flowchart illustrating the color adjustment steps in one embodiment;
[0035] Figure 9 This is a flowchart illustrating an image color adjustment method in one embodiment;
[0036] Figure 10 This is a structural block diagram of an image color adjustment device in one embodiment;
[0037] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0039] In one exemplary embodiment, an image color adjustment method is provided, see [link to relevant documentation]. Figure 1 The method includes the following steps:
[0040] S110, Obtain the image to be adjusted.
[0041] The image to be adjusted is the image that requires color adjustment.
[0042] In real-world scenarios, images to be adjusted can be acquired from devices such as mobile phones, industrial cameras, network cameras, tablet computer cameras, game console cameras, video smartwatches, security cameras, or camera modules.
[0043] S120, Based on the attribute data of each pixel in the image to be adjusted in different color spaces, determine the candidate type of the pixel in the corresponding color space.
[0044] Different color spaces can include the R (Red) G (Green) B (Blue) color space and the H (Hue) S (Saturation) V (Value) color space. The HSV color space is a color model based on human visual perception, which decomposes color into three independent components, or three attributes: hue, saturation, and value. Of course, other color spaces can also be included, but this is not limited here.
[0045] For example, based on the attribute data of each pixel in the image to be adjusted in the RGB color space, the candidate type of that pixel in the RGB color space can be determined; based on the attribute data of each pixel in the image to be adjusted in the HSV color space, the candidate type of that pixel in the HSV color space can be determined. Therefore, based on S120, the candidate types of each pixel in different color spaces can be obtained.
[0046] In this context, attribute data has different meanings in different color spaces. For example, in the RGB color space, attribute data can include the intensity data of the red channel, the green channel, and the blue channel. Similarly, in the HSV color space, attribute data can include lightness, hue, and saturation data.
[0047] The HSV color space has three attributes: Hue reflects the spectral composition of a color and is expressed in angles, ranging from 0° to 360°; Color purity is defined by saturation, which ranges from 0 to 1; and Brightness is a measure of the lightness of a color, also ranging from 0 to 1.
[0048] The candidate types include cloud type and sky type. If a pixel's candidate type in a color space is cloud type, then that pixel is considered a cloud pixel in that color space. If a pixel's candidate type in a color space is sky type, then that pixel is considered a sky pixel in that color space.
[0049] S130 determines the target type of a pixel based on the candidate types of each pixel in different color spaces.
[0050] The target types include cloud type and sky type.
[0051] Understandably, after obtaining the candidate types of each pixel in at least two color spaces, the target type of the pixel is determined based on each candidate type, and the target type is taken as the final type of the pixel.
[0052] In one optional implementation, if the candidate types of each pixel in different color spaces are all sky type, then the target type of the pixel is sky type; otherwise, the target type of the pixel is cloud type.
[0053] The above implementation ensures accurate identification of sky-type pixels, guaranteeing the accuracy of the subsequently obtained sky region. Since the attribute data of cloud-type pixels in the HSV color space overlaps with those of sky-type pixels, misidentifying cloud edges as sky-type pixels can lead to issues like layering and jagged edges in the cloud region. The above implementation, through its strict sky-type identification method, reduces the likelihood of cloud-type pixels being misidentified as sky-type pixels, thus minimizing layering and jagged edges and reducing the difficulty of subsequent color adjustments.
[0054] S140: Based on the pixels whose target type is cloud, perform cloud removal processing on the image to be adjusted to obtain the sky area.
[0055] That is, remove all pixels of the target type "cloud" from the image to be adjusted, and the area formed by the remaining pixels is the sky area.
[0056] S150 adjusts the color of the sky region based on the target attribute data of each pixel in the sky region under the preset color space.
[0057] The preset color space is one of the different color spaces mentioned above. For example, the preset color space is the HSV color space. In this case, the target attribute data can be at least one of saturation data, brightness data, and hue data, so as to adjust at least one of the saturation, brightness, and hue of the sky area, thereby achieving color adjustment.
[0058] In this embodiment, based on the attribute data of each pixel in the image to be adjusted under different color spaces, the candidate type of the pixel in the corresponding color space is determined. Then, the target type of the pixel is determined based on the candidate type of each pixel in different color spaces. It is evident that this embodiment provides a cross-validation method to determine the target type based on the candidate type of the pixel in different color spaces, which can improve the accuracy of pixel type identification and avoid unreasonable cloud removal processing due to inaccurate identification of pixel type caused by a single method. Therefore, this embodiment can improve the identification accuracy of the sky region. By adjusting the color of the sky region separately, without adjusting the color of the entire image to be adjusted, the attribute data of the cloud layer will also change during the adjustment of the image to be adjusted, making the clouds appear bluer. Therefore, this embodiment can improve the effect of color adjustment.
[0059] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the color space is refined to include the RGB color space, and the candidate type determination step in S120 is refined.
[0060] See Figure 2 The detailed candidate type determination steps include:
[0061] S210, determine the category feature data of each pixel in the image to be adjusted based on the attribute data of each pixel in the RGB color space.
[0062] Among them, category feature data can be understood as feature data that can reflect the type to which a pixel belongs.
[0063] In one alternative implementation, the category feature data of a pixel can be the ratio of the intensity data of the blue channel to the red channel of the pixel in the RGB color space, i.e., B / R.
[0064] The reason for choosing B / R (Browser / Red Ratio) as the categorical feature data is that the intensity of the blue channel in sky pixels is much higher than that of the red or green channels, while the intensity of the blue, red, and green channels in cloud pixels is almost the same, and all three color channels have relatively high intensities. Therefore, the B / R ratio of the blue to red channel intensity data for sky pixels is larger, while the B / R ratio for cloud pixels is smaller. Based on this, the B / R ratio of the blue to red channel intensity data of a pixel can be used as a basis for identifying candidate types; therefore, B / R is chosen as the categorical feature data.
[0065] Of course, the ratio of the intensity data of the blue channel to the green channel of a pixel in the RGB color space (B / G) can also be used as the category feature data of the pixel, or other data can be used as the category feature data, which is not limited here.
[0066] S220 determines the candidate type of a pixel in the RGB color space based on the pixel category feature data.
[0067] In one alternative implementation, see Figure 3 The candidate type determination step in S220 may include:
[0068] S310: Determine the candidate type of the pixel in the RGB color space based on the relationship between the category feature data of the pixel and the preset type threshold.
[0069] The preset type threshold can be set as needed and is not limited here.
[0070] For example, if the B / R ratio of a pixel is greater than a preset type threshold, then the candidate type of the pixel in the RGB color space is determined to be the sky type; if the B / R ratio of a pixel is less than or equal to the preset type threshold, then the candidate type of the pixel in the RGB color space is determined to be the cloud type.
[0071] In the above implementation, for each pixel, the category feature data is compared with the preset type threshold, which can accurately and quickly determine the candidate type of the pixel in the RGB color space.
[0072] In one alternative implementation, see Figure 4 The candidate type determination step in S220 may include:
[0073] S410, based on the difference between the category feature data of the pixel and the category feature data of the reference pixel, and the candidate type of the reference pixel, determine the candidate type of the pixel in the RGB color space; wherein, the reference pixel is the neighboring pixel with a known candidate type in the adjacent row of the pixel.
[0074] Among them, the known candidate types of the reference pixel are the candidate types in the RGB color space.
[0075] Among them, the candidate type of the reference pixel in the RGB color space is known, and the row where the reference pixel is located is adjacent to the row where the aforementioned pixel is located. The reference pixel and the aforementioned pixel are adjacent pixels. It can be seen that the reference pixel and the aforementioned pixel are two pixels located in two adjacent rows and in the same column.
[0076] Specifically, if the difference between the category feature data of a pixel and the category feature data of a reference pixel is less than a preset difference, then the candidate type of that pixel in the RGB color space is the same as the candidate type of the reference pixel in the RGB color space. If the difference between the category feature data of a pixel and the category feature data of a reference pixel is greater than or equal to a preset difference, then the candidate type of that pixel in the RGB color space is different from the candidate type of the reference pixel in the RGB color space. For example, if the candidate type of the reference pixel in the RGB color space is "cloud", then the candidate type of this pixel in the RGB color space is "sky".
[0077] There are several ways to determine the candidate type of the reference pixel in the RGB color space. For example, it can be determined by the method in S310 above, or it can be determined based on other reference pixels. Of course, other methods can also be used, which are not limited here.
[0078] For example, the method in S310 is used to determine the candidate types of each pixel in the first row of the image to be adjusted in the RGB color space. For the pixels in the first column of the second row, the B / R ratio of the pixels in the first column of the second row is calculated, and then the difference between the B / R ratio of the pixels in the first column of the second row and the B / R ratio of the pixels in the first column of the first row is calculated. If the difference between the B / R ratio of the pixels in the first column of the second row and the B / R ratio of the pixels in the first column of the first row is less than a preset difference, then the candidate types of the pixels in the first column of the second row and the pixels in the first column of the first row are the same in the RGB color space; otherwise, the candidate types of the pixels in the first column of the second row and the pixels in the first column of the first row are different in the RGB color space. For the pixel in the second column of the second row, calculate its B / R ratio. Then, calculate the difference between the B / R of the pixel in the second column of the second row and the B / R of the pixel in the second column of the first row. If the difference is less than a preset difference, the pixel in the second column of the second row has the same candidate type in the RGB color space as the pixel in the second column of the first row; otherwise, the pixel has a different candidate type in the RGB color space. Based on this method, the candidate type of each pixel in the second row in the RGB color space can be determined. Then, using each pixel in the second row as a reference pixel, the candidate type of each pixel in the third row in the RGB color space is determined.
[0079] The above implementation method can accurately determine the candidate type of the above pixel in the RGB color space based on the reference pixel of known candidate type.
[0080] As can be seen, this embodiment provides two implementation methods for determining the candidate type of a pixel in the RGB color space based on the category feature data of the pixel. Of course, other implementation methods can also be used, which are not limited here.
[0081] In this embodiment, the category feature data of each pixel in the image to be adjusted is determined based on the attribute data of each pixel in the RGB color space. The category feature data is used as the basis for identifying the candidate type of the pixel in the RGB color space, thereby accurately identifying the candidate type of the pixel in the RGB color space.
[0082] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the color space is refined to include the HSV color space, and the candidate type determination step in S120 is refined.
[0083] See Figure 5 The detailed candidate type determination steps include:
[0084] S510, Based on the relationship between the attribute data of each pixel in the image to be adjusted under different color attributes in the HSV color space and the attribute data range of the corresponding color attribute, determine the candidate type of the pixel in the HSV color space.
[0085] Among them, the attribute data under different color attributes include brightness data, hue data, and saturation data.
[0086] The attribute data ranges include the lightness data range, hue data range, and saturation data range. Each attribute data range can be set as needed and is not limited here.
[0087] For example, if the brightness data of a pixel is within the brightness data range, the hue data is within the hue data range, and the saturation data is within the saturation data range, then the candidate type of the pixel in the HSV color space is the sky type; otherwise, the candidate type of the pixel in the HSV color space is the cloud type.
[0088] In this embodiment, the candidate type of a pixel in the HSV color space can be quickly and accurately determined based on whether the attribute data of each pixel in different color attributes falls within the attribute data range of the corresponding color attribute.
[0089] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the sky area includes at least one non-overlapping area block, and the color adjustment steps in S150 are refined.
[0090] See Figure 6 Color adjustment steps may include:
[0091] S610 determines the adjustment offset of the sky region based on the target attribute data of each pixel in the sky region under the preset color space and the expected adjustment effect.
[0092] The preset color space can be the HSV color space or other color spaces.
[0093] In this context, target attribute data can be understood as the current data of the target attribute (e.g., saturation).
[0094] The expected adjustment effect is the desired effect of the sky area after color adjustment based on the target attribute. For example, it is expected that the vividness of the sky area will increase by 30%.
[0095] The adjustment offset can be understood as the overall offset of the target attribute of the sky area when adjusting the color of the sky area, or the overall change of the target attribute.
[0096] In practical scenarios, the average value of the target attribute data for each pixel in the sky region can be used as the baseline value for the target attribute of the sky region. Then, based on the baseline value and the expected adjustment effect, the adjusted target attribute value corresponding to the baseline value and the expected adjustment effect is looked up in the preset mapping table corresponding to the target attribute. The preset mapping table records the mapping relationship between the baseline value and the adjusted target attribute value, and each mapping relationship has a corresponding expected adjustment effect. Finally, the difference between the adjusted target attribute value and the baseline value is used to obtain the adjustment offset of the sky region.
[0097] S620, for each region block, determine the target weight of the region block based on the target attribute data of at least two pixels in the region block, and / or the block height information of the region block.
[0098] The block height information of a region can be understood as the height information of the region's position data in the sky region. For ease of calculation, all region blocks are of the same size, and the height of a region block itself is considered as one unit height. For example, the block height information of the region blocks in the first row of the sky region is 1 unit height, the block height information of the region blocks in the second row is 2 units height, and the block height information of the region blocks in the third row is 3 units height.
[0099] In real-world scenarios, when observing the sky from the horizon, the saturation of the sky near the horizon is relatively low, gradually increasing with viewpoint height. Therefore, target weights can be set based on the block height information of regions within the sky, resulting in smaller saturation enhancements for blocks near the horizon and larger saturation enhancements for higher blocks. Thus, when the target attribute is saturation, the larger the block height information of the region, the larger the target weight should be set for that region.
[0100] Understandably, when the target attribute is hue or lightness, the target weight of the region block can be set according to the block height information. This reflects the influence of block height information on the target attribute, causing the target attribute of each region block to vary vertically, thus improving the effect of subsequent color adjustments. In other words, the target weight of the region block is determined based on its block height information.
[0101] In real-world scenarios, applying different target weights to different regions within the sky region can lead to color stratification issues. Therefore, adjusting the target weights based on the target attribute data of pixels within a region can achieve color balance and reduce these issues. Thus, the target weights of a region are determined based on the target attribute data of at least two pixels within the region and the region's height information.
[0102] Of course, the target weight can also be determined based on the target attribute data of at least two pixels in the region block. This way, the horizontal color change between regions blocks can be smoother after color adjustment. Therefore, the target weight of the region block can be determined based on the target attribute data of at least two pixels in the region block.
[0103] S630 adjusts the color of the region block based on the adjusted offset and the target weight of the region block.
[0104] That is, based on the overall adjustment offset and the target weight of each region block, the color of the region block is adjusted in terms of the target attribute.
[0105] In this embodiment, color adjustment is performed on the regional blocks based on the adjustment offset and the target weight of the regional blocks. The adjustment offset is determined based on the target attribute data of each pixel in the sky region and the expected adjustment effect. Therefore, after color adjustment, the regional blocks can achieve the desired adjustment effect as much as possible. Moreover, the target weight is determined based on the block height information of the regional blocks and / or the target attribute data of the pixels in the regional blocks. Different weights are assigned to regional blocks with different block heights, resulting in vertical variations in the target attributes of each regional block, which conforms to the image effect in the actual scene and improves the color adjustment effect. The target attribute data of different regional blocks are different. Therefore, setting the target weight based on the target attribute data in the regional blocks can make the color changes in each regional block smoother, reduce layering problems, and improve the color adjustment effect. Furthermore, compared to the method of applying equal color adjustment to the entire sky region, this embodiment performs color adjustment by blocks, which can avoid artifacts caused by over-enhancement near the horizon and achieve an adaptive color adjustment method based on the color distribution characteristics of the sky.
[0106] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the target weight determination step in S620 is refined.
[0107] See Figure 7 The detailed steps for determining target weights include:
[0108] S710 determines the average target attribute of the region block based on the target attribute data of each pixel in the region block.
[0109] Understandably, the mean of the target attributes of a region block is the mean of the target attribute data of each pixel in that region block.
[0110] S720: Select the maximum value from the mean of the target attributes of each region block.
[0111] The extreme values can include the maximum value and / or the minimum value.
[0112] S730, determine the first weight of the region block based on the maximum and minimum values and the mean of the target attributes of the region block.
[0113] For example, the difference between the mean of the target attribute of a region block and the minimum value mentioned above is used to obtain a first difference; the difference between the maximum value and the minimum value mentioned above is used to obtain a second difference; the ratio between the first difference and the second difference is used as a first weight. In this case, the larger the mean of the target attribute of a region block, the larger the first weight corresponding to that region block.
[0114] Of course, other methods for determining the first weight can also be used, which are not limited here.
[0115] S740 determines the second weight of the region block based on the block height information of the region block.
[0116] For example, the ratio between the block height information of a region block and the maximum block height information among all region blocks is used as the first ratio; the difference between 1 and the first ratio is used as the second weight. In this case, the larger the block height information of a region block, the larger the second weight of that region block.
[0117] Of course, other methods for determining the second weight can also be used, which are not limited here.
[0118] S750 determines the target weight of the region block based on the first weight and / or second weight of the region block.
[0119] That is, the first weight of a region block is used as the target weight of the region block, or the second weight of a region block is used as the target weight of the region block, or the target weight of the region block is determined based on the first weight and the second weight of the region block.
[0120] For example, the specific method for determining the target weight of a region block based on its first and second weights can be as follows: the weighted sum of the first and second weights of the region block is taken as the target weight. When performing the weighted summation, the weight factors corresponding to the first and second weights can be set as needed and are not limited here. For example, if the weight factor corresponding to the first weight is 0.4 and the weight factor corresponding to the second weight is 0.6, then the target weight = 0.4 * first weight + 0.6 * second weight.
[0121] In this embodiment, a first weight is set based on the maximum and minimum values and the average target attribute value of the region block. The first weight reflects the importance of the target attribute data of the pixels in the region block. A second weight is determined based on the block height information of the region block. The second weight reflects the importance of the block height information of the region block. Thus, the target weight determined by the first weight and / or the second weight of the region block can reflect the importance of the target attribute data and / or block height information of the pixels in the region block. This can improve the effect of color adjustment when performing color adjustment based on the target weight.
[0122] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the color adjustment steps in S630 are refined.
[0123] See Figure 8 The detailed color adjustment steps include:
[0124] S810, determine the offset component corresponding to the region block based on the adjusted offset and the target weight corresponding to the region block.
[0125] The larger the target weight of a region block, the larger the offset component that region block can obtain.
[0126] The offset component of a region block can be understood as the degree of adjustment when that region block makes color adjustments for the target attribute.
[0127] One method is to multiply the adjustment offset by the target weight corresponding to a region block to obtain the offset component corresponding to that region block.
[0128] S820, determine the adjusted target attribute component corresponding to the region block based on the offset component and the mean value of the target attribute corresponding to the region block.
[0129] The mean of the target attributes of a region block is the average value of the target attribute data of each pixel in that region block. For example, the average saturation of each pixel in a region block is the average saturation value of that region block.
[0130] In this context, the adjusted target attribute component of a region block can be understood as the target attribute data of that region block after color adjustment.
[0131] In this process, the offset component corresponding to a region block and the target score corresponding to that region block can be added together to obtain the adjusted target attribute component corresponding to that region block.
[0132] S830, adjust the target attribute data of the region block to the adjusted target attribute component.
[0133] That is, the target attribute data of each pixel in a region block is adjusted to the adjusted target attribute component corresponding to that region block, thereby achieving color adjustment of that region block.
[0134] In the above implementation, the offset component of the region block is determined based on the adjustment offset and the target weight of the region block, thereby calculating the adjusted target attribute component of the region block. Then, the target attribute data of the region block is adjusted to the adjusted target attribute component, so as to achieve the color adjustment of the region block for the target attribute, so that the region block can achieve the desired adjustment effect.
[0135] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which see... Figure 9 Image color adjustment methods include:
[0136] S901, Obtain the image to be adjusted.
[0137] S902, determine the category feature data of each pixel in the image to be adjusted based on the attribute data of each pixel in the RGB color space.
[0138] S903, determine the candidate type of the pixel in the RGB color space based on the relationship between the category feature data of the pixel and the preset type threshold; or, determine the candidate type of the pixel in the RGB color space based on the difference between the category feature data of the pixel and the category feature data of the reference pixel, and the candidate type of the reference pixel.
[0139] S904. Based on the relationship between the attribute data of each pixel in the image to be adjusted under different color attributes in the HSV color space and the attribute data range of the corresponding color attribute, determine the candidate type of the pixel in the HSV color space.
[0140] S905 determines the target type of a pixel based on the candidate types of each pixel in different color spaces.
[0141] S906, based on the pixels whose target type is cloud, perform cloud removal processing on the image to be adjusted to obtain the sky area.
[0142] S907 determines the adjustment offset of the sky region based on the target attribute data of each pixel in the sky region under the preset color space and the expected adjustment effect.
[0143] S908, for each region block, determine the mean of the target attributes of the region block based on the target attribute data of at least two pixels in the region block; select the maximum value from the mean of the target attributes of each region block; determine the first weight of the region block based on the maximum value and the mean of the target attributes of the region block; determine the second weight of the region block based on the block height information of the region block; determine the target weight of the region block based on the first weight and / or the second weight of the region block.
[0144] S909, determine the offset component corresponding to the region block based on the adjusted offset and the target weight corresponding to the region block; determine the adjusted target attribute component corresponding to the region block based on the offset component corresponding to the region block and the mean of the target attribute; adjust the target attribute data of the region block to the adjusted target attribute component.
[0145] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0146] Based on the same inventive concept, this application also provides an image color adjustment apparatus for implementing the image color adjustment method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more image color adjustment apparatus embodiments provided below can be found in the limitations of the image color adjustment method described above, and will not be repeated here.
[0147] In one exemplary embodiment, an image color adjustment device is provided, see [link to relevant documentation]. Figure 10 The device includes: an image acquisition module 1010, a first determination module 1020, a second determination module 1030, a cloud removal processing module 1040, and a color adjustment module 1050, wherein:
[0148] Image acquisition module 1010 is used to acquire the image to be adjusted;
[0149] The first determining module 1020 is used to determine the candidate type of a pixel in a corresponding color space based on the attribute data of each pixel in the image to be adjusted in different color spaces.
[0150] The second determining module 1030 is used to determine the target type of a pixel based on the candidate types of each pixel in different color spaces.
[0151] The cloud removal module 1040 is used to perform cloud removal processing on the image to be adjusted based on each pixel whose target type is white cloud, so as to obtain the sky area.
[0152] The color adjustment module 1050 is used to adjust the color of the sky area based on the target attribute data of each pixel in the sky area under a preset color space.
[0153] In one embodiment, the color space includes the RGB color space; the first determining module includes: a first determining unit, configured to determine the category feature data of each pixel in the image to be adjusted based on the attribute data of each pixel in the RGB color space; and a second determining unit, configured to determine the candidate type of the pixel in the RGB color space based on the category feature data of the pixel.
[0154] In one embodiment, the second determining unit is specifically used to: determine the candidate type of a pixel in the RGB color space based on the size relationship between the category feature data of the pixel and the preset type threshold; and / or, determine the candidate type of a pixel in the RGB color space based on the difference between the category feature data of the pixel and the category feature data of a reference pixel, and the candidate type of the reference pixel; wherein, the reference pixel is an adjacent pixel with a known candidate type in the adjacent row of the pixel.
[0155] In one embodiment, the color space includes the hue, saturation, and lightness HSV color space; the first determining module includes: a third determining unit, used to determine the candidate type of the pixel in the HSV color space based on the relationship between the attribute data of each pixel in the image to be adjusted under different color attributes in the HSV color space and the attribute data range of the corresponding color attribute.
[0156] In one embodiment, the sky region includes at least one non-overlapping region block; the color adjustment module includes: a fourth determining unit, configured to determine the adjustment offset of the sky region based on the target attribute data of each pixel in the sky region under a preset color space and the expected adjustment effect; a fifth determining unit, configured to determine the target weight of each region block based on the target attribute data of at least two pixels in the region block and / or the block height information of the region block; and a color adjustment unit, configured to perform color adjustment on the region block based on the adjustment offset and the target weight of the region block.
[0157] In one embodiment, the fifth determining unit is specifically configured to: determine the mean of the target attributes of the region block based on the target attribute data of at least two pixels in the region block; select the maximum value from the mean of the target attributes of each region block; determine the first weight of the region block based on the maximum value and the mean of the target attributes of the region block; determine the second weight of the region block based on the block height information of the region block; and determine the target weight of the region block based on the first weight and / or the second weight of the region block.
[0158] Each module in the aforementioned image color adjustment device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0159] In one exemplary embodiment, a computer device is provided, the internal structure of which can be as shown in the figure. Figure 11 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements an image color adjustment method.
[0160] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0161] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the image color adjustment methods provided in the above embodiments.
[0162] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image color adjustment methods provided in the above embodiments.
[0163] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the image color adjustment methods provided in the above embodiments.
[0164] The image color adjustment methods provided in the above embodiments can be executed by a chip or a chip module; the image color adjustment devices provided in the above embodiments can be chips or chip modules. Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all included modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all included modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0165] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0166] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0167] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0168] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. An image color adjustment method, characterized in that, include: Obtain the image to be adjusted; Based on the attribute data of each pixel in the image to be adjusted in different color spaces, determine the candidate type of the pixel in the corresponding color space; The target type of the pixel is determined based on the candidate types of each pixel in different color spaces; Based on the pixels belonging to the cloud type of the target type, the image to be adjusted is processed to remove clouds to obtain the sky region; the sky region includes at least one non-overlapping region block. The adjustment offset of the sky region is determined based on the target attribute data of each pixel in the sky region under the preset color space and the expected adjustment effect. For each region block, the target weight of the region block is determined based on the target attribute data of at least two pixels in the region block and / or the block height information of the region block; The target attribute data is the current data of the target attribute. When the target attribute is saturation, the target weight is positively correlated with the block height information. The region block is color-adjusted based on the adjustment offset and the target weight of the region block.
2. The method according to claim 1, characterized in that, The color space includes the RGB color space (red, green, blue); determining the candidate type of each pixel in the image to be adjusted in a corresponding color space based on the attribute data of each pixel in different color spaces includes: Based on the attribute data of each pixel in the image to be adjusted in the RGB color space, determine the category feature data of the pixel; Based on the category feature data of the pixel, the candidate type of the pixel in the RGB color space is determined.
3. The method according to claim 2, characterized in that, The step of determining the candidate type of the pixel in the RGB color space based on the category feature data of the pixel includes: Based on the relationship between the category feature data of the pixel and the preset type threshold, the candidate type of the pixel in the RGB color space is determined; And / or, based on the difference between the category feature data of the pixel and the category feature data of the reference pixel, and the candidate type of the reference pixel, determine the candidate type of the pixel in the RGB color space; wherein, the reference pixel is a neighboring pixel with a known candidate type in the adjacent row of the pixel.
4. The method according to claim 1, characterized in that, The color space includes the hue, saturation, and lightness HSV color space; determining the candidate type of each pixel in the image to be adjusted in the corresponding color space based on the attribute data of each pixel in different color spaces includes: Based on the relationship between the attribute data of each pixel in the image to be adjusted under different color attributes in the HSV color space and the attribute data range of the corresponding color attribute, the candidate type of the pixel in the HSV color space is determined.
5. The method according to any one of claims 1, characterized in that, The step of determining the target weight of the region block based on the target attribute data of at least two pixels in the region block, and / or the block height information of the region block, includes: The mean value of the target attribute of the region block is determined based on the target attribute data of at least two pixels in the region block; Select the maximum or minimum value from the mean of the target attributes of each of the aforementioned regions; The first weight of the region block is determined based on the maximum and minimum values and the mean of the target attributes of the region block; The second weight of the region block is determined based on the block height information of the region block; The target weight of the region block is determined based on the first weight and / or second weight of the region block.
6. The method according to claim 5, characterized in that, The step of determining the first weight of the region block based on the maximum / minimum value and the mean of the target attribute of the region block includes: The first difference is obtained by subtracting the mean of the target attributes of the region block from the minimum value among the extreme values. The second difference is obtained by subtracting the maximum value from the minimum value among the extreme values; The ratio between the first difference and the second difference is used as the first weight.
7. An image color adjustment device, characterized in that, include: The image acquisition module is used to acquire the image to be adjusted. The first determining module is used to determine the candidate type of the pixel in the corresponding color space based on the attribute data of each pixel in the image to be adjusted in different color spaces. The second determining module is used to determine the target type of the pixel based on the candidate types of each pixel in different color spaces; The cloud removal module is used to perform cloud removal processing on the image to be adjusted based on each pixel that belongs to the white cloud type of the target type, so as to obtain the sky area; The sky region includes at least one non-overlapping region block; The color adjustment module includes: a fourth determining unit, used to determine the adjustment offset of the sky region based on the target attribute data of each pixel in the sky region under a preset color space and the expected adjustment effect; a fifth determining unit, used to determine the target weight of each region block based on the target attribute data of at least two pixels in the region block and / or the block height information of the region block; wherein the target attribute data is the current data of the target attribute, and the target weight is positively correlated with the block height information when the target attribute is saturation; and a color adjustment unit, used to perform color adjustment on the region block based on the adjustment offset and the target weight of the region block.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
A color image segmentation method
CN101216891A
Image color recognition method, computer equipment and storage medium
CN119444876A
