Method, device and equipment for generating any pure-color background of commodity graph and medium

By using BiRefNet and the depth and lineart modules to assist in generating pure color backgrounds, combined with the Stable Diffusion algorithm, the problem of generating consistent and diverse pure color backgrounds in traditional methods is solved, achieving efficient and accurate color calibration and improving product display effects.

CN120747282APending Publication Date: 2025-10-03ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510916219.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-04-30
Filing Date
2025-07-03
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Traditional methods have difficulty generating consistent and diverse solid color backgrounds, and manual operations are complex and inefficient, affecting product display effects and costs.

Method used

The BiRefNet cutout model and the depth and lineart modules are used to assist in generating a solid color background. Combined with the Stable Diffusion algorithm, a solid color background that meets user needs is generated through color calibration.

Benefits of technology

It can quickly and accurately generate pure color backgrounds of any color, improve processing efficiency and product display quality, reduce labor costs, and have good compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747282A_ABST
    Figure CN120747282A_ABST
Patent Text Reader

Abstract

The invention provides a method, device and equipment for generating any pure-color background for a commodity graph and a medium, and the method comprises the steps: carrying out the matting of a set commodity graph, and obtaining a background-removed graph; filling the background of the background-removed image into white to obtain a commodity white base image; a depth image and a line image are obtained; the method comprises the following steps of: guiding Stable Diffusion to draw and generate an intermediate image with a pure color background through a control net; extracting channel information of the intermediate graph to obtain H1, S1 and V1, and obtaining set H2, S2 and V2; traversing each pixel point of the intermediate image, traversing and modifying H1 and S1 numerical values into H2 and S2 according to a difference value, changing the whole image into H2, S2 and V1, and then converting H2, S2 and V1 from an HSV space to an RGB space to obtain a final result image; the requirement for pure-color background diversification in commodity graph display is met, and the commodity display effect and the processing efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of background mapping, and in particular to a method, device, equipment and medium for generating an arbitrary pure color background from a product image. Background Art

[0002] In product image display, a solid-color background is crucial for highlighting the main product. Currently, traditional methods for obtaining solid-color backgrounds for product images present numerous problems. Some methods rely on manual photography, which makes it difficult to ensure background consistency and purity, and the photography process is significantly affected by factors such as the environment and equipment. Existing image processing technologies, however, cannot meet user requirements for different background colors when generating solid-color backgrounds. Changing the background color often requires complex manual operations, which is inefficient and difficult to implement in batches. This not only increases labor costs but also impacts the overall effectiveness and efficiency of product display. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for generating an arbitrary solid color background from a product image, using a white background as a pad image, and assisting in generating a solid color background with the help of a depth and lineart control network, and being able to quickly calibrate the background color according to the color specified by the user, so as to meet the diverse needs for solid color backgrounds in product image display and improve product display effects and processing efficiency.

[0004] In a first aspect, the present invention provides a method for generating an arbitrary solid color background from a product image, comprising the following steps:

[0005] Step 1: Use the BiRefNet cutout model to cut out the set product image and obtain the background-removed image;

[0006] Step 2: Composite the image with the background removed with a white background image with a grayscale value of 255, and fill the background of the image with the background removed with white to obtain a product image with a white background;

[0007] Step 3: Input the product white background image into the depth module to obtain a depth image; input the product white background image into the lineart module to obtain a lineart image;

[0008] Step 4: Send the depth image and lineart image to controlnet respectively, and use controlnet to guide Stable Diffusion to draw the intermediate image of the solid color background;

[0009] Step 5: Convert the intermediate image from the RGB color space to the HSV color space, extract the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtain H1, S1, and V1, and obtain the set H2, S2, and V2;

[0010] Step 6. By traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, the entire image becomes H2, S2, V1, and then converting H2, S2, V1 from HSV space to RGB space to obtain the final result image.

[0011] In a second aspect, the present invention provides a device for generating an arbitrary solid color background from a product image, comprising:

[0012] The background removal unit cuts out the set product image using the BiRefNet cutout model to obtain the background-removed image;

[0013] Fill the background unit, synthesize the background-removed image with a white background image with a grayscale value of 255, and fill the background of the background-removed image with white to obtain a white background image of the product;

[0014] The guidance image unit inputs the product white background image into the depth module to obtain a depth image; the product white background image is input into the lineart module to obtain a lineart image;

[0015] Generate an intermediate unit, send the depth image and lineart image to the control network respectively, and use the control network to guide the Stable Diffusion to draw the intermediate image with a solid color background;

[0016] The channel conversion unit converts the intermediate image from the RGB color space to the HSV color space, extracts the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtains H1, S1, and V1, and obtains the set H2, S2, and V2;

[0017] Generate the result unit by traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, and the entire image becomes H2, S2, V1. Then convert H2, S2, V1 from HSV space to RGB space to get the final result image.

[0018] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when the program is executed by a processor.

[0020] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:

[0021] 1. Efficiency: Compared to traditional manual methods of generating pure background colors or complex image processing, this method utilizes a generative and optimized Stable Diffusion algorithm, coupled with a depth module and lineart module to control the network-assisted generation of pure background colors and rapidly complete color calibration. This reduces the processing time for a single image from several minutes or even longer with traditional manual operations to just seconds, significantly improving processing efficiency and meeting the demand for batch generation of pure background colors for product images.

[0022] 2. Accuracy: A precise color calibration algorithm accurately generates a pure background color that matches the user's specified color. Color deviation is kept to a minimum, ensuring that the product image background color is consistent with user expectations, enhancing the quality and professionalism of product display. Furthermore, the depth module and lineart module control the network-assisted generated background, resulting in superior stability and structural rationality, ensuring a more integrated look with the product.

[0023] 3. Flexibility: Users can freely specify any color as a solid background for product images. This system can quickly respond and complete color calibration, meeting the need for diverse background colors in product displays. Whether it's common colors or special custom colors, it can be easily achieved, providing more creativity and options for product display.

[0024] 4. Compatibility: This invention can be seamlessly integrated into existing product image processing workflows and is highly compatible with other image processing technologies and software. For example, it can be integrated with existing product image editing software as a functional module for solid color background generation and color adjustment, making it easier for users to integrate into existing workflows and reducing the barriers to entry and costs of technology application.

[0025] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0027] Figure 1 This is a flowchart of the method in Example 1 of the present invention;

[0028] Figure 2 This is a schematic diagram of the structure of the device in Example 2 of the present invention. DETAILED DESCRIPTION

[0029] The embodiments of the present application provide a method, apparatus, device and medium for generating an arbitrary solid color background from a product image, utilize a white background as a pad image, and assist in generating a solid color background with the help of a depth and lineart control network. The method can also quickly calibrate the background color according to the color specified by the user to meet the diverse needs for solid color backgrounds in product image displays, thereby improving product display effects and processing efficiency.

[0030] The technical solutions in the embodiments of this application have the following general ideas:

[0031] BiRefNet is a high-resolution image segmentation framework based on deep learning, which is often used to segment product images and backgrounds.

[0032] Depth module: A module used to extract image depth information. The depth image it outputs can reflect the distance relationship of objects in the image and provide reference information of the depth dimension for generating a solid color background.

[0033] Lineart module: This module is used to extract the line structure of an image. The generated lineart image can highlight the contours and line features of the image, and assist in generating a more structured solid color background.

[0034] ControlNet: The control generation network in diffusion models can guide the generation of corresponding images based on the input image features (such as depth images and lineart images). In this invention, it is used to guide Stable Diffusion to generate a solid color background.

[0035] The main implementation of the algorithm is as follows:

[0036] (1) Use BiRefNet to cut out the product image and mark the synthesized area. The algorithm then processes only the background of the product image.

[0037] (2) Composite the transparent image with a white background image with a grayscale value of 255, and fill the background of the transparent image with white to obtain a white background product image.

[0038] (3) Send the white background product image to the depth module and lineart module to extract the depth image and lineart image respectively, and obtain the depth image and lineart image.

[0039] (4) Input the white background product image into the stable diffusion model, and send the depth image and lineart image into the control network. At the same time, enable the color detail control plug-in CD-Tuner, set the redraw amplitude to 0.85, and set the reference weights of the lineart module and the depth module to 0.5 and 0.6 respectively. This guides the stable diffusion drawing to generate a preliminary solid color background. During the generation process, CD-Tuner optimizes and adjusts the color details to make the solid color background more pure and natural.

[0040] For example: CD-Tuner parameter setting details: To accurately generate a red background, in CD-Tuner, first adjust the Hue parameter to the hue range corresponding to red. Generally, the hue value of red is 0°. Set the Saturation parameter to 0.8 and the Value or Brightness parameter to 0.6.

[0041] (5) Convert the intermediate image from the common RGB color space to the HSV color space, extract the H channel, S channel, and V channel information of the intermediate image in the HSV color space, and store them as H1, S1, and V1 respectively. Convert the user input RGB information into HSV channels and name them H2, S2, and V2;

[0042] (6) Adjust the color of each pixel of the initial solid color background. By traversing each pixel of the image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, the entire image will change to H2, S2, V1. Then, convert H2, S2, V1 from HSV space to RGB space to obtain the final result image.

[0043] Example 1

[0044] like Figure 1 As shown, this embodiment provides a method for generating an arbitrary solid color background from a product image, including the following steps:

[0045] Step 1: Use the BiRefNet cutout model to cut out the set product image and obtain the background-removed image;

[0046] Step 2: Composite the image with the background removed with a white background image with a grayscale value of 255, and fill the background of the image with the background removed with white to obtain a product image with a white background;

[0047] Step 3: Input the product white background image into the depth module to obtain a depth image; input the product white background image into the lineart module to obtain a lineart image;

[0048] Step 4: Send the depth image and lineart image to controlnet respectively, and use controlnet to guide Stable Diffusion to draw the intermediate image of the solid color background;

[0049] Step 5: Convert the intermediate image from the RGB color space to the HSV color space, extract the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtain H1, S1, and V1, and obtain the set H2, S2, and V2;

[0050] Step 6. By traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, the entire image becomes H2, S2, V1, and then converting H2, S2, V1 from HSV space to RGB space to obtain the final result image.

[0051] In this embodiment, preferably, step 4 is specifically as follows: inputting the white background product image into the stable diffusion model, sending the depth image and the lineart image to the controlnet respectively, enabling the color detail control plug-in CD-Tuner at the same time, setting the redrawing amplitude to 0.85, setting the reference weights of the lineart module and the depth module to 0.5 and 0.6 respectively, and guiding the Stable Diffusion drawing to generate an intermediate image with a solid color background through the controlnet.

[0052] In this embodiment, preferably, step 5 is specifically: converting the intermediate image from the RGB color space to the HSV color space, extracting the H channel information, S channel information and V channel information of the intermediate image in the HSV color space to obtain H1, S1, and V1, and converting the user input RGB information into HSV channel information to obtain H2, S2, and V2.

[0053] Based on the same inventive concept, this application also provides a device corresponding to the method in Example 1, see Example 2 for details.

[0054] Example 2

[0055] like Figure 2 As shown, in this embodiment, a device for generating an arbitrary solid color background from a product image is provided, comprising:

[0056] The background removal unit cuts out the set product image using the BiRefNet cutout model to obtain the background-removed image;

[0057] Fill the background unit, synthesize the background-removed image with a white background image with a grayscale value of 255, and fill the background of the background-removed image with white to obtain a white background image of the product;

[0058] The guidance image unit inputs the product white background image into the depth module to obtain a depth image; the product white background image is input into the lineart module to obtain a lineart image;

[0059] Generate an intermediate unit, send the depth image and lineart image to the control network respectively, and use the control network to guide the Stable Diffusion to draw the intermediate image with a solid color background;

[0060] The channel conversion unit converts the intermediate image from the RGB color space to the HSV color space, extracts the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtains H1, S1, and V1, and obtains the set H2, S2, and V2;

[0061] Generate the result unit by traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, and the entire image becomes H2, S2, V1. Then convert H2, S2, V1 from HSV space to RGB space to get the final result image.

[0062] In this embodiment, preferably, the intermediate unit generation is specifically as follows: inputting the white background product image into the stable diffusion model, sending the depth image and the lineart image to the controlnet respectively, and enabling the color detail control plug-in CD-Tuner at the same time, setting the redrawing amplitude to 0.85, setting the reference weights of the lineart module and the depth module to 0.5 and 0.6 respectively, and guiding the Stable Diffusion to draw and generate the intermediate image with a solid color background through the controlnet.

[0063] In this embodiment, preferably, the channel conversion unit specifically converts the intermediate image from the RGB color space to the HSV color space, extracts the H channel information, S channel information and V channel information of the intermediate image in the HSV color space to obtain H1, S1, and V1, and converts the user input RGB information into HSV channel information to obtain H2, S2, and V2.

[0064] Since the device described in the second embodiment of the present invention is used to implement the method of the first embodiment of the present invention, those skilled in the art will be able to understand the specific structure and variations of the device based on the method described in the first embodiment of the present invention, and therefore will not be described in detail here. All devices used in the method of the first embodiment of the present invention fall within the scope of protection of the present invention.

[0065] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, see the third embodiment for details.

[0066] Example 3

[0067] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.

[0068] Since the electronic device described in this embodiment is the device used to implement the method in Example 1 of this application, based on the method described in Example 1 of this application, those skilled in the art will be able to understand the specific implementation of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection to be provided by this application.

[0069] Based on the same inventive concept, this application provides a storage medium corresponding to Example 1, see Example 4 for details.

[0070] Example 4

[0071] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any implementation method in the first embodiment can be implemented.

[0072] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

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

[0074] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0075] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0076] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for generating an arbitrary solid color background from a product image, characterized by: The steps include: Step 1: Use the BiRefNet cutout model to cut out the set product image and obtain the background-removed image; Step 2: Composite the image with the background removed with a white background image with a grayscale value of 255, and fill the background of the image with the background removed with white to obtain a product image with a white background; Step 3: Input the product white background image into the depth module to obtain a depth image; input the product white background image into the lineart module to obtain a lineart image; Step 4: Input the product image with white background into the stable diffusion model, and send the depth image and lineart image to the control network respectively. The control network guides the Stable Diffusion model to draw the intermediate image with solid color background. Step 5: Convert the intermediate image from the RGB color space to the HSV color space, extract the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtain H1, S1, and V1, and obtain the set H2, S2, and V2; Step 6. By traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, the entire image becomes H2, S2, V1, and then converting H2, S2, V1 from HSV space to RGB space to obtain the final result image.

2. The method for generating an arbitrary solid color background from a product image according to claim 1, characterized in that: The step 4 is specifically as follows: inputting the white background product image into the stable diffusion model, sending the depth image and the lineart image to the controlnet respectively, enabling the color detail control plug-in CD-Tuner at the same time, setting the redraw amplitude to 0.85, setting the reference weights of the lineart module and the depth module to 0.5 and 0.6 respectively, and guiding the Stable Diffusion to draw an intermediate image with a solid color background through the controlnet.

3. The method for generating an arbitrary solid color background from a product image according to claim 1, characterized in that: The step 5 is specifically as follows: converting the intermediate image from the RGB color space to the HSV color space, extracting the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space to obtain H1, S1, and V1, and converting the user input RGB information into HSV channel information to obtain H2, S2, and V2.

4. A device for generating an arbitrary solid color background from a product image, characterized by: include: The background removal unit cuts out the set product image using the BiRefNet cutout model to obtain the background-removed image; Fill the background unit, synthesize the background-removed image with a white background image with a grayscale value of 255, and fill the background of the background-removed image with white to obtain a white background image of the product; The guidance image unit inputs the product white background image into the depth module to obtain a depth image; the product white background image is input into the lineart module to obtain a lineart image; Generate an intermediate unit, input the white background product image into the stable diffusion model, send the depth image and lineart image to the control network respectively, and use the control network to guide the stable diffusion to draw the intermediate image with a solid color background; The channel conversion unit converts the intermediate image from the RGB color space to the HSV color space, extracts the H channel information, S channel information, and V channel information of the intermediate image in the HSV color space, obtains H1, S1, and V1, and obtains the set H2, S2, and V2; Generate the result unit by traversing each pixel point in the intermediate image, modifying its H1 and S1 values ​​to H2 and S2 according to the difference, and the entire image becomes H2, S2, V1. Then convert H2, S2, V1 from HSV space to RGB space to get the final result image.

5. The device for generating an arbitrary solid color background from a product image according to claim 4, characterized in that: The specific steps of generating the intermediate unit are as follows: inputting the white background product image into the stable diffusion model, sending the depth image and the lineart image to the control network respectively, enabling the color detail control plug-in CD-Tuner at the same time, setting the redrawing amplitude to 0.85, setting the reference weights of the lineart module and the depth module to 0.5 and 0.6 respectively, and guiding the Stable Diffusion to draw the intermediate image with a solid color background through the control network.

6. The device for generating an arbitrary solid color background from a product image according to claim 4, characterized in that: The channel conversion unit specifically converts the intermediate image from the RGB color space to the HSV color space, extracts the H channel information, S channel information and V channel information of the intermediate image in the HSV color space to obtain H1, S1, and V1, and converts the user input RGB information into HSV channel information to obtain H2, S2, and V2.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 3 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Highly adaptive image contrast enhancing method based on data driving technology

    CN104463806A

  • Automatic matting method based on U2-Net

    CN114359324A

  • E-commerce product poster generation method of image generation tool based on artificial intelligence

    CN117726718A

  • Method and Apparatus for Standardizing Pathological Slide Image Color Using HSV Color Space and CLAHE

    KR102395664B1

  • Method for obtaining three-dimensional model by means of photographing, method for obtaining picture by means of three-dimensional model, part machining method, and 3D printer

    WO2025021234A1