A color-based image processing method, device, equipment and storage medium

By automatically determining the set of suitable pixels and colors in the image that are close to the reference color range, a target color range is generated, which solves the problem of manual adjustment caused by uneven background lighting and achieves accurate removal of background color from the image.

CN115409730BActive Publication Date: 2026-03-27QISHENG SOFTWARE TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing digital compositing software requires users to manually adjust the color range to remove the background when the background lighting is uneven, which increases the difficulty of operation and makes it easy to miss or mis-select the background.

Method used

By obtaining the reference color range of the image to be processed, determining the set of suitable pixels whose color difference is less than a specified value, recording the suitable color set, generating the target color range based on the suitable color set, and automatically removing the color of the pixels in the target color range.

Benefits of technology

It can accurately remove pixels in an image that require color removal without requiring manual adjustment by the user, reducing the difficulty of operation and improving processing accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409730B_ABST
    Figure CN115409730B_ABST
Patent Text Reader

Abstract

The application provides a color-based image processing method, device, equipment and storage medium. The image processing method comprises: acquiring a to-be-processed image and a reference color range of a pixel point in the to-be-processed image that needs to be color removed; determining an adaptive pixel point set with a color difference less than a first specified value from the reference color range from the to-be-processed image, and recording an adaptive color set corresponding to the adaptive pixel point set; determining a target color range of the pixel point in the to-be-processed image that needs to be color removed according to the adaptive color set; and generating a target image removing the color of the pixel point corresponding to the target color range according to the to-be-processed image and the target color range. The application can accurately remove the color of the pixel point in the to-be-processed image that needs to be color removed without manual adjustment of the reference color range by the user.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, in particular to a color-based image processing method and device, equipment and storage medium. BACKGROUND

[0002] Blue (or green) screen technology is the most important means of extracting channels. It can use the difference in chroma to remove the single-color background after shooting the characters or other foreground content. Existing digital synthesis software allows users to specify a color range, and pixels that meet this color range are treated as background (i.e., the corresponding Alpha channel value is set to 0), and pixels that do not meet this color range are treated as foreground (i.e., the corresponding Alpha channel value is set to 1).

[0003] However, the actual scene captured by the camera and output to the screen is greatly affected by the ambient light and the camera, and the background lighting is easily uneven, and even serious color deviation occurs. At this time, there is a large difference between the color range specified by the user and the actual background color of the image, and the user needs to manually adjust the parameters to remove the background color of the image, increasing the user's operation difficulty, and any error in the user's parameter adjustment process will also cause the image to be missed or mis-cut. SUMMARY

[0004] In view of the problems, the present application is proposed to provide a color-based image processing method, device, equipment and storage medium to overcome the problems or at least partially solve the problems, which comprises:

[0005] A color-based image processing method comprises:

[0006] Obtaining a to-be-processed image and a reference color range of pixel points in the to-be-processed image that need to be color-removed;

[0007] Determining an adaptive pixel point set with a color difference less than a first specified value from the reference color range from the to-be-processed image, and recording an adaptive color set corresponding to the adaptive pixel point set;

[0008] According to the adaptive color set, determining a target color range of pixel points in the to-be-processed image that need to be color-removed;

[0009] According to the to-be-processed image and the target color range, a target image is generated by removing the color of the pixel points corresponding to the target color range.

[0010] Preferably, the adaptive pixel set comprises adaptive pixels; the adaptive color set comprises adaptive colors; the step of determining the adaptive pixel set with a color difference less than a first specified value from the reference color range from the image to be processed, and recording the adaptive color set corresponding to the adaptive pixel set, comprises:

[0011] calculating the color difference between each pixel in the image to be processed and the reference color range;

[0012] when the color difference is less than the first specified value, setting the pixel as the adaptive pixel;

[0013] record the color of the adaptive pixel to obtain the adaptive color.

[0014] Preferably, the step of determining the target color range of the pixel to be processed in the image to be processed according to the adaptive color set, comprises:

[0015] determining a key color set from the adaptive color set, wherein the number of the key color set in the adaptive color set is greater than a second specified value;

[0016] generating the target color range according to the key color set.

[0017] Preferably, the key color set comprises key colors; the step of determining the key color set from the adaptive color set, wherein the number of the key color set in the adaptive color set is greater than a second specified value, comprises:

[0018] removing duplicates in the adaptive color set to obtain a single color set;

[0019] counting the number of each single color in the adaptive color set in the single color set;

[0020] when the number is greater than the second specified value, setting the single color as the key color.

[0021] Preferably, the step of generating the target color range according to the key color set, comprises:

[0022] determining a target color center according to the key color set;

[0023] generating the target color range according to the target color center; wherein the target color center is the middle value of the target color range.

[0024] Preferably, the step of determining the target color center according to the key color set, comprises:

[0025] perform a weighted average on all the focus colors in the focus color set to obtain the target color center.

[0026] Preferably, the step of generating the target image removing the color of the pixel points corresponding to the target color range according to the target image and the target color range comprises:

[0027] determining a target pixel point set corresponding to the target color range from the target image;

[0028] removing the color of each target pixel point in the target pixel point set to obtain the target image.

[0029] A color-based image processing apparatus, comprising:

[0030] a target object acquisition module configured to acquire a target image and a reference color range of pixel points in the target image that need to have their colors removed;

[0031] an adaptive color set determination module configured to determine an adaptive pixel point set having a color difference less than a first specified value from the reference color range from the target image, and record an adaptive color set corresponding to the adaptive pixel point set;

[0032] a target color range determination module configured to determine a target color range of pixel points in the target image that need to have their colors removed according to the adaptive color set;

[0033] a target image generation module configured to generate a target image removing the color of the pixel points corresponding to the target color range according to the target image and the target color range.

[0034] A computer device, comprising a processor, a memory, and a computer program stored on the memory and capable of running on the processor, the computer program being executed by the processor to implement the image processing method according to any one of the preceding embodiments.

[0035] A computer readable storage medium, the computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the image processing method according to any one of the preceding embodiments.

[0036] The present application has the following advantages:

[0037] In the embodiment of the present application, by acquiring a to-be-processed image and a reference color range of pixel points in the to-be-processed image that need to be subjected to color removal, a set of adaptive pixel points with a color difference less than a first specified value from the reference color range is determined from the to-be-processed image, and a set of adaptive colors corresponding to the set of adaptive pixel points is recorded; according to the set of adaptive colors, a target color range of pixel points in the to-be-processed image that need to be subjected to color removal is determined; and according to the to-be-processed image and the target color range, a target image in which the colors of pixel points corresponding to the target color range are removed is generated, so that the colors of the pixel points in the to-be-processed image that need to be subjected to color removal can be accurately removed without manual adjustment of the reference color range by a user. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the description of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0039] Figure 1 is a step flow chart of a color-based image processing method provided by an embodiment of the present application;

[0040] Figure 2 is a structural block diagram of a color-based image processing method device provided by an embodiment of the present application;

[0041] Figure 3 is a structural schematic diagram of a computer device provided by an embodiment of the present application.

[0042] The reference signs in the drawings of the specification are as follows:

[0043] 12, computer device; 14, external device; 16, processing unit; 18, bus; 20, network adapter; 22, I / O interface; 24, display; 28, memory; 30, random access memory; 32, cache memory; 34, storage system; 40, program / utility; 42, program module. DETAILED DESCRIPTION

[0044] In order to make the purposes, features and advantages of the present application more obvious and easy to understand, the following will further describe the present application in detail with reference to the drawings and specific embodiments. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0045] ReferenceFigure 1 The embodiment of the present application provides a color-based image processing method, and the method comprises the following steps:

[0046] In the step S110, a to-be-processed image and a reference color range of pixel points needing color removal in the to-be-processed image are acquired.

[0047] In the step S120, an adaptive pixel point set with a color difference less than a first specified value from the reference color range is determined from the to-be-processed image, and an adaptive color set corresponding to the adaptive pixel point set is recorded.

[0048] In the step S130, a target color range of pixel points needing color removal in the to-be-processed image is determined according to the adaptive color set.

[0049] In the step S140, a target image in which the color of the pixel points corresponding to the target color range is removed is generated according to the to-be-processed image and the target color range.

[0050] In the embodiment of the present application, the to-be-processed image and the reference color range of the pixel points needing color removal in the to-be-processed image are acquired, the adaptive pixel point set with a color difference less than a first specified value from the reference color range is determined from the to-be-processed image, the adaptive color set corresponding to the adaptive pixel point set is recorded, the target color range of the pixel points needing color removal in the to-be-processed image is determined according to the adaptive color set, and the target image in which the color of the pixel points corresponding to the target color range is removed is generated according to the to-be-processed image and the target color range, so that the color of the pixel points needing color removal in the to-be-processed image can be accurately removed without manually adjusting the reference color range by a user.

[0051] In the following, the color-based image processing method in the present exemplary embodiment will be further described.

[0052] As described in the step S110, the to-be-processed image and the reference color range of the pixel points needing color removal in the to-be-processed image are acquired.

[0053] It is assumed that there exist an ideal image and the to-be-processed image at the same time; the ideal image is an image of a specified object (including a foreground object and a background object) taken under an ideal condition (i.e., uniform and moderate light), and the to-be-processed image is an image of the specified object taken under an actual condition (i.e., non-uniform light or excessively large or small light intensity), and the foreground content (i.e., content corresponding to the foreground object) in the ideal image corresponds to the position of the foreground content (i.e., content corresponding to the foreground object) in the to-be-processed image, and the background content (i.e., content corresponding to the background object) in the ideal image corresponds to the position of the background content (i.e., content corresponding to the background object) in the to-be-processed image, and the color range of the foreground content in the ideal image does not overlap with the color range of the background content in the ideal image.

[0054] The pixel points in the to-be-processed image that need to be subjected to color removal are pixel points that constitute the background content in the to-be-processed image. The reference color range is the color range of the background content in the ideal image. It can be understood that the color range of the background content in the ideal image can be different from the color range of the background content in the to-be-processed image. Therefore, the reference color range can be different from the color of the pixel points in the to-be-processed image that need to be subjected to color removal. At this time, if the reference color range is directly used to remove the color of the pixel points in the to-be-processed image that need to be subjected to color removal, the situation of missing matting or incorrect matting can occur. Therefore, the reference color range needs to be processed to obtain a target color range suitable for the to-be-processed image.

[0055] As described in the step S120, a set of adaptive pixel points with a color difference less than a first specified value from the reference color range is determined from the to-be-processed image, and a set of adaptive colors corresponding to the set of adaptive pixel points is recorded.

[0056] In an embodiment, a relatively loose standard can be used to determine a set of adaptive pixel points similar to the reference color range from the to-be-processed image, and a set of adaptive colors corresponding to the set of adaptive pixel points is recorded. At this time, the first specified value needs to be set using a relatively loose standard to ensure that the set of adaptive pixel points determined from the to-be-processed image is not an empty set.

[0057] In another embodiment, a step-by-step relaxed standard can also be adopted to determine the adaptive pixel set close to the reference color range from the image to be processed, and record the adaptive color set corresponding to the adaptive pixel set. At this time, the first specified value needs to be set with a more relaxed standard to ensure that the adaptive pixel set determined from the image to be processed is not an empty set, and a plurality of preselected values increasing (which can be an arithmetic progression or a geometric progression) need to be set to control the number of adaptive pixels in the adaptive pixel set. This can obtain more accurate results while reducing the computational complexity of the subsequent processing process.

[0058] Specifically, according to the first specified value, a first preselected value, a second preselected value, and a third preselected value are generated; wherein the first preselected value, the second preselected value, the third preselected value, and the first specified value are in arithmetic progression; and a first adaptive pixel set with a color difference less than the first preselected value from the reference color range is determined from the image to be processed;

[0059] When the number of first adaptive pixels in the first adaptive pixel set is greater than a third specified value, the first adaptive pixel set is set as the adaptive pixel set, and the adaptive color set corresponding to the adaptive pixel set is recorded;

[0060] When the number of first adaptive pixels in the first adaptive pixel set is not greater than the third specified value, a second adaptive pixel set with a color difference less than the second preselected value from the reference color range is determined from the image to be processed;

[0061] When the number of second adaptive pixels in the second adaptive pixel set is greater than the third specified value, the second adaptive pixel set is set as the adaptive pixel set, and the adaptive color set corresponding to the adaptive pixel set is recorded;

[0062] When the number of second adaptive pixels in the second adaptive pixel set is not greater than the third specified value, a third adaptive pixel set with a color difference less than the third preselected value from the reference color range is determined from the image to be processed;

[0063] When the number of third adaptive pixels in the third adaptive pixel set is greater than the third specified value, the third adaptive pixel set is set as the adaptive pixel set, and the adaptive color set corresponding to the adaptive pixel set is recorded;

[0064] When the number of third adaptive pixels in the third adaptive pixel set is not greater than the third specified value, the adaptive pixel set with a color difference less than the first specified value from the reference color range is determined from the image to be processed, and an adaptive color set corresponding to the adaptive pixel set is recorded.

[0065] By determining the adaptive pixel set close to the reference color range from the image to be processed, and recording the color of each adaptive pixel in the adaptive pixel set, an adaptive color set close to the reference color range and adaptive to the image to be processed can be obtained.

[0066] As described in step S130, according to the adaptive color set, the target color range of the pixel points in the image to be processed that need to be color removed is determined.

[0067] The number of adaptive colors of different types in the adaptive color set is counted to determine a key color set in which the number of the same type of color meets a certain standard. In this way, the interference of non-key colors (which can be considered as miscellaneous colors selected under a relatively loose standard) with a small number on the result can be excluded, thereby obtaining a more accurate result.

[0068] According to the key color set, the target color range of the pixel points in the image to be processed that need to be color removed is generated. The generation method of the target color range includes but is not limited to the following two methods: the first method: extracting several edge values (including the maximum value and the minimum value in the three channels) in the key color set, and constructing an initial color range according to the edge values in the key color set; wherein the edge values in the key color set fall on the edge of the initial color range; constructing the target color range according to the initial color range; wherein the target color range covers the initial color range. The second method: weighted average is performed on each key color in the key color set to obtain a target color center, and the target color range is generated according to the target color center; wherein the target color center is the center value of the target color range. In actual application, the second method is preferred, which has a simple processing process and can obtain a more accurate result.

[0069] As described in step S140, according to the image to be processed and the target color range, a target image in which the colors of the pixel points corresponding to the target color range are removed is generated.

[0070] The target pixel set corresponding to the target color range is determined from the image to be processed by using the color difference calculation method, and the color of each target pixel in the target pixel set is removed (i.e. the Alpha channel value is set to 0), thereby obtaining the target image.

[0071] In an embodiment of the present application, the step of determining a set of adaptive pixel points with a color difference less than a first specified value from the reference color range in the image to be processed, and recording a set of adaptive colors corresponding to the set of adaptive pixel points, comprises:

[0072] The color difference of each pixel point in the image to be processed from the reference color range is calculated. Specifically, since the reference color range belongs to a continuous color range, the center value of the reference color range can be extracted as a reference color center, and the color difference of each pixel point in the image to be processed from the reference color center is calculated. The color difference calculation formula can use the CIELAB color difference formula (such as CIE76, CIE94 and CIEDE2000), which calculates the color difference in the CIELAB space and has a good judgment effect.

[0073] When the color difference is less than the first specified value, the pixel point is set as an adaptive pixel point; wherein the adaptive pixel point is included in the set of adaptive pixel points.

[0074] The color of the adaptive pixel point is recorded to obtain an adaptive color; wherein the adaptive color is included in the set of adaptive colors.

[0075] In an embodiment of the present application, the step of determining a target color range of a pixel point in the image to be processed that needs to be removed in color according to the set of adaptive colors, comprises:

[0076] A set of key colors in the set of adaptive colors is determined from the set of adaptive colors. Specifically, the duplicates in the set of adaptive colors are removed to obtain a single color set; the number of each single color in the set of adaptive colors in the single color set is counted; when the number is greater than a second specified value, the single color is set as the key color; wherein the key color is included in the set of key colors.

[0077] The target color range is generated according to the set of key colors. Specifically, a target color center is determined according to the set of key colors; the target color range is generated according to the target color center; wherein the target color center is the middle value of the target color range; the difference between the target color center and the edge value of the target color range is a fourth specified value.

[0078] In an embodiment of the present application, the step of determining a target color center according to the set of key colors, comprises:

[0079] The target color center is obtained by weighted average of all the key colors in the key color set. Specifically, the target color center is obtained by weighted average of all the key colors in the key color set according to the number of the key colors in the key color set in the adaptive color set.

[0080] In an embodiment of the present application, the step of generating the target image with the color of the pixel point corresponding to the target color range removed from the to-be-processed image according to the to-be-processed image and the target color range comprises:

[0081] A target pixel point set corresponding to the target color range is determined from the to-be-processed image. Specifically, the color difference between each pixel point in the to-be-processed image and the target color range is calculated. Since the target color range belongs to a continuous color range, the center value of the target color range can be extracted as a target color center, and the color difference between each pixel point in the to-be-processed image and the target color center is calculated. The color difference calculation formula can use the CIELAB color difference formula (such as CIE76, CIE94 and CIEDE2000), which calculates the color difference in the CIELAB space and has good judgment effect. When the color difference is less than the fourth specified value, the pixel point is set as a target pixel point; wherein the target pixel point is included in the target pixel point set.

[0082] The color of each target pixel point in the target pixel point set is removed to obtain the target image. Specifically, the Alpha channel value of each target pixel point in the target pixel point set is set to 0 to obtain the target image.

[0083] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts are referred to the part of the method embodiment.

[0084] Reference Figure 2 , an image processing device provided by an embodiment of the present application is shown, which comprises:

[0085] The to-be-processed object acquisition module 210 is configured to acquire a to-be-processed image and a reference color range of a pixel point in the to-be-processed image that needs to be removed in color;

[0086] The adaptive color set determination module 220 is configured to determine an adaptive pixel point set with a color difference less than a first specified value from the reference color range from the to-be-processed image, and record an adaptive color set corresponding to the adaptive pixel point set;

[0087] The target color range determination module 230 is configured to determine a target color range of pixel points in the image to be processed, which need to be removed in color, according to the adaptive color set.

[0088] The target image generation module 240 is configured to generate a target image in which the pixel points corresponding to the target color range are removed, according to the image to be processed and the target color range.

[0089] In an embodiment of the present application, the adaptive pixel point set includes an adaptive pixel point, and the adaptive color set includes an adaptive color.

[0090] The reference color difference calculation submodule is configured to calculate a color difference between each pixel point in the image to be processed and the reference color range.

[0091] The adaptive pixel point setting submodule is configured to set the pixel point as the adaptive pixel point when the color difference is less than the first specified value.

[0092] The adaptive color recording submodule is configured to record the color of the adaptive pixel point to obtain the adaptive color.

[0093] In an embodiment of the present application, the target color range determination module 230 includes:

[0094] The key color set determination submodule is configured to determine a key color set from the adaptive color set, the number of colors in the key color set being greater than a second specified value.

[0095] The target color range generation submodule is configured to generate the target color range according to the key color set.

[0096] In an embodiment of the present application, the key color set includes a key color, and the key color set determination submodule includes:

[0097] The single color set determination submodule is configured to remove duplicates in the adaptive color set to obtain a single color set.

[0098] The single color number determination submodule is configured to count the number of each single color in the adaptive color set in the single color set.

[0099] The key color setting submodule is configured to set the single color as the key color when the number is greater than the second specified value.

[0100] In an embodiment of the present application, the target color range generation submodule includes:

[0101] a target color center determination submodule, configured to determine a target color center according to the key color set;

[0102] a target color range construction submodule, configured to generate the target color range according to the target color center; wherein the target color center is a middle value of the target color range.

[0103] In an embodiment of the present application, the target color center determination submodule comprises:

[0104] a weighting calculation submodule, configured to perform weighted average on all key colors in the key color set to obtain the target color center.

[0105] In an embodiment of the present application, the target image generation module 240 comprises:

[0106] a target pixel point set determination submodule, configured to determine a target pixel point set corresponding to the target color range from the to-be-processed image;

[0107] a target image generation submodule, configured to remove the color of each target pixel point in the target pixel point set to obtain the target image.

[0108] Referring to Figure 3 , a computer device of a color-based image processing method is shown, which can specifically comprise the following:

[0109] The computer device 12 is in the form of a general-purpose computing device, and the components of the computer device 12 can include but are not limited to one or more processors or processing units 16, a memory 28, and a bus 18 connecting different system components including the memory 28 and the processing unit 16.

[0110] The bus 18 represents one or more of several types of buses 18, including a memory bus 18 or a memory controller, a peripheral bus 18, a graphics acceleration port, a processor or a local bus 18 using any of a variety of bus 18 structures. For example, these architectures include but are not limited to an industry standard architecture (ISA) bus 18, a micro channel architecture (MAC) bus 18, an enhanced ISA bus 18, a video electronics standards association (VESA) local bus 18, and a peripheral component interconnect (PCI) bus 18.

[0111] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0112] Memory 28 can include computer system readable media in the form of volatile memory, such as random access memory 30 and / or cache memory 32. Computer device 12 can further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 can be provided for reading from and writing to a non-removable, non-volatile magnetic media (typically called a "hard drive"). Figure 3 Although not shown in FIG. 3, computer device 12 can employ other, peripheral, and / or software modules that can be used in conjunction with computer device 12, including but not limited to: micro-code, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems 34, etc.

[0113] Program / utility 40, having a set (at least one) of program modules 42, can be stored in, for example, memory by way of example, and not limitation, as

[0114] Computer device 12 can also communicate with one or more external devices 14 such as a keyboard or a pointing device, display 24, camera, etc.; one or more devices that enable a user to interact with computer device 12; and / or one or more devices that enable computer device 12 to communicate with one or more other computing devices. Such communication can be via I / O interface 22. 22. Additionally, computer device 12 can communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and / or a public network (e.g., the Internet) via network adapter 20. As depicted, network adapter 20 communicates with the other components of computer device 12 via bus 18. It should be appreciated that other buses and / or communication media can be utilized to facilitate communication between the various components of computer device 12 and / or to facilitate communication between computer device 12 and one or more other systems. Figure 3 Figure 3 It is to be appreciated that computer device 12 can be one of a plurality of computer devices that forms a network, and that the plurality of computer devices can exchange data via a connection, which can be a network. It is further appreciated that a network can include a local area network, a wide area network, or an intranet, such as a network in a company or an academic institution, or the Internet.

[0115] ​The processing unit 16 executes various function applications and data processing by running programs stored in the memory 28, such as implementing the color-based image processing method provided in the embodiments of the present application.

[0116] That is, the processing unit 16, when executing the programs, implements the following: obtaining a to-be-processed image and a reference color range of pixel points in the to-be-processed image that need to be subjected to color removal; determining, from the to-be-processed image, a set of adaptive pixel points with a color difference less than a first specified value from the reference color range, and recording a set of adaptive colors corresponding to the set of adaptive pixel points; determining, according to the set of adaptive colors, a target color range of pixel points in the to-be-processed image that need to be subjected to color removal; and generating, according to the to-be-processed image and the target color range, a target image in which the colors of pixel points corresponding to the target color range are removed.

[0117] In an embodiment of the present application, a computer readable storage medium is provided, which stores a computer program. The program, when executed by a processor, implements the color-based image processing method provided in all embodiments of the present application.

[0118] That is, the program, when executed by a processor, implements the following: obtaining a to-be-processed image and a reference color range of pixel points in the to-be-processed image that need to be subjected to color removal; determining, from the to-be-processed image, a set of adaptive pixel points with a color difference less than a first specified value from the reference color range, and recording a set of adaptive colors corresponding to the set of adaptive pixel points; determining, according to the set of adaptive colors, a target color range of pixel points in the to-be-processed image that need to be subjected to color removal; and generating, according to the to-be-processed image and the target color range, a target image in which the colors of pixel points corresponding to the target color range are removed.

[0119] Any combination of one or more computer readable medium can be employed. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, the computer readable storage medium can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

[0120] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0121] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as a standalone software package, partially on the operator's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the operator's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably.

[0122] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0123] Finally, it is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is not intended to exclude myriad other embodiments of the present application that other inventors can develop based on the same general inventive concepts embodied by the described embodiments. That is, although the present application is described in terms of particular embodiments and implementations, it is to be understood that the terminology used is for the purpose of descriptive clarity and that it should be taken in its broadest possible sense. For example, the terms "first" and "second" are used herein only to differentiate one element from another, without necessarily requiring or implying any actual relationship or order between or among the elements. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0124] The above provides a color-based image processing method, device, equipment and storage medium, and the principle and implementation of the present application are described in detail. The above examples are used to help understand the method and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation and application range will be changed, and the above description should not be understood as a limitation of the present application.

Claims

1. A color-based image processing method, characterized in that, include: Obtain the image to be processed and the reference color range of the pixels in the image to be processed that need to have their colors removed; Determine a set of adaptive pixels from the image to be processed whose color difference from the reference color range is less than a first specified value, and record the adaptive color set corresponding to the set of adaptive pixels; Based on the adaptive color set, determine the target color range of pixels in the image to be processed that need color removal; determine the set of key colors whose number in the adaptive color set is greater than a second specified value; generate the target color range based on the set of key colors. The target color range is generated using any of the following methods: Method 1: Extract several edge values ​​from the key color set, and construct an initial color range based on the edge values ​​in the key color set; wherein the edge values ​​in the key color set fall on the edge of the initial color range; construct the target color range based on the initial color range; wherein the target color range covers the initial color range. The second method involves taking a weighted average of each key color in the set of key colors to obtain the target color center, and then generating the target color range based on the target color center; wherein the target color center is the center value of the target color range. Based on the image to be processed and the target color range, a target image is generated by removing the colors of the pixels corresponding to the target color range.

2. The image processing method according to claim 1, characterized in that, The set of adaptive pixels includes adaptive pixels; the set of adaptive colors includes adaptive colors; the step of determining the set of adaptive pixels from the image to be processed whose color difference from the reference color range is less than a first specified value, and recording the set of adaptive colors corresponding to the set of adaptive pixels, includes: Calculate the color difference between each pixel in the image to be processed and the reference color range; When the color difference is less than the first specified value, the pixel is set as the adaptive pixel. Record the color of the adapted pixel to obtain the adapted color.

3. The image processing method according to claim 1, characterized in that, The set of accent colors includes accent colors; the step of determining, from the set of adaptive colors, the set of accent colors whose quantity in the set of adaptive colors is greater than a second specified value includes: Remove duplicates from the adaptive color set to obtain a single color set; Count the number of each individual color in the single color set in the adaptive color set; When the quantity is greater than the second specified value, the single color is set as the accent color.

4. The image processing method according to claim 1, characterized in that, The step of generating a target image by removing the color of pixels corresponding to the target color range based on the image to be processed and the target color range includes: Determine the set of target pixels corresponding to the target color range from the image to be processed; The color of each target pixel in the target pixel set is removed to obtain the target image.

5. A color-based image processing apparatus, characterized in that, include: The object to be processed module is used to obtain the image to be processed and the reference color range of the pixels in the image to be processed that need to be color removed; The adaptive color set determination module is used to determine, from the image to be processed, a set of adaptive pixels whose color difference with the reference color range is less than a first specified value, and to record the adaptive color set corresponding to the set of adaptive pixels; The target color range determination module is used to determine the target color range of pixels in the image to be processed that need to be color removed based on the adaptive color set; determine the set of key colors in the adaptive color set whose number is greater than a second specified value; and generate the target color range based on the set of key colors. The target color range is generated using any of the following methods: Method 1: Extract several edge values ​​from the key color set, and construct an initial color range based on the edge values ​​in the key color set; wherein the edge values ​​in the key color set fall on the edge of the initial color range; construct the target color range based on the initial color range; wherein the target color range covers the initial color range. The second method involves taking a weighted average of each key color in the set of key colors to obtain the target color center, and then generating the target color range based on the target color center; wherein the target color center is the center value of the target color range. The target image generation module is used to generate a target image by removing the color of the pixels corresponding to the target color range, based on the image to be processed and the target color range.

6. A computer device, characterized in that, The system includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the image processing method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the image processing method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and system for detecting balls

    CN102148919A

  • Image processing method and device, storage medium and processor

    CN112767312A