Image processing method, device, computer equipment and computer program product
By obtaining the target chromaticity component combination of image pixels and mapping it to a reference image, the processing features are determined, which solves the problem of low efficiency in traditional image processing and achieves more efficient image processing.
Patent Information
- Application Number
- CN202111405564.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-11-24
AI Technical Summary
Traditional image processing methods require users to analyze each pixel in an image to determine feature values, resulting in low processing efficiency.
By obtaining the target chromaticity component combination corresponding to the pixel of the image to be processed, and using the mapping relationship in the first reference image, mapping it to the first reference image, the target processing features of the pixel are determined, thereby performing image processing.
It improves image processing efficiency by utilizing the regional distribution characteristics of target color types in the color space, reducing the need to calculate the transparency of each candidate color, and thus increasing processing speed.
Smart Images

Figure CN116168091B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of image processing technology, various processing can be performed on images through computer equipment, such as removing or replacing the background color of an image.
[0003] In traditional technology, users are usually required to analyze each pixel in an image to determine the characteristic values of these pixels, and the computer equipment then processes these pixels according to the characteristic values, resulting in low image processing efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide an image processing method, apparatus, computer device, computer-readable storage medium and computer program product that can improve image processing efficiency in response to the above technical problems.
[0005] In one aspect, the present application provides an image processing method. The method comprises:
[0006] Acquire an image to be processed, and for each pixel in the image to be processed, acquire a target chromaticity component combination corresponding to the pixel; the target chromaticity component combination is obtained according to the chromaticity components of the pixel in at least two chromaticity channels respectively;
[0007] Acquire a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where the mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping a candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in the at least two chromaticity channels respectively;
[0008] Mapping the target chromaticity component combination to the first reference image based on the first mapping relationship to obtain a first mapping position point corresponding to the pixel point;
[0009] Determine a target processing feature corresponding to the pixel point according to a pixel feature of the first mapping position point in the first reference image; the target processing feature matches a target position relationship; the target position relationship represents a positional relationship between the first mapping position point and the first target area;
[0010] The image to be processed is processed based on the target processing feature of each of the pixel points.
[0011] On the other hand, the present application also provides an image processing device. The device comprises:
[0012] A chroma component acquisition module is used to acquire an image to be processed, and for each pixel in the image to be processed, acquire a target chroma component combination corresponding to the pixel; the target chroma component combination is obtained according to the chroma components of the pixel in at least two chroma channels respectively;
[0013] A reference image acquisition module is used to acquire a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where the mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in the at least two chromaticity channels respectively;
[0014] A chrominance component mapping module, configured to map the target chrominance component combination to the first reference image based on the first mapping relationship, to obtain a first mapping position point corresponding to the pixel point;
[0015] a processing feature determination module, configured to determine a target processing feature corresponding to the pixel point according to a pixel feature of the first mapping position point in the first reference image; the target processing feature matches a target position relationship; the target position relationship represents a positional relationship between the first mapping position point and the first target area;
[0016] A processing module is used to process the image to be processed based on the target processing feature of each pixel point.
[0017] On the other hand, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned image processing method are implemented.
[0018] On the other hand, the present application further provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps of the above-mentioned image processing method when executed by a processor.
[0019] On the other hand, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned image processing method are implemented.
[0020] The above-mentioned image processing method, apparatus, computer equipment, storage medium and computer program product, after obtaining the image to be processed, obtain the target chromaticity component combination corresponding to the pixel point for each pixel point in the image to be processed, and further obtain the first reference image. Since each position point in the first reference image has a first mapping relationship with the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels, the target chromaticity component combination can be mapped to the first reference image based on the first mapping relationship to obtain the first mapping position point corresponding to the pixel point. Finally, the target processing feature corresponding to the pixel point can be determined based on the pixel feature of the first mapping position point in the first reference image, and then the image to be processed can be processed based on the target processing feature of each pixel point. Since the mapping position point of the pixel point in the image to be processed can be obtained through the first reference image, the target processing feature can be determined based on the pixel feature of the mapping position point, thereby improving the image processing efficiency.
[0021] Furthermore, since the first reference image includes the first target area; the first target area is the area where the mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained based on the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels respectively, in the process of determining the target processing feature processing, the regional distribution characteristics of the target color type in the color space determined by at least two chromaticity components can be utilized, and through the positional relationship between the mapping position points and the first target area, the target processing features can be determined from the regional dimension, further improving the image processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A diagram showing an application environment of an image processing method in an embodiment;
[0023] Figure 2 is a schematic flow chart of an image processing method in one embodiment;
[0024] Figure 3 is a schematic diagram of position points in a first reference image in one embodiment;
[0025] Figure 4 is a schematic diagram of a first target area in one embodiment;
[0026] Figure 5 is a schematic diagram of a first target area after blurring in one embodiment;
[0027] Figure 6 A schematic diagram of a process of generating a first reference image in one embodiment;
[0028] Figure 7 is a schematic diagram of a target color space in one embodiment;
[0029] Figure 8 A schematic diagram of a mapping area corresponding to a color gamut of a target color type in one embodiment;
[0030] Fig. 9 A schematic diagram of a process of generating a first reference image in another embodiment;
[0031] Fig.10 A schematic diagram of a process for updating the chrominance component of a pixel in one embodiment;
[0032] Fig.11 It is a schematic diagram of the application of green screen cutout in one embodiment;
[0033] Fig.12 It is a schematic diagram of the application of green screen cutout in another embodiment;
[0034] Fig.13 A schematic diagram of a process of cutting out a picture in an embodiment;
[0035] Fig.14 A schematic diagram showing a comparison of cutout effects in an embodiment;
[0036] Fig.15 is a structural block diagram of an image processing device in one embodiment;
[0037] Fig.16 is an internal structure diagram of a computer device in one embodiment;
[0038] Fig.17 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] The image processing method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the images to be processed and the processed images that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various desktop computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The terminal can be provided with a client, and the terminal can obtain the image to be processed through the client. The server 104 can be implemented with an independent server or a server cluster or cloud server composed of multiple servers.
[0041] The terminal and the server can collaboratively execute the image processing method of the present application, or the terminal and the server can independently execute the image processing method of the present application. Taking the example that the terminal and the server can collaboratively execute the image processing method of the present application, the terminal sends the image to be processed input by the user to the server. After the server receives the image to be processed, for each pixel point in the image to be processed, the target chromaticity component combination corresponding to the pixel point is obtained, the first reference image is obtained, and the target chromaticity component combination is mapped to the first reference image based on the first mapping relationship existing in the first reference image to obtain the first mapping position point corresponding to the pixel point, and then the target processing feature corresponding to the pixel point can be determined according to the pixel feature of the first mapping position point in the first reference image, and finally the image to be processed is processed based on the target processing feature of each pixel point.
[0042] It should be noted that, in the embodiment of the present application, the first reference image includes a first target area, and the first target area is the area where the mapping position points corresponding to the target color type are distributed. The mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type. The candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels respectively, and the target processing feature determined according to the pixel feature of the first mapping position point is matched with the positional relationship between the first mapping position point and the first target area, that is, the positional relationship between the first mapping position point and the first target area is utilized in the process of determining the target processing feature in the embodiment of the present application. Since the positional relationship can be utilized to determine the target processing feature, the transparency representation value can be calculated for the first target area as a whole, avoiding the calculation of the transparency representation value for each candidate color of the target color type, thereby improving the image processing efficiency.
[0043] In one embodiment, Figure 2As shown, an image processing method is provided, and the method is applied to a computer device, and the computer device can be a terminal, a server, or a system composed of a terminal and a server. Figure 1 The server in the example is used to illustrate the following steps:
[0044] Step 202, obtaining an image to be processed, and for each pixel in the image to be processed, obtaining a target chromaticity component combination corresponding to the pixel; the target chromaticity component combination is obtained according to the chromaticity components of the pixel in at least two chromaticity channels respectively.
[0045] The image to be processed refers to an image that needs to be processed. The image to be processed may include an image area belonging to the target color category. In one embodiment, the image to be processed may be an image obtained by photographing the target object with a curtain of the target color category as the background. The target color category may be any color category, for example, blue or green. The target object may be various living or non-living things according to different scene requirements. It should be noted that there are multiple candidate colors for each color category. Taking green as an example, green may appear gray-green, light green, dark green, etc. at different saturations.
[0046] The target chromaticity component combination is obtained based on the chromaticity components of the pixel points in at least two chromaticity channels. The chromaticity channel refers to a color channel used to characterize the chromaticity size. The chromaticity channel is used to describe the color and saturation to specify the color of the pixel. At least two chromaticity channels refer to two or more chromaticity channels. For example, in the YUV color space, at least two color channels may be the U color channel and the V color channel. The chromaticity component of the chromaticity channel is used to characterize the chromaticity size of the chromaticity channel. The chromaticity component may specifically be a grayscale value. The grayscale value may range from 0 to 255.
[0047] Specifically, the terminal obtains the image to be processed and sends the image to be processed to the server. After receiving the image to be processed, the server starts to process the image to be processed. During the processing, for each pixel in the image to be processed, the server can obtain the target chromaticity component combination corresponding to the pixel.
[0048] In one embodiment, the server may obtain the target chromaticity component combination corresponding to the pixel point, which may be specifically: the server obtains the chromaticity components of the pixel point in at least two chromaticity channels respectively, arranges the obtained chromaticity components in a preset order, and obtains the target chromaticity component combination. For example, assuming that at least two chromaticity channels are U channel and V channel, and the preset order is U channel first and V channel later, then for a certain pixel point, if the chromaticity component obtained from the U channel is u1, and the chromaticity component obtained from the V channel is v1, then the target chromaticity component combination corresponding to the pixel point is (u1, v1). In other embodiments, the server may simultaneously receive the target chromaticity component combination corresponding to each pixel point when receiving the image to be processed, that is, the target chromaticity component combination is predetermined by the terminal.
[0049] It is understandable that, in some embodiments, when the server receives the image to be processed and the channel values of the image to be processed in other color spaces, the channel values of the other color spaces can be converted to the color space containing the chromaticity channel. For example, assuming that the server receives the channel values of each pixel in the processed image and the image to be processed in the RGB color space, the grayscale values of the Y channel, the grayscale values of the U channel, and the grayscale values of the V channel in the YUV color space can be converted according to the grayscale values of the R (Red) channel, the G (Green) channel, and the B (Blue) channel in the RGB color space.
[0050] In one embodiment, an image processing application may be installed on the terminal, and the terminal may use the image processing application to call the terminal's camera to shoot and obtain the image to be processed. The terminal may also use the image processing application to select an image from pre-stored images as the image to be processed.
[0051] Step 204, obtaining a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained based on chromaticity components of at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained based on the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels.
[0052] Among them, the first reference image is an image pre-generated and saved by the server. There is a first mapping relationship between each position point in the first reference image and the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels. The first mapping relationship means that for each position point in the first reference image, there is a corresponding chromaticity component combination, and for different position points, the corresponding chromaticity component combinations are different. In one embodiment, the coordinate axis can be determined by each chromaticity channel respectively, and a coordinate system can be established in the first reference image, so as to establish a mapping relationship between the chromaticity component combination and each position point in the first reference image. For example, assuming that at least two chromaticity channels are the Y channel and the U channel, then the Y axis can be determined by the Y channel in the first reference image, and the X axis can be determined by the U channel, and a rectangular coordinate system can be established with one of the vertices of the first reference image as the origin.
[0053] It can be understood that, in the color space determined by the chromaticity channel, if the candidate colors belonging to the same color category are represented by scattered points, these points will be concentrated in one area, and since each position point in the first reference image has a first mapping relationship with the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels, therefore, in the first reference image, the mapping position points corresponding to the target color category will be concentrated in one area. For example, refer to Figure 3 , is a schematic diagram of position points in a first reference image in an embodiment. Figure 3 The image (A) in the figure is obtained by photographing the target object 301 with a green screen as the background. The color type of the background of the image is green. Figure 3 Figure (B) in the figure is obtained by mapping each pixel point in Figure (A) to the UV coordinate system of Figure (B). It can be seen from Figure (B) that when the green screen is used as the background, the mapping position points of the background color are mainly distributed in a circle. Among them, the UV coordinate system of Figure (B) is established with the X-axis determined by the U channel in the YUV color space, the Y-axis determined by the V channel, and the lower left corner of the image as the origin.
[0054] Since the mapping position points corresponding to the target color type are concentrated in one area, when establishing the first reference image, the area where the mapping position points corresponding to the target color type are distributed can be determined as the first target area. The mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type, and the candidate chromaticity component combination is obtained based on the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels. The target color type here refers to the color type to which the color of the pixel to be processed belongs when processing the image in the current application scenario. For example, assuming that the current application scenario is to subtract the background in the image, the target color type is the color of the image background. For example, in an image shot with a green screen as the background, the target color type can be green.
[0055] In one embodiment, the first target area may be an area where some candidate colors of the target color category are distributed, such as the above Figure 3 In the (A) image taken with the green screen as the background, the green in the background is green with a normal saturation range, and the area where these greens are distributed in the (B) image is roughly a circular area. It can be understood that if the circular area is used as the first target area, then the first target area does not include the mapping position points corresponding to the green with too low saturation and the mapping position points corresponding to the very saturated green.
[0056] Specifically, after obtaining the image to be processed and the target chromaticity component combination corresponding to each pixel in the image to be processed, the server can further obtain a pre-established first reference image and continue to process the image to be processed based on the first reference image.
[0057] Step 206: Map the target chromaticity component combination to the first reference image based on the first mapping relationship to obtain a first mapping position point corresponding to the pixel point.
[0058] Specifically, the server determines a position point corresponding to the target chromaticity component combination corresponding to the pixel point in the first reference image based on the first mapping relationship, and uses the position point as the mapping position point corresponding to the pixel point.
[0059] For example, assuming that at least two channels are a Y channel and a U channel, a first mapping relationship between a chromaticity component combination and each position point in the first reference image is established through a coordinate system, where the coordinate system is a Y axis determined by the V channel, an X axis determined by the U channel, and a coordinate system established with one of the vertices in the first reference image as the origin. Assuming that the chromaticity component of a pixel point in the V channel is y1 and the chromaticity component in the X channel is x1, the first mapping position point of the pixel point in the first reference image is (x1, y1).
[0060] Step 208, determining a target processing feature corresponding to the pixel point according to the pixel feature of the first mapping position point in the first reference image; matching the target processing feature with the target position relationship; the target position relationship represents the positional relationship between the first mapping position point and the first target area.
[0061] Among them, pixel features refer to features exhibited by pixel points. The pixel features of the first mapping position point in the first reference image may be features exhibited by the pixel point where the first mapping position point is located in the first reference image, and the features may be pixel positions or pixel grayscale values. The target processing features corresponding to the pixel points refer to features used by the pixel points for image processing, and the target processing features may be transparency representation values or color representation values, and the color representation values are components of each color channel in a given color space, such as R channel components, G channel components, and B channel components in the RGB color space, or Y channel components, U channel components, and V channel components in the YUV color space. The transparency representation value is used to represent the degree to which the layer is difficult to see through. The transparency representation value may be transparency or opacity. The transparency representation value may be a value corresponding to the Alpha channel. .
[0062] The target processing feature matches the target position relationship, which means that the target processing feature is consistent with the processing feature determined by the target position relationship. The target position relationship represents the position relationship between the first mapping position point and the first target area, which can be that the first mapping position point is within the first target area, or that the first mapping position point is outside the first target area.
[0063] In one embodiment, during the process of generating the first reference image, the server can determine in advance the processing features corresponding to each position point based on the positional relationship between the position point and the first target area, and establish a correspondence between the pixel features of the position point and the processing features. Different positional relationships correspond to different processing features. Therefore, after obtaining the first mapping position point corresponding to the pixel point in the image to be processed, the server can directly query the pre-established correspondence based on the pixel features of the first mapping position point, thereby obtaining the target processing features corresponding to the pixel point.
[0064] In another embodiment, after obtaining the first mapping position point corresponding to the pixel point, the server can determine the positional relationship between the first mapping position point and the first target area based on the pixel feature of the first mapping position point in the first reference image, and obtain the target processing feature that matches the positional relationship based on the determined positional relationship. For example, assuming that the processing feature is a transparency characterization value, when the determined positional relationship is that the first mapping position point is within the first target area, a first transparency characterization value is determined, and the first transparency characterization value can shield the pixel, and when the determined positional relationship is that the first mapping position point is outside the first target area, a second transparency characterization value is determined, and the second transparency characterization value can display the pixel normally, so that the color of the target color type in the area can be obtained from the image.
[0065] Step 210 , processing the image to be processed based on the target processing feature of each pixel.
[0066] Specifically, the server can obtain the target processing features of each pixel in the image to be processed according to the above steps, and can perform corresponding processing on the image to be processed based on these target processing features.
[0067] In one embodiment, when the target processing feature is a transparency representation value, the server can set a transparency representation value for each pixel position in the image to be processed based on the transparency representation value of each pixel point to process the image to be processed. After the transparency representation value is set, the area with a transparency representation value of 0 will no longer be displayed, so it can be used to subtract the background color in the image.
[0068] In another embodiment, when the target processing feature is a color representation value, the server can change the color of each pixel position in the image to be processed based on the color representation value of each pixel point to process the image to be processed. It can be applied to replace the background color in the image.
[0069] In the above-mentioned image processing method, after obtaining the image to be processed, for each pixel point in the image to be processed, the target chromaticity component combination corresponding to the pixel point is obtained, and the first reference image is further obtained. Since each position point in the first reference image has a first mapping relationship with the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels, the target chromaticity component combination can be mapped to the first reference image based on the first mapping relationship to obtain the first mapping position point corresponding to the pixel point. Finally, the target processing feature corresponding to the pixel point can be determined based on the pixel feature of the first mapping position point in the first reference image, and then the image to be processed can be processed based on the target processing feature of each pixel point. Since the mapping position point of the pixel point in the image to be processed can be obtained through the first reference image, the target processing feature can be determined based on the pixel feature of the mapping position point, thereby improving the image processing efficiency.
[0070] Furthermore, since the first reference image includes the first target area; the first target area is the area where the mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained based on the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels respectively, in the process of determining the target processing feature processing, the regional distribution characteristics of the target color type in the color space determined by at least two chromaticity components can be utilized, and through the positional relationship between the mapping position points and the first target area, the target processing features can be determined from the regional dimension, further improving the image processing efficiency.
[0071] In one embodiment, the above-mentioned image processing method also includes the step of determining a first target area, specifically including: obtaining a preset chromaticity component combination, mapping the preset chromaticity component combination to a first reference image based on a first mapping relationship, and obtaining a mapping position point corresponding to the preset chromaticity component combination; obtaining a color range value corresponding to an expected background color range of a target color type; the color range value is positively correlated with the size of the expected background color range; based on the mapping position point corresponding to the preset chromaticity component combination, determining a central mapping position point corresponding to the expected background color range on the first reference image; and determining the first target area on the first reference image based on the central mapping position point and the color range value.
[0072] Among them, the preset chromaticity component combination is a chromaticity component combination corresponding to the candidate color of the target color type input by the user based on experience. The preset chromaticity component combination can be a chromaticity component combination corresponding to the primary color of the target color type. Taking green as an example, the preset chromaticity component combination can be a chromaticity component combination corresponding to the primary color of green. The primary color refers to the purest color, that is, the basic color, without any other color mixed. The expected background color range refers to the distribution range of the candidate color belonging to the target color type presented in the image background that the user expects in the color space formed by the above-mentioned at least two chromaticity channels. The central mapping position point corresponding to the expected background color range refers to the central position of the mapping area corresponding to the expected background color range, wherein the mapping area refers to the area where the mapping position points of the candidate colors belonging to the expected background color range on the first reference image are distributed. The color range value is used to characterize the size of the expected background color range, and is positively correlated with the size of the expected background color range, that is, the larger the expected background color range, the larger the color range value, and the smaller the expected background color range, the smaller the color range value. When the mapping area corresponding to the expected background color range is a circle, the color range value may be the radius of the circle, and the central mapping position point may be the center of the circle.
[0073] Specifically, the server can obtain a preset chromaticity component combination, map the preset chromaticity component combination to a first reference image based on a first mapping relationship, obtain a corresponding mapping position point, further obtain a color range value corresponding to an expected background color range, and determine a first target area on the first reference image based on the center mapping position point and the color range value.
[0074] In one embodiment, the image to be processed is an image obtained by photographing the target object with a curtain of the target color type as the background. The color range value may be a value input by the user based on experience. Considering that the candidate colors presented in the background of the image to be processed are mainly distributed in a circle, the expected background color range may be a circle. At this time, the mapping area corresponding to the expected background color range is also a circle. The color range value input by the user is the radius of the circle. The server may directly determine the mapping position point corresponding to the preset chromaticity component combination as the center mapping position point corresponding to the expected background color range, that is, use the mapping position point corresponding to the preset chromaticity component combination as the center of the circle. Based on the center and radius, a circular area may be determined on the first reference image, and the server may determine the area where the circle is located as the first target area. For example, if Figure 4 FIG. 1 is a schematic diagram of a first target area in one embodiment. Figure 4 The area where the middle circle 401 is located is the first target area. key is the center of the circle.
[0075] In one embodiment, the processing of the image to be processed is to remove the background area from the image to be processed. In order to achieve background removal, the pixels corresponding to the internal position points of the circle in the image to be processed can be set to transparent, and the pixels corresponding to the external position points of the circle can be set to opaque, thereby realizing image removal. Based on this, the server can fill the grayscale value of the area inside the circle in the first reference image with 0, and the grayscale value of the area outside the circle with 255, and establish a relationship between the grayscale value 0 and the first transparency characterization value, and establish a relationship between 255 and the second transparency characterization value. The first grayscale value is used to shield the pixel, that is, it represents transparency, and the second transparency characterization value represents opacity. In a specific embodiment, in order to ensure that the transparency characterization value calculated for the semi-transparent area can transition smoothly, a preset gradient intensity a can be obtained, and a blur processing of a size of a*p can be performed in the first reference image. The gradient intensity a is a hyperparameter in the interval [0,1]. The blur processing can be any one of mean blur, Gaussian blur, and circular convolution kernel blur. Reference Figure 5 , is a schematic diagram of the first target area after blurring in one embodiment. Figure 5 It can be seen that after the convolution blurring process, the pixels at the boundary of the circle can transition smoothly. Based on the blurred circle (i.e., the first target area), the effect of transparency characterization value changing with color gradient can be added, so that the image quality with smooth edges can be obtained when cutting out the image.
[0076] like Figure 6 FIG. 1 is a schematic diagram of a specific process of generating a first reference image in an embodiment. Figure 6The user first inputs the grayscale value of the background color (i.e. the target color type) in the U channel and the V channel, as well as the color range R (i.e. the color range value), sets the color level P (the color level of an 8-bit image is 2 to the 8th power, i.e. 256), prepares a canvas with a grayscale value of P and a width of P and a height of P, and establishes a UV coordinate system in the canvas. Based on the grayscale values of the U channel and the V channel input by the user, the center point P can be determined. key , based on the center point P key The circle area can be determined on the two-dimensional image by using R, filling the grayscale value 0 inside the image and filling the grayscale value 255 outside the circle to obtain the canvas with the circle drawn on it, obtaining the gradient intensity a to blur the canvas, and finally obtaining the first reference image. The first reference image can be referred to Figure 5 The first reference image can be used to remove the background color from the image to be processed.
[0077] In this embodiment, the preset chromaticity component combination is mapped to the first reference image to obtain the corresponding mapping position point, and then the central mapping position point corresponding to the expected background color range can be determined through the mapping position point, so that after the color range value is obtained, the first target area can be determined based on the color range value and the central mapping position point, so that the first target area can be quickly determined on the first reference image.
[0078] In one embodiment, obtaining a color range value corresponding to a desired background color range includes: obtaining an input color gamut angle and a target line segment length; the color gamut angle and the size of the color gamut of the target color type within the target color space are positively correlated; the target color space is a color space determined based on at least two chromaticity channels; the target line segment length is positively correlated with the size of the foreground color range within the color gamut; and determining the color range value based on the color gamut angle and the target line segment length.
[0079] The color gamut of the target color type in the target color space refers to the area formed by all candidate colors of the target color type in the target color space, and the target color space refers to the color space formed by the at least two chromaticity components, such as the YUV color space. Figure 7As shown, assuming that the color range formed by all colors in the target color space is a circle, the center 0 is neutral gray, the area formed by all candidate colors of the first color type is a sector AOB, the area formed by all candidate colors of the second color type is a sector COB, and the area formed by all candidate colors of the third color type is a sector COD, then the color gamut of the first color type is a sector AOB area, the color gamut of the second color type is a sector COB area, and the color gamut of the third color type is a sector COD area. For the first color type, the color gamut angle is the angle AOB, for the second color type, the color gamut angle is the angle COB, and for the third color type, the color gamut angle is the angle COD. It can be seen that the larger the color gamut angle, the larger the sector area, that is, the color gamut angle is positively correlated with the size of the color gamut.
[0080] It should be noted that, in the present embodiment, the mapping relationship between each position point in the first reference image and the combination of chromaticity components is obtained by establishing a rectangular coordinate system with the chromaticity channel as the coordinate axis in the first reference image. Therefore, the color gamut of the target color type is still sector-shaped when mapped to the plane where the first reference image is located. Then the color gamut angle is the angle of the sector-shaped area mapped by the color gamut of the target color type on the first reference image.
[0081] The target line segment length is positively correlated with the size of the foreground color range in the color gamut. The foreground color range is the range formed by the candidate colors belonging to the target color category presented in the foreground in the target color space. The candidate colors of the target color category within the foreground color range have low saturation because they are mixed with other colors in the foreground. For example, when the image to be processed is an image obtained by shooting with a green curtain (hereinafter referred to as the green curtain) as the background, the candidate colors belonging to the target color category presented in the foreground of the image to be processed are usually obtained by reflecting the green curtain. For example, human hair, edges of clothes, etc. will be dyed gray-green with low saturation by the reflection of the green curtain. The target line segment length is positively correlated with the size of the foreground color range in the color gamut, that is, the larger the foreground color range, the longer the target line segment length, and conversely, the smaller the foreground color range, the shorter the target line segment length.
[0082] It can be understood that in the target color space, the saturation of the color gradually increases from the neutral gray as the starting point. Figure 7, where the center of the circle O represents neutral gray. In the color gamut of each color type, the closer to the center of the circle, the lower the saturation. Each position in the color gamut can represent a candidate color. The greater the distance between the position and the center of the circle, the higher the saturation. Based on this, it can be determined that the foreground color range must be the area close to the center of the circle, and the expected background color range is located in the area near the middle of the sector. If the expected background color range is set to a circle tangent to the color gamut boundary, the mapping area of the expected background color range in the first reference image is also a circle, and the circle is tangent to the boundary of the mapping area corresponding to the color gamut corresponding to the target color type in the first mapping image. Then the server can determine the color range value based on the color gamut angle and the target line segment length. The color range value is the radius of the circle.
[0083] In one embodiment, assuming that the color gamut angle input by the user is θ, the target line segment length d is the distance between the mapping position point of the neutral gray in the first reference image and the center mapping position point corresponding to the expected background color range, then the color range value r can be calculated by the following formula (1):
[0084]
[0085] In one embodiment, assuming that the color gamut angle input by the user is θ, the target line segment length d is the distance between the mapping position point of the neutral gray in the first reference image and the center mapping position point corresponding to the expected background color range, and the difference between the color range value, then the color range value r can be calculated by the following formula (2):
[0086]
[0087] For example, see Figure 8 , is a schematic diagram of a mapping area corresponding to the color gamut of the target color type in the first reference image in one embodiment. In this embodiment, assuming that the image to be processed is an image with a green screen as the background, the target color type is green. Figure 8 In the figure, the area where the circle 802 is located is the mapping area corresponding to the expected background color range, p key is the center of the circle, and the line segments CG and CH are the mapping area boundaries corresponding to the color gamut in the first mapping image. The circle 802 is tangent to the line segments CG and CH respectively, and the tangent points are respectively points D and E. If the angle ACB (color gamut angle) and the line segment cp are given key The length of the circle can be calculated by the above formula (1) to obtain the radius of the circle (i.e., the color range value); if the angle ACB (color gamut angle) and the line segment cp are given key The difference of the circle radius can be calculated by the above formula (2).
[0088] In the above embodiment, the color range value can be determined based on the color gamut angle and the target line segment length input by the user, thereby avoiding the need to manually set the color range value for different background colors and improving image processing efficiency.
[0089] In one embodiment, based on the mapping position points corresponding to the preset chromaticity component combination, the center mapping position point corresponding to the expected background color range is determined on the first reference image, including: obtaining the first mapping position point corresponding to neutral gray; the first mapping position point corresponding to neutral gray is obtained by mapping the chromaticity component combination corresponding to neutral gray onto the first reference image; the chromaticity component combination corresponding to neutral gray is obtained based on the chromaticity components of neutral gray in at least two chromaticity channels; calculating the direction angle of the straight line determined by the mapping position points corresponding to the preset chromaticity component combination and the first mapping position points corresponding to neutral gray, and determining the direction angle as the target direction angle corresponding to the center mapping position; based on the target direction angle and the obtained target line segment length, determining the center mapping position point in the first reference image; wherein the target line segment length is positively correlated with the size of the foreground color range within the color gamut corresponding to the target color type.
[0090] Among them, the straight line determined by the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to neutral gray refers to the straight line passing through the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to neutral gray, and the straight line is unique. The direction angle refers to the angle between the straight line and the vertical direction. The target direction angle corresponding to the center mapping position refers to the direction angle of the straight line passing through the center mapping position and the first mapping position point corresponding to neutral gray. The direction angle of the straight line passing through the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to neutral gray is determined as the target direction angle corresponding to the center mapping position, then the center mapping position and the mapping position point corresponding to the preset chromaticity component combination are on the same straight line, so in this embodiment, the direction of the center mapping position point is actually determined by the preset chromaticity component combination. The color gamut corresponding to the target color type refers to the color gamut of the target color type in the target color space, and the details can be referred to the description in the above embodiment.
[0091] Specifically, in this embodiment, one of the vertices in the first reference image is used as the origin, and the Y axis and the X axis are determined by two chromaticity channels respectively. Then, based on the line segment cp key The coordinates of the neutral mapping position point are calculated based on the lengths of the mapping line segments on the X-axis and the Y-axis and the coordinates of the first mapping position point corresponding to the neutral gray, so that the central mapping position point can be determined in the first reference image.
[0092] For example, continue to refer to Figure 8 , assuming Figure 8The width and height of the first reference image shown are both g (g is the grayscale level), and the coordinates of the first mapping position point corresponding to neutral gray are (g / 2, g / 2). If the length of the target line segment obtained is cp key , then the center mapping position point p key The calculation formula can refer to the following formula (3), where β is the direction angle:
[0093]
[0094] If the length of the target line segment is the difference between CP and the circle radius, the center mapping position point p key The calculation formula can refer to the following formula (4), where β is the direction angle:
[0095]
[0096] In the above embodiment, the target direction angle corresponding to the center mapping position point is determined by the mapping position point corresponding to the preset chromaticity component combination, so that the center mapping position point can be determined in the first reference image based on the target direction angle and the acquired target line segment length. Compared with directly determining the mapping position point corresponding to the preset chromaticity component combination as the center mapping position, the center mapping position point determined in this embodiment is more accurate and more flexible, and the user does not need to input the default parameters to obtain the accurate center mapping position point.
[0097] In one embodiment, a first target area is determined on a first reference image based on a central mapping position point and a color range value, including: establishing a first polar coordinate system with the central mapping position point as the pole and the color range value as the polar radius; determining a first tangent point and a second tangent point between a first target circle and a target tangent based on the first polar coordinate system; the first target circle has the central mapping position point as the center and the color range value as the radius; the target tangent line is a straight line passing through the first mapping position point corresponding to neutral gray and tangent to the first target circle; determining at least one first intermediate position point on a first minor arc with the first tangent point and the second tangent point as endpoints on the first target circle based on the first polar coordinate system; using a line segment determined by the first tangent point, the second tangent point and at least one first intermediate position point as a first target broken line segment; determining an area in the mapping area corresponding to the color gamut of the target color type on the first reference image, away from the first mapping position point corresponding to neutral gray and bounded by the first target broken line segment, as the first target area.
[0098] It can be understood that in the image to be processed obtained by taking a picture with a curtain of the target color type as the background, due to the influence of factors such as shooting angle and light, there may be very saturated candidate colors in the image to be processed. In the color gamut corresponding to the target color type, the very saturated area is the area far away from neutral gray. Considering that if only the mapping area corresponding to the expected background color range is used as the first target area, the first target area is very likely not to include the mapping position points corresponding to the very saturated candidate colors, resulting in the inability to effectively process the very saturated candidate color areas when processing the background of the image to be processed. Therefore, in order to improve the accuracy of image processing, it is necessary to expand the first target area so that the first target area can include the mapping position points corresponding to the very saturated candidate colors as much as possible. Reference Figure 8 , sector CGH is the mapping area corresponding to the color gamut of the target color type, point C is the mapping position point corresponding to neutral gray, and from the distribution characteristics of the color in the target color space, it can be seen that the area where the circle is located is an area with normal saturation, the area DEC formed by the minor arc DE and point C is an area with too low saturation, and the area DEHG formed by the minor arc GH, the major arc DE, the line segment DG and the line segment EH is a very saturated area. Therefore, in the embodiment of the present application, the area DEHG can be included in the first target area.
[0099] Specifically, the approximate broken line segment of the minor arc DE (i.e., the first target broken line segment) can be determined to obtain the minor arc, and then the color gamut of the target color type in the corresponding mapping area on the first reference image, away from the first mapping position point corresponding to neutral gray and with the first target broken line segment as the boundary, is determined as the first target area.
[0100] In one embodiment, n points can be found at equal intervals on the minor arc DE, and the minor arc can be approximated by a broken line composed of these points. n can be set as needed, and the recommended value of n is 10. Figure 8 Take θ as an example, where point D is the first tangent point, point E is the second tangent point, and the lines CD and CE are two target tangent lines. The steps for determining the first target polyline segment are as follows:
[0101] 1) With p key Establish the first polar coordinate system for the center of the circle, and the polar diameter is the radius r of the circle.
[0102] 2) The angle of the nth point (i.e., point D) on the first target polyline segment in this polar coordinate system is The circle here refers to the circle with p key A circle with a radius of Figure 8 Circle 802 in the figure.
[0103] 3) The angle of the first point (point E) on the first target polyline segment in this polar coordinate system is
[0104]
[0105] 4) The angle of the i-th point between the n-th point and the 1-th point (i.e. the first intermediate point) is
[0106]
[0107] 5) Connect the above-obtained points in sequence to obtain a first target broken line segment, which can approximate the minor arc DE.
[0108] In the above embodiment, by establishing a first polar coordinate system, the first tangent point, the second tangent point and at least one center position point can be determined through the first polar coordinate system, so that the first broken line segment can be quickly obtained, thereby determining the position of the first target area.
[0109] In one embodiment, the method further includes: establishing a second polar coordinate system with the center mapping position point as the pole and the target value as the polar radius; determining a first extended position point based on the second polar coordinate system; the first extended position point is in the same straight line with the first tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; determining a second extended position point based on the second polar coordinate system; the second extended position point is in the same straight line with the second tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; and determining a second target circle with the first extended position point and the second extended position point as the ends based on the second polar coordinate system. at least one second intermediate position point on the second minor arc of the point; the second target circle takes the first mapping position point corresponding to neutral gray as the center and the target value as the radius; the line segment determined by the first extended position point, the second extended position point and at least one second intermediate position point is used as the second target broken line segment; in the first reference image, the area determined by the second target broken line segment, the first connecting line segment and the second connecting line segment is used as the mapping area corresponding to the color gamut of the target color type; the first connecting line segment is the line between the first mapping position point corresponding to neutral gray and the first extended position point; the second connecting line segment is the line between the first mapping position point corresponding to neutral gray and the second extended position point.
[0110] The target value is greater than the length of the line segment between the first mapping position point corresponding to the neutral gray and the vertex of the first reference image. Figure 8 For example, the target value needs to be greater than the length of the line segment OC.
[0111] Specifically, after the server establishes a second polar coordinate system with the central mapping position point as the pole and the target value as the polar radius, the server can determine the first extended position point and the second extended position point based on the polar coordinate system, wherein the first extended position point is in the same straight line as the first tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray, and the second extended position point is in the same straight line as the second tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray, so that Figure 8 For example, the first extension position point is point G, and the second extension position point is point H.
[0112] Further, based on the second polar coordinate system, the server determines at least one second intermediate position point on the minor arc with the first extended position point and the second extended position point as endpoints on the second target circle, and connects these positions point in sequence starting from the first extended position point to obtain the second target polyline segment. The second target circle is a circle with the first mapping position point corresponding to the neutral gray as the center and the target value as the radius, with reference to Figure 8 , the second target circle is a circle with point C as the center and the length of line segment CG as the radius, and the minor arc with the first extended position point and the second extended position point as endpoints refers to the minor arc GH. The second target broken line segment can approximate the minor arc GH. Among them, the calculation method of the first extended position point, the second extended position point and the second intermediate position point can refer to the calculation steps of the first tangent point, the second tangent point and the first intermediate position point above, and this application will not repeat them here.
[0113] The server may connect the first mapping position point corresponding to the neutral gray with the first extended position point to obtain a first connecting line segment, and connect the first mapping position point corresponding to the neutral gray with the second extended position point to obtain a second connecting line segment, and in the first reference image, use the area determined by the second target broken line segment, the first connecting line segment, and the second connecting line segment as the mapping area corresponding to the color gamut of the target color type. Figure 8 , the area where the fan-shaped CGH is located is the mapping area corresponding to the color gamut of the target color type.
[0114] In a specific embodiment, Fig. 9 FIG. 1 is a schematic diagram of a specific process of generating a first reference image in an embodiment. In this embodiment, a canvas with color p can be obtained, and the steps of generating a first reference image on the canvas are as follows: first, hyper parameters are obtained, Figure 8 For example, the angle θ formed by angle ACB, the line segment cp key The difference d of the circle radius and the gray level g (i.e., image width and height) are calculated, and then the parameters of the first minor arc are calculated, including the first tangent point, the second tangent point, and at least one first intermediate position point. The approximate broken line segment 1 of the first minor arc (i.e., the first target broken line segment) is obtained by the first tangent point, the second tangent point, and at least one first intermediate position point. Figure 8 For example, point D, point E and at least one position point between point D and point E on the first minor arc DE are determined, and an approximate broken line segment of the first minor arc DE is obtained according to these points. Then, the parameters of the second minor arc can be calculated, including the first extended position point, the second extended position point and at least one second intermediate position point. The approximate broken line segment 2 (i.e., the second target broken line segment) of the second minor arc is obtained by the first extended position point, the second extended position point and at least one second intermediate position point. Figure 8 For example, point G, point H and at least one position point between point G and point H on the second minor arc GH are determined, and the approximate polyline segment 2 of the second minor arc GH is obtained according to these points. The combined polygon can be obtained according to the approximate polyline segment 1 and the approximate polyline segment 2. Figure 8 For example, the polygon obtained is the polygon DGHE determined by the minor arc DE, the line segment DG, the minor arc GH and the line segment HE. After determining the area where the polygon is located on the canvas with color P, the grayscale value inside the polygon can be filled with 0 to obtain the first reference image. It can be understood that the grayscale value outside the polygon is P, that is, 255.
[0115] Furthermore, a preset gradient strength can be obtained, where the gradient strength is a hyperparameter in the interval [0,1]. On the basis of drawing a polygon on the canvas, a blurring process with a size of a·P is performed. The blurring process can be any one of mean blur, Gaussian blur, and circular convolution kernel blur. When the first reference image is used for clipping, it can ensure that the transparency representation value calculated in the semi-transparent area can have a smooth transition.
[0116] In one embodiment, the method further includes: configuring different position point grayscale values for the first target area and the non-target area in the first reference image, and establishing a corresponding relationship between the position point grayscale value and the processing feature value; determining the target processing feature corresponding to the pixel point according to the pixel feature of the first mapping position point in the first reference image, including: based on the corresponding relationship between the position point grayscale value and the processing feature value, obtaining the processing feature value corresponding to the position point grayscale value of the first mapping position point, and determining the obtained processing feature value as the target processing feature corresponding to the pixel point. .
[0117] The gray value of a position point refers to the gray value of a certain pixel position. The non-target area refers to the area outside the first target area in the first reference image.
[0118] Specifically, in this embodiment, after determining the first target area, the server can fill the pixels in the first target area with the first grayscale value and fill the non-target area with the second grayscale value, the first grayscale value and the second grayscale value are different grayscale values, and establish a correspondence between the first grayscale value and the first processing feature value, and establish a correspondence between the second grayscale value and the second processing feature value, the first processing feature value and the second processing feature value are different values. Since the correspondence between the grayscale value of the position point and the processing feature value is established, after obtaining the first mapping position point corresponding to the pixel point in the image to be processed, the server can obtain the processing feature value that has a corresponding relationship with the grayscale value of the position point according to the grayscale value of the position point of the first mapping position point in the first reference image, and determine the obtained processing feature value as the target processing feature corresponding to the pixel point, so that the target processing feature can be quickly determined based on the pre-established correspondence.
[0119] In the above embodiment, since the corresponding relationship between the mapping position point and the processing feature value is established in advance according to the positional relationship between the mapping position point and the first target area, the obtained first reference image is more user-friendly. In the process of processing the image to be processed, the target processing features of the pixel points can be quickly acquired, thereby improving the image processing efficiency.
[0120] In one embodiment, the background of the image to be processed includes an image area belonging to the target color category; the image to be processed is processed based on the target processing feature of each pixel, including: if the target processing feature is a transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the first target area and the first transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the non-target area and the second transparency representation value, then each pixel in the image to be processed is configured with its corresponding transparency representation value to remove the target image area from the image to be processed; wherein the first transparency representation value is used to shield the corresponding pixel in the image to be processed; and the second transparency representation value is used to display the corresponding pixel in the image to be processed.
[0121] Specifically, in this embodiment, the target processing feature is a transparency characterization value, and a grayscale value of a position point corresponding to the first target area corresponds to the first transparency characterization value, while a grayscale value of a position point corresponding to the non-target area corresponds to the second transparency characterization value. The first transparency characterization value and the second transparency characterization value are different transparency characterization values. The first transparency characterization value indicates transparency, and the second transparency characterization value indicates opacity. The first transparency characterization value is used to shield the corresponding pixel point in the image to be processed, that is, after the transparency characterization value of the pixel point is set to the first transparency characterization value, the pixel point is no longer displayed in the image, and the second transparency characterization value is used to display the corresponding pixel point in the image to be processed, that is, after the transparency characterization value of the pixel point is set to the second transparency characterization value, the pixel point can be displayed normally in the image.
[0122] The background of the image to be processed includes an image area belonging to the target color type. For example, the image to be processed may be an image captured with a curtain of the target color type as the background. In this embodiment, by setting the first target area to represent transparency and setting the non-target area to represent opacity, when processing the image, for each pixel in the image to be processed, a transparency representation value corresponding to the grayscale value of the position point can be obtained according to the grayscale value of the first mapping position point of the pixel point in the first reference image, and the obtained transparency representation value is determined as the transparency representation value corresponding to the pixel point, and then each pixel in the image to be processed is configured with its corresponding transparency representation value. At this time, for the image area belonging to the target color type, its pixel points are transparent and shielded, while the pixel points of the image area that does not belong to the target color type are displayed normally, thereby removing the target image area from the image to be processed, that is, realizing the cutout.
[0123] In the above embodiment, by setting the first target area to represent transparency and the non-target area to represent opacity, the transparency representation value of the pixel point can be quickly determined by querying the first reference image, so that the target image area can be quickly removed from the image to be processed.
[0124] In one embodiment, different position point grayscale values are configured for the first target area and the non-target area in the first reference image, and a correspondence between the position point grayscale values and the processing characteristic values is established, including: configuring the first target area in the first reference image as the minimum grayscale value; configuring the non-target area in the first reference image as the maximum grayscale value; obtaining a preset gradient intensity parameter, blurring the first reference image based on the gradient intensity parameter, and obtaining an updated first reference image; establishing a correspondence between the grayscale value of each pixel point in the updated first reference image and a transparency representation value of the same value.
[0125] The minimum grayscale value refers to the grayscale value with the smallest grayscale level, and the maximum grayscale value refers to the grayscale value with the largest grayscale level. The minimum grayscale value can be 0, and the maximum grayscale value can be 255.
[0126] Specifically, after obtaining the preset gradient intensity parameter, the server can perform blur processing on the first reference image based on the gradient intensity parameter to obtain an updated first reference image, which will include grayscale values greater than the minimum grayscale value and less than the maximum grayscale value. The server further establishes a corresponding relationship between the grayscale value of each pixel in the updated first reference image and the transparency representation value of the same value, that is, the value corresponding to the grayscale value is the value of the transparency representation value. For example, assuming the grayscale value is 25, the transparency representation value is 25.
[0127] In one embodiment, the transparency representation value is positively correlated with the degree of transparency of the pixel, that is, the larger the transparency representation value, the higher the degree of transparency of the pixel. When the transparency representation value reaches the maximum value, the pixel is completely transparent, that is, the pixel is shielded to the maximum extent in the image, and its color is no longer displayed in the image. When the transparency representation value reaches the minimum value, the pixel is completely opaque, that is, the color of the pixel can be displayed to the maximum extent in the image. The transparency representation value can be transparency. By establishing a corresponding relationship between the grayscale value of each pixel in the updated first reference image and the transparency representation value of the same value, the server can establish a corresponding relationship between the maximum grayscale value and the maximum transparency representation value, that is, the grayscale value of 255 can be used to represent complete transparency, and at the same time, the server establishes a corresponding relationship between the minimum grayscale value and the second transparency representation value, that is, the grayscale value of 0 can be used to represent complete opacity. At this time, for the intermediate grayscale value greater than the minimum grayscale value and less than the maximum grayscale value, the larger the grayscale value, the higher the degree to which the corresponding transparency representation value shields the pixel.
[0128] In another embodiment, the transparency representation value is negatively correlated with the degree of transparency of the pixel, that is, the larger the transparency representation value, the lower the degree of transparency of the pixel. When the transparency representation value reaches the maximum value, the pixel is completely opaque, that is, the pixel can be displayed to the maximum extent in the image, and when the transparency representation value reaches the minimum value, the pixel is completely transparent, that is, the pixel is shielded to the maximum extent in the image, and its color is no longer displayed in the image. The transparency representation value can be opacity. By establishing a corresponding relationship between the grayscale value of each pixel in the updated first reference image and the transparency representation value of the same value, the server can establish a corresponding relationship between the maximum grayscale value and the maximum transparency representation value, that is, the grayscale value of 255 can be used to represent complete opacity, and at the same time, the server establishes a corresponding relationship between the minimum grayscale value and the minimum transparency representation value, that is, the grayscale value of 0 can be used to represent complete transparency. At this time, for the intermediate grayscale value greater than the minimum grayscale value and less than the maximum grayscale value, the larger the grayscale value, the lower the degree of shielding of the pixel by the corresponding transparency representation value.
[0129] In the above embodiment, the first reference image is updated by blurring the first reference image, and the correspondence between the grayscale value of each pixel in the updated image and the transparency representation value of the same value is established, so that the transparency representation value calculated for the semi-transparent area can be smoothly transitioned, thereby obtaining a cutout quality with smooth edges.
[0130] In one embodiment, the above method also includes: configuring different position point grayscale values for the first target area and the non-target area in the first reference image; determining the target processing feature corresponding to the pixel point based on the pixel feature of the first mapping position point in the first reference image, including: when the position point grayscale value of the first mapping position point in the first reference image matches the position point grayscale value of the first target area, determining that the target processing feature corresponding to the pixel point is the first processing feature; when the position point grayscale value of the first mapping position point in the first reference image matches the position point grayscale value of the non-target area, determining that the target processing feature corresponding to the pixel point is the second processing feature different from the first processing feature.
[0131] Specifically, the server configures different position point grayscale values for the first target area and the non-target area in the first reference image, that is, establishes a connection between the first target area and the grayscale value. For example, the position point grayscale value of the first target area can be configured as 0, and the position point grayscale value of the non-target area can be configured as 255. Then, it is possible to determine whether a certain position point is located in the first target area or the non-target area based on the position point grayscale value. After obtaining the first mapping position point corresponding to each pixel point in the image to be processed, it is possible to determine whether the position point grayscale value of the first mapping position point matches the position point grayscale value of the first target area. If it matches, it indicates that the first mapping position point is within the first target area, and the target processing feature corresponding to the pixel point is the first processing feature; if it does not match, it indicates that the first mapping position point is outside the first target area, that is, it is in the non-target area, and the target processing feature corresponding to the pixel point is the second processing feature. The first processing feature and the second processing feature are different processing features. The first processing feature is used to represent transparency, and the second processing feature is used to represent opacity.
[0132] In the above embodiment, by configuring different position point grayscale values for the first target area and the non-target area, the positional relationship between the first mapping position point and the first target area can be determined by matching the position point grayscale values, so that the corresponding processing feature value can be determined based on the positional relationship, avoiding the need to determine the positional relationship through complex calculations, thereby improving image processing efficiency.
[0133] In one embodiment, the method further comprises: for each pixel in the image to be processed, using the second reference images corresponding to the respective chromaticity channels, updating the chromaticity components of the pixel in the respective chromaticity channels. Fig.10 , taking one of the chroma channels (hereinafter referred to as the first chroma component) as an example, the specific steps of updating the chroma components of each pixel under the chroma channel are described:
[0134] Step 1002, obtaining a second reference image corresponding to the first chromaticity component; each position point in the second reference image has a second mapping relationship with a chromaticity component combination obtained based on the chromaticity components of at least two chromaticity channels; the second reference image includes a second target area; the second target area at least includes a mapping area corresponding to a foreground color range corresponding to a target color type; pixel features of each position point in the second reference image have associated chromaticity components corresponding to the first chromaticity channel, and the associated chromaticity components corresponding to the pixel features of the position points in the second target area are consistent with the chromaticity components of neutral gray in the first chromaticity channel.
[0135] Among them, the second mapping relationship means that for each position point in the second reference image, there is a corresponding chromaticity component combination, and for different position points, the corresponding chromaticity component combinations are different. The second mapping relationship and the first mapping relationship can be the same mapping relationship. The second reference image includes a second target area, and the second target area at least includes a mapping area corresponding to the foreground color range corresponding to the target color type. The foreground color range corresponding to the target color type refers to the foreground color range of the target color type in the color gamut in the target color space, and the mapping area corresponding to the foreground color range refers to the area where the candidate colors within the foreground color range are distributed in the mapping position points in the second reference image. Figure 8 For example, suppose Figure 8 is the second reference image, then the mapping area corresponding to the foreground color range is the area enclosed by the minor arc DE, the line segments CD and CE.
[0136] The pixel features of each position point in the second reference image have associated chromaticity components corresponding to the first chromaticity channel, that is, in this embodiment, the pixel features of each position point in the second reference image are pre-associated with the chromaticity components under the first chromaticity channel, and the associated chromaticity components are the chromaticity components under the first chromaticity channel that are associated with the position points in the second reference image. The associated chromaticity components corresponding to the pixel features of the position points belonging to the second target area are consistent with the chromaticity components of neutral gray in the first chromaticity channel, so when the image is updated according to the chromaticity components obtained based on the pixel features of the position points in the second target area, the updated pixel points in the image to be processed can be presented as neutral gray. Among them, the pixel feature can be a pixel position or a grayscale value.
[0137] Specifically, the server obtains the second reference image corresponding to the first chrominance channel from the pre-stored reference images.
[0138] Step 1004: Map the target chromaticity component combination to the second reference image based on the second mapping relationship to obtain a second mapping position point corresponding to the pixel point.
[0139] Step 1006, obtaining the associated chromaticity component corresponding to the pixel feature of the second mapping position point, and determining the updated chromaticity component corresponding to the pixel point using the obtained associated chromaticity component.
[0140] Specifically, since the association relationship between the pixel feature and the chromaticity component is established in advance, the associated chromaticity component associated with the pixel feature of the second mapping position point can be queried based on the association relationship, and the updated chromaticity component corresponding to the pixel point can be determined by the queried associated chromaticity component. For each pixel point in the image to be processed, the corresponding updated chromaticity component can be obtained by querying.
[0141] Step 1008 , updating the chromaticity component of each pixel in the image to be processed based on the updated chromaticity component corresponding to each pixel.
[0142] Specifically, after obtaining the updated chromaticity component of each pixel in the first chromaticity channel, the server may update the chromaticity component of each pixel in the image to be processed in the first chromaticity channel.
[0143] It can be understood that for each chromaticity channel, the chromaticity components of each pixel in the image to be processed in the chromaticity channel are updated according to the above steps, and in the image obtained after the update, the candidate color corresponding to the foreground color range will be updated to neutral gray. For example, assuming that the image to be processed is an image of a person photographed under a green screen, the hair and clothing edges in the original image to be processed will be dyed into a low-saturation gray-green color by the reflection of the green screen, and after being processed by the steps of this embodiment, the gray-green color will be changed to gray, so that the processed image can be more natural.
[0144] In the above embodiment, by acquiring the second reference image in each chromaticity channel, the color in the image to be processed can be updated, so that the color presented by the foreground in the updated image is more natural.
[0145] In one embodiment, the above method also includes: determining a mapping area corresponding to the color gamut of the target color type on a second reference image, and determining an area close to the second mapping position point corresponding to neutral gray and bounded by the first target broken line segment as a second target area; for each position point within the second target area, filling in a grayscale value that matches the chromaticity component of the neutral gray in the chromaticity channel; for each position point outside the second target area, filling in a grayscale value that matches the corresponding mapping chromaticity component on the chromaticity channel; obtaining an associated chromaticity component corresponding to a pixel feature of the second mapping position point includes: obtaining a chromaticity component that matches the chromaticity channel according to the grayscale value of the second mapping position point in the second reference image, and obtaining an associated chromaticity component.
[0146] Among them, the second mapping position point corresponding to neutral gray refers to the mapping position point obtained by mapping the chromaticity component combination corresponding to neutral gray to the second reference image based on the second mapping relationship. The first target broken line segment can be determined with reference to the steps in the above embodiment, and this application will not repeat them. The mapped chromaticity component corresponding to the position point on a certain chromaticity channel refers to the value corresponding to the chromaticity channel in the chromaticity component combination that has a second mapping relationship with the position point.
[0147] Specifically, after determining the second target area, the server fills each position point in the second target area with a grayscale value that matches the chromaticity component of neutral gray in the chromaticity channel, and for each position point outside the second target area, fills with a grayscale value that matches the corresponding mapped chromaticity component on the chromaticity channel. Since the filled grayscale value matches the chromaticity component, it is equivalent to establishing an association relationship between the chromaticity component and the grayscale value through numerical matching, that is, the value of the grayscale value is the value of the corresponding associated chromaticity component. For example, if the grayscale value is 30, the corresponding associated chromaticity component is also 30. Taking the second reference image of the U channel as an example, the grayscale value corresponding to the neutral gray is filled in the second target area. Taking the 8-bit image as an example, the grayscale value can be 127; for the position point outside the second target area, the U channel value in the chromaticity component combination that has a first mapping relationship with the position point is obtained. Assuming that the obtained U channel value is x1, the grayscale value filled for the position point is x1.
[0148] Since the association between the chromaticity component and the grayscale value is established through numerical matching, when the server needs to obtain the associated chromaticity component corresponding to the pixel feature of the second mapping position point, it can directly query the grayscale value of the second mapping position point in the second reference image. The associated graduation value is the same as the queried grayscale value. For example, assuming the queried grayscale value is 127, the associated chromaticity component is also 127.
[0149] In the above embodiment, the correlation relationship between the chromaticity component and the grayscale value is established through numerical matching, and the associated chromaticity component can be quickly queried through the grayscale value of the second mapping position point in the second reference image, thereby improving image processing efficiency.
[0150] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0151] The present application also provides an application scenario, which can be applied to the above-mentioned image processing method. In this application scenario, the image processing method provided in the embodiment of the present application can be used to implement green screen cutout, that is, the background of the image to be processed obtained by shooting with the green screen as the background is removed to obtain a foreground image. It can be understood that the color of the screen in the image to be processed is slightly different due to different lighting, different screen materials, and different camera shooting parameters. It can also be understood that in the process of shooting the image to be processed, the screen can also be other colors, such as blue. This embodiment only takes the green screen as an example for explanation.
[0152] Green screen cutouts can be used to achieve the following in live broadcasts / celebrity shows: Fig.11 The picture effect shown makes the viewing experience better. Fig.11 The target person 1102 is a foreground image obtained by cutting out the green screen.
[0153] Through green screen cutout, virtual production can also be realized. Virtual production is a technology that mixes real people with virtual scenes. Through virtual production technology, variety shows and large-scale live broadcasts can achieve very cool and flexible screen effects, bringing the ultimate special effects experience to live broadcasts / on-demand. Fig.12 As shown in FIG. 1 , it is a schematic diagram of the effect of virtual production, wherein 1202 is a green screen image (image to be processed) obtained by shooting. The image processing method provided in the embodiment of the present application can be used to cut out the person in 1202 and apply it to Fig.12 In the variety image frame shown, that is Fig.12 1204 of them.
[0154] When the embodiment of the present application is applied to green screen cutout, after the user sets the UV value of the background color, three reference images are quickly created by drawing to speed up the cutout speed: one is the first reference image (after inputting a set of UV values, query to obtain the transparency standard value), and two are the second reference images (after inputting a set of UV values, query to obtain the updated grayscale values of U and V respectively). The specific steps are as follows:
[0155] 1. Create the first reference image.
[0156] Get a canvas with grayscale values of all g. On the canvas, take the lower left corner as the origin, use the U channel to determine the X axis, and use the V channel to determine the Y axis (for details, please refer to Figure 8 ), the first reference image can be established by the following steps:
[0157] 1. Configure hyperparameters. The hyperparameters are: the angle θ formed by the angle ACB, the line segment cp key The difference d of the radius of the subtracted circle, the gray level g (i.e., the width and height of the image), and the gradient intensity a (where the circle is tangent to CA and CB, with the tangent points being D and E respectively, and the angle θ must be an acute angle.
[0158] 2. Calculate vector cp key The calculation formula can refer to the following formula (5), where v is the gray value of the background color in the V channel, and u is the gray value of the background color in the U channel:
[0159]
[0160] 3. Draw the minor arc DE, which includes the following steps:
[0161] 1) Calculate the radius r of the circle by referring to formula (2) above;
[0162] 2) Refer to formula (4) above to calculate the center of the circle p key The coordinates of
[0163] 3) Using the center p key , a polar coordinate system is established with a radius r, and n points are found on the minor arc DE at equal intervals using the polar coordinate system, and the minor arc DE is approximated by a broken line composed of these points, and a recommended value of n is 10. For details, refer to the description in the above embodiment.
[0164] 4. Draw the minor arc GH (where point G is on ray CA and point H is on ray CB. The radius of the arc should be greater than the length of line segment OC, that is, ). Please refer to the description in the previous embodiment for details.
[0165] 5. The approximate broken line of the minor arc GH, the approximate broken line segment of the minor arc DE, the line segment DG, and the line segment EH are combined into the required polygonal shape.
[0166] 6. On the canvas whose grayscale values are all g, draw the above polygon whose grayscale value is 0 (ie, the first target area).
[0167] 7. Add a gradient effect. The gradient intensity is a. a is a hyperparameter in the interval [0,1] to ensure that the transparency calculated in the semi-transparent area can smoothly transition. On the basis of drawing the polygon on the canvas, a blurring process with a size of a·P is performed.
[0168] In the first reference image, the gray value 0 represents transparency, and the maximum gray value g (in a two-dimensional image, g is 255) represents opacity, so that the green screen background in the image to be processed can be set to transparent.
[0169] 2. Create a second reference image. Considering that the hair and the edges of the clothes will be dyed into a low-saturation gray-green by the reflection of the green screen, Figure 8 , the low-saturation gray-green is mainly distributed in the area DCE determined by the minor arc DE, the line segment DC and the line segment EC. In order to make the cutout effect more natural, the gray-green needs to be changed to gray. From the previous description, it can be seen that the color corresponding to the polygonal area composed of the minor arc DE, the line segment DA, the line segment AO, the line segment OB and the line segment BE will be cut out, so the fan-shaped GCH area can be determined as the second target area.
[0170] 1. Create a second reference image corresponding to the U channel. The determination of the sector-shaped GCH area is the same as that of the first reference image, and reference may be made to the description of the above embodiment, which will not be repeated in this application.
[0171] 1) Get a canvas with grayscale values of all g, take the lower left corner as the origin, use the U channel to determine the X axis, and use the V channel to determine the Y axis (for details, please refer to Figure 8 ).
[0172] 2) Fill the canvas with a gradient color along the U axis. The specific method is to remember that if the filled pixel is in the i-th row (u axis) and the j-th column (v axis), the filled gray value is i;
[0173] 3) Fill the sector-shaped GCH area with color, and the grayscale value of the color is g / 2 (the grayscale value corresponding to neutral gray);
[0174] 4) Blurring the image obtained in step 3).
[0175] 2. Establish a second reference image corresponding to the V channel. The determination of the sector-shaped GCH area is the same as that of the first reference image, and reference may be made to the description of the above embodiment, which will not be repeated in this application.
[0176] 1) Get a canvas with grayscale values of all g, take the lower left corner as the origin, use the U channel to determine the X axis, and use the V channel to determine the Y axis (for details, please refer to Figure 8 ).
[0177] 2) Fill the canvas with a gradient color along the V axis. The specific method is to remember that if the filled pixel is in the i-th row (u-axis) and the j-th column (v-axis), the filled gray value is j;
[0178] 3) Fill the sector-shaped GCH area with color, and the grayscale value of the color is g / 2 (the grayscale value corresponding to neutral gray);
[0179] 4) Blurring the image obtained in step 3).
[0180] The second reference image obtained through the U channel and the reference image of the V channel can map the color corresponding to the area surrounded by the minor arc DE, the line segment DC, and the line segment EC into neutral gray.
[0181] 3. Using the first reference image obtained above, the second reference image corresponding to the U channel, and the reference image corresponding to the V channel, the image to be processed is matted.
[0182] refer to Fig.13 , is a schematic diagram of the process of cutting out images, Fig.13 The steps in are applied to computer devices, which can be terminals, servers, or systems consisting of terminals and servers. The following takes a server as an example, and the specific steps are as follows:
[0183] 1. For the image to be cut out (i.e. the image to be processed), obtain the UV channel map (including the U channel map and the V channel map) and the Y channel map.
[0184] 2. Query the first reference image to obtain the transparency representation value. Specifically, for the UV value (i.e., the grayscale value of the U channel and the grayscale value of the V channel) of each pixel position on the image to be cut out, take the grayscale value of the uth row and the vth column in the first reference image to obtain the transparency representation value.
[0185] 3. Query the second reference image corresponding to the U channel to obtain the cutout result corresponding to the U channel (updated U channel value). Specifically, for the UV value of each pixel position on the image to be cutout, take the grayscale value of the uth row and the vth column in the second reference image corresponding to the U channel to obtain the cutout result corresponding to the U channel.
[0186] 4. Query the second reference image corresponding to the V channel to obtain the cutout result corresponding to the V channel (updated V channel value). Specifically, for the UV value of each pixel position on the image to be cutout, take the grayscale value of the uth row and the vth column in the second reference image corresponding to the V channel to obtain the cutout result corresponding to the V channel.
[0187] 5. For each pixel position on the image to be cut out, its transparency representation value, the cutout result corresponding to the U channel, and the cutout result corresponding to the V channel constitute the cutout result of the position, so that the green screen background can be cut out from the image to be cut out.
[0188] It is understandable that the hyperparameters given in this application scenario are default parameters, and users can use these default parameters to obtain the above-mentioned first reference image and two second reference images without adjusting the parameters, and realize normal cutout, which greatly reduces the difficulty of use. Of course, if users further adjust these hyperparameters, the edge quality of the cutout can be further improved.
[0189] In the above embodiment, by establishing the first reference image and the two second reference images, a relatively good cutout effect can be achieved in practice. Fig.14 ,in Fig.14 Figure (a) is the image to be cut out taken under a green screen. Fig.14 Figure (b) is a schematic diagram of using the method provided in an embodiment of the present application to remove the background of Figure (a) and apply the obtained foreground image to other backgrounds; Fig.14 Figure (c) in FIG. 1 is a schematic diagram of using the method in the prior art to remove the background of Figure (a) and apply the obtained foreground image to other backgrounds. Fig.14 It can be seen that the method provided in the embodiment of the present application has the following advantages: 1. The epidermis color is more natural (close to the original epidermis color); 2. The hair can be well preserved; 3. The shadows can be well displayed; 4. The translucent objects can be well displayed.
[0190] Based on the same inventive concept, the embodiment of the present application also provides an image processing device for implementing the above-mentioned image processing method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image processing device embodiments provided below can refer to the limitations on the image processing method above, and will not be repeated here.
[0191] In one embodiment, Fig.15 As shown, an image processing device 1500 is provided, comprising:
[0192] The chroma component acquisition module 1502 is used to acquire the image to be processed, and for each pixel in the image to be processed, acquire a target chroma component combination corresponding to the pixel; the target chroma component combination is obtained according to the chroma components of the pixel in at least two chroma channels respectively;
[0193] The reference image acquisition module 1504 is used to acquire a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained according to chromaticity components of at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels respectively;
[0194] A chrominance component mapping module 1506 is used to map the target chrominance component combination to the first reference image based on the first mapping relationship to obtain a first mapping position point corresponding to the pixel point;
[0195] The processing feature determination module 1508 is used to determine the target processing feature corresponding to the pixel point according to the pixel feature of the first mapping position point in the first reference image; the target processing feature is matched with the target position relationship; the target position relationship represents the position relationship between the first mapping position point and the first target area;
[0196] The processing module 1510 is used to process the image to be processed based on the target processing feature of each pixel.
[0197] The above-mentioned image processing device, after acquiring the image to be processed, acquires the target chromaticity component combination corresponding to the pixel point for each pixel point in the image to be processed, and further acquires the first reference image. Since each position point in the first reference image has a first mapping relationship with the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels, the target chromaticity component combination can be mapped to the first reference image based on the first mapping relationship to obtain the first mapping position point corresponding to the pixel point. Finally, the target processing feature corresponding to the pixel point can be determined based on the pixel feature of the first mapping position point in the first reference image, and then the image to be processed can be processed based on the target processing feature of each pixel point. Since the mapping position point of the pixel point in the image to be processed can be obtained through the first reference image, the target processing feature can be determined based on the pixel feature of the mapping position point, thereby improving the image processing efficiency.
[0198] Furthermore, since the first reference image includes the first target area; the first target area is the area where the mapping position points corresponding to the target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping the candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained based on the chromaticity components of the candidate colors of the target color type in at least two chromaticity channels respectively, in the process of determining the target processing feature processing, the regional distribution characteristics of the target color type in the color space determined by at least two chromaticity components can be utilized, and through the positional relationship between the mapping position points and the first target area, the target processing features can be determined from the regional dimension, further improving the image processing efficiency.
[0199] In one embodiment, the above-mentioned image processing device also includes: a first target area determination module, which is used to obtain a preset chromaticity component combination, map the preset chromaticity component combination to the first reference image based on a first mapping relationship, and obtain a mapping position point corresponding to the preset chromaticity component combination; obtain a color range value corresponding to the expected background color range of the target color type; the color range value is positively correlated with the size of the expected background color range; based on the mapping position point corresponding to the preset chromaticity component combination, determine the center mapping position point corresponding to the expected background color range on the first reference image; determine the first target area on the first reference image based on the center mapping position point and the color range value.
[0200] In one embodiment, the above-mentioned first target area determination module is also used to: obtain the input color gamut angle and target line segment length; the color gamut angle and the size of the color gamut of the target color type in the target color space are positively correlated; the target color space is a color space determined based on at least two chromaticity channels; the target line segment length is positively correlated with the size of the foreground color range in the color gamut; based on the color gamut angle and the target line segment length, determine the color range value.
[0201] In one embodiment, the above-mentioned first target area determination module is also used to: obtain a first mapping position point corresponding to neutral gray; the first mapping position point corresponding to neutral gray is obtained by mapping the chromaticity component combination corresponding to neutral gray to the first reference image; the chromaticity component combination corresponding to neutral gray is obtained based on the chromaticity components of neutral gray in at least two chromaticity channels; calculate the direction angle of the straight line determined by the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to neutral gray, and determine the direction angle as the target direction angle corresponding to the center mapping position; based on the target direction angle and the obtained target line segment length, determine the center mapping position point in the first reference image; wherein the target line segment length is positively correlated with the size of the foreground color range within the color gamut.
[0202] In one embodiment, the above-mentioned first target area determination module is also used to: establish a first polar coordinate system with the central mapping position point as the pole and the color range value as the polar radius; based on the first polar coordinate system, determine the first tangent point and the second tangent point of the first target circle and the target tangent; the first target circle takes the central mapping position point as the center and the color range value as the radius; the target tangent is a straight line that passes through the first mapping position point corresponding to neutral gray and is tangent to the first target circle; based on the first polar coordinate system, determine at least one first intermediate position point on the first minor arc with the first tangent point and the second tangent point as endpoints on the first target circle; use the line segment determined by the first tangent point, the second tangent point and at least one first intermediate position point as the first target broken line segment; determine the area in the mapping area corresponding to the color gamut of the target color type on the first reference image, away from the first mapping position point corresponding to neutral gray and bounded by the first target broken line segment as the first target area.
[0203] In one embodiment, the first target area determination module is also used to: establish a second polar coordinate system with the center mapping position point as the pole and the target value as the polar radius; determine the first extended position point based on the second polar coordinate system; the first extended position point is in the same straight line with the first tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; determine the second extended position point based on the second polar coordinate system; the second extended position point is in the same straight line with the second tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; determine the second target circle with the first extended position point and the second extended position point based on the second polar coordinate system. at least one second intermediate position point on the second minor arc with the endpoint; the second target circle takes the first mapping position point corresponding to neutral gray as the center and the target value as the radius; the line segment determined by the first extended position point, the second extended position point and at least one second intermediate position point is used as the second target broken line segment; in the first reference image, the area determined by the second target broken line segment, the first connecting line segment and the second connecting line segment is used as the mapping area corresponding to the color gamut of the target color type; the first connecting line segment is the line between the first mapping position point corresponding to neutral gray and the first extended position point; the second connecting line segment is the line between the first mapping position point corresponding to neutral gray and the second extended position point.
[0204] In one embodiment, the above-mentioned device also includes: a grayscale value filling module, which is used to configure different position point grayscale values for the first target area and the non-target area in the first reference image, and establish a corresponding relationship between the position point grayscale value and the processing feature value; a processing feature determination module, which is also used to obtain the processing feature value corresponding to the position point grayscale value of the first mapping position point based on the corresponding relationship between the position point grayscale value and the processing feature value, and determine the obtained processing feature value as the target processing feature corresponding to the pixel point.
[0205] In one embodiment, the background of the image to be processed includes an image area belonging to the target color type; the processing module is also used to configure each pixel in the image to be processed with its corresponding transparency representation value if the target processing feature is a transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the first target area and the first transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the non-target area and the second transparency representation value, so as to remove the target image area from the image to be processed; wherein the first transparency representation value is used to shield the corresponding pixel in the image to be processed; and the second transparency representation value is used to display the corresponding pixel in the image to be processed.
[0206] In one embodiment, the grayscale value filling module is also used to configure the first target area in the first reference image as the minimum grayscale value; configure the non-target area in the first reference image as the maximum grayscale value; obtain a preset gradient intensity parameter, blur the first reference image based on the gradient intensity parameter, and obtain an updated first reference image; establish a correspondence between the grayscale value of each pixel point in the updated first reference image and the transparency representation value of the same value.
[0207] In one embodiment, the above-mentioned device also includes a grayscale value filling module, which is used to configure different position point grayscale values for the first target area and the non-target area in the first reference image; a processing feature determination module, which is used to determine that the target processing feature corresponding to the pixel point is the first processing feature when the position point grayscale value of the first mapping position point in the first reference image matches the position point grayscale value of the first target area; when the position point grayscale value of the first mapping position point in the first reference image matches the position point grayscale value of the non-target area, determine that the target processing feature corresponding to the pixel point is the second processing feature different from the first processing feature.
[0208] The above-mentioned device also includes a chromaticity component updating module, which is used to obtain a corresponding second reference image for each chromaticity channel; each position point in the second reference image has a second mapping relationship with the chromaticity component combination obtained according to the chromaticity components of at least two chromaticity channels; the second reference image includes a second target area; the second target area at least includes a mapping area corresponding to the foreground color range corresponding to the target color type; the pixel features of each position point in the second reference image have associated chromaticity components corresponding to the chromaticity channel, and the associated chromaticity components corresponding to the pixel features of the position points in the second target area are consistent with the chromaticity components of neutral gray in the chromaticity channel; based on the second mapping relationship, the target chromaticity component combination is mapped to the second reference image to obtain the second mapping position point corresponding to the pixel point; the associated chromaticity components corresponding to the pixel features of the second mapping position point are obtained, and the updated chromaticity components corresponding to the pixel point are determined by the obtained associated chromaticity components; based on the updated chromaticity components corresponding to each pixel point, the chromaticity components of each pixel point in the processed image in the chromaticity channel are updated.
[0209] In one embodiment, the above-mentioned device is also used to determine the mapping area corresponding to the color gamut of the target color type on the second reference image, and determine the area close to the second mapping position point corresponding to the neutral gray and bounded by the first target broken line segment as the second target area; for each position point within the second target area, fill in the grayscale value that matches the chromaticity component of the neutral gray in the chromaticity channel; for each position point outside the second target area, fill in the grayscale value that matches the corresponding mapping chromaticity component on the chromaticity channel; the processing feature determination module is also used to obtain the chromaticity component that matches on the chromaticity channel according to the grayscale value of the second mapping position point in the second reference image, and obtain the associated chromaticity component.
[0210] Each module in the above image processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0211] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.16As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store image data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image processing method is implemented.
[0212] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.17 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an image processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0213] Those skilled in the art will understand that Fig.16 , Fig.17 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0214] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned image processing method when executing the computer program.
[0215] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned image processing method are implemented.
[0216] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of the above-mentioned image processing method when executed by a processor.
[0217] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0218] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0219] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0220] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image processing method, characterized in that: The method comprises: Acquire an image to be processed, and for each pixel in the image to be processed, acquire a target chromaticity component combination corresponding to the pixel; the target chromaticity component combination is obtained according to the chromaticity components of the pixel in at least two chromaticity channels respectively; Acquire a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where mapping position points corresponding to a target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping a candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in the at least two chromaticity channels respectively; the first target area is determined based on a first polar coordinate system, the first polar coordinate system uses the central mapping position point corresponding to the expected background color range of the target color type as the pole, and uses the color range value corresponding to the expected background color range as the polar diameter; the central mapping position point is determined on the first reference image based on the mapping position point corresponding to a preset chromaticity component combination, and the mapping position point corresponding to the preset chromaticity component combination is obtained by mapping the preset chromaticity component combination to the first reference image based on the first mapping relationship; Mapping the target chromaticity component combination to the first reference image based on the first mapping relationship to obtain a first mapping position point corresponding to the pixel point; Determine a target processing feature corresponding to the pixel point according to a pixel feature of the first mapping position point in the first reference image; the target processing feature matches a target position relationship; the target position relationship represents a positional relationship between the first mapping position point and the first target area; The image to be processed is processed based on the target processing feature of each of the pixel points.
2. The method according to claim 1, characterized in that The step of determining the first target area comprises: Acquire a preset chroma component combination, and map the preset chroma component combination to the first reference image based on the first mapping relationship to obtain a mapping position point corresponding to the preset chroma component combination; Acquire a color range value corresponding to an expected background color range of the target color type; the color range value is positively correlated with the size of the expected background color range; Based on the mapping position point corresponding to the preset chromaticity component combination, determining, on the first reference image, a central mapping position point corresponding to the expected background color range; The first target area is determined on the first reference image based on the central mapping position point and the color range value.
3. The method according to claim 2, characterized in that The acquiring a color range value corresponding to the expected background color range includes: Get the input color gamut angle and target line segment length; The color gamut angle is positively correlated with the size of the color gamut of the target color type in the target color space; the target color space is a color space determined according to the at least two chromaticity channels; the target line segment length is positively correlated with the size of the foreground color range in the color gamut; The color range value is determined based on the color gamut angle and the target line segment length.
4. The method according to claim 2, characterized in that: The determining, based on the mapping position point corresponding to the preset chromaticity component combination, a central mapping position point corresponding to the expected background color range on the first reference image includes: Acquire a first mapping position point corresponding to neutral gray; the first mapping position point corresponding to the neutral gray is obtained by mapping the chromaticity component combination corresponding to the neutral gray to the first reference image; the chromaticity component combination corresponding to the neutral gray is obtained according to the chromaticity components of the neutral gray in the at least two chromaticity channels; Calculating the direction angle of a straight line determined by the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to the neutral gray, and determining the direction angle as the target direction angle corresponding to the central mapping position; Determining the center mapping position point in the first reference image based on the target direction angle and the acquired target line segment length; The target line segment length is positively correlated with the size of the foreground color range in the color gamut corresponding to the target color type.
5. The method according to claim 2, characterized in that: The determining the first target area on the first reference image based on the central mapping position point and the color range value comprises: Establishing a first polar coordinate system with the central mapping position point as the pole and the color range value as the polar diameter; Based on the first polar coordinate system, determine the first tangent point and the second tangent point of the first target circle and the target tangent line; the first target circle takes the central mapping position point as the center and the color range value as the radius; the target tangent line is a straight line passing through the first mapping position point corresponding to the neutral gray and tangent to the first target circle; Determine, based on the first polar coordinate system, at least one first intermediate position point on a first minor arc on the first target circle with the first tangent point and the second tangent point as endpoints; Using a line segment determined by the first tangent point, the second tangent point, and the at least one first intermediate position point as a first target polyline segment; The area of the color gamut of the target color type in the mapping area corresponding to the first reference image, which is far away from the first mapping position point corresponding to the neutral gray and has the first target broken line segment as a boundary, is determined as the first target area.
6. The method according to claim 5, characterized in that The method further comprises: Establishing a second polar coordinate system with the central mapping position point as the pole and the target value as the polar radius; Based on the second polar coordinate system, a first extension position point is determined; the first extension position point is in the same straight line as the first tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; Based on the second polar coordinate system, a second extension position point is determined; the second extension position point is in the same straight line as the second tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; Based on the second polar coordinate system, determining at least one second intermediate position point on a second minor arc with the first extended position point and the second extended position point as endpoints on a second target circle; the second target circle takes the first mapping position point corresponding to the neutral gray as the center and the target value as the radius; Using a line segment determined by the first extended position point, the second extended position point and the at least one second intermediate position point as a second target broken line segment; In the first reference image, an area determined by the second target polyline segment, the first connecting line segment and the second connecting line segment is used as a mapping area corresponding to the color gamut of the target color type; The first connecting line segment is a line between a first mapping position point corresponding to neutral gray and the first extended position point; the second connecting line segment is a line between a first mapping position point corresponding to neutral gray and the second extended position point.
7. The method according to claim 1, characterized in that The method further comprises: Configuring different position point grayscale values for the first target area and the non-target area in the first reference image, and establishing a corresponding relationship between the position point grayscale values and the processing feature values; The determining, according to the pixel feature of the first mapping position point in the first reference image, the target processing feature corresponding to the pixel point includes: Based on the correspondence between the grayscale value of the position point and the processing feature value, the processing feature value corresponding to the grayscale value of the position point of the first mapping position point is obtained, and the obtained processing feature value is determined as the target processing feature corresponding to the pixel point.
8. The method according to claim 7, characterized in that The background of the image to be processed includes an image area belonging to the target color category; and processing the image to be processed based on the target processing feature of each pixel point includes: If the target processing feature is a transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the first target area and the first transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the non-target area and the second transparency representation value, then Assigning each pixel point in the image to be processed a corresponding transparency representation value to remove the image area from the image to be processed; The first transparency representation value is used to shield the corresponding pixel points in the image to be processed; and the second transparency representation value is used to display the corresponding pixel points in the image to be processed.
9. The method according to claim 7, characterized in that: The configuring different position point grayscale values for the first target area and the non-target area in the first reference image, and establishing a corresponding relationship between the position point grayscale values and the processing feature values, includes: configuring the first target area in the first reference image to have a minimum grayscale value; configuring the non-target area in the first reference image to have a maximum grayscale value; Acquire a preset gradient intensity parameter, and perform blur processing on the first reference image based on the gradient intensity parameter to obtain an updated first reference image; A corresponding relationship is established between the grayscale value of each pixel in the updated first reference image and the transparency representation value of the same value.
10. The method according to claim 1, characterized in that The method further comprises: Configuring different position point grayscale values for the first target area and the non-target area in the first reference image; The determining, according to the pixel feature of the first mapping position point in the first reference image, the target processing feature corresponding to the pixel point includes: When the grayscale value of the position point of the first mapping position point in the first reference image matches the grayscale value of the position point of the first target area, determining that the target processing feature corresponding to the pixel point is the first processing feature; When the grayscale value of the position point of the first mapping position point in the first reference image matches the grayscale value of the position point in the non-target area, it is determined that the target processing feature corresponding to the pixel point is a second processing feature different from the first processing feature.
11. The method according to claim 1, characterized in that: The method further comprises: For each chromaticity channel, a corresponding second reference image is obtained; each position point in the second reference image has a second mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the second reference image includes a second target area; the second target area at least includes a mapping area corresponding to a foreground color range corresponding to a target color type; pixel features of each position point in the second reference image have associated chromaticity components corresponding to the chromaticity channel, and the associated chromaticity components corresponding to the pixel features of the position points in the second target area are consistent with the chromaticity components of neutral gray in the chromaticity channel; Mapping the target chromaticity component combination to the second reference image based on the second mapping relationship to obtain a second mapping position point corresponding to the pixel point; Acquire an associated chromaticity component corresponding to the pixel feature of the second mapping position point, and determine the acquired associated chromaticity component as an updated chromaticity component corresponding to the pixel point; The chromaticity component of each pixel in the image to be processed in the chromaticity channel is updated based on the updated chromaticity component corresponding to each pixel.
12. The method according to claim 11, characterized in that The method further comprises: Determine a mapping area corresponding to the color gamut of the target color type on the second reference image, and determine an area close to the second mapping position point corresponding to neutral gray and bounded by the first target polyline segment as the second target area; For each position point in the second target area, fill in the gray value that matches the chromaticity component of the neutral gray in the chromaticity channel; For each position point outside the second target area, fill in the gray value that matches the corresponding mapped chromaticity component on the chromaticity channel; The acquiring of the associated chromaticity component corresponding to the pixel feature of the second mapping position point comprises: According to the grayscale value of the second mapping position point in the second reference image, the chromaticity component matched on the chromaticity channel is obtained to obtain the associated chromaticity component.
13. An image processing device, characterized in that: The device comprises: A chroma component acquisition module is used to acquire an image to be processed, and for each pixel in the image to be processed, acquire a target chroma component combination corresponding to the pixel; the target chroma component combination is obtained according to the chroma components of the pixel in at least two chroma channels respectively; A reference image acquisition module, used to acquire a first reference image; each position point in the first reference image has a first mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the first reference image includes a first target area; the first target area is an area where mapping position points corresponding to a target color type are distributed; the mapping position points corresponding to the target color type are obtained by mapping a candidate chromaticity component combination of the target color type; the candidate chromaticity component combination is obtained according to the chromaticity components of the candidate colors of the target color type in the at least two chromaticity channels respectively; the first target area is determined based on a first polar coordinate system, the first polar coordinate system takes the central mapping position point corresponding to the expected background color range of the target color type as the pole, and takes the color range value corresponding to the expected background color range as the polar diameter; the central mapping position point is determined on the first reference image based on the mapping position point corresponding to a preset chromaticity component combination, and the mapping position point corresponding to the preset chromaticity component combination is obtained by mapping the preset chromaticity component combination to the first reference image based on the first mapping relationship; A chrominance component mapping module, configured to map the target chrominance component combination to the first reference image based on the first mapping relationship, to obtain a first mapping position point corresponding to the pixel point; a processing feature determination module, configured to determine a target processing feature corresponding to the pixel point according to a pixel feature of the first mapping position point in the first reference image; the target processing feature matches a target position relationship; the target position relationship represents a positional relationship between the first mapping position point and the first target area; A processing module is used to process the image to be processed based on the target processing feature of each pixel point.
14. The device according to claim 13, characterized in that The device also includes: A first target area determination module is used to obtain a preset chromaticity component combination, map the preset chromaticity component combination to the first reference image based on the first mapping relationship, and obtain a mapping position point corresponding to the preset chromaticity component combination; obtain a color range value corresponding to an expected background color range of the target color type; the color range value is positively correlated with the size of the expected background color range; based on the mapping position point corresponding to the preset chromaticity component combination, determine a center mapping position point corresponding to the expected background color range on the first reference image; and determine the first target area on the first reference image based on the center mapping position point and the color range value.
15. The device according to claim 14, characterized in that The first target area determination module is further used to obtain an input color gamut angle and a target line segment length; the color gamut angle is positively correlated with the size of the color gamut of the target color type in the target color space; the target color space is a color space determined according to the at least two chromaticity channels; the target line segment length is positively correlated with the size of the foreground color range in the color gamut; The color range value is determined based on the color gamut angle and the target line segment length.
16. The device according to claim 14, characterized in that The first target area determination module is further used to obtain a first mapping position point corresponding to neutral gray; the first mapping position point corresponding to the neutral gray is obtained by mapping the chromaticity component combination corresponding to the neutral gray to the first reference image; the chromaticity component combination corresponding to the neutral gray is obtained according to the chromaticity components of the neutral gray in the at least two chromaticity channels; Calculate the direction angle of the straight line determined by the mapping position point corresponding to the preset chromaticity component combination and the first mapping position point corresponding to the neutral gray, and determine the direction angle as the target direction angle corresponding to the center mapping position; based on the target direction angle and the acquired target line segment length, determine the center mapping position point in the first reference image; wherein the target line segment length is positively correlated with the size of the foreground color range within the color gamut corresponding to the target color type.
17. The device according to claim 14, characterized in that The first target area determination module is also used to establish a first polar coordinate system with the central mapping position point as the pole and the color range value as the polar radius; based on the first polar coordinate system, determine the first tangent point and the second tangent point of the first target circle and the target tangent line; the first target circle takes the central mapping position point as the center and the color range value as the radius; the target tangent line is a straight line passing through the first mapping position point corresponding to the neutral gray and tangent to the first target circle; Determine, based on the first polar coordinate system, at least one first intermediate position point on a first minor arc on the first target circle with the first tangent point and the second tangent point as endpoints; Using a line segment determined by the first tangent point, the second tangent point, and the at least one first intermediate position point as a first target polyline segment; The area of the color gamut of the target color type in the mapping area corresponding to the first reference image, which is far away from the first mapping position point corresponding to the neutral gray and has the first target broken line segment as a boundary, is determined as the first target area.
18. The device according to claim 17, characterized in that The first target area determination module is further used to establish a second polar coordinate system with the central mapping position point as the pole and the target value as the polar radius; based on the second polar coordinate system, determine a first extended position point; the first extended position point is in the same straight line as the first tangent point and the first mapping position point corresponding to the neutral gray, and is far away from the first mapping position point corresponding to the neutral gray; Based on the second polar coordinate system, determining a second extension position point; The second extension position point, the second tangent point, and the first mapping position point corresponding to the neutral gray are located in the same straight line, and are far away from the first mapping position point corresponding to the neutral gray; Based on the second polar coordinate system, at least one second intermediate position point on a second minor arc with the first extended position point and the second extended position point as endpoints on a second target circle is determined; the second target circle takes the first mapping position point corresponding to the neutral gray as the center and the target value as the radius; and a line segment determined by the first extended position point, the second extended position point and the at least one second intermediate position point is used as a second target broken line segment; In the first reference image, the area determined by the second target broken line segment, the first connecting line segment and the second connecting line segment is used as the mapping area corresponding to the color gamut of the target color type; the first connecting line segment is the line between the first mapping position point corresponding to neutral gray and the first extended position point; the second connecting line segment is the line between the first mapping position point corresponding to neutral gray and the second extended position point.
19. The device according to claim 13, characterized in that The device also includes: A gray value filling module, used to configure different position point gray values for the first target area and the non-target area in the first reference image, and establish a corresponding relationship between the position point gray values and the processing feature values; The processing feature determination module is also used to obtain the processing feature value corresponding to the grayscale value of the position point of the first mapping position point based on the correspondence between the grayscale value of the position point and the processing feature value, and determine the obtained processing feature value as the target processing feature corresponding to the pixel point.
20. The device according to claim 19, characterized in that The background of the image to be processed includes an image area belonging to the target color type; the processing module is also used to configure each pixel in the image to be processed with its corresponding transparency representation value if the target processing feature is a transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the first target area and the first transparency representation value, and there is a corresponding relationship between the grayscale value of the position point corresponding to the non-target area and the second transparency representation value, so as to remove the image area from the image to be processed; wherein the first transparency representation value is used to shield the corresponding pixel in the image to be processed; and the second transparency representation value is used to display the corresponding pixel in the image to be processed.
21. The device according to claim 19, characterized in that The gray value filling module is further used to configure the first target area in the first reference image to have a minimum gray value; and configure the non-target area in the first reference image to have a maximum gray value; Acquire a preset gradient intensity parameter, and perform blur processing on the first reference image based on the gradient intensity parameter to obtain an updated first reference image; A corresponding relationship is established between the grayscale value of each pixel in the updated first reference image and the transparency representation value of the same value.
22. The device according to claim 13, characterized in that The device also includes: A gray value filling module, used for configuring different position point gray values for the first target area and the non-target area in the first reference image; The processing feature determination module is also used to determine that the target processing feature corresponding to the pixel point is the first processing feature when the grayscale value of the position point of the first mapping position point in the first reference image matches the grayscale value of the position point of the first target area; when the grayscale value of the position point of the first mapping position point in the first reference image matches the grayscale value of the position point of the non-target area, determine that the target processing feature corresponding to the pixel point is the second processing feature different from the first processing feature.
23. The device according to claim 13, characterized in that The device also includes: A chromaticity component update module is used to obtain a corresponding second reference image for each chromaticity channel; each position point in the second reference image has a second mapping relationship with a chromaticity component combination obtained according to the chromaticity components of the at least two chromaticity channels; the second reference image includes a second target area; the second target area at least includes a mapping area corresponding to a foreground color range corresponding to a target color type; the pixel features of each position point in the second reference image have associated chromaticity components corresponding to the chromaticity channel, and the associated chromaticity components corresponding to the pixel features of the position points in the second target area are consistent with the chromaticity components of neutral gray in the chromaticity channel; based on the second mapping relationship, the target chromaticity component combination is mapped to the second reference image to obtain a second mapping position point corresponding to the pixel point; the associated chromaticity components corresponding to the pixel features of the second mapping position point are obtained, and the obtained associated chromaticity components are determined as the updated chromaticity components corresponding to the pixel point; based on the updated chromaticity components corresponding to the pixel points, the chromaticity components of each pixel point in the image to be processed in the chromaticity channel are updated.
24. The device according to claim 23, characterized in that The device also includes: Determine a mapping area corresponding to the color gamut of the target color type on the second reference image, determine an area close to the second mapping position point corresponding to the neutral gray and bounded by the first target polyline segment as the second target area; for each position point within the second target area, fill in a gray value matching the chromaticity component of the neutral gray in the chromaticity channel; for each position point outside the second target area, fill in a gray value matching the corresponding mapped chromaticity component on the chromaticity channel; The chroma component updating module is further used to obtain the chroma component matched on the chroma channel according to the gray value of the second mapping position point in the second reference image, so as to obtain the associated chroma component.
25. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
26. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
27. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Image processing method, device and equipment
CN106251286A
Image saturation adjusting method and device, storage medium and terminal
CN109741279A