Color compounding method for image, color compounding device and readable medium
By using segmentation model and LAB color space in image complex technology, combining camera response curve and human eye correction to optimize LAB difference, the problem of unfine and inconsistent image complex color in the prior art is solved, and high-precision and stable image complex color effect is achieved.
Patent Information
- Application Number
- CN202411960038.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-16
AI Technical Summary
Existing image complex technology is difficult to achieve fine complexing, and manual operations are complex and inefficient. The automation method is poor in handling complex backgrounds and irregular graphics, resulting in inconsistency and loss of color adjustments.
The target area is extracted using the segmentation model, and the target color and target area are converted to the LAB color space respectively, and the LAB difference is optimized by combining the camera response curve and human eye correction, and finally the optimized LAB difference is superimposed on the target area to achieve image complex color.
It improves the accuracy and consistency of image complex colors, ensures the accuracy and stability of complex colors adjustment, and is suitable for complex backgrounds and rich details images, avoiding the loss of image details.
Smart Images

Figure CN120013838A_ABST
Abstract
Description
Technical Field
[0001] The present application generally relates to the technical field of image color reproduction, and more specifically, to a color reproduction method, a color reproduction device and a computer-readable storage medium for an image. Background Art
[0002] Image color restoration technology can change the overall tone of an image, making it look more saturated, brighter, or softer. Traditional image color restoration adjustments mainly rely on manually operated design tools (such as Adobe Photoshop, GIMP, etc.) and manual fixed area adjustments. However, manual design tools are powerful but complex to operate, require professional skills, and are inefficient to operate manually, making it difficult to quickly and batch process a large number of product images. Fixed area adjustment methods usually assume that the area to be adjusted is a simple regular shape (such as a rectangle or circle). This method does not work well when dealing with complex backgrounds and irregular graphics. For images with multiple colors or complex patterns, manual adjustment is extremely difficult and time-consuming.
[0003] At present, existing image color restoration methods have been automated through color restoration adjustments, such as color mapping and replacement, deep learning-based image processing and style transfer and color migration. Among them, color mapping and replacement often simply replace colors and lack precise color adjustment capabilities. Simple color mapping easily leads to unnatural changes in hue, brightness and saturation, and the final effect is poor. Deep learning has made significant progress in image segmentation and restoration. For example, models such as ResNet and U-Net are widely used in image segmentation tasks. Deep learning technology can generate high-precision image segmentation results by learning a large amount of data, but these models usually have high hardware requirements and limited processing speed. Color migration and style transfer technologies achieve color changes by matching the color histogram or other features of the image, but the existing algorithms still need to be improved when dealing with edge transitions and complex backgrounds. Color restoration requires correction of the camera response curves of different devices to ensure color consistency and visual effects. In addition, existing methods are usually based on pixel value adjustment, and directly superimpose pixel differences on the required color restoration area, which will cause image details to be lost and lead to inaccurate color restoration.
[0004] In view of this, there is an urgent need to provide a color reproduction solution for images so as to achieve fine color reproduction and ensure the accuracy and consistency of color reproduction adjustment. Summary of the invention
[0005] In order to at least solve one or more of the above-mentioned technical problems, the present application proposes a color complexing scheme for an image in multiple aspects.
[0006] In a first aspect, the present application provides a method for image rephrase, comprising: extracting a target color according to an image type of an image to be rephrase; in response to target guidance information, performing image segmentation on the image to be rephrase using a segmentation model to obtain a target area for desired rephrase; converting the target color and the target area into a LAB color space, respectively, to obtain a corresponding first LAB value and a second LAB value; optimizing a LAB difference between the first LAB value and the second LAB value based on a camera response curve and human eye correction to obtain an optimized LAB difference; and superimposing the optimized LAB difference on the target area to achieve image rephrase.
[0007] In a second aspect, the present application provides a complex color device for an image, comprising: a processor; and a memory on which computer instructions for complex color of an image are stored, and when the computer instructions are executed by the processor, the complex color device implements the embodiment of the aforementioned first aspect.
[0008] In a third aspect, the present application provides a computer-readable storage medium having stored thereon computer program instructions for complex color of an image, wherein when the computer program instructions are executed by one or more processors, the embodiment of the aforementioned first aspect is implemented.
[0009] Through the above-provided color retouching scheme for images, the embodiment of the present application extracts the target area by using a segmentation model to accurately locate the color retouching area, and converts the target color and the target area to the LAB color space respectively, so as to be closer to the visual perception of the human eye, so as to achieve accuracy in color management. Then, the LAB difference between the first and second LAB values corresponding to the target color and the target area is optimized by combining the camera response curve and the human eye correction. That is, by optimizing the LAB difference simultaneously through the relationship between the pixel value and the real irradiance and the human eye correction, the accuracy of the image color retouching is greatly improved, and the accuracy and consistency of the color retouching adjustment can be ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0011] Figure 1 is an exemplary schematic diagram showing color reproduction based on an existing image;
[0012] Figure 2 is an exemplary flowchart showing a method for color reproduction of an image according to an embodiment of the present application;
[0013] Figure 3is an exemplary flowchart showing a method of extracting a target color according to an embodiment of the present application;
[0014] Figure 4 is an exemplary flowchart showing how to obtain an optimized LAB difference according to an embodiment of the present application;
[0015] Figure 5 is an overall exemplary flow chart showing a method for color reproduction of an image according to an embodiment of the present application;
[0016] Figure 6 is an exemplary schematic diagram showing that the color reproduction method for an image according to an embodiment of the present application realizes image color reproduction;
[0017] Figure 7 It is an exemplary structural block diagram of a color complexing device for an image according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0019] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present application indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0020] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0021] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" 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" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0022] Figure 1 FIG. 1 is an exemplary schematic diagram showing color reproduction based on an existing image. Figure 1 Figure (a) shows the original image to be recolored, Figure (b) shows the target area to be recolored, where the target color is black, and Figure (c) shows the recolored result. According to the background technology description, the existing image recoloring method is to directly superimpose the pixel difference between the target color and the target area to be recolored on the target area to complete the image recoloring. This method is only applicable to a single color, and for scenes with color gradients, directly superimposing pixel differences will result in loss of image detail information. For example Figure 1 The flower texture is lost in the complex color result image shown in Figure (c), and there is no obvious brightness change in the complex color result image, which does not conform to the human eye habits.
[0023] As mentioned above, most of the existing image color restoration methods rely on manual operation of image processing software. This not only consumes a lot of time and energy, but also has high technical requirements for operators, and has large variability and inconsistency. Manual operation is difficult to ensure the accuracy and consistency of color adjustment. For example, in e-commerce product image scenes, when adjusting large quantities of product images, it is difficult to ensure that the effect of each image is consistent, resulting in unstable quality of the finished product. In addition, the existing methods have poor processing effects in transition areas (such as the junction of the target area and the background area), and are prone to leaving obvious traces, affecting the overall appearance. In addition, some automated color restoration adjustment algorithms have long processing times due to complex calculations, and cannot meet user needs in real time, especially when processing in large quantities, and cannot automatically adjust parameters according to different pictures and scenes, resulting in poor generalization of processing effects.
[0024] Based on this, an embodiment of the present application provides a color reproduction scheme for images, which optimizes pixel differences by combining camera response curves and human eye correction, and then superimposes the optimized pixel differences on the target area to achieve fine color reproduction and ensure the accuracy and consistency of the color reproduction adjustment.
[0025] The specific implementation of the present application is described in detail below with reference to the accompanying drawings.
[0026] Figure 2FIG. 2 is an exemplary flowchart showing a method 200 for recoloring an image according to an embodiment of the present application. Figure 2 As shown in, the color restoration method 200 includes: step S201: extracting the target color according to the image type of the image to be restored; step S202: in response to the target guidance information, using the segmentation model to perform image segmentation on the image to be restored, and obtaining the target area required for color restoration; step S203: converting the target color and the target area to the LAB color space respectively to obtain the corresponding first LAB value and second LAB value; step S204: optimizing the LAB difference between the first LAB value and the second LAB value based on the camera response curve and human eye correction to obtain the optimized LAB difference; and step S205: superimposing the optimized LAB difference on the target area to achieve image restoration.
[0027] First, in step S201, a target color is extracted according to the image type of the image to be recolored.
[0028] In some embodiments, the image to be recolored may be any image that needs to be recolored, and the present application does not impose any limitation on this. Figure 1 In some embodiments, the image type is an original image or an original RGB color value. That is, the image to be recolored is in the form of an image or an RGB value. In the implementation scenario, the target color can be extracted according to the judgment result by judging whether the image to be recolored is an original image or an original RGB color value. Figure 3 Describe the extraction of target color in detail.
[0029] Next, at step S202, in response to the target guidance information, the image to be recolored is segmented using a segmentation model to obtain a target area of desired recoloring.
[0030] In some embodiments, the target guidance information may be, for example, the area information of the desired color reproduction that is guided by the user using dots, boxes or text. That is, the target area is marked by guiding points, boxes or text. In some embodiments, the aforementioned segmentation model may be, for example, a SAM model. Thus, by introducing high-precision image segmentation technologies such as the SAM model, it is possible to accurately locate and segment the target area in the image to be reproduced, ensuring that the color reproduction operation only acts on the marked area, avoiding the impact on other areas. In the implementation scenario, the SAM model can generate a mask of the target area based on the guidance information provided by the user, where a mask value of 1 represents the target area and 0 represents the non-target area.
[0031] Based on the extracted target color and target area, at step S203, the target color and the target area are respectively converted into the LAB color space to obtain corresponding first LAB value and second LAB value.
[0032] It can be understood that the aforementioned target color and target area are both in the RGB color space, so the target color and target area can be converted from the RGB color space to the LAB color space, respectively, to obtain the corresponding first LAB value and the second LAB value. In some implementation scenarios, the target color and target area can first be converted from the RGB color space to the XYZ color space by, for example, matrix multiplication, and then converted from the XYZ color space to the LAB color space, and the conversion process can be implemented in an existing manner. The converted LAB color space contains brightness information L and chromaticity information A, B, so as to be closer to the visual perception of the human eye, so that it has accuracy in color management. In an embodiment of the present application, the first LAB value can be obtained by converting the target color from RGB to LAB. By taking statistics on the LAB values in the target area and taking the median respectively, the second LAB value can be obtained.
[0033] Further, at step S204, the LAB difference between the first LAB value and the second LAB value is optimized based on the camera response curve and the human eye correction to obtain the optimized LAB difference. The camera response curve refers to the relationship curve between the output brightness value (or pixel value) of the camera under different exposures and the actual light intensity (that is, the energy referred to in the context of this application). As an example, the camera response curve can be expressed as P = a*pow(E,b)+c or E = pow((Pc) / a,1 / b), where P represents the pixel value, E represents the energy, the pow function returns the power exponent result, and a, b, and c are all constants. b<1 corresponds to a nonlinear response. For high energy values, if the same pixel value needs to be increased, additional energy can be added. c is equivalent to a minimum threshold value, and P>=c. Preferably, a∈[1e4,1e5], b∈[0.5,1.0], c∈[0,100] or a and c can be divided by 255 to perform pixel value normalization operations.
[0034] It should be understood that for pixels with low brightness, color reproduction can be achieved by superimposing pixel differences; for pixels with high brightness, the maximum value after superimposing the same pixel value difference can only be 255, so that accurate color reproduction cannot be achieved. As an example, assuming that the pixel difference is 20, for example, for low-brightness pixel 10, its superimposed pixel difference is 30; and for example, for high-brightness pixel 240, its superimposed pixel difference is 260, which exceeds the maximum brightness value of 255, so that accurate color reproduction cannot be achieved. Therefore, the present application considers the camera response curve to optimize the pixel difference by energy rather than directly based on the pixel value. In addition, the human eye is obviously sensitive to changes in brightness, but not to changes in chromaticity. For example, gray darkening, bright white, etc. can be brightened to meet human eye expectations, while corresponding colors, black, etc. can not be changed too much. Based on this, the embodiment of the present application combines the camera response curve and human eye correction to optimize the LAB difference, which can greatly improve the accuracy of image color reproduction.
[0035] After obtaining the optimized LAB difference, at step S205, the optimized LAB difference is superimposed on the target area to achieve image color restoration. Specifically, the pixel value of the target area is superimposed on the optimized LAB difference to achieve image color restoration.
[0036] Combined with the above description, it can be seen that the embodiment of the present application first extracts the target area by using a segmentation model, and converts the target color and the target area to the LAB color space respectively, and then optimizes the LAB difference between the first and second LAB values corresponding to the target color and the target area by combining the camera response curve and human eye correction, and superimposes the optimized LAB difference on the target area to achieve image color reproduction. Based on this, the segmentation model can be used to accurately locate the color reproduction area to avoid affecting other areas. By converting the target color and the target area to the LAB domain, the accuracy of color management is improved to be closer to the visual perception of the human eye. Furthermore, by optimizing the LAB difference simultaneously through the relationship between the real irradiance and pixels in the camera response curve and the habits of the human eye, the accuracy of image color reproduction is greatly improved, and the accuracy and consistency of color reproduction adjustment can be ensured.
[0037] Figure 3 is an exemplary flowchart showing the extraction of target color according to an embodiment of the present application. It should be understood that Figure 3 is the above Figure 2 A specific embodiment of step S202 in the color-reproduction method 200, so the above Figure 2 The description also applies to Figure 3 .
[0038] like Figure 3As shown in , extracting the target color may include: step S301: determining whether the image to be recolored is the original image or the original RGB color value; step S302: in response to the image to be recolored being the original image, performing median filtering on the image to be recolored to obtain the target RGB color value, and using the target RGB color value as the target color; step S303: in response to the image to be recolored being the original RGB color value, using the original RGB color value as the target color.
[0039] That is, if the image to be recolored is in the form of an image, at step S302, the target RGB color value can be extracted by, for example, median filtering, and the extracted target RGB color value is the target color. If the image to be recolored is in the form of RGB color values, at step S303, the RGB color value can be directly used as the target color.
[0040] Figure 4 FIG. 1 is an exemplary flowchart showing how to obtain an optimized LAB difference according to an embodiment of the present application. It should be understood that Figure 4 is the above Figure 2 A specific embodiment of step S204 in the color-reproduction method 200, so the above Figure 2 The description also applies to Figure 4 .
[0041] like Figure 4 As shown in, obtaining the optimized LAB difference may include: step S401: determining whether the first LAB value and / or the second LAB value are within the pixel range of human eye correction; step S402: adjusting the first LAB value and / or the second LAB value according to the determination result or retaining the original first LAB value and the second LAB value; and step S403: optimizing the LAB difference between the adjusted first LAB value and the second LAB value based on the camera response curve or optimizing the LAB difference between the original first LAB value and the second LAB value to obtain the optimized LAB difference.
[0042] That is, in the process of optimizing the LAB difference, human eye correction can be performed first, and then further optimized based on the camera response area. In some embodiments, the pixel range of human eye correction can be, for example, pixels with A and B around 0.5 and L≥0.25. Therefore, at step S401, it is first determined whether there are pixels with A and B around 0.5 and L≥0.25 in the first LAB value and / or the second LAB value.
[0043] Then, at step S402, the first LAB value and / or the second LAB value are adjusted according to the judgment result or the original first LAB value and the second LAB value are retained. In some embodiments, the step S402 may include: step S4021: in response to the first LAB value and / or the second LAB value being within the pixel range of human eye correction, the first LAB value and / or the second LAB value are adjusted to the corresponding target pixel value to obtain the adjusted first LAB value and the second LAB value. Alternatively, step S4022: in response to the first LAB value and the second LAB value not being within the pixel range of human eye correction, the original first LAB value and the second LAB value are retained. In some implementation scenarios, the aforementioned target pixel value can be set according to an empirical value. That is, when the first LAB value and / or the second LAB value are within the pixel range of human eye correction, at step S4021, the first LAB value and / or the second LAB value can be adjusted to the corresponding pixel value set. When the first LAB value and the second LAB value do not need to be corrected, at step S4022, the original first LAB value and the original second LAB value are retained.
[0044] Further, at step S403, based on the adjusted first LAB value, the second LAB value or based on the original first LAB value, the second LAB, the LAB difference is optimized under the camera response curve to obtain an optimized LAB difference. In some embodiments, the aforementioned step S403 may include: step S4031: calculating the original energy and the new energy corresponding to the target position based on the camera response curve, the adjusted first LAB value and the second LAB value or calculating the original energy and the new energy corresponding to the target position based on the camera response curve, the original first LAB value and the second LAB; step S4032: determining a new LAB value according to the difference between the original energy and the new energy and calculating a new LAB difference to obtain an optimized LAB difference.
[0045] It can be understood that the pixel values (LAB values) before and after the color adjustment at different target positions will change, while the energy before and after the color adjustment remains unchanged. Therefore, the embodiment of the present application constructs a relationship involving pixels by making the energy difference between the original energy and the new energy before and after the color adjustment at different target positions the same to calculate the new LAB value (corresponding to the new second LAB value in the target area). Correspondingly, a new LAB difference can be obtained based on the new second LAB and the first LAB value corresponding to the target color to obtain the optimized LAB difference.
[0046] In an exemplary scenario, assuming that the original energy and new energy before and after color adjustment at target position 1 are respectively recorded as Energy_ori_mean and Energy_ori, and the original energy and new energy before and after color adjustment at target position 2 are respectively recorded as Energy_res_mean and Energy_res, then Energy_res-Energy_res_mean=Energy_ori-Energy_ori_mean. According to the above, the camera response curve can be expressed as E = pow((Pc) / a, 1 / b), so the above formula can be expressed as pow((Pr-c) / a, 1 / b)-pow((Prm-c) / a, 1 / b) = pow((Po-c) / a, 1 / b)-pow((Pom-c) / a, 1 / b), where Pr represents the new second LAB value to be determined after the color adjustment at the target position 2, and Prm represents the first LAB value before the color adjustment at the target position 2; Pr represents the second LAB value after the color adjustment at the target position 1, and Prm represents the first LAB value before the color adjustment at the target position 1. As mentioned above, the first and second LAB values are based on the artificially corrected values or the original values.
[0047] Furthermore, by simplifying the above relationship to pow(Pr-c, 1 / b)-pow(Prm-c, 1 / b)=pow(Po-c, 1 / b)-pow(Pom-c, 1 / b), then pow(Pr-c, 1 / b)=pow(Prm-c, 1 / b)+pow(Po-c, 1 / b)-pow(Pom-c, 1 / b), and then calculating the new second LAB value Pr=pow(pow(Prm-c, 1 / b)+pow(Po-c, 1 / b)-pow(Pom-c, 1 / b),b)+c. In some implementation scenarios, the optimized ΔLAB value=Pr-Prm. If the LAB value corresponding to Pr is L0, A0, B0, and the LAB value corresponding to Prm is L1, A1, B1, then ΔLAB=(L1-L0, A1-A0, B1-B0). By superimposing the optimized ΔLAB value on the target area, the final complex color image can be obtained.
[0048] In combination with the above description, it can be seen that the embodiment of the present application first corrects pixels through the human eye to improve the accuracy of color management, then calculates the pixel value based on the energy difference, and then calculates the pixel difference and superimposes it to the target area, rather than directly superimposing it based on the pixel difference. In this way, more accurate pixel value changes can be obtained to improve the accuracy of image complex color.
[0049] In some embodiments, the embodiments of the present application may also include optimizing the boundaries of the target area after the image is recolored to obtain the final image result of the image recolorization. In some implementation scenarios, the boundary can be obtained by performing, for example, morphological processing on the target area. Preferably, the target area can be self-expanded minus self-eroded to obtain the boundary. Then, image restoration processing is performed along the aforementioned boundary to avoid boundary mismatch problems caused by, for example, the SAM model or other segmentation models, so that the recolored image is more complete and accurate. Preferably, the boundary can be image restored based on large mask restoration methods such as lama.
[0050] Figure 5 FIG. 1 is an overall exemplary flow chart showing a method for color reproduction of an image according to an embodiment of the present application. Figure 5 As shown in, at step S501, an image to be recolored is obtained. Based on the image to be recolored, at step S502, the image type of the image to be recolored is determined. Specifically, it is determined whether the image to be recolored is an original image or an original RGB color value. Wherein, at step S503, if the image to be recolored is in the form of an image, the target RGB color value can be extracted by, for example, median filtering to serve as the target color. At step S504, if the image to be recolored is in the form of RGB color values, the RGB color value is directly used as the target color. Then, at step S505, the target color is converted to the LAB color space to obtain a corresponding first LAB value.
[0051] At step S506, the image to be recolored is segmented using a segmentation model to extract the target area to be recolored. Preferably, the aforementioned segmentation model can be, for example, a SAM model. At step S507, the target area is converted to the LAB color space to obtain the corresponding second LAB value. Further, at step S508, it is determined whether the first LAB value and / or the second LAB value are within the pixel range of human eye correction. When the first LAB value and / or the second LAB value are within the pixel range of human eye correction, at step S509, the first LAB value and / or the second LAB value are adjusted to the corresponding target pixel value to obtain the adjusted first LAB value and the second LAB value. When it is not within the pixel range of human eye correction, at step S510, the original first LAB value and the second LAB value are retained.
[0052] Further, at step S511, the original energy and the new energy corresponding to the target position are calculated, and at step S512, a new LAB value is calculated according to the energy difference between the original energy and the new energy, and then at step S513, an optimized LAB difference value is obtained. For more details on optimizing the LAB difference value, please refer to the above Figure 4After obtaining the optimized LAB difference, at step S514, the optimized LAB difference is superimposed on the target area. At step S515, the boundary can also be optimized by, for example, morphological processing and image restoration processing to obtain the final complex color image.
[0053] Figure 6 FIG. 1 is an exemplary schematic diagram showing how the method for image color reproduction according to an embodiment of the present application realizes image color reproduction. Figure 6 Figure (a) shows the original image to be recolored. The target color is black, and its corresponding RGB value is [0,0,0]. Figure 6 Figure (b) shows the target area, and Figure (c) shows the final complex color image. As an example, assume that P1 and P2 are pixels before color adjustment at different positions, and P3 and P4 correspond to pixels after color adjustment. According to the foregoing, the energy transformed from pixel P1 to pixel P3 is the same as the energy transformed from pixel P2 to pixel P4. By constructing a relationship containing pixels with the same energy transformation, new pixel values and optimized pixel differences can be obtained, thereby obtaining the final complex color image. It can be seen from the final complex color image shown in Figure (c) that the complex color image obtained by the complex color method according to the embodiment of the present application is more accurate and no texture information is lost.
[0054] Based on the foregoing description, the embodiment of the present application accurately locates and segments the target area in the image by introducing a segmentation model (such as SAM), ensuring that the color retouching operation only acts on the predetermined part and avoids the impact on other areas. The LAB difference is optimized by combining human eye correction with the camera response curve to perform fine color retouching in the target area, thereby ensuring the accuracy and consistency of color adjustment. Based on this, it is possible to effectively process images with complex backgrounds and rich details, avoid losing image information, and ensure the accuracy and meticulousness of color adjustment. Furthermore, the embodiment of the present application also optimizes the boundary transition of the color retouching area by adopting morphological processing technology and image restoration algorithm, solves the unnatural edge phenomenon that is prone to occur in traditional methods, and makes the color retouching effect more realistic and natural.
[0055] In addition, the color recoloring method of the embodiment of the present application realizes a high degree of automation of the image color recoloring adjustment process, greatly reduces the steps and time of manual operation, and improves work efficiency. The color recoloring method of the embodiment of the present application is device-independent, can ensure color consistency under different display devices and printing devices, and improve the reliability of color management. The demand for computing resources is reduced by optimizing the algorithm, and fast processing can be achieved under ordinary hardware conditions, which is suitable for batch processing and real-time application of large-scale images. In addition, the review method of the embodiment of the present application is simple and easy to use, and even non-professionals can easily operate it, thereby reducing the cost of learning and use, and enhancing the user experience. It is applicable to multiple fields such as e-commerce, advertising design, and fashion industries, and can widely meet the color adjustment needs in different scenarios, and significantly improve image quality and product display effects.
[0056] Figure 7 FIG. 7 is an exemplary structural block diagram of a color complexing device 700 for an image according to an embodiment of the present application. Figure 7 As shown in the figure, the color reproduction device 700 of the present application may include a processor 701 and a memory 702, wherein the processor 701 and the memory 702 communicate with each other via a bus. The memory 702 stores program instructions for color reproduction of an image. When the program instructions are executed by the processor 701, the color reproduction device 700 of the present application may be implemented according to the above description in combination with the attached Figure 2-Figure 5 The method steps described are as follows: extracting a target color according to the image type of the image to be repaved; in response to target guidance information, using a segmentation model to perform image segmentation on the image to be repaved to obtain a target area for desired repaving; converting the target color and the target area to the LAB color space respectively to obtain a corresponding first LAB value and a second LAB value; optimizing the LAB difference between the first LAB value and the second LAB value based on a camera response curve and human eye correction to obtain an optimized LAB difference and superimposing the optimized LAB difference on the target area to achieve image repaving.
[0057] According to the above description in combination with the accompanying drawings, those skilled in the art can also understand that the embodiments of the present application can also be implemented by a software program. Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores computer-readable instructions for complex color of an image. When the computer-readable instructions are executed by one or more processors, the present application in combination with the accompanying drawings can be implemented. Figure 2-Figure 5 The described method for color reproduction of images.
[0058] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0059] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0060] It should be understood that when the terms "first", "second", "third" and "fourth" are used in the claims, the specification and the drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0061] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0062] Although the implementation methods of the present application are as above, the contents described are only examples adopted to facilitate the understanding of the present application, and are not intended to limit the scope and application scenarios of the present application. Any technician in the technical field described in the present application can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present application, but the scope of patent protection of the present application shall still be subject to the scope defined in the attached claims.
[0063] In addition, the collection and acquisition of various data in this application complies with relevant laws and regulations and is authorized by the data provider. Any organization or individual that needs to obtain external data must obtain authorization in accordance with the law and ensure data security. It is not allowed to illegally collect, use, process, or transmit unauthorized or unprotected data, or to illegally buy, sell, provide, or disclose unauthorized or unprotected data.
Claims
1. A method for recoloring an image, comprising: Extracting a target color according to the image type of the image to be recolored; In response to the target guidance information, using a segmentation model to perform image segmentation on the image to be replated to obtain a target area to be replated; Convert the target color and the target area into LAB color space respectively to obtain corresponding first LAB value and second LAB value; Optimizing a LAB difference between the first LAB value and the second LAB value based on a camera response curve and eye correction to obtain an optimized LAB difference; as well as The optimized LAB difference is superimposed on the target area to achieve image color reproduction.
2. The color reproduction method according to claim 1, wherein extracting the target color according to the image type of the image to be color reproduced comprises: Determine whether the image to be recolored is an original image or an original RGB color value; In response to the image to be recolored being an original image, median filtering is performed on the image to be recolored to obtain a target RGB color value, and the target RGB color value is used as the target color; or In response to the image to be recolored being original RGB color values, the original RGB color values are used as the target color.
3. The color re-coloring method according to claim 1, wherein the target guidance information at least includes area information of the color re-coloring required for guidance by the user using dots, boxes or texts. The color reproduction method according to claim 1 , wherein the segmentation model comprises a SAM model.
5. The color reproduction method according to claim 1, wherein optimizing the LAB difference between the first LAB value and the second LAB value based on a camera response curve and human eye correction to obtain an optimized LAB difference comprises: Determining whether the first LAB value and / or the second LAB value is within a pixel range corrected by the human eye; Adjust the first LAB value and / or the second LAB value according to the judgment result or retain the original first LAB value and the second LAB value; as well as The LAB difference between the adjusted first LAB value and the second LAB value is optimized based on the camera response curve, or the original LAB difference between the first LAB value and the second LAB value is optimized to obtain the optimized LAB difference.
6. The color reproduction method according to claim 5, wherein adjusting the first LAB value and / or the second LAB value or retaining the original first LAB value and the second LAB value according to the judgment result comprises: In response to the first LAB value and / or the second LAB value being within a pixel range corrected for human eyes, adjusting the first LAB value and / or the second LAB value to a corresponding target pixel value to obtain an adjusted first LAB value and a second LAB value; or In response to the first LAB value and the second LAB value both being not within the pixel range corrected for human eyes, the original first LAB value and the original second LAB value are retained.
7. The color reproduction method according to claim 5 or 6, wherein optimizing the LAB difference between the adjusted first LAB value and the second LAB value or optimizing the original LAB difference between the first LAB value and the second LAB value based on the camera response curve to obtain the optimized LAB difference comprises: Calculate the original energy and the new energy corresponding to the target position based on the camera response curve, the adjusted first LAB value and the second LAB value, or calculate the original energy and the new energy corresponding to the target position based on the camera response curve, the original first LAB value and the second LAB value; as well as A new LAB value is determined according to the difference between the original energy and the new energy, and a new LAB difference is calculated to obtain the optimized LAB difference.
8. The color retouching method according to claim 1, further comprising: The boundary of the target area after the image is recolored is optimized to obtain the final image result of the image recolorization.
9. A color reproduction device for an image, comprising: processor; as well as A memory having computer instructions for complex color of an image stored thereon, wherein when the computer instructions are executed by a processor, the complex color device implements the complex color method according to any one of claims 1 to 8.
10. A computer-readable storage medium having stored thereon computer program instructions for complex color of an image, wherein when the computer program instructions are executed by one or more processors, the complex color method according to any one of claims 1 to 8 is implemented.