Image processing method and related equipment
By adjusting and separating the target and background characteristic parameters of the image data to be processed collected by the image acquisition device, and using the HSV color model for transparency curve setting and smooth fitting, the high cost and edge overflow problems in the separation of the target and the background in the existing technology are solved. It solves the color problem, achieves smooth separation of the target and the background, and improves the versatility and portability of the separation effect.
Patent Information
- Application Number
- CN202410747680.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-10-08
AI Technical Summary
Existing technologies in the fields of live streaming, film and television post-production, e-commerce photo processing and other fields have problems such as high cost and insufficient smoothness when separating targets and backgrounds. The traditional RGB color model is difficult to effectively separate.
Collect the image data to be processed by receiving the image acquisition device, adjust the target and background characteristic parameters, use the HSV color model to set the transparency curve and smooth fitting, determine the mapping relationship between the target and the background, and perform image separation and smoothing processing.
It achieves smooth separation of the target and the background, reduces the cost, and improves the versatility and portability of the separation effect.
Smart Images

Figure CN118747762A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing, and in particular to a method and related equipment. Background Art
[0002] The mathematical definition of separating the target and the background was first proposed by foreign scholars. This mathematical definition is to calculate each pixel of the image and estimate the Alpha value (that is, the ratio of the foreground and background colors).
[0003] In recent years, with the development of deep learning technology, most object and background separation uses deep learning models to establish deep convolutional networks for processing. With the boom of the digital economy, many live streaming scenarios are ubiquitous. There is a need to separate images and backgrounds in live streaming scenarios. In order to better introduce products, the background separation needs to be replaced with a custom background. Secondly, there is a great demand for object and background separation in film and television post-production, e-commerce photo processing, standard ID photos, pan-entertainment applications and other businesses.
[0004] However, products that use deep learning technology often face the problem of high costs, and traditional image background separation technology is based on the red, blue, green and alpha (RGBA) color model to distinguish colors and remove the background color. This method causes large overflow at the edge of the target object and the target edge is not smooth enough. Summary of the invention
[0005] The embodiments of the present application provide an image processing method and related equipment for separating a target image from a background image.
[0006] A first aspect of an embodiment of the present application provides an image processing method, which is applied to an image processing device, wherein the image processing device is connected to an image acquisition device, and the method includes:
[0007] Receiving the image data to be processed acquired by the image acquisition device; wherein the image data to be processed includes target image data to be processed and background image data to be processed;
[0008] Adjusting the target characteristic parameters of the target image data to be processed to obtain the target image data; adjusting the background characteristic parameters of the background image data to be processed to obtain the background image data;
[0009] Reasoning the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data;
[0010] The target image data and the background image data are calculated based on the target mapping relationship to obtain inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values.
[0011] Optionally, the receiving the image data to be processed acquired by the image acquisition device includes:
[0012] Receiving the image data to be processed corresponding to the current image frame acquired by the image acquisition device;
[0013] Determine vertex attribute values of the image data to be processed, and perform coordinate transformation on the image data to be processed based on the vertex attribute values to obtain vertex data and vertex index values corresponding to the vertex data; wherein the vertex index values are used to describe the composition of the vertex data in the image data to be processed;
[0014] All the vertex data are combined according to all the vertex index values to obtain the target image data to be processed and the background image data.
[0015] Optionally, the adjusting target feature parameters of the target image data to be processed to obtain target image data; and adjusting background feature parameters of the background image data to be processed to obtain background image data include:
[0016] Setting a transparency curve according to the target characteristic parameters and the background characteristic parameters;
[0017] According to the transparency curve, smooth fitting is performed on the target image data to be processed and the background image data to be processed to obtain the target image data to be separated and the background image data to be separated;
[0018] Adjusting a first ratio value of a characteristic parameter in the target characteristic parameter and the background characteristic parameter, and adjusting a second ratio value of a color parameter value in the target image data to be separated and the background image data to be separated;
[0019] Obtaining a transparency smooth curve corresponding to transparency according to the first ratio value and the second ratio value;
[0020] According to the smooth transparency curve and the color parameter value, the target image data to be separated and the background image data to be separated are separated and smoothed respectively to obtain the target image data and the background image data.
[0021] Optionally, setting a transparency curve according to the target characteristic parameter and the background characteristic parameter includes:
[0022] Analyze the target characteristic parameters and the background characteristic parameters to obtain hue parameters, saturation parameters and brightness parameters;
[0023] Acquire a hue coefficient value corresponding to the hue parameter, a saturation coefficient value corresponding to the saturation parameter, and a brightness coefficient value corresponding to the brightness parameter in the target image data to be processed and the background image data to be processed;
[0024] Setting a hue transition curve where the hue coefficient value is within a preset hue threshold, a saturation transition curve where the saturation coefficient value is within a preset saturation threshold, and a brightness transition curve where the brightness coefficient value is within a preset brightness threshold;
[0025] The transparency curve is determined according to the hue transition curve, the saturation transition curve, and the brightness transition curve.
[0026] Optionally, the adjusting a first ratio value of a characteristic parameter in the target characteristic parameter and the background characteristic parameter, and adjusting a second ratio value of a color parameter value in the target image data to be separated and the background image data to be separated, comprises:
[0027] Adjusting the ratio among the hue coefficient value, the saturation coefficient value and the brightness coefficient value to the first ratio value;
[0028] Respectively obtaining the color parameter value in the target image data to be separated or the background image data to be separated; wherein the color parameter value includes a red parameter value, a green parameter value or a blue parameter value;
[0029] The remaining color parameter values are proportionally adjusted using any two of the color parameter values to obtain the second proportional value; wherein the remaining color parameter values are color parameter values excluding any two of the color parameter values.
[0030] Optionally, obtaining a transparency smoothing curve corresponding to transparency according to the first ratio value and the second ratio value includes:
[0031] Determining an estimated transparency value according to the first ratio value and the second ratio value;
[0032] The estimated transparency value is suppressed according to a target transition curve to obtain the transparency smooth curve; wherein the target transition curve is any two transition curves of the hue transition curve, the saturation transition curve or the brightness transition curve;
[0033] The step of separating and smoothing the target image data to be separated and the background image data to be separated according to the smooth transparency curve and the color parameter value to obtain the target image data and the background image data comprises:
[0034] According to the transparency smoothing curve and other transition curves except the target transition curve, the target image data to be separated and the background image data to be separated are separated and smoothed respectively to obtain the target image data and the background image data.
[0035] Optionally, the reasoning the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data includes:
[0036] Determining current color parameter values and current transparency values in the target image data and the background image data respectively;
[0037] Determining a boundary segmentation boundary between the target image data and the background image data;
[0038] The target mapping relationship is obtained by performing reasoning according to the current color parameter value, the current transparency value and the boundary segmentation limit.
[0039] A second aspect of an embodiment of the present application provides an image processing system, which is applied to an image processing device, wherein the image processing device is connected to an image acquisition device, and the system includes:
[0040] A receiving unit, used for receiving the image data to be processed acquired by the image acquisition device; wherein the image data to be processed includes target image data to be processed and background image data to be processed;
[0041] An adjustment unit, used for adjusting target feature parameters of the target image data to be processed to obtain target image data; and adjusting background feature parameters of the background image data to be processed to obtain background image data;
[0042] a determination unit, configured to infer the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data;
[0043] An acquisition unit is used to calculate the target image data and the background image data based on the target mapping relationship to obtain inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values.
[0044] The second aspect of the embodiments of the present application provides an image processing method for executing the image processing method described in the first aspect.
[0045] A third aspect of the embodiments of the present application provides an image processing device, including:
[0046] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;
[0047] The memory is a short-term storage memory or a persistent storage memory;
[0048] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory to perform the image processing method described in the first aspect.
[0049] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions. When the instructions are executed on a computer, the computer executes the image processing method described in the first aspect.
[0050] A fifth aspect of the embodiments of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer, the computer executes the image processing method described in the first aspect.
[0051] It can be seen from the above technical scheme that the embodiment of the present application has the following advantages: through an image processing method disclosed in the embodiment of the present application, first receive the image data to be processed collected by the image acquisition device; wherein the image data to be processed includes the target image data to be processed and the background image data to be processed; then adjust the target feature parameters of the target image data to be processed to obtain the target image data; adjust the background feature parameters of the background image data to be processed to obtain the background image data; then, infer the target image data and the background image data to determine the target mapping relationship between the target image data and the background image data; finally, calculate the target image data and the background image data based on the target mapping relationship to obtain the inference parameter value corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter value. Thus, through various feature parameters of the target object image and the background in the image data, through the mapping relationship between the feature parameters between the two, the separation of the target object image and the background tends to be smooth, so that the solution has universality and portability. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0053] Figure 1 A flowchart of an image processing method disclosed in an embodiment of the present application;
[0054] Figure 2A schematic diagram of a flow chart of another image processing method disclosed in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of a flow chart of another image processing method disclosed in an embodiment of the present application;
[0056] Figure 4 A hexagonal pyramid HSV color model disclosed in the embodiment of the present application;
[0057] Figure 5 A programmable rendering flowchart disclosed in an embodiment of the present application;
[0058] Figure 6 A schematic diagram of a tone transition curve disclosed in an embodiment of the present application;
[0059] Figure 7 A schematic diagram of image optimization in a virtual camera application scenario disclosed in an embodiment of the present application;
[0060] Figure 8 A schematic diagram of the structure of an image processing system disclosed in an embodiment of the present application;
[0061] Fig. 9 A schematic diagram of the structure of an image processing device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0062] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0063] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0064] The mathematical definition of separating the target and the background was first proposed by foreign scholars. The problem was defined as the task of estimating the alpha value of each image pixel (the ratio of the foreground and background colors). Traditional image background removal technology is based on many basic technologies such as color sampling and adjacent gradient analysis or a fusion of the two. In recent years, with the development of deep learning technology, most target and background separation uses deep learning models to establish deep convolutional networks for processing. At present, and in the boom of the digital economy, many live broadcasting scenes are everywhere. There is a need to separate the image and the background for live broadcast scenes. In order to better introduce the product, the background separation needs to replace the custom background. Secondly, there is a great demand in film and television post-production, e-commerce photo processing, standard ID photos, pan-entertainment applications and other businesses. Products that use deep learning technology often face the problem of high costs, and traditional image background separation technology is based on the RGBA color model to distinguish colors and remove the background color. This method will cause the edge of the target object to have a large overflow and the target edge is not smooth enough.
[0065] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] To solve the above technical problems, please refer to Figure 1 , Figure 1 The flowchart of an image processing method disclosed in an embodiment of the present application includes steps 101 to 104.
[0067] 101. Receive image data to be processed acquired by an image acquisition device.
[0068] It should be noted in advance that the present embodiment is mainly applied to an image processing device, wherein the image processing device is connected to an image acquisition device. In one of the feasible technical solutions, the image acquisition device may be a video source acquisition camera, or other image acquisition devices that can acquire or record video images, and there is no specific limitation here. Furthermore, the image processing device may be a processing device that uses an open source image library of opengl. The processing device may input the target image into the rendering pipeline and process the image through a programmable shader. In addition, an APP application may also be loaded in the processing device. Among them, the above-mentioned APP application may receive the image resources processed by the virtual camera, thereby completing the image processing. For the convenience of understanding and description, this will not be described in detail later.
[0069] Thus, the image processing device can receive the image data to be processed collected by the image collection device. It is not difficult to understand that the image data to be processed includes the target image data to be processed and the background image data to be processed.
[0070] In one specific embodiment, the image data to be processed collected by the image acquisition device includes target image data to be processed and background image data to be processed, which need to be separated later but whose image properties have not been determined. It is not difficult to understand that the current target image and background image are not completely separated, but can be simply identified by the image acquisition device to determine the characteristic parameters of the target image data to be processed and the background image data to be processed. For easy understanding, this will be described in detail later.
[0071] 102. Adjust target feature parameters of the target image data to be processed to obtain target image data; adjust background feature parameters of the background image data to be processed to obtain background image data.
[0072] Thus, based on the target image data to be processed and the background image data to be processed collected in step 101, the target image data can be obtained by adjusting the target feature parameters of the target image data to be processed. The background image data can be obtained by adjusting the target feature parameters of the background image data to be processed.
[0073] In one of the specific embodiments, in the process of implementing the separation of the image and the background in the programmable rendering pipeline shader of OpenGL, the image data to be processed can be first converted into an image in the RGBA image format, so that the corresponding target image data to be processed and the background image data to be processed can also be converted into the RGBA image format described above. Then, the target image data to be processed and the background image data to be processed in the RGBA image format are converted into the HSV model in the shader (Verlex shader). It is not possible to attach numerical values associated with characteristic parameters to the background and the target to be separated at the same time. For example, data on characteristic parameters related to color can be attached. In one of the feasible technical solutions, the Hue, Saturation, Value (HSV) model can be used. Please refer to Figure 4 , Figure 4 A hexagonal pyramid HSV color model disclosed in the embodiment of this application. Figure 4 It can be seen that in the process of processing the image data to be processed, the HSV color model is selected to cope with the influence of the complex light environment on the color of the picture in the actual scene, as follows Figure 4 As shown in the figure, this HSV model can distinguish colors more accurately to distinguish the background from the target. It should be noted that the HSV model is a color space based on the intuitive characteristics of color, also known as the Hexcone Model. The HSV color model refers to a subset of visible light in the three-dimensional color space of H, S, and V, which contains all colors in a certain color domain. Each color is represented by hue (Hue, referred to as H), saturation (S), and value (V). The color parameters in this model are: hue (H), saturation (S), and brightness (V). The hue H parameter represents the color information, that is, the position of the spectral color. This parameter is expressed as an angle, with a value range of 0° to 360°. If calculated counterclockwise from red, red is 0°, green is 120°, and blue is 240°. Their complementary colors are: yellow is 60°, cyan is 180°, and purple is 300°; saturation S: the value range is 0.0 to 1.0; brightness V: the value range is 0.0 (black) to 1.0 (white). For the convenience of understanding and description, this will not be described in detail later.
[0074] Therefore, by adjusting the ratio of various parameters of the HSV mentioned above, the colors of the target image data to be processed and the background image data to be processed are affected, so as to obtain the target image data and the background image data respectively.
[0075] 103. Infer the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data.
[0076] Therefore, after the target image data and the background image data are acquired, fuzzy reasoning can be performed on the target image data and the background image data, so as to determine the target mapping relationship between the target image data and the background image data.
[0077] In one specific embodiment, through the HSV color model described in step 102, by respectively setting the h curve, s curve and v curve corresponding to the HSV color model, the transparency and grayscale adjustment of the image data can be achieved in combination with the h curve, s curve and v curve, thereby achieving the purpose of separation and smoothing. Furthermore, in this embodiment, after the image is converted into the HSV model, the curve can be smoothly fitted according to the characteristics of the target image data to be processed and the background image data to be processed, and the overflow degree of the above image data can be quantified and converted into grayscale color, so that while following the basic theory of fuzzy control, the size of color transparency and boundary segmentation are fuzzy inference, thereby obtaining the fuzzy mapping relationship between the target image data and the background image data, that is, the target mapping relationship described above. For the convenience of understanding and description, in Figure 2 and Figure 3 The illustrated embodiments are described in detail.
[0078] 104. Calculate the target image data and the background image data based on the target mapping relationship to obtain inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values.
[0079] Therefore, the target image data and the background image data can be calculated through the target mapping relationship to obtain the inference parameter values corresponding to the image data to be processed, and then the target image data and the background image data can be separated according to the inference parameter values.
[0080] In one specific embodiment, based on the target mapping relationship between the target image data and the background image data, an inverse fuzzy operation is performed to obtain the fuzzy inference data value, that is, the inference parameter value described above. Thus, the target image data and the background image data can be separated based on the inference parameter value to obtain the target image and background image actually required.
[0081] An image processing method disclosed in this embodiment first receives the image data to be processed collected by the image acquisition device; wherein the image data to be processed includes the target image data to be processed and the background image data to be processed; then adjusts the target feature parameters of the target image data to be processed to obtain the target image data; adjusts the background feature parameters of the background image data to be processed to obtain the background image data; then, infers the target image data and the background image data to determine the target mapping relationship between the target image data and the background image data; finally, based on the target mapping relationship, the target image data and the background image data are calculated to obtain the inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values. Thus, through various feature parameters of the target object image and the background in the image data, and through the mapping relationship between the feature parameters between the two, the separation of the target object image and the background tends to be smooth, so that the solution has universality and portability.
[0082] To facilitate the above Figure 1 For a detailed description of the image processing methods described in , see Figure 2 , Figure 2 This is a flowchart of another image processing method disclosed in an embodiment of the present application, including steps 201 to 210.
[0083] 201. A receiving image acquisition device acquires image data to be processed corresponding to a current image frame, and determines vertex attribute values of the image data to be processed, so as to perform coordinate transformation on the image data to be processed based on the vertex attribute values to obtain vertex data and vertex index values corresponding to the vertex data.
[0084] In this embodiment, Figure 1 As shown in step 101, the image acquisition device can acquire the image data to be processed of the current image frame in real time. At the same time, by analyzing the image data to be processed, the vertex attribute values of the image data to be processed can be obtained, so that the coordinates of the image data to be processed are changed according to the vertex attribute values, so as to obtain the vertex data and the vertex index values corresponding to the vertex data. It is not difficult to understand that the vertex index values are used to describe the composition of the vertex data in the image data to be processed.
[0085] In one of the specific embodiments, for ease of understanding and description, please refer to Figure 4 See also Figure 5 , Figure 5 A programmable rendering flow chart disclosed in the embodiment of the present application. Figure 4It can be seen that in the processing process of the image data to be processed of the current image frame, the vertex attribute values corresponding to different attributes can be obtained by decomposing the image data to be processed by the HSV model. It should be added that the vertex attribute values include but are not limited to hue, saturation, brightness, red, green, blue, yellow, cyan or purple. Furthermore, the vertex attributes can also include vertex coordinates, normals or texture coordinates. In the process of the CPU system processing the image data to be processed, the vertex attribute values are determined based on the HSV model, and the vertex shader in the CPU system can also change the coordinates of the vertices corresponding to the vertex attribute values and color the vertices. The input of vertex coloring comes from the CPU, including vertex attributes. The processing unit of the vertex shader is the vertex, and each vertex input will call the vertex shader once. Therefore, through the change of the vertex by the vertex shader, the vertex data and the vertex index value corresponding to the vertex data can be obtained.
[0086] It should be added that when the CPU passes vertex data to the GPU, it also passes vertex index information. This index information is used to determine how the vertices form the final target image data and background image data. Figure 5 It can be seen that the element array stores vertex indices. From the figure, we can see that each vertex has its own exclusive index name. The three vertices 1, 2, and 3 form a triangle, and the three vertices 3, 2, and 4 form a triangle, thus forming the vertex array vertexarray. It is not difficult to understand that the vertex shader can separate and combine the image data to be processed by combining the uniform state object, that is, the obtained video or image (the image data to be processed of the current image frame), and the vertex array.
[0087] 202. Combine all vertex data according to all vertex index values to obtain target image data to be processed and background image data to be processed.
[0088] Therefore, based on the vertex index values and vertex data obtained in step 201, all vertex data are combined according to all vertex index values, thereby obtaining the target image data to be processed and the background image data to be processed.
[0089] In one of the specific embodiments, in order to produce a realistic scene and separate the target image data to be processed and the background image data to be processed in the image data to be processed, it is necessary to perform vertex shading (vertex shader) on each vertex of the HSV model, while other calculations can be performed during pixel rasterization, which will not be described in detail here. Since in the HSV model, each vertex corresponds to a vertex attribute value, and the vertex attribute value can store various material data, that is, vertex data, vertex data includes but is not limited to point position, normal, color or any other digital information required to calculate the shading equation. Therefore, all vertex data are combined by vertex index values to obtain the vertex shading result (which can be color, vector, texture coordinate or any other kind of shaded data), Figure 5 The rendering process can be clearly understood. Triangle assembly corresponds to the process of generating primitives, clipping, and screen mapping; testing and blending corresponds to fragment-by-fragment operations. Furthermore, rasterization is the process of converting vertex data into fragments, which has the function of converting a graph into an image composed of grids, and the characteristic is that each element corresponds to a pixel in the frame buffer. In short, vertex shader, primitive generation, clipping, and screen mapping belong to the geometry stage; rasterization, fragment shader, and fragment-by-fragment operations belong to the rasterization stage. Therefore, combined with the above rendering process, the image data to be processed is divided into target image data to be processed, and background image data to be processed.
[0090] 203. Set a transparency curve according to the target characteristic parameters and the background characteristic parameters.
[0091] After the target image data to be processed and the background image data to be processed are acquired, the transparency curve can be set according to the target characteristic parameters of the target image data to be processed and the background characteristic parameters of the background image data to be processed, respectively.
[0092] In one specific embodiment, when implementing the process of separating the image from the background, the RGBA image corresponding to the target image data to be processed and the background image data to be processed in the shader is converted into an HSV model. For the background image and the target image to be separated, a transparency curve is added based on the corresponding background feature parameters or target feature parameters.
[0093] Furthermore, for the background feature parameters or the target feature parameters, the transparency curve of the target image or the background image can be set according to the vertex attribute values of the image data to be processed.
[0094] 204. Perform smooth fitting on the target image data to be processed and the background image data to be processed according to the transparency curve to obtain the target image data to be separated and the background image data to be separated.
[0095] Therefore, based on the transparency curve generated in step 203, by performing smooth curve fitting on the target image data to be processed and the background image data to be processed respectively according to the transparency curve, the target image data to be separated corresponding to the target image data to be processed, and the background image data to be separated corresponding to the background image data to be processed can be obtained.
[0096] In one of the specific embodiments, since the generation of the H coefficient, S coefficient or V coefficient of the HSV model depends on the value of the input target background color (corresponding to the H value, S value or V value, respectively), we expect the colors within the target H value, S value or V value range to have the highest transparency to ensure that the target can be separated from the background. If two simple states of transparent and opaque are used, it will cause the phenomenon of excessive unevenness between the image and the background, so a piecewise curve transition method is adopted. For example, the generation of the H coefficient first depends on the H value of the input target background color. We expect the colors within the target H value range to have the highest transparency to ensure that the target can be separated from the background, so as to perform smooth fitting on the target image data to be processed and the background image data to be processed to obtain the target image data to be separated and the background image data to be separated.
[0097] Furthermore, you may also refer to the description of step 302, which will not be described in detail here.
[0098] 205. Adjust a first ratio value of a feature parameter in the target feature parameter and the background feature parameter, and adjust a second ratio value of a color parameter value in the target image data to be separated and the background image data to be separated.
[0099] Thus, after completing the above steps, that is, being able to separate the background image and the target image, and obtaining the target image data to be separated and the background image data to be separated, the first ratio value of the characteristic parameter in the target characteristic parameter and the background characteristic parameter can be adjusted. At the same time, the second ratio value of the color parameter value in the target image data to be separated and the background image data to be separated can also be adjusted.
[0100] In one of the specific embodiments, after the initial separation of the target image and the background image is completed, the overflow color needs to be processed. Specifically, the overflow part needs to be processed into a grayscale color, and then a transparency can be added to reduce the visual impact of the overflow color without affecting the target. In the HSV model, the grayscale formula in OpenGL is substituted into the value of each color channel, that is, r=g=b=Gray=R*0.299+G*0.587+B*0.114, that is, when the first ratio value is reached, the overflow color tends to grayscale. Therefore, the first ratio value is achieved by adjusting the ratio of specific feature parameters in the target feature parameters and the background feature parameters, specifically the ratio between hue H: saturation S: brightness V.
[0101] Furthermore, in order to obtain the first ratio value, firstly, the RGB ratio is adjusted for any color (ie, color parameter value) within the range of all three primary colors of the input target image source. For example, for green, The ratio is made close to 1:1:1, which is the second ratio value. At this time, the green background part of the output image no longer exists visually. Furthermore, for grayscale images, Gray 灰色 =R 红色 *0.299+G 绿色 *0.587+B 蓝色 *0.114 is calculated to convert the image in the green range into a grayscale image (or other background color). It is not difficult to understand that the above 0.299:0.587:0.114 can also be understood as the second ratio value in another feasible solution.
[0102] It is not difficult to understand that the same operation can be achieved for red or blue.
[0103] 206. Obtain a transparency smooth curve corresponding to the transparency according to the first ratio value and the second ratio value.
[0104] Thus, a transparency smooth curve corresponding to the transparency can be obtained according to the first ratio value and the second ratio value.
[0105] In one of the specific embodiments, after the overflow color part is processed, the next step is to process the transparency of the entire background part to maximize the smoothness of the transition area. Specifically, the transparency is preliminarily estimated based on the ratio of the original green background to the grayscale color after the adjustment ratio. Since the above steps are illustrated by the H coefficient. Therefore, in this embodiment, the estimated transparency value is suppressed according to the S coefficient and the V coefficient curve. Since the range of V and S is between 0 and 1, the saturation and brightness close to the background color visually suppress the transparency the least, so the V curve is multiplied by the S curve and the square is taken so that the part close to 1 can remain unchanged. After such processing, a smooth curve of estimated transparency after being suppressed by the S and V curves is obtained. At this time, the range of the transparency curve is also between 0 and 1, and the trend of its function is similar to that of the S and V curves, thereby obtaining a transparency smooth curve corresponding to the transparency.
[0106] 207. Separate and smooth the target image data to be separated and the background image data to be separated according to the smooth transparency curve and the color parameter value, respectively, to obtain the target image data and the background image data.
[0107] Based on the above steps, the transparency of the changed grayscale has been adjusted, and the target image data and the background image data to be separated can be separated and smoothed according to the smooth transparency curve and the color parameter value to obtain the target image data and the background image data.
[0108] In one specific embodiment, the purpose of separation and smoothing is achieved by adding an H coefficient curve in combination with a smooth transparency curve. Specifically, the H curve can be adjusted according to the actual effect.
[0109] In one of the feasible technical solutions, the H curve can be adjusted by adjusting the H, S or V coefficient curves described in step 204-step 205, and the specifics are not limited here. Specifically, different color parameter values are substituted into the smooth transparency curve, so that each element corresponds to a pixel in the buffer of the current image frame, thereby determining the proportion of RGB and HSV in the pixel, that is, Figure 5 The frame buffer framebuffer in the steps shown is used to separate the target image from the background image, thereby obtaining the target image data and the background image data.
[0110] 208. Determine the current color parameter value and the current transparency value in the target image data and the background image data respectively, and determine the boundary segmentation limit between the target image data and the background image data.
[0111] After obtaining the target image data and the background image data, the current color parameter value and the current transparency value of the target image data and the current color parameter value and the current transparency value of the background image data can be determined respectively. At the same time, there is also a boundary segmentation limit between the target image data and the background image data.
[0112] In one specific embodiment, since this embodiment mainly uses the basic theory of fuzzy control, it is necessary to determine the color transparency and the boundary segmentation limit of the target image and the background image, so as to perform fuzzy reasoning according to the color transparency and boundary segmentation.
[0113] 209. Reasoning is performed based on the current color parameter value, the current transparency value and the boundary segmentation limit to obtain a target mapping relationship.
[0114] Thus, based on the current color parameter value, the current transparency value and the boundary segmentation limit obtained in step 208, the target mapping relationship can be obtained.
[0115] In one specific embodiment, fuzzy reasoning is performed on the current color parameter value, the current transparency value and the boundary segmentation limit to obtain a fuzzy mapping relationship, thereby taking an inverse fuzzy operation.
[0116] Furthermore, fuzzy mapping is a method for adjusting the transparency value initially given. For example, the transparency at that time is 0.5, but it is still not enough and needs to be adjusted to 0.2. After determining the specific values described above, the fitting curve can be obtained, and then the previously initially fitted curve, that is, the S and V curves, can be adjusted to obtain the final curve, that is, the target mapping relationship.
[0117] 210. Calculate the target image data and the background image data based on the target mapping relationship to obtain inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values.
[0118] In this embodiment, step 210 is similar to the above Figure 1 It is similar to step 104 in the above example, and will not be described in detail here. However, it should be noted that in this embodiment, the above parameter values can be substituted into the calculation formula of the inverse fuzzy operation. Specifically,
[0119]
[0120] It is not difficult to understand that f is the inference parameter value described above. * The C parameter in (i) can be understood as the initial transparency, that is, the value given first according to the change from green to grayscale value. C*(i) It can be understood as an S*V curve. To achieve a faster adjustment trend, the square is taken. This is the H curve described above. i is the independent variable, which is the color change value in the three primary colors, and p is the range of color change, which can be mapped to 0 to 1.
[0121] Therefore, the target image data and the background image data can be separated according to the inference parameter values.
[0122] It is also necessary to add that, through the transparency smoothing curve obtained above, combined with the overflow color quantization value, the transparency value initially given is adjusted, and the above inverse blur calculation formula is used to substitute the three HSV curve functions into the final transparency value obtained as the final transparency (i.e., the inference parameter value), thereby achieving image separation of the target image data and the background image data.
[0123] For ease of understanding and description, please refer to Figure 7 , Figure 7 Schematic diagram of image optimization in a virtual camera application scenario disclosed in an embodiment of the present application. Figure 7 It can be seen that among them, Figure 7 a is used to indicate that green overflow still exists after the background is removed. Figure 7 b is used to represent an image with overflow removed.
[0124] The image processing method disclosed in this embodiment uses the opengl open source image library to input the target image into the rendering pipeline, and uses the programmable shader to process the image. At the same time, the quadratic function smoothing curve and the suppression algorithm are used in the shader to make the separation of the target object image and the background smooth, so that the solution has universality and portability.
[0125] Furthermore, to understand Figure 2 For the image processing method described in steps 203 to 207, please refer to Figure 3 , Figure 3 This is a flowchart of another image processing method disclosed in an embodiment of the present application, including steps 301 to 307.
[0126] 301. Analyze the target feature parameters and the background feature parameters to obtain the hue parameter, saturation parameter and brightness parameter to obtain the hue coefficient value corresponding to the hue parameter, the saturation coefficient value corresponding to the saturation parameter, and the brightness coefficient value corresponding to the brightness parameter in the target image data to be processed and the background image data to be processed.
[0127] It should be noted that in this embodiment, steps 301 to 307 correspond to the above Figure 2Another feasible technical solution of step 203 to step 207 in the embodiment shown. Figure 3 In the embodiment shown, the hue parameter, saturation parameter and brightness parameter can be obtained by analyzing the target feature parameters and the background feature parameters. At the same time, the hue coefficient value corresponding to the hue parameter, the saturation coefficient value corresponding to the saturation parameter, and the brightness coefficient value corresponding to the brightness parameter in the target image data to be processed and the background image data to be processed can also be obtained.
[0128] In one specific embodiment, by converting the images of the target image data to be processed and the background image data to be processed (the above image data is in RGBA image format) into the HSV model in the shader, the target feature parameters corresponding to the target image data to be processed and the background feature parameters of the background image data to be processed can be parsed, thereby obtaining the hue parameter H, the saturation parameter S and the brightness parameter V, as well as the hue coefficient value corresponding to the hue parameter, the saturation coefficient value corresponding to the saturation parameter and the brightness coefficient value corresponding to the brightness parameter.
[0129] Furthermore, when the target image data to be processed and the background image data to be processed are on one image, the H value, S value or V value of the input target background color can be obtained through the HSV model. At this time, the input target background can also be understood as the H value, S value or V value of the image data to be processed.
[0130] 302. Set a hue transition curve whose hue coefficient value is within a preset hue threshold, a saturation transition curve whose saturation coefficient value is within a preset saturation threshold, and a brightness transition curve whose brightness coefficient value is within a preset brightness threshold, so as to determine a transparency curve according to the hue transition curve, the saturation transition curve, and the brightness transition curve.
[0131] Therefore, based on the various coefficient values obtained in step 301, a hue transition curve with a hue coefficient value at a preset hue threshold, a saturation transition curve with a saturation coefficient value at a preset saturation threshold, and a brightness transition curve with a brightness coefficient value at a preset brightness threshold can be set, thereby determining a transparency curve based on the hue transition curve, the saturation transition curve, and the brightness transition curve.
[0132] In one specific embodiment, in order to determine that the target can be separated from the background, the color within the preset threshold range needs to be expected that the transparency of the target image data to be processed and the background image data to be processed has the highest value. Therefore, it is necessary to set the hue transition curve whose hue coefficient value is within the preset hue threshold range, set the saturation transition curve whose saturation coefficient value is within the preset saturation threshold range, and set the brightness transition curve whose brightness coefficient value is within the preset brightness threshold range.
[0133] Furthermore, if two simple states of transparency and opacity are used, the transition between the image and the background will be uneven, so a piecewise curve transition method is used. For example, in one of the feasible technical solutions, please refer to Figure 6 , Figure 6 Schematic diagram of a tone transition curve disclosed in the embodiment of the present application. Figure 6 It can be seen that, corresponding to the transition curve of the hue, the two sharply declining endpoints in the curve represent the points where the background and the target are separated. Because of the existence of light, the fitting of the s and v curves is also necessary. Therefore, based on the design idea of hue h, the same method can be used to take the maximum value of the s and v values of the background to preliminarily fit the transition curve. Furthermore, the ordinate is a preliminary value. The transparency suppressed by the subsequent combination of the S and V curves is the fuzzy formula described in the subsequent section. The abscissa is the value of H, and the 4-6 corresponding to the abscissa is the green area, that is, the area with the highest transparency. H can first take a fixed value according to the HSV model. If the fixed value does not meet the curve value range, it needs to be adjusted. After determining the H value, looking at the HSV model diagram, it can be concluded that other colors are caused by changes in S and V. The closer it is to 0, the color is not visually green. The S and V curves can be preliminarily fitted based on this relationship.
[0134] Therefore, the hue transition curve, saturation transition curve and brightness transition curve designed by the above design ideas can be used to design a corresponding transparency curve, and the transparency curve depends on the three coefficients h, s and v.
[0135] 303. Perform smooth fitting on the target image data to be processed and the background image data to be processed according to the transparency curve to obtain the target image data to be separated and the background image data to be separated.
[0136] In this embodiment, step 303 is the same as the aforementioned Figure 2 The step 204 in FIG. 2 is similar to the step 204 in FIG. 2 and will not be described in detail here. However, it should be noted that the target is a person or an object, and the background can be understood as a green curtain. Smooth fitting is to fit Figure 6 The segmented form gives a preliminary value, which is the value of the ordinate, according to the range of H. S and B are both curve functions that are initially obtained by looking at the color model diagram. For example, within the range of H, we look at this diagram and find that the larger the value of V is, the closer it is to black, so the suppression degree should be smaller and more opaque. The higher the degree of S, the greener it will be, so the degree of V should be higher.
[0137] 304. Adjust the ratio among the hue coefficient value, the saturation coefficient value and the brightness coefficient value to a first ratio value.
[0138] It is not difficult to understand that the above steps 301 to 303 can be understood as steps of smoothing curve fitting according to the characteristics of the target and the background. Steps 304 to 307 can be understood as steps of quantifying the overflow degree and converting it into grayscale, thereby obtaining the target image data and the background image data.
[0139] Specifically, the ratio among the hue coefficient value, the saturation coefficient value and the brightness coefficient value is adjusted to a first ratio value.
[0140] In one specific embodiment, since the overflow color part is expected to be processed into grayscale color, adding a transparency can reduce the visual impact of the overflow color without affecting the target. Therefore, by adjusting the ratio between the hue coefficient value, the saturation coefficient value and the brightness coefficient value to the first ratio value, the visual impact of the overflow color is reduced.
[0141] According to the above description, further, in the HSV model, the ratio of the three HSVs is set to 1:1:1, so as to achieve that the overflow color tends to grayscale. In another specific embodiment, to adjust the ratio of the three HSVs, refer to step 305.
[0142] Furthermore, the overflow color is the degree of green, that is, in the area where the background and the target are excessive, the adjustment is to process all the colors in the green range of the entire H into a grayscale image. In this way, after the initial processing, there are parts of the color that are not visually green in the S and B ranges, and the S and V curves are needed to adjust the transparency to solve it. It is not difficult to understand that S and V are adjustable (by changing the endpoint position of the S and V curves that drop sharply), so the overflow color can be processed in the end. For the convenience of understanding and description, this will not be repeated in the future.
[0143] It is not difficult to understand that the above is only one specific ratio value of the three ratios of HSV, and the first ratio value is not specifically limited here.
[0144] 305 . Obtain color parameter values in the target image data to be separated or the background image data to be separated respectively, and use any two color parameter values in the color parameter values to proportionally adjust the remaining color parameter values to obtain a second proportional value.
[0145] Specifically, by respectively obtaining the color parameter values in the target image data to be separated or the background image data to be separated, any two color parameter values in the color parameter values are used to proportionally adjust the remaining color parameter values to obtain the second proportional value. It is not difficult to understand that the color parameter values include a red parameter value red, a green parameter value green or a blue parameter value blue, and the remaining color parameter values are color parameter values excluding any two color parameter values.
[0146] In one specific embodiment, the RGB ratio of the color of the input target image source is adjusted so that the ratio of the red parameter value, the green parameter value and the blue parameter value satisfies the second ratio value, so that the first ratio value of the parameter in HSV approaches the r=g=b=Gray=R*0.299+G*0.587+B*0.114 described above.
[0147] Specifically, taking the processing of green background as an example, firstly, the RGB ratio of all colors in the green range of the input target image source is adjusted. In this way, the blue parameter value and the red parameter value are adjusted or modified. At this time, the green background part in the output image no longer exists visually. It is not difficult to understand that the colors within the blue range or the colors within the red range can also be adjusted by the above adjustment method, so that the ratio of the red parameter value, the green parameter value and the blue parameter value satisfies the second ratio value. Specifically, the numerical value of the specific second ratio value is not limited here.
[0148] 306. Determine an estimated transparency value according to the first ratio value and the second ratio value, so as to suppress the estimated transparency value according to the target transition curve to obtain a transparency smoothing curve.
[0149] Thus, by limiting the green background, red background or blue background in the output image, the estimated transparency value can be determined according to the first ratio value and the second ratio value, so that the estimated transparency value is suppressed according to the target transition curve to obtain a transparency smooth curve. It is not difficult to understand that the target transition curve is any two transition curves among the hue transition curve, the saturation transition curve or the brightness transition curve.
[0150] In one of the specific embodiments, in order to deal with the relationship between the transparency of the entire background part and to ensure the smoothness of the transition area to the greatest extent, the transparency can be preliminarily estimated based on the ratio of the original color background to the grayscale color after the adjustment ratio. Specifically, as shown in step 305, the estimated transparency value can be obtained based on the ratio of the original green background to the grayscale color after the adjustment ratio, that is, based on the adjustment result of the first ratio value and the second ratio value. Then, the estimated transparency value is suppressed based on the transition curve of any two coefficients among the H coefficient, the S coefficient or the V coefficient. By Figure 2 In the illustrated embodiment, the estimated transparency value may be suppressed by combining the S coefficient and the V coefficient curves.
[0151] It is not difficult to understand that, since the range of the S coefficient or the V coefficient is between 0 and 1, in order to minimize the suppression of transparency when the saturation and brightness are close to the background color visually, the V transition curve can be multiplied by the S transition curve and the squared, so that the value close to 1 remains unchanged. After such processing, a smooth curve of estimated transparency (i.e., a transparency smooth curve) is obtained after being suppressed by the S and V transition curves. At this time, the range of the transparency curve is also between 0 and 1, and the trend of its function is similar to that of the S and V transition curves. The transparency of the changed grayscale has been adjusted.
[0152] It is not difficult to understand that the calculation method for the S, H or H, V transition curve is similar to the above, and the details are not repeated here.
[0153] 307. Separate and smooth the target image data to be separated and the background image data to be separated according to the transparency smoothing curve and other transition curves except the target transition curve, to obtain the target image data and the background image data.
[0154] The target image data to be separated and the background image data to be separated are separated and smoothed according to the transparency smoothing curve obtained in step 306 and other transition curves except the target transition curve, so as to obtain the target image data and the background image data.
[0155] In one of the specific embodiments, it can be seen from the above description that since the V transition curve and the S transition curve are used, the H transition curve can be added to achieve the purpose of separation and smoothing. Therefore, the target image data to be separated and the background image data to be separated can be separated and smoothed respectively by the transparency smoothing curve and the H transition curve, so as to obtain the target image data and the background image data.
[0156] Furthermore, if the S, H or H, V transition curve is used in step 306, then this step corresponds to using the V transition curve or the S transition curve, which will not be described in detail here.
[0157] An image processing method disclosed in this embodiment uses the division of h, s, and v values to distinguish between the background and the target. At the same time, the above-mentioned features are used and combined with the idea of fuzzy control to abstract a mathematical model. Secondly, in the problem of image smoothness, segmented smoothing and smoothing suppression methods are adopted. Finally, grayscale is used to process overflow, which can visually reduce overflow without affecting the overall original image. Therefore, the idea of fuzzy control is abstracted for the case where there are too many variables in image processing. When processing a single background overflow, it can be converted into grayscale and then the transparency controlled by a smooth curve can greatly reduce the visual overflow. At the same time, the segmented curve method is used to separate the target from the background more naturally.
[0158] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned 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 does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can 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 to be 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.
[0159] See also Figure 8 , Figure 8 A schematic diagram of the structure of an image processing system disclosed in an embodiment of the present application.
[0160] The receiving unit 801 is used to receive the image data to be processed collected by the image collection device; wherein the image data to be processed includes the target image data to be processed and the background image data to be processed;
[0161] An adjusting unit 802 is used to adjust target feature parameters of the target image data to be processed to obtain target image data; and to adjust background feature parameters of the background image data to be processed to obtain background image data;
[0162] A determination unit 803 is used to infer the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data;
[0163] The acquisition unit 804 is used to calculate the target image data and the background image data based on the target mapping relationship to obtain the inference parameter value corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter value.
[0164] Exemplarily, the system further includes: an execution unit 805;
[0165] The receiving unit 801 is specifically configured to receive the image data to be processed corresponding to the current image frame acquired by the image acquisition device;
[0166] The determination unit 803 is specifically used to determine the vertex attribute values of the image data to be processed, and perform coordinate transformation on the image data to be processed based on the vertex attribute values to obtain the vertex data and the vertex index values corresponding to the vertex data; wherein the vertex index values are used to describe the composition of the vertex data in the image data to be processed;
[0167] The execution unit 805 is used to combine all vertex data according to all vertex index values to obtain target image data to be processed and background image data.
[0168] Exemplarily, the system further includes: a setting unit 806;
[0169] A setting unit 806, used to set a transparency curve according to target characteristic parameters and background characteristic parameters;
[0170] The acquisition unit 804 is specifically used to perform smooth fitting on the target image data to be processed and the background image data to be processed according to the transparency curve to obtain the target image data to be separated and the background image data to be separated;
[0171] The adjusting unit 802 is specifically used to adjust the first ratio value of the characteristic parameters in the target characteristic parameters and the background characteristic parameters, and adjust the second ratio value of the color parameter values in the target image data to be separated and the background image data to be separated;
[0172] The acquisition unit 804 is further configured to obtain a transparency smoothing curve corresponding to the transparency according to the first ratio value and the second ratio value;
[0173] The acquisition unit 804 is further used to separate and smooth the target image data to be separated and the background image data to be separated according to the smooth transparency curve and the color parameter value, so as to obtain the target image data and the background image data.
[0174] Exemplarily, the system includes:
[0175] The acquisition unit 804 is specifically used to analyze the target characteristic parameters and the background characteristic parameters to obtain the hue parameter, the saturation parameter and the brightness parameter;
[0176] The acquisition unit 804 is further used to acquire the hue coefficient value corresponding to the hue parameter, the saturation coefficient value corresponding to the saturation parameter, and the brightness coefficient value corresponding to the brightness parameter in the target image data to be processed and the background image data to be processed;
[0177] The setting unit 806 is specifically used to set a hue transition curve whose hue coefficient value is within a preset hue threshold, a saturation transition curve whose saturation coefficient value is within a preset saturation threshold, and a brightness transition curve whose brightness coefficient value is within a preset brightness threshold;
[0178] The determination unit 803 is specifically configured to determine a transparency curve according to the hue transition curve, the saturation transition curve and the brightness transition curve.
[0179] Exemplarily, the system includes:
[0180] The adjusting unit 802 is specifically configured to adjust the ratio among the hue coefficient value, the saturation coefficient value and the brightness coefficient value to a first ratio value;
[0181] The acquisition unit 804 is specifically used to respectively acquire the color parameter value in the target image data to be separated or the background image data to be separated; wherein the color parameter value includes a red parameter value, a green parameter value or a blue parameter value;
[0182] The adjustment unit 802 is further configured to use any two of the color parameter values to proportionally adjust the remaining color parameter values to obtain a second proportional value; wherein the remaining color parameter values are the color parameter values excluding any two of the color parameter values.
[0183] Exemplarily, the system includes:
[0184] A determining unit 803, specifically configured to determine an estimated transparency value according to the first ratio value and the second ratio value;
[0185] The acquisition unit 804 is specifically used to suppress the estimated transparency value according to the target transition curve to obtain a transparency smooth curve; wherein the target transition curve is any two transition curves of the hue transition curve, the saturation transition curve or the brightness transition curve;
[0186] The acquisition unit 804 is further used to separate and smooth the target image data to be separated and the background image data to be separated according to the transparency smoothing curve and other transition curves except the target transition curve, so as to obtain the target image data and the background image data.
[0187] Exemplarily, the system includes:
[0188] The determination unit 803 is specifically used to determine the current color parameter value and the current transparency value in the target image data and the background image data respectively;
[0189] The determination unit 803 is further used to determine the boundary segmentation limit between the target image data and the background image data;
[0190] The acquisition unit 804 is specifically used to perform reasoning according to the current color parameter value, the current transparency value and the boundary segmentation limit to obtain the target mapping relationship.
[0191] See below Fig. 9 , a schematic diagram of the structure of an image processing device disclosed in an embodiment of the present application includes:
[0192] CPU 901, memory 905, input / output interface 904, wired or wireless network interface 903 and power supply 902;
[0193] The memory 905 is a temporary storage memory or a permanent storage memory;
[0194] The CPU 901 is configured to communicate with the memory 905 and execute the instructions in the memory 905 to perform the aforementioned Figures 1 to 3 The image processing method in any of the illustrated embodiments.
[0195] The embodiment of the present application also provides a chip system, characterized in that the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is used to run a computer program or instruction to execute the aforementioned Figures 1 to 3 The image processing method in any of the illustrated embodiments.
[0196] The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes instructions, when the instructions are executed on a computer, the computer executes the aforementioned Figures 1 to 3 The image processing method in any of the illustrated embodiments.
[0197] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the aforementioned Figures 1 to 3 The image processing method in any of the illustrated embodiments.
[0198] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0199] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0200] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0201] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0202] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. An image processing method, characterized in that: Applied to an image processing device, the image processing device is connected to an image acquisition device, and the method includes: Receiving the image data to be processed acquired by the image acquisition device; wherein the image data to be processed includes target image data to be processed and background image data to be processed; Adjusting target feature parameters of the target image data to be processed to obtain target image data; adjusting background feature parameters of the background image data to be processed to obtain background image data; Performing reasoning on the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data; The target image data and the background image data are calculated based on the target mapping relationship to obtain inference parameter values corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter values.
2. The image processing method according to claim 1, wherein: The receiving the image data to be processed acquired by the image acquisition device includes: receiving the image data to be processed corresponding to the current image frame acquired by the image acquisition device; Determining vertex attribute values of the image data to be processed, and performing coordinate transformation on the image data to be processed based on the vertex attribute values to obtain vertex data and vertex index values corresponding to the vertex data; wherein the vertex index values are used to describe the composition of the vertex data in the image data to be processed; All the vertex data are combined according to all the vertex index values to obtain the target image data to be processed and the background image data to be processed.
3. The image processing method according to claim 1, wherein: adjusting target feature parameters of the target image data to be processed to obtain target image data; Adjusting background feature parameters of the background image data to be processed to obtain background image data includes: Setting a transparency curve according to the target characteristic parameters and the background characteristic parameters; Performing smooth fitting on the target image data to be processed and the background image data to be processed according to the transparency curve to obtain the target image data to be separated and the background image data to be separated; Adjusting a first ratio value of a characteristic parameter among the target characteristic parameter and the background characteristic parameter, and adjusting a second ratio value of a color parameter value among the target image data to be separated and the background image data to be separated; Obtaining a transparency smooth curve corresponding to transparency according to the first ratio value and the second ratio value; According to the smooth transparency curve and the color parameter value, the target image data to be separated and the background image data to be separated are separated and smoothed respectively to obtain the target image data and the background image data.
4. The image processing method according to claim 3, wherein: The setting of the transparency curve according to the target characteristic parameter and the background characteristic parameter includes: Analyzing the target characteristic parameters and the background characteristic parameters to obtain hue parameters, saturation parameters and brightness parameters; Acquire a hue coefficient value corresponding to the hue parameter, a saturation coefficient value corresponding to the saturation parameter, and a brightness coefficient value corresponding to the brightness parameter in the target image data to be processed and the background image data to be processed; Setting a hue transition curve where the hue coefficient value is within a preset hue threshold, a saturation transition curve where the saturation coefficient value is within a preset saturation threshold, and a brightness transition curve where the brightness coefficient value is within a preset brightness threshold; The transparency curve is determined according to the hue transition curve, the saturation transition curve, and the brightness transition curve.
5. The image processing method according to claim 4, characterized in that The adjusting of the first ratio value of the characteristic parameters in the target characteristic parameters and the background characteristic parameters, and the adjusting of the second ratio value of the color parameter values in the target image data to be separated and the background image data to be separated, include: Adjusting the ratio among the hue coefficient value, the saturation coefficient value, and the brightness coefficient value to the first ratio value; Respectively obtaining the color parameter values in the target image data to be separated or the background image data to be separated; wherein the color parameter values include red parameter values, green parameter values or blue parameter values; The remaining color parameter values are proportionally adjusted using any two of the color parameter values to obtain the second proportional value; wherein the remaining color parameter values are color parameter values excluding any two of the color parameter values.
6. The image processing method according to claim 5, characterized in that Obtaining a transparency smooth curve corresponding to transparency according to the first ratio value and the second ratio value includes: determining an estimated transparency value according to the first ratio value and the second ratio value; The estimated transparency value is suppressed according to a target transition curve to obtain the transparency smooth curve; wherein the target transition curve is any two transition curves of the hue transition curve, the saturation transition curve, or the brightness transition curve; The step of separating and smoothing the target image data to be separated and the background image data to be separated according to the smooth transparency curve and the color parameter value to obtain the target image data and the background image data includes: The target image data to be separated and the background image data to be separated are separated and smoothed respectively according to the transparency smoothing curve and other transition curves except the target transition curve to obtain the target image data and the background image data.
7. The image processing method according to claim 6, characterized in that: The reasoning on the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data includes: Determining current color parameter values and current transparency values in the target image data and the background image data respectively; Determining a boundary segmentation boundary between the target image data and the background image data; The target mapping relationship is obtained by performing reasoning based on the current color parameter value, the current transparency value, and the boundary segmentation limit.
8. An image processing system, characterized in that: Applied to an image processing device, the image processing device is connected to an image acquisition device, and the system includes: A receiving unit, configured to receive the image data to be processed acquired by the image acquisition device; wherein the image data to be processed includes target image data to be processed and background image data to be processed; an adjusting unit, configured to adjust target feature parameters of the target image data to be processed to obtain target image data; and to adjust background feature parameters of the background image data to be processed to obtain background image data; a determining unit, configured to infer the target image data and the background image data to determine a target mapping relationship between the target image data and the background image data; An acquisition unit is used to calculate the target image data and the background image data based on the target mapping relationship to obtain an inference parameter value corresponding to the image data to be processed, so as to perform image separation on the target image data and the background image data respectively according to the inference parameter value.
9. An image processing device, characterized in that: The device comprises: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the image processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium includes instructions, and when the instructions are executed on a computer, the computer is caused to execute the image processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image processing method and device, computer readable storage medium and computer device
CN110335277A
Image processing method and device, electronic equipment and storage medium
CN112330531A
Image color matting method and system, computer equipment and storage medium
CN113409221A
Information processing method and electronic equipment
CN116033098A
Method for realizing calculation and dynamic visualization of three-dimensional grid data field
CN117496089A
