WO2018177237A1 - Image processing method and device, and storage medium - Google Patents

Image processing method and device, and storage medium Download PDF

Info

Publication number
WO2018177237A1
WO2018177237A1 PCT/CN2018/080446 CN2018080446W WO2018177237A1 WO 2018177237 A1 WO2018177237 A1 WO 2018177237A1 CN 2018080446 W CN2018080446 W CN 2018080446W WO 2018177237 A1 WO2018177237 A1 WO 2018177237A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
map
preset
color
probability
Prior art date
Application number
PCT/CN2018/080446
Other languages
French (fr)
Chinese (zh)
Inventor
朱晓龙
郑永森
王浩
黄凯宁
罗文寒
高雨
杨之华
华园
曾毅榕
吴发强
黄祥瑞
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018177237A1 publication Critical patent/WO2018177237A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features

Definitions

  • the present application relates to the field of computer technologies, and in particular, to an image processing method, apparatus, and storage medium.
  • the embodiment of the present application provides an image processing method and apparatus; the accuracy of segmentation can be improved, and the fusion effect can be improved.
  • the embodiment of the present application provides an image processing method, which is applied to an image processing apparatus, and the method includes:
  • the image is merged with the preset element material according to the initial probability map to obtain a processed image.
  • An embodiment of the present application further provides an image processing apparatus, where the apparatus includes a processor and a memory, wherein the memory stores an instruction executable by the processor, and when the instruction is executed, the processor is used by :
  • the image is merged with the preset element material according to the initial probability map to obtain a processed image.
  • FIG. 1 is a schematic diagram of a scenario of an image processing method according to an embodiment of the present application
  • FIG. 1b is a flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 2a is another flowchart of an image processing method provided by an embodiment of the present application.
  • 2b is a diagram showing an example of an interface of an image processing request in an image processing method according to an embodiment of the present application
  • 2c is a diagram showing an example of sky segmentation in an image processing method provided by an embodiment of the present application.
  • 2d is a process flow diagram of an image processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
  • FIG. 3b is another schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a server provided by an embodiment of the present application.
  • the threshold value can be generally determined based on the color and position of the sky in the image, and then the image is segmented according to the judgment result, and the sky region obtained after the segmentation is replaced with other elements, such as Pyrotechnics, reindeer, or two-dimensional space, etc., so that the processed image can achieve a special effect, but it is easy to cause false detection and missed detection, greatly affecting the accuracy of segmentation, and the fusion effect of images, such as Distortion or not smooth enough, and so on.
  • the embodiment of the present application provides an image processing method and apparatus, where the image processing apparatus may be specifically integrated in a device such as a server.
  • an image processing request may be sent to the server through the terminal, wherein the image processing request indicates an image to be processed, and information such as an element type to be replaced.
  • the server may acquire a semantic segmentation model corresponding to the element type (the semantic segmentation model is trained by a deep neural network), and then, according to the semantic segmentation model, each pixel in the image belongs to The probability of the element type is predicted to obtain a segmentation probability map.
  • the segmentation probability map is referred to as an initial probability map.
  • the server may also optimize the initial probability map by means of a conditional random field to obtain a more fine segmentation result (ie, obtain a segmentation effect map), and then fuse the image with the preset element material according to the segmentation result.
  • a fusion method can be used to combine a first color portion (such as a white portion) in a segmentation effect image with a replaceable element material, and a second color portion (such as a black portion) in the segmentation effect image is combined with the image. Then, the two combined results are synthesized, and the synthesized processed image is supplied to the terminal, and the like.
  • An image processing method comprising: receiving an image processing request indicating an image to be processed (ie, an image to be processed), and an element type to be replaced (ie, an element type to be replaced), acquiring the element type Corresponding semantic segmentation model, which is trained by deep neural network. According to the semantic segmentation model, the probability that each pixel belongs to the element type is predicted, and the initial probability map is obtained, based on the conditional random field pair. The initial probability map is optimized to obtain a segmentation effect map, and the image is merged with the preset element material according to the segmentation effect image to obtain a processed image.
  • the specific process of the image processing method can be as follows:
  • the image processing request sent by the terminal or other network side device may be specifically received (eg, a server), and the like.
  • the image processing request may indicate an image to be processed, and information such as an element type to be replaced.
  • the so-called element type refers to the category of the element, and the element refers to the basic element that can carry the visual information. For example, if the image processing request indicates that the type of the element to be replaced is “sky”, it indicates that the image needs to be in the image. All sky parts are replaced; for example, if the image processing request indicates that the type of element to be replaced is "portrait”, it means that all portrait parts in the image need to be replaced, and so on, and so on.
  • step 101 the image processing request received by the server (eg, the server) indicates that the element type to be replaced is "sky”, then at this time, (eg, the server) may acquire a semantic segmentation corresponding to "sky” a model, and if the image processing request received in step 101 (eg, the server) indicates that the type of element to be replaced is "portrait", then at this time, a semantic segmentation model corresponding to "portrait” may be acquired, etc. .
  • the semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is, Before the step of "acquiring the semantic segmentation model corresponding to the element type", the image processing method may further include:
  • the training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
  • a semantic segmentation model corresponding to “sky” for example, a certain number (such as 8000, etc.) of images containing the sky can be collected, and then, based on these images, a preliminary semantic segmentation initial model is extracted by using a deep neural network. Fine tune, the resulting model is the semantic segmentation model corresponding to “sky”.
  • the preset semantic segmentation initial model may be preset according to the requirements of the actual application. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
  • the specific information may be as follows:
  • (1) (eg, a server) import the image into the semantic segmentation model to predict the probability that each pixel in the image belongs to the element type.
  • the image can be imported into the semantic segmentation model corresponding to "sky” to predict the probability that each pixel in the image belongs to "sky".
  • the image may be imported into a semantic segmentation model corresponding to “portrait” to predict the probability that each pixel in the image belongs to “portrait”, and so on. ,and many more.
  • (2) (e.g., the server) sets the color of the corresponding pixel on the preset mask according to the probability to obtain an initial probability map.
  • the specificity may be determined whether the probability is greater than a preset threshold. If yes, the color of the corresponding pixel on the preset mask is set to the first color, and if not, the color of the corresponding pixel on the preset mask is set to The second color, after determining that all the pixels in the image are set on the preset mask, output a preset mask after setting the color to obtain an initial probability map.
  • the mask is a part outside the selection area and is responsible for protecting the content of the selection.
  • a mask containing the first color and the second color may be obtained at this time, wherein the first color in the mask indicates that the probability that the corresponding pixel belongs to the element type is large, for example, greater than a preset threshold, and the second The color indicates that the probability that the corresponding pixel belongs to the element type is small, such as less than a preset threshold. Therefore, for the convenience of description, in the embodiment of the present application, the mask of the output is referred to as an initial probability map.
  • the preset threshold may be set according to the requirements of the actual application.
  • the preset threshold is specifically 80%, and the element type is “sky” as an example. If a certain pixel A belongs to the “sky”, the probability is greater than 80%, you can set the color of pixel A on the preset mask to the first color. Otherwise, if the probability that pixel A belongs to "sky" is less than or equal to 80%, you can set pixel A on the preset mask. The color is set to the second color, and so on.
  • the first color and the second color may also be determined according to actual application requirements.
  • the first color may be set to white
  • the second color may be set to black
  • the first color may be set to pink
  • the second color may be set to green, and so on.
  • the description will be made by taking the first color as white and the second color as black.
  • the image is merged with the preset element material according to the initial probability map to obtain a processed image; for example, the specific content may be as follows:
  • (1) obtains replaceable element material according to a preset policy.
  • the preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
  • the element material can also be obtained by random interception, that is, the step of “acquiring the replaceable element material according to the preset strategy” may also include:
  • a candidate image is acquired, the candidate image is randomly intercepted, and the intercepted image is taken as a replaceable element material, and the like.
  • the candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
  • (2) (eg, the server) combines the first color portion of the initial probability map with the acquired element material by a fusion method to obtain a first combination map.
  • the portion can be combined with the acquired element material by the fusion method, that is, the pixel of the portion can be Replaced with the acquired element material.
  • (3) (eg, the server) combines the second color portion of the initial probability map with the image by a fusion method to obtain a second combination map.
  • the portion can be combined with the original image by the fusion method, that is, the pixel of the portion is retained.
  • the image may be subjected to certain preprocessing, such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc., and then combining the second color portion with the preprocessed image by a fusion method to obtain a second combination map.
  • certain preprocessing such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc.
  • the initial probability map in the above example may be optimized, and the specific optimization manner is as follows:
  • the initial probability map is optimized based on conditional random fields (CRF or CRFs, also referred to as conditional random fields) to obtain a segmentation effect map.
  • CRF conditional random fields
  • the pixel in the initial probability map may be mapped to the node in the conditional random field, and the similarity of the edge constraint between the nodes may be determined, and the similarity of the edge constraint is used in the initial probability map.
  • the segmentation result of the pixel is adjusted to obtain a segmentation effect map.
  • the conditional random field is a discriminative probability model, which is a kind of random field.
  • the conditional random field has an undirected graph model.
  • the nodes (ie, vertices) in the graph model represent random variables, and the connections between nodes represent the dependencies between random variables.
  • Conditional random fields have the ability to express long-distance dependence and overlapping features, which can better solve the advantages of labeling (classification) biasing, and all features can be globally normalized to obtain global optimality. Solution, therefore, the conditional random field can be used to optimize the initial probability map to achieve the purpose of optimizing the segmentation result.
  • the segmentation effect map is optimized by the initial probability map, the segmentation effect map is also a mask containing the first color and the second color.
  • Step 104 merging the image with the preset element material according to the initial probability map, and obtaining the processed image, comprising: merging the image with the preset element material according to the segmentation effect image to obtain a processed image; for example, Specifically, it can be as follows:
  • (1) obtains replaceable element material according to a preset policy.
  • the preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
  • the element material can also be obtained by random interception, that is, the step “acquiring the replaceable element material according to the preset strategy” may also include:
  • a candidate image is acquired, the candidate image is randomly intercepted, and the intercepted image is taken as a replaceable element material, and the like.
  • the candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
  • (2) (e.g., the server) combines the first color portion of the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map.
  • the portion can be combined with the acquired element material by the fusion method, that is, the pixel of the portion can be Replaced with the acquired element material.
  • (3) (eg, a server) combines the second color portion of the segmentation rendering with the image by a fusion method to obtain a second combination.
  • the portion can be combined with the original image by the fusion method, that is, the pixel of the portion is retained.
  • the image may be subjected to certain preprocessing, such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc., and then combining the second color portion with the preprocessed image by a fusion method to obtain a second combination map.
  • certain preprocessing such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc.
  • the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region.
  • the color processing may be more natural; that is, before the step of “merging the image with the preset element material according to the segmentation effect image to obtain a processed image”, the image processing method may further include:
  • the segmentation effect diagram is subjected to an Appearance Model method and/or an image morphology operation process to obtain a processed segmentation effect map.
  • the step of “merging the image with the preset element material according to the segmentation effect image to obtain the processed image” may include: fusing the image with the preset element material according to the processed segmentation effect image, for example, performing Transparency (Alpha) blends to get processed images.
  • Transparency Alpha
  • the appearance model method is a feature point extraction method widely used in the field of pattern recognition. It can statistically model the texture and further fuse the two statistical models of shape and texture into the apparent model.
  • the image morphology operation processing may include processing such as noise reduction processing and/or connected domain analysis, and the segmentation effect map processed by the appearance model method or the image morphology operation may have a smoother boundary and a connection of the replacement area. The color transition at the place can be more natural.
  • Alpha Fusion in the embodiment of the present application refers to the fusion based on the Alpha value, wherein Alpha is mainly used to specify the transparency level of the pixel.
  • Alpha is mainly used to specify the transparency level of the pixel.
  • 8 bits can be reserved for the alpha portion of each pixel, the effective value of alpha is in the range [0, 255], and [0, 255] represents the opacity [0%, 100%]. Therefore, when the alpha of the pixel is 0, it means completely transparent. When the alpha of the pixel is 128, it means 50% transparency, and when the alpha of the pixel is 255, it means completely opaque.
  • the embodiment may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and predict, according to the model, the probability that each pixel in the image belongs to the element type.
  • To obtain an initial probability map and then optimize the initial probability map based on the conditional random field, and use the segmentation effect map obtained by the optimization to fuse the image with the preset element material, thereby achieving an element type part of the image.
  • the purpose of replacing the material of the preset element because the semantic segmentation model in this scheme is mainly trained by the deep neural network, and when the image is semantically segmented by the model, it is not based on information such as color and position.
  • the probability of false detection and missed detection can be greatly reduced compared to the existing scheme; in addition, since the scheme can also utilize conditional random field pair segmentation
  • the initial probability map is optimized, so that a more detailed segmentation result can be obtained. Large improve accuracy of segmentation, helps to reduce the image distortion and improve image fusion effect.
  • the image processing apparatus is specifically integrated into the server, and the element to be replaced is “sky” as an example.
  • an image processing method can be as follows:
  • the terminal sends an image processing request to the server, where the image processing request may indicate an image to be processed (ie, an image to be processed), and information such as an element type to be replaced (ie, an element type to be replaced).
  • the image processing request may indicate an image to be processed (ie, an image to be processed), and information such as an element type to be replaced (ie, an element type to be replaced).
  • the image processing request may be triggered in various manners, for example, by clicking or sliding a trigger button on a webpage or a client interface, or by triggering a preset instruction, and the like.
  • the server After receiving the image processing request, the server acquires a semantic segmentation model corresponding to “sky”, and the semantic segmentation model is trained by a deep neural network.
  • the semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-created by the image processing device, for example,
  • the training data including the type of the element may be obtained, for example, collecting a certain number of images containing the sky, and then, according to the training data (ie, the image containing the sky), using the deep neural network to perform the preset semantic segmentation initial model Train to get the semantic segmentation model corresponding to the "sky".
  • the preset semantic segmentation initial model may be preset according to the requirements of the actual application. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
  • the server imports the image into the semantic segmentation model to predict a probability that each pixel in the image belongs to the “sky”.
  • step 202 the received image processing request indicates that the image to be processed is the picture A
  • the picture A may be imported into the semantics corresponding to the “sky” in the form of a three-channel color image.
  • step 204 to predict the probability that each pixel in the image A belongs to the "sky”, then step 204 is performed.
  • the server sets the color of the corresponding pixel on the preset mask according to the probability, to obtain an initial probability map.
  • the specificity may be determined whether the probability is greater than a preset threshold. If yes, the color of the corresponding pixel on the preset mask is set to the first color, and if not, the color of the corresponding pixel on the preset mask is set to The second color, after determining that all the pixels in the image are set on the preset mask, output a preset mask after setting the color to obtain an initial probability map.
  • the preset threshold may be set according to the requirements of the actual application. For example, the preset threshold is specifically 80%. If the probability that a certain pixel K belongs to the “sky” is greater than 80%, the pixel K may be used. The color on the preset mask is set to the first color. Otherwise, if the probability that a pixel K belongs to the "sky" is less than or equal to 80%, the color of the pixel K on the preset mask may be set to the second color. Color, and so on.
  • the first color and the second color may also be determined according to actual application requirements. For example, the first color may be set to white, the second color may be set to black, or the first color may be set to pink. And set the second color to green, and so on.
  • an initial probability map as shown in FIG. 2c can be obtained.
  • the server optimizes the initial probability map based on the conditional random field to obtain a segmentation effect diagram.
  • the server may map the pixels in the initial probability map to the nodes in the conditional random field, determine the similarity of the edge constraints between the nodes, and perform the segmentation result of the pixels in the initial probability map according to the similarity of the edge constraints. Adjust to get the split rendering.
  • each pixel in the image can correspond to a node in the conditional random field, and preset a priori information including parameters such as color, texture, and position, so that The pixels with similar edge constraints between the nodes have similar segmentation results. Therefore, the segmentation results of the pixels in the initial probability map can be adjusted according to the similarity of the edge constraints, so that the sky segmentation result is more fine, for example, participation.
  • a more detailed segmentation effect map of the segmentation result can be obtained.
  • the server performs an appearance model method and/or an image morphology operation process on the segmentation rendering image to obtain a processed segmentation effect map, and then performs step 207.
  • the image morphology operation process may include processing such as noise reduction processing and/or connected domain analysis.
  • the segmentation effect map processed by the appearance model method or the image morphology operation can make the segmentation boundary smoother and the color transition at the junction of the replacement region can be more natural.
  • step 206 is an optional step. If step 206 is not performed, after step 205 is performed, step 207 may be directly performed, and in step 208, the segmentation effect map, image, and The element material is fused to obtain a processed image.
  • the server obtains replaceable element material according to a preset policy.
  • the preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
  • the element material can also be obtained by random interception.
  • the server can acquire the candidate image, and then randomly intercept the candidate image, and replace the captured image as a replaceable image. Elemental material, and more.
  • the candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
  • the server fuses the processed segmentation effect image, the image, and the element material by a fusion method to obtain a processed image.
  • the first color is white and the second color is black.
  • the server can combine the white part of the split effect image with the acquired element material by the fusion method to obtain the first color.
  • the second combination map is obtained by combining the black portion in the segmentation effect map with the image A by a fusion method, and then the first combination image and the second combination image are combined to obtain a processed image.
  • the pixel of the portion can be replaced with the acquired element material by the fusion method, and the pixel of the black portion belongs to the "sky".
  • the probability is low. Therefore, at this time, the pixel of the part can be combined with the original image A by the fusion method, that is, the pixel of the part is retained, so that the first combination picture and the second combination picture are combined, and then The "sky” in the original image A can be replaced with the corresponding element material, for example, the "sky” in the image A is replaced with "the night sky of Christmas", etc., see FIG. 2d, and details are not described herein again.
  • the image A may be fixed before the black portion (ie, the second color portion) is combined with the image A.
  • Pre-processing such as color conversion, contrast adjustment, brightness adjustment, saturation adjustment, and/or adding other special effects masks, etc., and then combining the black portion with the pre-processed image A by a fusion method to A second combination diagram is obtained, and details are not described herein again.
  • the server sends the processed image to the terminal.
  • the processed image can be displayed on the interface of the corresponding client.
  • the server may also provide a corresponding save path and/or share interface for the user to protect and/or share, for example, the processed image may be saved in the cloud or locally (ie, in the terminal), and the processed image may be processed. Share to Weibo, circle of friends, and/or insert into the chat dialog interface of the instant chat tool, and so on, and will not repeat them here.
  • the embodiment may acquire a semantic segmentation model corresponding to “sky” according to the instruction of the request, and predict a probability that each pixel in the image belongs to “sky” according to the model, to obtain The initial probability map is then optimized based on the conditional random field, and the image is merged with the preset element material by using the segmentation effect map obtained by the optimization, thereby replacing the “sky” part of the image with the pre-predetermined image.
  • the purpose of the element material is set; because the semantic segmentation model in this scheme is mainly trained by the deep neural network, and the semantic segmentation of the image by using the model is not based on information such as color and position, but through The probability that each pixel belongs to the element type is predicted, so the probability of false detection and missed detection can be greatly reduced compared with the existing scheme; in addition, since the scheme can also utilize the conditional random field pair initialization after segmentation The probability map is optimized, so that more detailed segmentation results can be obtained, which greatly improves the segmentation precision. Accuracy helps reduce image distortion and improves image fusion.
  • the embodiment of the present application further provides an image processing apparatus, which may be integrated into a device such as a server.
  • the image processing apparatus includes a receiving unit 301, an obtaining unit 302, a prediction unit 303, an optimization unit 304, and a fusion unit 305, as follows:
  • the receiving unit 301 is configured to receive an image processing request, where the image processing request indicates an image that needs to be processed, and information such as an element type that needs to be replaced.
  • the obtaining unit 302 is configured to obtain a semantic segmentation model corresponding to the element type, and the semantic segmentation model is trained by a deep neural network.
  • the acquiring unit 302 can acquire the semantic segmentation model corresponding to “sky”, and if the receiving unit 301 receives The image processing request to the image indicates that the type of the element to be replaced is "portrait”. At this time, the obtaining unit 302 can acquire a semantic segmentation model corresponding to the "portrait", and the like, and is not enumerated here.
  • the semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is, As shown in FIG. 3b, the image processing apparatus may further include a model establishing unit 306, as follows:
  • the model establishing unit 306 can be used to establish a semantic segmentation model corresponding to the element type.
  • the specific information may be as follows:
  • the training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
  • the preset semantic segmentation initial model may be preset according to actual application requirements. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
  • the prediction unit 303 is configured to predict, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtain an initial probability map.
  • the prediction unit 303 can include a prediction subunit and a setting subunit, as follows:
  • a prediction subunit that can be used to import the image into the semantic segmentation model to predict the probability that each pixel in the image belongs to the element type.
  • the prediction subunit can import the image into the semantic segmentation model corresponding to “sky” to predict the probability that each pixel in the image belongs to “sky”.
  • the setting subunit can be used to set the color of the corresponding pixel on the preset mask according to the probability to obtain an initial probability map.
  • the setting subunit may be specifically configured to determine whether the probability is greater than a preset threshold, and if yes, set a color of the corresponding pixel on the preset mask to a first color; if not, the corresponding pixel is preset The color on the mask is set to the second color; after determining that all the pixels in the image are set on the preset mask, the preset mask after setting the color is output, and an initial probability map is obtained.
  • the preset threshold may be set according to the requirements of the actual application, and the first color and the second color may also be determined according to actual application requirements.
  • the first color may be set to white
  • the second color may be set to Black, and so on.
  • the optimization unit 304 is configured to optimize the initial probability map based on the conditional random field to obtain a segmentation effect map.
  • the optimization unit 304 may be specifically configured to map the pixels in the initial probability map to the nodes in the conditional random field, determine the similarity of the edge constraints between the nodes, and determine the initial probability map according to the similarity of the edge constraints.
  • the segmentation result of the pixel is adjusted to obtain a segmentation effect map.
  • the merging unit 305 is configured to fuse the image with the preset element material according to the segmentation effect image to obtain a processed image.
  • the fusion unit 305 can include a material acquisition subunit, a first fusion subunit, a second fusion subunit, and a synthesis subunit, as follows:
  • the material acquisition sub-unit is used to obtain a replaceable element material according to a preset policy.
  • the preset policy may be set according to the requirements of the actual application.
  • the material acquisition sub-unit may be specifically configured to receive a material selection instruction triggered by the user, and obtain corresponding material from the material library according to the material selection instruction, as Replaced element material, and so on.
  • the material of the element can also be obtained by random interception, namely:
  • the material acquisition sub-unit is specifically configured to acquire a candidate image, randomly intercept the candidate image, and use the intercepted image as a replaceable element material.
  • the candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
  • the first fusion subunit may be configured to combine the first color portion in the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map.
  • the second fusion subunit may be configured to combine the second color portion in the segmentation effect map with the image by a fusion method to obtain a second combination map.
  • the synthesis subunit can be used to synthesize the first combination map and the second combination map to obtain a processed image.
  • the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region.
  • the color transition at the location may be more natural; that is, as shown in FIG. 3b, the image processing apparatus may further include a pre-processing unit 307, as follows:
  • the pre-processing unit 307 can be configured to perform an appearance model method and/or an image morphology operation process on the segmentation effect map to obtain a processed segmentation effect map.
  • the merging unit 305 may be specifically configured to fuse the image with the preset element material according to the processed segmentation effect image to obtain a processed image.
  • the image morphological operation processing may include processing such as noise reduction processing and/or connected domain analysis, and details are not described herein again.
  • the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same or a plurality of entities.
  • the foregoing method embodiments and details are not described herein.
  • the acquiring unit 302 may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and the prediction unit 303 predicts each image according to the model.
  • a pixel belongs to the probability of the element type to obtain an initial probability map.
  • the optimization unit 304 optimizes the initial probability map based on the conditional random field
  • the fusion unit 305 uses the optimized segmentation effect map to image and pre-
  • the element material is fused to achieve the purpose of replacing a certain element type part of the image with the preset element material; since the semantic segmentation model in the scheme is mainly trained by the deep neural network, and the model is utilized Semantic segmentation of images is not based solely on information such as color and position, but by predicting the probability that each pixel belongs to that element type. Therefore, compared to existing solutions, false detection and leakage can be greatly reduced. Probability of detection; in addition, since the scheme can also utilize the conditional random field to split the initial Fig rate optimization, so you can get a finer segmentation results, greatly improving the accuracy of segmentation, helps to reduce the image distortion and improve image fusion effect.
  • the embodiment of the present application further provides a server, as shown in FIG. 4, which shows a schematic structural diagram of a server involved in the embodiment of the present application, specifically:
  • the server may include one or more processing core processor 401, one or more computer readable storage medium memories 402, power source 403, and input unit 404. It will be understood by those skilled in the art that the server structure illustrated in FIG. 4 does not constitute a limitation to the server, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements. among them:
  • the processor 401 is the control center of the server, connecting various portions of the entire server using various interfaces and lines, by running or executing software programs and/or modules stored in the memory 402, and recalling data stored in the memory 402, Execute the server's various functions and process data to monitor the server as a whole.
  • the processor 401 may include one or more processing cores; the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application, etc., and the modem processor mainly Handle wireless communications. It can be understood that the above modem processor may not be integrated into the processor 401.
  • the memory 402 can be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by running software programs and modules stored in the memory 402.
  • the memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the server, etc.
  • memory 402 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 402 can also include a memory controller to provide processor 401 access to memory 402.
  • the server also includes a power supply 403 for powering various components.
  • the power supply 403 can be logically coupled to the processor 401 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the power supply 403 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the server can also include an input unit 404 that can be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • an input unit 404 can be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • the server may further include a display unit or the like, and details are not described herein again.
  • the processor 401 in the server loads the executable file corresponding to the process of one or more applications into the memory 402 according to the following instruction, and is stored in the memory by the processor 401.
  • the application in 402 performs the above-described methods shown in Figures 1b and 2a, and the operations of the devices shown in Figures 3a and 3b, as follows:
  • the replaceable element material may be obtained according to a preset strategy, and then the first color portion in the segmentation effect image is combined with the acquired element material by a fusion method to obtain a first combination image, and the fusion method is adopted.
  • the second color portion in the segmentation effect map is combined with the image to obtain a second combination image, and then the first combination image and the second combination image are combined to obtain a processed image.
  • the semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is,
  • the processor 401 can also run an application stored in the memory 402 to implement the following functions:
  • the training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
  • the preset semantic segmentation initial model may be preset according to actual application requirements. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
  • the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region.
  • the color transition at the location can be more natural; that is, the processor 401 can also run an application stored in the memory 402 to implement the following functions:
  • the appearance model method and/or the image morphology operation processing are performed on the segmentation effect diagram, and the segmentation effect map is obtained after the processing, so that, after the fusion, the image and the preset element material can be segmented according to the processed segmentation effect map.
  • the fusion is performed to obtain the processed image.
  • the server of the embodiment may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and predict, according to the model, each pixel in the image belongs to the element type. Probability to obtain the initial probability map, then optimize the initial probability map based on the conditional random field, and use the segmentation effect map obtained by the optimization to fuse the image with the preset element material to achieve an element in the image
  • the type part is replaced with the purpose of the preset element material; since the semantic segmentation model in this scheme is mainly trained by the deep neural network, and the semantic segmentation of the image using the model is not based only on color and position, etc.
  • the program may be stored in a computer readable storage medium, and the storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.
  • ROM Read Only Memory
  • RAM Random Access Memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed in an embodiment of the present invention are an image processing method and device. The method disclosed in the embodiment of the present invention comprises: after receiving a processing request with respect to an image, acquiring, according to an indication in the request, a semantic segmentation model corresponding to an element type to be replaced; performing, according to the model, an estimation of a probability that each pixel in the image belongs to the element type to obtain a preliminary probability graph; and performing according to conditional random fields, optimization on the preliminary probability graph, and using a segmented image obtained after the optimization to fuse the image and a preset element material, thereby replacing a certain element type in the image with the preset element material.

Description

图像处理方法、装置和存储介质Image processing method, device and storage medium
本申请要求于2017年03月29日提交中国专利局、申请号为201710199165.X、发明名称为“一种图像处理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 200910199165.X filed on March 29, 2017, the entire disclosure of which is incorporated herein by reference. In the application.
技术领域Technical field
本申请涉及计算机技术领域,具体涉及一种图像处理方法、装置和存储介质。The present application relates to the field of computer technologies, and in particular, to an image processing method, apparatus, and storage medium.
发明背景Background of the invention
随着智能移动终端的普及,随时随地进行拍摄记录已经逐渐成为人们生活的一种方式,以此同时,图像处理,比如对图像进行美化或特效等处理也越来越受到人们的欢迎。With the popularity of smart mobile terminals, shooting records anytime and anywhere has gradually become a way of life, and at the same time, image processing, such as image beautification or special effects, has become more and more popular.
发明内容Summary of the invention
本申请实施例提供一种图像处理方法和装置;可以提高分割的精准性,以及改善融合效果。The embodiment of the present application provides an image processing method and apparatus; the accuracy of segmentation can be improved, and the fusion effect can be improved.
本申请实施例提供一种图像处理方法,应用于图像处理装置,所述方法包括:The embodiment of the present application provides an image processing method, which is applied to an image processing apparatus, and the method includes:
接收图像处理请求,所述图像处理请求指示待处理的图像、以及待替换的元素类型;Receiving an image processing request indicating an image to be processed, and an element type to be replaced;
获取与所述元素类型对应的语义分割模型,所述语义分割模型由深度神经网络训练而成;Obtaining a semantic segmentation model corresponding to the element type, the semantic segmentation model being trained by a deep neural network;
根据所述语义分割模型,对所述图像中每一像素属于所述元素类型 的概率进行预测,得到初始概率图;Determining, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtaining an initial probability map;
根据所述初始概率图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the initial probability map to obtain a processed image.
本申请实施例还提供一种图像处理装置,所述装置包括处理器和存储器,其中,所述存储器中存储可被所述处理器执行的指令,当执行所述指令时,所述处理器用于:An embodiment of the present application further provides an image processing apparatus, where the apparatus includes a processor and a memory, wherein the memory stores an instruction executable by the processor, and when the instruction is executed, the processor is used by :
接收图像处理请求,所述图像处理请求指示待处理的图像、以及待替换的元素类型;Receiving an image processing request indicating an image to be processed, and an element type to be replaced;
获取与所述元素类型对应的语义分割模型,所述语义分割模型由深度神经网络训练而成;Obtaining a semantic segmentation model corresponding to the element type, the semantic segmentation model being trained by a deep neural network;
根据所述语义分割模型,对所述图像中每一像素属于所述元素类型的概率进行预测,得到初始概率图;Determining, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtaining an initial probability map;
根据所述初始概率图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the initial probability map to obtain a processed image.
附图简要说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present application. Other drawings can also be obtained from those skilled in the art based on these drawings without paying any creative effort.
图1a是本申请实施例提供的图像处理方法的场景示意图;FIG. 1 is a schematic diagram of a scenario of an image processing method according to an embodiment of the present application;
图1b是本申请实施例提供的图像处理方法的流程图;FIG. 1b is a flowchart of an image processing method provided by an embodiment of the present application;
图2a是本申请实施例提供的图像处理方法的另一流程图;2a is another flowchart of an image processing method provided by an embodiment of the present application;
图2b是本申请实施例提供的图像处理方法中图像处理请求的界面示例图;2b is a diagram showing an example of an interface of an image processing request in an image processing method according to an embodiment of the present application;
图2c是本申请实施例提供的图像处理方法中天空分割的示例图;2c is a diagram showing an example of sky segmentation in an image processing method provided by an embodiment of the present application;
图2d是本申请实施例提供的图像处理方法的处理流程框架图;2d is a process flow diagram of an image processing method provided by an embodiment of the present application;
图3a是本申请实施例提供的图像处理装置的结构示意图;FIG. 3 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application; FIG.
图3b是本申请实施例提供的图像处理装置的另一结构示意图;FIG. 3b is another schematic structural diagram of an image processing apparatus according to an embodiment of the present application; FIG.
图4是本申请实施例提供的服务器的结构示意图。4 is a schematic structural diagram of a server provided by an embodiment of the present application.
实施方式Implementation
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。在本申请一实施例中,在特效处理中,元素替换是最为常见的技术之一。以替换天空元素为例,一般可以基于图像中天空的颜色和位置等信息,进行阈值判断,然后,根据判断结果对图像进行天空分割,并将分割后得到的天空区域替换为其他的元素,比如烟火、驯鹿、或二次元太空,等等,从而使得处理后的图像可以达到一种特殊的效果,但容易造成误检和漏检,大大影响分割的精准性、以及图像的融合效果,比如产生失真或不够平滑的问题等等。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present application without creative efforts are within the scope of the present application. In an embodiment of the present application, element replacement is one of the most common techniques in special effects processing. Taking the sky element as an example, the threshold value can be generally determined based on the color and position of the sky in the image, and then the image is segmented according to the judgment result, and the sky region obtained after the segmentation is replaced with other elements, such as Pyrotechnics, reindeer, or two-dimensional space, etc., so that the processed image can achieve a special effect, but it is easy to cause false detection and missed detection, greatly affecting the accuracy of segmentation, and the fusion effect of images, such as Distortion or not smooth enough, and so on.
本申请实施例提供一种图像处理方法和装置,其中,该图像处理装置具体可以集成在服务器等设备中。The embodiment of the present application provides an image processing method and apparatus, where the image processing apparatus may be specifically integrated in a device such as a server.
例如,参见图1a,当用户需要对某张图像进行处理时,可以通过终端向服务器发送图像处理请求,其中,该图像处理请求指示需要处理的图像、以及需要替换的元素类型等信息。服务器在接收到图像处理请求后,可以获取与该元素类型对应的语义分割模型(该语义分割模型由深度神经网络训练而成),然后,根据该语义分割模型,对该图像中每一像素属于该元素类型的概率进行预测,得到一张分割概率图,为了描述方便,在本申请实施例中,将该分割概率图称为初始概率图。此后,服务器还可以采用条件随机场等方式对该初始概率图进行优化,以得到更精细的分割结果(即得到分割效果图),然后,根据分割结果将该图像与预设元素素材进行融合,比如,可以通过融合方法将分割效果图中的第一颜色部分(比如白色部分)与可替换的元素素材相结合,以及将分 割效果图中的第二颜色部分(比如黑色部分)与图像相结合,然后,将两个结合结果进行合成,并将合成得到的处理后图像提供给终端,等等。For example, referring to FIG. 1a, when a user needs to process an image, an image processing request may be sent to the server through the terminal, wherein the image processing request indicates an image to be processed, and information such as an element type to be replaced. After receiving the image processing request, the server may acquire a semantic segmentation model corresponding to the element type (the semantic segmentation model is trained by a deep neural network), and then, according to the semantic segmentation model, each pixel in the image belongs to The probability of the element type is predicted to obtain a segmentation probability map. For convenience of description, in the embodiment of the present application, the segmentation probability map is referred to as an initial probability map. Thereafter, the server may also optimize the initial probability map by means of a conditional random field to obtain a more fine segmentation result (ie, obtain a segmentation effect map), and then fuse the image with the preset element material according to the segmentation result. For example, a fusion method can be used to combine a first color portion (such as a white portion) in a segmentation effect image with a replaceable element material, and a second color portion (such as a black portion) in the segmentation effect image is combined with the image. Then, the two combined results are synthesized, and the synthesized processed image is supplied to the terminal, and the like.
以下分别进行详细说明。需说明的是,以下实施例的序号不作为对实施例顺序的限定。The details are described below separately. It should be noted that the serial numbers of the following embodiments are not intended to limit the order of the embodiments.
本实施例将从图像处理装置的角度进行描述,该图像处理装置具体可以集成在服务器等设备中。This embodiment will be described from the perspective of an image processing apparatus, which may be integrated in a device such as a server.
一种图像处理方法,包括:接收图像处理请求,该图像处理请求指示需要处理的图像(即待处理的图像)、以及需要替换的元素类型(即待替换的元素类型),获取与该元素类型对应的语义分割模型,该语义分割模型由深度神经网络训练而成,根据该语义分割模型,对该图像中每一像素属于该元素类型的概率进行预测,得到初始概率图,基于条件随机场对该初始概率图进行优化,得到分割效果图,根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像。An image processing method comprising: receiving an image processing request indicating an image to be processed (ie, an image to be processed), and an element type to be replaced (ie, an element type to be replaced), acquiring the element type Corresponding semantic segmentation model, which is trained by deep neural network. According to the semantic segmentation model, the probability that each pixel belongs to the element type is predicted, and the initial probability map is obtained, based on the conditional random field pair. The initial probability map is optimized to obtain a segmentation effect map, and the image is merged with the preset element material according to the segmentation effect image to obtain a processed image.
如图1b所示,该图像处理方法的具体流程可以如下:As shown in FIG. 1b, the specific process of the image processing method can be as follows:
101、接收图像处理请求。101. Receive an image processing request.
例如,具体可以(如,服务器)接收终端或其他网络侧设备发送的图像处理请求,等等。其中,该图像处理请求可以指示需要处理的图像、以及需要替换的元素类型等信息。For example, the image processing request sent by the terminal or other network side device may be specifically received (eg, a server), and the like. Wherein, the image processing request may indicate an image to be processed, and information such as an element type to be replaced.
所谓元素类型,指的是元素的类别,而元素指的是可承载视觉信息的基本要素,比如,若该图像处理请求指示需要替换的元素类型为“天空”,则表明需要对该图像中的所有天空部分进行替换;又比如,若该图像处理请求指示需要替换的元素类型为“人像”,则表明需要对该图像中的所有人像部分进行替换,以此类推,等等。The so-called element type refers to the category of the element, and the element refers to the basic element that can carry the visual information. For example, if the image processing request indicates that the type of the element to be replaced is “sky”, it indicates that the image needs to be in the image. All sky parts are replaced; for example, if the image processing request indicates that the type of element to be replaced is "portrait", it means that all portrait parts in the image need to be replaced, and so on, and so on.
102、获取与该元素类型对应的语义分割模型,该语义分割模型由深度神经网络训练而成。102. Obtain a semantic segmentation model corresponding to the element type, and the semantic segmentation model is trained by a deep neural network.
例如,若在步骤101中,(如,服务器)所接收到的图像处理请求指示需要替换的元素类型为“天空”,则此时,(如,服务器)可以获取与“天空”对应的语义分割模型,而若在步骤101中,(如,服务器)所接 收到的图像处理请求指示需要替换的元素类型为“人像”,则此时,可以获取与“人像”对应的语义分割模型,等等。For example, if in step 101, the image processing request received by the server (eg, the server) indicates that the element type to be replaced is "sky", then at this time, (eg, the server) may acquire a semantic segmentation corresponding to "sky" a model, and if the image processing request received in step 101 (eg, the server) indicates that the type of element to be replaced is "portrait", then at this time, a semantic segmentation model corresponding to "portrait" may be acquired, etc. .
该语义分割模型可以预先保存在该图像处理装置或其他存储设备中,在需要使用时,由该图像处理装置进行获取,或者,该语义分割模型也可以由该图像处理装置自行建立而成,即,在步骤“获取与该元素类型对应的语义分割模型”之前,该图像处理方法还可以包括:The semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is, Before the step of "acquiring the semantic segmentation model corresponding to the element type", the image processing method may further include:
建立该元素类型对应的语义分割模型,比如,具体可以如下:Establish a semantic segmentation model corresponding to the element type. For example, the specifics can be as follows:
获取包含有该元素类型的训练数据,根据该训练数据,利用深度神经网络对预设的语义分割初始模型进行训练,得到该元素类型对应的语义分割模型。The training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
例如,以建立“天空”对应的语义分割模型为例,具体可以收集一定数量(比如8000张等)的包含天空的图片,然后,根据这些图片,利用深度神经网络对预设的语义分割初始模型进行调整(fine tune),最终得到的模型便是“天空”对应的语义分割模型。For example, to establish a semantic segmentation model corresponding to “sky”, for example, a certain number (such as 8000, etc.) of images containing the sky can be collected, and then, based on these images, a preliminary semantic segmentation initial model is extracted by using a deep neural network. Fine tune, the resulting model is the semantic segmentation model corresponding to “sky”.
需说明的是,该预设的语义分割初始模型可以根据实际应用的需求预先进行设置,比如,可以采用预先训练好的针对一般场景20个类别的语义分割模型,等等。It should be noted that the preset semantic segmentation initial model may be preset according to the requirements of the actual application. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
103、根据该语义分割模型,对该图像中每一像素属于该元素类型的概率进行预测,得到初始概率图;例如,具体可以如下:103. According to the semantic segmentation model, predicting a probability that each pixel in the image belongs to the element type, and obtaining an initial probability map; for example, the specific information may be as follows:
(1)(如,服务器)将该图像导入该语义分割模型,以预测该图像中每一像素属于该元素类型的概率。(1) (eg, a server) import the image into the semantic segmentation model to predict the probability that each pixel in the image belongs to the element type.
例如,以该元素类型为“天空”为例,则此时,可以将该图像导入“天空”对应的语义分割模型,以预测该图像中每一像素属于“天空”的概率。For example, taking the element type as "sky" as an example, at this time, the image can be imported into the semantic segmentation model corresponding to "sky" to predict the probability that each pixel in the image belongs to "sky".
又例如,以该元素类型为“人像”为例,则此时,可以将该图像导入“人像”对应的语义分割模型,以预测该图像中每一像素属于“人像”的概率,以此类推,等等。For another example, taking the element type as “portrait” as an example, at this time, the image may be imported into a semantic segmentation model corresponding to “portrait” to predict the probability that each pixel in the image belongs to “portrait”, and so on. ,and many more.
(2)(如,服务器)根据该概率对相应像素在预设蒙版上的颜色进 行设置,得到初始概率图。(2) (e.g., the server) sets the color of the corresponding pixel on the preset mask according to the probability to obtain an initial probability map.
例如,具体可以确定该概率是否大于预设阈值,若是,则将相应像素在预设蒙版上的颜色设置为第一颜色,若否,则将相应像素在预设蒙版上的颜色设置为第二颜色,在确定该图像中所有像素在预设蒙版上的颜色均设置完毕后,输出设置颜色后的预设蒙版,得到初始概率图。在本申请一实施例中,蒙版就是选区之外的部分,负责保护选区内容。For example, the specificity may be determined whether the probability is greater than a preset threshold. If yes, the color of the corresponding pixel on the preset mask is set to the first color, and if not, the color of the corresponding pixel on the preset mask is set to The second color, after determining that all the pixels in the image are set on the preset mask, output a preset mask after setting the color to obtain an initial probability map. In an embodiment of the present application, the mask is a part outside the selection area and is responsible for protecting the content of the selection.
即此时可以得到一只包含第一颜色和第二颜色的蒙版,其中,该蒙版中的第一颜色表示相应像素属于该元素类型的概率较大,例如大于预设阈值,而第二颜色表示相应像素属于该元素类型的概率较小,例如小于预设阈值。因此,为了描述方便,在本申请实施例中,将该输出的蒙版称为初始概率图。That is, a mask containing the first color and the second color may be obtained at this time, wherein the first color in the mask indicates that the probability that the corresponding pixel belongs to the element type is large, for example, greater than a preset threshold, and the second The color indicates that the probability that the corresponding pixel belongs to the element type is small, such as less than a preset threshold. Therefore, for the convenience of description, in the embodiment of the present application, the mask of the output is referred to as an initial probability map.
其中,该预设阈值可以根据实际应用的需求进行设置,比如,以该预设阈值具体为80%,且该元素类型为“天空”为例,若某个像素A属于“天空”的概率大于80%,则可以将像素A在预设蒙版上的颜色设置为第一颜色,否则,若像素A属于“天空”的概率小于等于80%,则可以将像素A在预设蒙版上的颜色设置为第二颜色,等等。The preset threshold may be set according to the requirements of the actual application. For example, the preset threshold is specifically 80%, and the element type is “sky” as an example. If a certain pixel A belongs to the “sky”, the probability is greater than 80%, you can set the color of pixel A on the preset mask to the first color. Otherwise, if the probability that pixel A belongs to "sky" is less than or equal to 80%, you can set pixel A on the preset mask. The color is set to the second color, and so on.
其中,第一颜色和第二颜色也可以根据实际应用的需求而定,比如,可以将第一颜色设置为白色,将第二颜色设置为黑色,或者,也可以将第一颜色设置为粉色,而将第二颜色设置为绿色,等等。为了描述方便,在本申请实施例中,将均以第一颜色为白色,而第二颜色为黑色为例进行说明。The first color and the second color may also be determined according to actual application requirements. For example, the first color may be set to white, the second color may be set to black, or the first color may be set to pink. And set the second color to green, and so on. For convenience of description, in the embodiment of the present application, the description will be made by taking the first color as white and the second color as black.
104、根据该初始概率图将该图像与预设元素素材进行融合,得到处理后图像;例如,具体可以如下:104. The image is merged with the preset element material according to the initial probability map to obtain a processed image; for example, the specific content may be as follows:
(1)(如,服务器)按照预设策略获取可替换的元素素材。(1) (eg, server) obtains replaceable element material according to a preset policy.
其中,该预设策略可以根据实际应用的需求进行设置,比如,可以接收用户触发的素材选择指令,然后,根据该素材选择指令从素材库获取相应的素材,作为可替换的元素素材,等等。The preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
为了增加该元素素材的多样性,还可以采用随机截取的方式获取该 元素素材,即步骤“按照预设策略获取可替换的元素素材”也可以包括:In order to increase the diversity of the material of the element, the element material can also be obtained by random interception, that is, the step of “acquiring the replaceable element material according to the preset strategy” may also include:
获取候选图像,对该候选图像进行随机截取,并将截取到的图像作为可替换的元素素材,等等。A candidate image is acquired, the candidate image is randomly intercepted, and the intercepted image is taken as a replaceable element material, and the like.
其中,该候选图像可以通过在网络上进行获取,或者,也可以由用户进行上传,甚至,也可以由用户直接在终端屏幕或网页上截图,然后提供给该图像处理装置,等等,在此不再赘述。The candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
(2)(如,服务器)通过融合方法将该初始概率图中的第一颜色部分与获取到的元素素材相结合,得到第一结合图。(2) (eg, the server) combines the first color portion of the initial probability map with the acquired element material by a fusion method to obtain a first combination map.
由于第一颜色部分的像素属于该需要替换的元素类型的概率较高的像素,因此,此时,可以通过融合方法,将该部分与获取到的元素素材进行结合,即可以将该部分的像素均替换为获取到的元素素材。Since the pixel of the first color portion belongs to the pixel with higher probability of the element type to be replaced, at this time, the portion can be combined with the acquired element material by the fusion method, that is, the pixel of the portion can be Replaced with the acquired element material.
(3)(如,服务器)通过融合方法将该初始概率图中的第二颜色部分与该图像相结合,得到第二结合图。(3) (eg, the server) combines the second color portion of the initial probability map with the image by a fusion method to obtain a second combination map.
由于第二颜色部分的像素属于该需要替换的元素类型的概率较低的像素,因此,此时,可以通过融合方法,将该部分与原图像进行结合,即保留该部分的像素。Since the pixel of the second color portion belongs to the pixel with a lower probability of the element type to be replaced, at this time, the portion can be combined with the original image by the fusion method, that is, the pixel of the portion is retained.
需说明的是,为了提高融合效果,或者实现其他的特效效果,在将第二颜色部分与该图像相结合之前,还可以对该图像进行一定预处理,比如进行色彩变换,对比度调整、亮度调整、饱和度调整、和/或添加其他特效蒙版等,然后,再通过融合方法,将第二颜色部分与该预处理后的图像进行结合,以得到第二结合图。It should be noted that, in order to improve the fusion effect, or to achieve other special effect effects, before the second color portion is combined with the image, the image may be subjected to certain preprocessing, such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc., and then combining the second color portion with the preprocessed image by a fusion method to obtain a second combination map.
(4)(如,服务器)将第一结合图和第二结合图进行合成,得到处理后图像。(4) (eg, a server) synthesizing the first combination map and the second combination map to obtain a processed image.
这样,便可以将图像中需要进行替换的元素替换为该元素素材,比如将图像中的“天空”替换为“太空”,等等,在此不再赘述。In this way, the elements in the image that need to be replaced can be replaced with the material of the element, such as replacing "sky" in the image with "space", and so on, and will not be described here.
此外,为了保证根据该初始概率图得到的处理后的图像更加优质,可以对上述实例中的初始概率图进行优化,其具体优化方式如下:In addition, in order to ensure that the processed image obtained according to the initial probability map is more excellent, the initial probability map in the above example may be optimized, and the specific optimization manner is as follows:
基于条件随机场(CRF或CRFs,Conditional Random Fields,也称为 条件随机域)对该初始概率图进行优化,得到分割效果图。The initial probability map is optimized based on conditional random fields (CRF or CRFs, also referred to as conditional random fields) to obtain a segmentation effect map.
例如,具体可以(如,服务器)将该初始概率图中的像素映射至条件随机场中的节点,确定节点之间的边约束的相似性,并根据边约束的相似性对该初始概率图中像素的分割结果进行调整,得到分割效果图。For example, the pixel in the initial probability map may be mapped to the node in the conditional random field, and the similarity of the edge constraint between the nodes may be determined, and the similarity of the edge constraint is used in the initial probability map. The segmentation result of the pixel is adjusted to obtain a segmentation effect map.
其中,条件随机场是一种判别式概率模型,是随机场的一种。如同马尔可夫随机场,条件随机场为具有无向的图模型,图模型中的节点(即顶点)代表随机变量,节点间的连线代表随机变量间的相依关系。条件随机场具有表达长距离依赖性和交叠性特征的能力,能够较好地解决标注(分类)偏置等问题的优点,而且所有特征可以进行全局归一化,能够求得全局的最优解,因此,可以利用条件随机场来优化该初始概率图,以达到优化分割结果的目的。Among them, the conditional random field is a discriminative probability model, which is a kind of random field. Like the Markov random field, the conditional random field has an undirected graph model. The nodes (ie, vertices) in the graph model represent random variables, and the connections between nodes represent the dependencies between random variables. Conditional random fields have the ability to express long-distance dependence and overlapping features, which can better solve the advantages of labeling (classification) biasing, and all features can be globally normalized to obtain global optimality. Solution, therefore, the conditional random field can be used to optimize the initial probability map to achieve the purpose of optimizing the segmentation result.
需说明的是,由于分割效果图是由初始概率图优化得到的,因此,该分割效果图同样也是一张包含第一颜色和第二颜色的蒙版。It should be noted that since the segmentation effect map is optimized by the initial probability map, the segmentation effect map is also a mask containing the first color and the second color.
其中,步骤104、根据该初始概率图将该图像与预设元素素材进行融合,得到处理后图像,包括:根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像;例如,具体可以如下:Step 104: merging the image with the preset element material according to the initial probability map, and obtaining the processed image, comprising: merging the image with the preset element material according to the segmentation effect image to obtain a processed image; for example, Specifically, it can be as follows:
(1)(如,服务器)按照预设策略获取可替换的元素素材。(1) (eg, server) obtains replaceable element material according to a preset policy.
其中,该预设策略可以根据实际应用的需求进行设置,比如,可以接收用户触发的素材选择指令,然后,根据该素材选择指令从素材库获取相应的素材,作为可替换的元素素材,等等。The preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
为了增加该元素素材的多样性,还可以采用随机截取的方式获取该元素素材,即步骤“按照预设策略获取可替换的元素素材”也可以包括:In order to increase the diversity of the material of the element, the element material can also be obtained by random interception, that is, the step “acquiring the replaceable element material according to the preset strategy” may also include:
获取候选图像,对该候选图像进行随机截取,并将截取到的图像作为可替换的元素素材,等等。A candidate image is acquired, the candidate image is randomly intercepted, and the intercepted image is taken as a replaceable element material, and the like.
其中,该候选图像可以通过在网络上进行获取,或者,也可以由用户进行上传,甚至,也可以由用户直接在终端屏幕或网页上截图,然后提供给该图像处理装置,等等,在此不再赘述。The candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
(2)(如,服务器)通过融合方法将该分割效果图中的第一颜色部 分与获取到的元素素材相结合,得到第一结合图。(2) (e.g., the server) combines the first color portion of the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map.
由于第一颜色部分的像素属于该需要替换的元素类型的概率较高的像素,因此,此时,可以通过融合方法,将该部分与获取到的元素素材进行结合,即可以将该部分的像素均替换为获取到的元素素材。Since the pixel of the first color portion belongs to the pixel with higher probability of the element type to be replaced, at this time, the portion can be combined with the acquired element material by the fusion method, that is, the pixel of the portion can be Replaced with the acquired element material.
(3)(如,服务器)通过融合方法将该分割效果图中的第二颜色部分与该图像相结合,得到第二结合图。(3) (eg, a server) combines the second color portion of the segmentation rendering with the image by a fusion method to obtain a second combination.
由于第二颜色部分的像素属于该需要替换的元素类型的概率较低的像素,因此,此时,可以通过融合方法,将该部分与原图像进行结合,即保留该部分的像素。Since the pixel of the second color portion belongs to the pixel with a lower probability of the element type to be replaced, at this time, the portion can be combined with the original image by the fusion method, that is, the pixel of the portion is retained.
需说明的是,为了提高融合效果,或者实现其他的特效效果,在将第二颜色部分与该图像相结合之前,还可以对该图像进行一定预处理,比如进行色彩变换,对比度调整、亮度调整、饱和度调整、和/或添加其他特效蒙版等,然后,再通过融合方法,将第二颜色部分与该预处理后的图像进行结合,以得到第二结合图。It should be noted that, in order to improve the fusion effect, or to achieve other special effect effects, before the second color portion is combined with the image, the image may be subjected to certain preprocessing, such as color conversion, contrast adjustment, and brightness adjustment. , saturation adjustment, and/or adding other special effect masks, etc., and then combining the second color portion with the preprocessed image by a fusion method to obtain a second combination map.
(4)(如,服务器)将第一结合图和第二结合图进行合成,得到处理后图像。(4) (eg, a server) synthesizing the first combination map and the second combination map to obtain a processed image.
这样,便可以将图像中需要进行替换的元素替换为该元素素材,比如将图像中的“天空”替换为“太空”,等等,在此不再赘述。In this way, the elements in the image that need to be replaced can be replaced with the material of the element, such as replacing "sky" in the image with "space", and so on, and will not be described here.
为了使得融合结果更为真实,避免由于概率预测不准确所导致的噪声或缺失,还可以在融合之前,对该分割效果图进行一定处理,以使得其分割边界更为光滑、以及替换区域的连接处的颜色过渡可以更为自然;即在步骤“根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像”之前,该图像处理方法还可以包括:In order to make the fusion result more realistic and avoid noise or missing due to inaccurate probability prediction, the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region. The color processing may be more natural; that is, before the step of “merging the image with the preset element material according to the segmentation effect image to obtain a processed image”, the image processing method may further include:
对该分割效果图进行外观模型(Appearance Model)方法和/或图像形态学操作处理,得到处理后分割效果图。The segmentation effect diagram is subjected to an Appearance Model method and/or an image morphology operation process to obtain a processed segmentation effect map.
则此时,步骤“根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像”可以包括:根据处理后分割效果图,将该图像与预设元素素材进行融合,比如进行透明度(Alpha)融合,得到处理后图像。In this case, the step of “merging the image with the preset element material according to the segmentation effect image to obtain the processed image” may include: fusing the image with the preset element material according to the processed segmentation effect image, for example, performing Transparency (Alpha) blends to get processed images.
其中,外观模型方法是广泛应用于模式识别领域的一种特征点提取方法,它可以对纹理进行统计建模,并将形状和纹理两个统计模型进一步融合为表观模型。而图像形态学操作处理可以包括降噪处理和/或连通域分析等处理,通过外观模型方法或图像形态学操作等处理后的分割效果图,其分割边界可以更为光滑、且替换区域的连接处的颜色过渡可以更为自然。Among them, the appearance model method is a feature point extraction method widely used in the field of pattern recognition. It can statistically model the texture and further fuse the two statistical models of shape and texture into the apparent model. The image morphology operation processing may include processing such as noise reduction processing and/or connected domain analysis, and the segmentation effect map processed by the appearance model method or the image morphology operation may have a smoother boundary and a connection of the replacement area. The color transition at the place can be more natural.
还需说明的是,本申请实施例所说的“Alpha融合”指的是基于Alpha值进行的融合,其中,Alpha主要是用来指定像素的透明等级。一般的,可以为每个像素的alpha部分保留8位,alpha的有效值在[0,255]范围内,[0,255]代表不透明度[0%,100%]。因此,像素的alpha为0时,表示完全透明,像素的alpha为128时,表示50%透明,像素的alpha为255时,表示完全不透明。It should be noted that the “Alpha Fusion” in the embodiment of the present application refers to the fusion based on the Alpha value, wherein Alpha is mainly used to specify the transparency level of the pixel. In general, 8 bits can be reserved for the alpha portion of each pixel, the effective value of alpha is in the range [0, 255], and [0, 255] represents the opacity [0%, 100%]. Therefore, when the alpha of the pixel is 0, it means completely transparent. When the alpha of the pixel is 128, it means 50% transparency, and when the alpha of the pixel is 255, it means completely opaque.
由上可知,本实施例在接收到图像处理请求后,可以根据该请求的指示获取与需要替换的元素类型对应的语义分割模型,根据该模型预测图像中每一像素属于该元素类型的概率,以得到初始概率图,然后,基于条件随机场对该初始概率图进行优化,并利用优化后得到的分割效果图将图像与预设元素素材进行融合,从而达到将图像中的某一元素类型部分替换为预设元素素材的目的;由于该方案中的语义分割模型主要是由深度神经网络训练而成的,而且在利用该模型对图像进行语义分割时,并不是只基于颜色和位置等信息,而是通过对每一像素属于该元素类型的概率进行预测,因此,相对于现有方案而言,可以大大减少误检和漏检的概率;此外,由于该方案还可以利用条件随机场对分割后的初始概率图进行优化,因此,可以得到更为精细的分割结果,大大提高分割的精准性,有利于减少图像失真的情况,改善图像的融合效果。It can be seen that, after receiving the image processing request, the embodiment may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and predict, according to the model, the probability that each pixel in the image belongs to the element type. To obtain an initial probability map, and then optimize the initial probability map based on the conditional random field, and use the segmentation effect map obtained by the optimization to fuse the image with the preset element material, thereby achieving an element type part of the image. The purpose of replacing the material of the preset element; because the semantic segmentation model in this scheme is mainly trained by the deep neural network, and when the image is semantically segmented by the model, it is not based on information such as color and position. Rather, by predicting the probability that each pixel belongs to the type of the element, the probability of false detection and missed detection can be greatly reduced compared to the existing scheme; in addition, since the scheme can also utilize conditional random field pair segmentation The initial probability map is optimized, so that a more detailed segmentation result can be obtained. Large improve accuracy of segmentation, helps to reduce the image distortion and improve image fusion effect.
根据上述实施例所描述的方法,以下将举例作进一步详细说明。According to the method described in the above embodiments, the following will be exemplified in further detail.
在本实施例中,将以该图像处理装置具体集成在服务器,且该需要替换的元素为“天空”为例进行说明。In this embodiment, the image processing apparatus is specifically integrated into the server, and the element to be replaced is “sky” as an example.
如图2a和2d所示,一种图像处理方法,具体流程可以如下:As shown in Figures 2a and 2d, an image processing method can be as follows:
201、终端向服务器发送图像处理请求,其中,该图像处理请求可以指示需要处理的图像(即待处理的图像)、以及需要替换的元素类型(即待替换的元素类型)等信息。201. The terminal sends an image processing request to the server, where the image processing request may indicate an image to be processed (ie, an image to be processed), and information such as an element type to be replaced (ie, an element type to be replaced).
其中,该图像处理请求的触发方式可以有多种,比如,可以通过点击或滑动网页或客户端界面上的触发键来触发,或者,也可以通过输入预设指令来进行触发,等等。The image processing request may be triggered in various manners, for example, by clicking or sliding a trigger button on a webpage or a client interface, or by triggering a preset instruction, and the like.
例如,以点击触发键来进行触发为例,参见图2b,当用户需要将图片A中的天空部分替换为其他元素,比如替换为“太空”元素或增加“云朵”时,可以通过上传图片A,并点击触发键“玩一次”来触发生成图像处理请求,并向服务器发送该图像处理请求,其中,该图像处理请求指示需要处理的图像为图像A,以及需要替换的元素类型为“天空”。For example, taking the trigger button to trigger, for example, see Figure 2b. When the user needs to replace the sky part of the picture A with other elements, such as replacing the "space" element or adding "cloud", you can upload the picture A. And clicking the trigger key "play once" to trigger the generation of the image processing request, and sending the image processing request to the server, wherein the image processing request indicates that the image to be processed is the image A, and the element type to be replaced is "sky" .
需说明的是,在本实施例中,将均以需要替换的元素为“天空”为例进行说明,应当理解的,该需要替换的元素类型也可以是其他类型,比如“人像”、“眼睛”或“植物”,等等,其实现与此类似,在此不再赘述。It should be noted that in the embodiment, the elements that need to be replaced are referred to as “sky” as an example. It should be understood that the types of elements that need to be replaced may also be other types, such as “portraits” and “eyes”. "Or "plant", etc., the implementation is similar to this, and will not be repeated here.
202、服务器接收到该图像处理请求后,获取与“天空”对应的语义分割模型,该语义分割模型由深度神经网络训练而成。202. After receiving the image processing request, the server acquires a semantic segmentation model corresponding to “sky”, and the semantic segmentation model is trained by a deep neural network.
该语义分割模型可以预先保存在该图像处理装置或其他存储设备中,在需要使用时,由该图像处理装置进行获取,或者,该语义分割模型也可以由该图像处理装置自行建立而成,例如,可以获取包含有该元素类型的训练数据,比如,收集一定数量的包含天空的图片,然后,根据该训练数据(即包含天空的图片),利用深度神经网络对预设的语义分割初始模型进行训练,得到该“天空”对应的语义分割模型。The semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-created by the image processing device, for example, The training data including the type of the element may be obtained, for example, collecting a certain number of images containing the sky, and then, according to the training data (ie, the image containing the sky), using the deep neural network to perform the preset semantic segmentation initial model Train to get the semantic segmentation model corresponding to the "sky".
需说明的是,该预设的语义分割初始模型可以根据实际应用的需求预先进行设置,比如,可以采用预先训练好的针对一般场景20个类别的语义分割模型,等等。It should be noted that the preset semantic segmentation initial model may be preset according to the requirements of the actual application. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
203、服务器将该图像导入该语义分割模型,以预测该图像中每一像素属于该“天空”的概率。203. The server imports the image into the semantic segmentation model to predict a probability that each pixel in the image belongs to the “sky”.
例如,若在步骤202中,所接收到的图像处理请求中,指示需要处理的图像为图片A,则此时,可以将图片A以三通道彩色图像的方式导入到该“天空”对应的语义分割模型中,以预测该图像A中每一像素属于该“天空”的概率,然后,执行步骤204。For example, if in step 202, the received image processing request indicates that the image to be processed is the picture A, then at this time, the picture A may be imported into the semantics corresponding to the “sky” in the form of a three-channel color image. In the segmentation model, to predict the probability that each pixel in the image A belongs to the "sky", then step 204 is performed.
204、服务器根据该概率对相应像素在预设蒙版上的颜色进行设置,得到初始概率图。204. The server sets the color of the corresponding pixel on the preset mask according to the probability, to obtain an initial probability map.
例如,具体可以确定该概率是否大于预设阈值,若是,则将相应像素在预设蒙版上的颜色设置为第一颜色,若否,则将相应像素在预设蒙版上的颜色设置为第二颜色,在确定该图像中所有像素在预设蒙版上的颜色均设置完毕后,输出设置颜色后的预设蒙版,得到初始概率图。For example, the specificity may be determined whether the probability is greater than a preset threshold. If yes, the color of the corresponding pixel on the preset mask is set to the first color, and if not, the color of the corresponding pixel on the preset mask is set to The second color, after determining that all the pixels in the image are set on the preset mask, output a preset mask after setting the color to obtain an initial probability map.
其中,该预设阈值可以根据实际应用的需求进行设置,比如,以该预设阈值具体为80%为例,若某个像素K属于“天空”的概率大于80%,则可以将该像素K在预设蒙版上的颜色设置为第一颜色,否则,若某个像素K属于“天空”的概率小于等于80%,则可以将该像素K在预设蒙版上的颜色设置为第二颜色,等等。The preset threshold may be set according to the requirements of the actual application. For example, the preset threshold is specifically 80%. If the probability that a certain pixel K belongs to the “sky” is greater than 80%, the pixel K may be used. The color on the preset mask is set to the first color. Otherwise, if the probability that a pixel K belongs to the "sky" is less than or equal to 80%, the color of the pixel K on the preset mask may be set to the second color. Color, and so on.
其中,第一颜色和第二颜色也可以根据实际应用的需求而定,比如,可以将第一颜色设置为白色,将第二颜色设置为黑色,或者,也可以将第一颜色设置为粉色,而将第二颜色设置为绿色,等等。The first color and the second color may also be determined according to actual application requirements. For example, the first color may be set to white, the second color may be set to black, or the first color may be set to pink. And set the second color to green, and so on.
比如,以第一颜色设置为白色,将第二颜色设置为黑色为例,则将图片A导入该语义分割模型后,可以得到如图2c所示的初始概率图。For example, if the first color is set to white and the second color is set to black, then after the picture A is imported into the semantic segmentation model, an initial probability map as shown in FIG. 2c can be obtained.
205、服务器基于条件随机场对该初始概率图进行优化,得到分割效果图。205. The server optimizes the initial probability map based on the conditional random field to obtain a segmentation effect diagram.
例如,服务器可以将该初始概率图中的像素映射至条件随机场中的节点,确定节点之间的边约束的相似性,并根据边约束的相似性对该初始概率图中像素的分割结果进行调整,得到分割效果图。For example, the server may map the pixels in the initial probability map to the nodes in the conditional random field, determine the similarity of the edge constraints between the nodes, and perform the segmentation result of the pixels in the initial probability map according to the similarity of the edge constraints. Adjust to get the split rendering.
由于条件随机场是一种无向图模型,因此,可以将图像中的每一个像素都对应条件随机场中的一个节点,并预设包括颜色、纹理、以及位置等参数的先验信息,这样,节点之间的边约束相似的像素便具有相似 的分割结果,所以,可以根据边约束的相似性对该初始概率图中像素的分割结果进行调整,使得天空分割结果更为精细,例如,参加图2c,基于条件随机场对该初始概率图进行优化后,可以得到分割结果更为精细的分割效果图。Since the conditional random field is an undirected graph model, each pixel in the image can correspond to a node in the conditional random field, and preset a priori information including parameters such as color, texture, and position, so that The pixels with similar edge constraints between the nodes have similar segmentation results. Therefore, the segmentation results of the pixels in the initial probability map can be adjusted according to the similarity of the edge constraints, so that the sky segmentation result is more fine, for example, participation. In Fig. 2c, after the initial probability map is optimized based on the conditional random field, a more detailed segmentation effect map of the segmentation result can be obtained.
206、服务器对该分割效果图进行外观模型方法和/或图像形态学操作处理,得到处理后分割效果图,然后,执行步骤207。206. The server performs an appearance model method and/or an image morphology operation process on the segmentation rendering image to obtain a processed segmentation effect map, and then performs step 207.
其中,图像形态学操作处理可以包括降噪处理和/或连通域分析等处理。通过外观模型方法或图像形态学操作等处理后的分割效果图,其分割边界可以更为光滑、且替换区域的连接处的颜色过渡可以更为自然。The image morphology operation process may include processing such as noise reduction processing and/or connected domain analysis. The segmentation effect map processed by the appearance model method or the image morphology operation can make the segmentation boundary smoother and the color transition at the junction of the replacement region can be more natural.
需说明的是,步骤206为可选步骤,若不执行步骤206,则在步骤205执行完毕后,可以直接执行步骤207,并在步骤208中,通过融合方法将该分割效果图、图像、以及元素素材进行融合,得到处理后图像。It should be noted that step 206 is an optional step. If step 206 is not performed, after step 205 is performed, step 207 may be directly performed, and in step 208, the segmentation effect map, image, and The element material is fused to obtain a processed image.
207、服务器按照预设策略获取可替换的元素素材。207. The server obtains replaceable element material according to a preset policy.
其中,该预设策略可以根据实际应用的需求进行设置,比如,可以接收用户触发的素材选择指令,然后,根据该素材选择指令从素材库获取相应的素材,作为可替换的元素素材,等等。The preset policy may be set according to the requirements of the actual application. For example, the user may select a material selection instruction triggered by the user, and then, according to the material selection instruction, obtain the corresponding material from the material library as a replaceable element material, etc. .
为了增加该元素素材的多样性,还可以采用随机截取的方式可获取该元素素材,比如,服务器可以获取候选图像,然后,对该候选图像进行随机截取,并将截取到的图像作为可替换的元素素材,等等。In order to increase the diversity of the element material, the element material can also be obtained by random interception. For example, the server can acquire the candidate image, and then randomly intercept the candidate image, and replace the captured image as a replaceable image. Elemental material, and more.
其中,该候选图像可以通过在网络上进行获取,或者,也可以由用户进行上传,甚至,也可以由用户直接在终端屏幕或网页上截图,然后提供给该图像处理装置,等等,在此不再赘述。The candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
208、服务器通过融合方法将该处理后分割效果图、图像、以及元素素材进行融合,得到处理后图像。208. The server fuses the processed segmentation effect image, the image, and the element material by a fusion method to obtain a processed image.
例如,还是以第一颜色为白色,第二颜色为黑色为例进行说明,则此时,服务器可以通过融合方法将该分割效果图中的白色部分与获取到的元素素材相结合,得到第一结合图,以及,通过融合方法将该分割效果图中的黑色部分与该图像A相结合,得到第二结合图,然后,将第一 结合图和第二结合图进行合成,得到处理后图像。For example, the first color is white and the second color is black. For example, the server can combine the white part of the split effect image with the acquired element material by the fusion method to obtain the first color. The second combination map is obtained by combining the black portion in the segmentation effect map with the image A by a fusion method, and then the first combination image and the second combination image are combined to obtain a processed image.
由于白色部分的像素属于该“天空”的概率较高,因此,此时,可以通过融合方法,将该部分的像素均替换为获取到的元素素材,而由于黑色部分的像素属于“天空”的概率较低,因此,此时,可以通过融合方法,将该部分的像素与原图像A进行结合,即保留该部分的像素,这样,将第一结合图和第二结合图进行合成后,便可以将原图像A中的“天空”替换为相应的元素素材,比如将图像A中的“天空”替换为“圣诞的夜空”,等等,参见图2d,在此不再赘述。Since the probability that the white portion of the pixel belongs to the "sky" is high, at this time, the pixel of the portion can be replaced with the acquired element material by the fusion method, and the pixel of the black portion belongs to the "sky". The probability is low. Therefore, at this time, the pixel of the part can be combined with the original image A by the fusion method, that is, the pixel of the part is retained, so that the first combination picture and the second combination picture are combined, and then The "sky" in the original image A can be replaced with the corresponding element material, for example, the "sky" in the image A is replaced with "the night sky of Christmas", etc., see FIG. 2d, and details are not described herein again.
需说明的是,如图2d所示,为了提高融合效果,或者实现其他的特效效果,在将黑色部分(即第二颜色部分)与该图像A相结合之前,还可以对该图像A进行一定预处理,比如进行色彩变换,对比度调整、亮度调整、饱和度调整、和/或添加其他特效蒙版等,然后,再通过融合方法,将黑色部分与该预处理后的图像A进行结合,以得到第二结合图,在此不再赘述。It should be noted that, as shown in FIG. 2d, in order to improve the fusion effect or implement other special effects, the image A may be fixed before the black portion (ie, the second color portion) is combined with the image A. Pre-processing, such as color conversion, contrast adjustment, brightness adjustment, saturation adjustment, and/or adding other special effects masks, etc., and then combining the black portion with the pre-processed image A by a fusion method to A second combination diagram is obtained, and details are not described herein again.
209、服务器将处理后图像发送给终端。209. The server sends the processed image to the terminal.
比如,可以在相应客户端的界面上显示该处理后图像。该服务器还可以提供相应的保存途径和/或分享接口,以供用户进行保护和/或分享,比如,可以将该处理后图像保存在云端或本地(即终端中),以及将该处理后图像分享至微博、朋友圈、和/或插入至即时聊天工具的聊天对话界面中,等等,在此不再赘述。For example, the processed image can be displayed on the interface of the corresponding client. The server may also provide a corresponding save path and/or share interface for the user to protect and/or share, for example, the processed image may be saved in the cloud or locally (ie, in the terminal), and the processed image may be processed. Share to Weibo, circle of friends, and/or insert into the chat dialog interface of the instant chat tool, and so on, and will not repeat them here.
由上可知,本实施例在接收到图像处理请求后,可以根据该请求的指示获取与“天空”对应的语义分割模型,根据该模型预测图像中每一像素属于“天空”的概率,以得到初始概率图,然后,基于条件随机场对该初始概率图进行优化,并利用优化后得到的分割效果图将图像与预设元素素材进行融合,从而达到将图像中的“天空”部分替换为预设元素素材的目的;由于该方案中的语义分割模型主要是由深度神经网络训练而成的,而且在利用该模型对图像进行语义分割时,并不是只基于颜色和位置等信息,而是通过对每一像素属于该元素类型的概率进行预 测,因此,相对于现有方案而言,可以大大减少误检和漏检的概率;此外,由于该方案还可以利用条件随机场对分割后的初始概率图进行优化,因此,可以得到更为精细的分割结果,大大提高分割的精准性,有利于减少图像失真的情况,改善图像的融合效果。As can be seen from the above, after receiving the image processing request, the embodiment may acquire a semantic segmentation model corresponding to “sky” according to the instruction of the request, and predict a probability that each pixel in the image belongs to “sky” according to the model, to obtain The initial probability map is then optimized based on the conditional random field, and the image is merged with the preset element material by using the segmentation effect map obtained by the optimization, thereby replacing the “sky” part of the image with the pre-predetermined image. The purpose of the element material is set; because the semantic segmentation model in this scheme is mainly trained by the deep neural network, and the semantic segmentation of the image by using the model is not based on information such as color and position, but through The probability that each pixel belongs to the element type is predicted, so the probability of false detection and missed detection can be greatly reduced compared with the existing scheme; in addition, since the scheme can also utilize the conditional random field pair initialization after segmentation The probability map is optimized, so that more detailed segmentation results can be obtained, which greatly improves the segmentation precision. Accuracy helps reduce image distortion and improves image fusion.
为了更好地实施以上方法,本申请实施例还提供一种图像处理装置,该图像处理装置具体可以集成在服务器等设备中。In order to better implement the above method, the embodiment of the present application further provides an image processing apparatus, which may be integrated into a device such as a server.
如图3a所示,该图像处理装置包括接收单元301、获取单元302、预测单元303、优化单元304、以及融合单元305,如下:As shown in FIG. 3a, the image processing apparatus includes a receiving unit 301, an obtaining unit 302, a prediction unit 303, an optimization unit 304, and a fusion unit 305, as follows:
(1)接收单元301;(1) receiving unit 301;
接收单元301,用于接收图像处理请求,该图像处理请求指示需要处理的图像、以及需要替换的元素类型等信息。The receiving unit 301 is configured to receive an image processing request, where the image processing request indicates an image that needs to be processed, and information such as an element type that needs to be replaced.
(2)获取单元302;(2) obtaining unit 302;
获取单元302,用于获取与该元素类型对应的语义分割模型,该语义分割模型由深度神经网络训练而成。The obtaining unit 302 is configured to obtain a semantic segmentation model corresponding to the element type, and the semantic segmentation model is trained by a deep neural network.
例如,若接收单元301所接收到的图像处理请求指示需要替换的元素类型为“天空”,则此时,获取单元302可以获取与“天空”对应的语义分割模型,而若接收单元301所接收到的图像处理请求指示需要替换的元素类型为“人像”,则此时,获取单元302可以获取与“人像”对应的语义分割模型,等等,在此不再列举。For example, if the image processing request received by the receiving unit 301 indicates that the element type to be replaced is “sky”, then the acquiring unit 302 can acquire the semantic segmentation model corresponding to “sky”, and if the receiving unit 301 receives The image processing request to the image indicates that the type of the element to be replaced is "portrait". At this time, the obtaining unit 302 can acquire a semantic segmentation model corresponding to the "portrait", and the like, and is not enumerated here.
该语义分割模型可以预先保存在该图像处理装置或其他存储设备中,在需要使用时,由该图像处理装置进行获取,或者,该语义分割模型也可以由该图像处理装置自行建立而成,即如图3b所示,该图像处理装置还可以包括模型建立单元306,如下:The semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is, As shown in FIG. 3b, the image processing apparatus may further include a model establishing unit 306, as follows:
该模型建立单元306,可以用于建立该元素类型对应的语义分割模型,比如,具体可以如下:The model establishing unit 306 can be used to establish a semantic segmentation model corresponding to the element type. For example, the specific information may be as follows:
获取包含有该元素类型的训练数据,根据该训练数据,利用深度神经网络对预设的语义分割初始模型进行训练,得到该元素类型对应的语义分割模型。The training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
其中,该预设的语义分割初始模型可以根据实际应用的需求预先进行设置,比如,可以采用预先训练好的针对一般场景20个类别的语义分割模型,等等。The preset semantic segmentation initial model may be preset according to actual application requirements. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
(3)预测单元303;(3) prediction unit 303;
预测单元303,用于根据该语义分割模型,对该图像中每一像素属于该元素类型的概率进行预测,得到初始概率图。The prediction unit 303 is configured to predict, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtain an initial probability map.
例如,该预测单元303可以包括预测子单元和设置子单元,如下:For example, the prediction unit 303 can include a prediction subunit and a setting subunit, as follows:
预测子单元,可以用于将该图像导入该语义分割模型,以预测该图像中每一像素属于该元素类型的概率。A prediction subunit that can be used to import the image into the semantic segmentation model to predict the probability that each pixel in the image belongs to the element type.
例如,以该元素类型为“天空”为例,则此时,预测子单元可以将该图像导入“天空”对应的语义分割模型,以预测该图像中每一像素属于“天空”的概率。For example, taking the element type as “sky” as an example, at this time, the prediction subunit can import the image into the semantic segmentation model corresponding to “sky” to predict the probability that each pixel in the image belongs to “sky”.
设置子单元,可以用于根据该概率对相应像素在预设蒙版上的颜色进行设置,得到初始概率图。The setting subunit can be used to set the color of the corresponding pixel on the preset mask according to the probability to obtain an initial probability map.
比如,该设置子单元,具体可以用于确定该概率是否大于预设阈值,若是,则将相应像素在预设蒙版上的颜色设置为第一颜色;若否,则将相应像素在预设蒙版上的颜色设置为第二颜色;在确定该图像中所有像素在预设蒙版上的颜色均设置完毕后,输出设置颜色后的预设蒙版,得到初始概率图。For example, the setting subunit may be specifically configured to determine whether the probability is greater than a preset threshold, and if yes, set a color of the corresponding pixel on the preset mask to a first color; if not, the corresponding pixel is preset The color on the mask is set to the second color; after determining that all the pixels in the image are set on the preset mask, the preset mask after setting the color is output, and an initial probability map is obtained.
其中,该预设阈值可以根据实际应用的需求进行设置,而第一颜色和第二颜色也可以根据实际应用的需求而定,比如,可以将第一颜色设置为白色,将第二颜色设置为黑色,等等。The preset threshold may be set according to the requirements of the actual application, and the first color and the second color may also be determined according to actual application requirements. For example, the first color may be set to white, and the second color may be set to Black, and so on.
(4)优化单元304;(4) optimization unit 304;
优化单元304,用于基于条件随机场对该初始概率图进行优化,得到分割效果图。The optimization unit 304 is configured to optimize the initial probability map based on the conditional random field to obtain a segmentation effect map.
例如,该优化单元304,具体可以用于将该初始概率图中的像素映射至条件随机场中的节点,确定节点之间的边约束的相似性,根据边约束的相似性对该初始概率图中像素的分割结果进行调整,得到分割效果 图。For example, the optimization unit 304 may be specifically configured to map the pixels in the initial probability map to the nodes in the conditional random field, determine the similarity of the edge constraints between the nodes, and determine the initial probability map according to the similarity of the edge constraints. The segmentation result of the pixel is adjusted to obtain a segmentation effect map.
(5)融合单元305;(5) a fusion unit 305;
融合单元305,用于根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像。The merging unit 305 is configured to fuse the image with the preset element material according to the segmentation effect image to obtain a processed image.
例如,该融合单元305可以包括素材获取子单元、第一融合子单元、第二融合子单元和合成子单元,如下:For example, the fusion unit 305 can include a material acquisition subunit, a first fusion subunit, a second fusion subunit, and a synthesis subunit, as follows:
该素材获取子单元,用于按照预设策略获取可替换的元素素材。The material acquisition sub-unit is used to obtain a replaceable element material according to a preset policy.
其中,该预设策略可以根据实际应用的需求进行设置,比如,该素材获取子单元,具体可以用于接收用户触发的素材选择指令,根据该素材选择指令从素材库获取相应的素材,作为可替换的元素素材,等等。The preset policy may be set according to the requirements of the actual application. For example, the material acquisition sub-unit may be specifically configured to receive a material selection instruction triggered by the user, and obtain corresponding material from the material library according to the material selection instruction, as Replaced element material, and so on.
为了增加该元素素材的多样性,还可以采用随机截取的方式可获取该元素素材,即:In order to increase the diversity of the material of the element, the material of the element can also be obtained by random interception, namely:
该素材获取子单元,具体用于获取候选图像,对该候选图像进行随机截取,并将截取到的图像作为可替换的元素素材。The material acquisition sub-unit is specifically configured to acquire a candidate image, randomly intercept the candidate image, and use the intercepted image as a replaceable element material.
其中,该候选图像可以通过在网络上进行获取,或者,也可以由用户进行上传,甚至,也可以由用户直接在终端屏幕或网页上截图,然后提供给该图像处理装置,等等,在此不再赘述。The candidate image may be acquired on the network, or may be uploaded by the user, or may be directly recorded by the user on the terminal screen or the webpage, and then provided to the image processing apparatus, etc., where No longer.
该第一融合子单元,可以用于通过融合方法将该分割效果图中的第一颜色部分与获取到的元素素材相结合,得到第一结合图。The first fusion subunit may be configured to combine the first color portion in the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map.
该第二融合子单元,可以用于通过融合方法将该分割效果图中的第二颜色部分与该图像相结合,得到第二结合图。The second fusion subunit may be configured to combine the second color portion in the segmentation effect map with the image by a fusion method to obtain a second combination map.
该合成子单元,可以用于将第一结合图和第二结合图进行合成,得到处理后图像。The synthesis subunit can be used to synthesize the first combination map and the second combination map to obtain a processed image.
为了使得融合结果更为真实,避免由于概率预测不准确所导致的噪声或缺失,还可以在融合之前,对该分割效果图进行一定处理,以使得其分割边界更为光滑、以及替换区域的连接处的颜色过渡可以更为自然;即如图3b所示,该图像处理装置还可以包括预处理单元307,如下:In order to make the fusion result more realistic and avoid noise or missing due to inaccurate probability prediction, the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region. The color transition at the location may be more natural; that is, as shown in FIG. 3b, the image processing apparatus may further include a pre-processing unit 307, as follows:
该预处理单元307,可以用于对该分割效果图进行外观模型方法和/ 或图像形态学操作处理,得到处理后分割效果图。The pre-processing unit 307 can be configured to perform an appearance model method and/or an image morphology operation process on the segmentation effect map to obtain a processed segmentation effect map.
则此时,融合单元305,具体可以用于根据处理后分割效果图,将该图像与预设元素素材进行融合,得到处理后图像。At this time, the merging unit 305 may be specifically configured to fuse the image with the preset element material according to the processed segmentation effect image to obtain a processed image.
其中,图像形态学操作处理可以包括降噪处理和/或连通域分析等处理,在此不再赘述。The image morphological operation processing may include processing such as noise reduction processing and/or connected domain analysis, and details are not described herein again.
具体实施时,以上各个单元可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元的具体实施可参见前面的方法实施例,在此不再赘述。In the specific implementation, the foregoing units may be implemented as a separate entity, or may be implemented in any combination, and may be implemented as the same or a plurality of entities. For the specific implementation of the foregoing, refer to the foregoing method embodiments, and details are not described herein.
由上可知,本实施例在接收到图像处理请求后,可以由获取单元302根据该请求的指示获取与需要替换的元素类型对应的语义分割模型,并由预测单元303根据该模型预测图像中每一像素属于该元素类型的概率,以得到初始概率图,然后,由优化单元304基于条件随机场对该初始概率图进行优化,并由融合单元305利用优化后得到的分割效果图将图像与预设元素素材进行融合,从而达到将图像中的某一元素类型部分替换为预设元素素材的目的;由于该方案中的语义分割模型主要是由深度神经网络训练而成的,而且在利用该模型对图像进行语义分割时,并不是只基于颜色和位置等信息,而是通过对每一像素属于该元素类型的概率进行预测,因此,相对于现有方案而言,可以大大减少误检和漏检的概率;此外,由于该方案还可以利用条件随机场对分割后的初始概率图进行优化,因此,可以得到更为精细的分割结果,大大提高分割的精准性,有利于减少图像失真的情况,改善图像的融合效果。As can be seen from the above, after receiving the image processing request, the acquiring unit 302 may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and the prediction unit 303 predicts each image according to the model. A pixel belongs to the probability of the element type to obtain an initial probability map. Then, the optimization unit 304 optimizes the initial probability map based on the conditional random field, and the fusion unit 305 uses the optimized segmentation effect map to image and pre- The element material is fused to achieve the purpose of replacing a certain element type part of the image with the preset element material; since the semantic segmentation model in the scheme is mainly trained by the deep neural network, and the model is utilized Semantic segmentation of images is not based solely on information such as color and position, but by predicting the probability that each pixel belongs to that element type. Therefore, compared to existing solutions, false detection and leakage can be greatly reduced. Probability of detection; in addition, since the scheme can also utilize the conditional random field to split the initial Fig rate optimization, so you can get a finer segmentation results, greatly improving the accuracy of segmentation, helps to reduce the image distortion and improve image fusion effect.
本申请实施例还提供一种服务器,如图4所示,其示出了本申请实施例所涉及的服务器的结构示意图,具体来讲:The embodiment of the present application further provides a server, as shown in FIG. 4, which shows a schematic structural diagram of a server involved in the embodiment of the present application, specifically:
该服务器可以包括一个或者一个以上处理核心的处理器401、一个或一个以上计算机可读存储介质的存储器402、电源403和输入单元404等部件。本领域技术人员可以理解,图4中示出的服务器结构并不构成对服务器的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:The server may include one or more processing core processor 401, one or more computer readable storage medium memories 402, power source 403, and input unit 404. It will be understood by those skilled in the art that the server structure illustrated in FIG. 4 does not constitute a limitation to the server, and may include more or less components than those illustrated, or some components may be combined, or different component arrangements. among them:
处理器401是该服务器的控制中心,利用各种接口和线路连接整个服务器的各个部分,通过运行或执行存储在存储器402内的软件程序和/或模块,以及调用存储在存储器402内的数据,执行服务器的各种功能和处理数据,从而对服务器进行整体监控。处理器401可包括一个或多个处理核心;处理器401可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器401中。The processor 401 is the control center of the server, connecting various portions of the entire server using various interfaces and lines, by running or executing software programs and/or modules stored in the memory 402, and recalling data stored in the memory 402, Execute the server's various functions and process data to monitor the server as a whole. The processor 401 may include one or more processing cores; the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application, etc., and the modem processor mainly Handle wireless communications. It can be understood that the above modem processor may not be integrated into the processor 401.
存储器402可用于存储软件程序以及模块,处理器401通过运行存储在存储器402的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器402可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据服务器的使用所创建的数据等。此外,存储器402可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器402还可以包括存储器控制器,以提供处理器401对存储器402的访问。The memory 402 can be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by running software programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the server, etc. Moreover, memory 402 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 402 can also include a memory controller to provide processor 401 access to memory 402.
服务器还包括给各个部件供电的电源403,电源403可以通过电源管理系统与处理器401逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源403还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The server also includes a power supply 403 for powering various components. The power supply 403 can be logically coupled to the processor 401 through a power management system to manage functions such as charging, discharging, and power management through the power management system. The power supply 403 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
该服务器还可包括输入单元404,该输入单元404可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The server can also include an input unit 404 that can be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
尽管未示出,服务器还可以包括显示单元等,在此不再赘述。具体在本实施例中,服务器中的处理器401会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器402中,并由处理器401来运行存储在存储器402中的应用程序,执行上述图1b和图2a 所示的方法,以及图3a和图3b所示装置的操作,如下:Although not shown, the server may further include a display unit or the like, and details are not described herein again. Specifically, in this embodiment, the processor 401 in the server loads the executable file corresponding to the process of one or more applications into the memory 402 according to the following instruction, and is stored in the memory by the processor 401. The application in 402 performs the above-described methods shown in Figures 1b and 2a, and the operations of the devices shown in Figures 3a and 3b, as follows:
接收图像处理请求,该图像处理请求指示需要处理的图像、以及需要替换的元素类型,获取与该元素类型对应的语义分割模型,该语义分割模型由深度神经网络训练而成,根据该语义分割模型,对该图像中每一像素属于该元素类型的概率进行预测,得到初始概率图,基于条件随机场对该初始概率图进行优化,得到分割效果图,根据该分割效果图将该图像与预设元素素材进行融合,得到处理后图像。Receiving an image processing request indicating an image to be processed and an element type to be replaced, and acquiring a semantic segmentation model corresponding to the element type, the semantic segmentation model being trained by a deep neural network, according to the semantic segmentation model Predicting the probability that each pixel belongs to the element type in the image, obtaining an initial probability map, and optimizing the initial probability map based on the conditional random field to obtain a segmentation effect map, and the image and the preset according to the segmentation effect map The element material is fused to obtain a processed image.
例如,具体可以按照预设策略获取可替换的元素素材,然后,通过融合方法将该分割效果图中的第一颜色部分与获取到的元素素材相结合,得到第一结合图,以及通过融合方法将该分割效果图中的第二颜色部分与该图像相结合,得到第二结合图,再然后,将第一结合图和第二结合图进行合成,得到处理后图像。For example, the replaceable element material may be obtained according to a preset strategy, and then the first color portion in the segmentation effect image is combined with the acquired element material by a fusion method to obtain a first combination image, and the fusion method is adopted. The second color portion in the segmentation effect map is combined with the image to obtain a second combination image, and then the first combination image and the second combination image are combined to obtain a processed image.
该语义分割模型可以预先保存在该图像处理装置或其他存储设备中,在需要使用时,由该图像处理装置进行获取,或者,该语义分割模型也可以由该图像处理装置自行建立而成,即处理器401还可以运行存储在存储器402中的应用程序,从而实现如下功能:The semantic segmentation model may be pre-stored in the image processing device or other storage device, and may be acquired by the image processing device when needed, or the semantic segmentation model may be self-established by the image processing device, that is, The processor 401 can also run an application stored in the memory 402 to implement the following functions:
获取包含有该元素类型的训练数据,根据该训练数据,利用深度神经网络对预设的语义分割初始模型进行训练,得到该元素类型对应的语义分割模型。The training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
其中,该预设的语义分割初始模型可以根据实际应用的需求预先进行设置,比如,可以采用预先训练好的针对一般场景20个类别的语义分割模型,等等。The preset semantic segmentation initial model may be preset according to actual application requirements. For example, a pre-trained semantic segmentation model for 20 categories of general scenes may be used, and the like.
为了使得融合结果更为真实,避免由于概率预测不准确所导致的噪声或缺失,还可以在融合之前,对该分割效果图进行一定处理,以使得其分割边界更为光滑、以及替换区域的连接处的颜色过渡可以更为自然;即处理器401还可以运行存储在存储器402中的应用程序,从而实现如下功能:In order to make the fusion result more realistic and avoid noise or missing due to inaccurate probability prediction, the segmentation effect map can be processed before fusion to make the segmentation boundary smoother and the connection of the replacement region. The color transition at the location can be more natural; that is, the processor 401 can also run an application stored in the memory 402 to implement the following functions:
对该分割效果图进行外观模型方法和/或图像形态学操作处理,得到 处理后分割效果图,这样,后续在融合时,便可以根据该处理后分割效果图,将该图像与预设元素素材进行融合,得到处理后图像,详见前面的实施例,在此不再赘述。The appearance model method and/or the image morphology operation processing are performed on the segmentation effect diagram, and the segmentation effect map is obtained after the processing, so that, after the fusion, the image and the preset element material can be segmented according to the processed segmentation effect map. The fusion is performed to obtain the processed image. For details, refer to the previous embodiment, and details are not described herein again.
以上各个操作的具体实施可参见前面的实施例,在此不再赘述。For the specific implementation of the foregoing operations, refer to the foregoing embodiments, and details are not described herein again.
由上可知,本实施例的服务器在接收到图像处理请求后,可以根据该请求的指示获取与需要替换的元素类型对应的语义分割模型,根据该模型预测图像中每一像素属于该元素类型的概率,以得到初始概率图,然后,基于条件随机场对该初始概率图进行优化,并利用优化后得到的分割效果图将图像与预设元素素材进行融合,从而达到将图像中的某一元素类型部分替换为预设元素素材的目的;由于该方案中的语义分割模型主要是由深度神经网络训练而成的,而且在利用该模型对图像进行语义分割时,并不是只基于颜色和位置等信息,而是通过对每一像素属于该元素类型的概率进行预测,因此,相对于现有方案而言,可以大大减少误检和漏检的概率;此外,由于该方案还可以利用条件随机场对分割后的初始概率图进行优化,因此,可以得到更为精细的分割结果,大大提高分割的精准性,有利于减少图像失真的情况,改善图像的融合效果。It can be seen that, after receiving the image processing request, the server of the embodiment may acquire a semantic segmentation model corresponding to the element type that needs to be replaced according to the instruction of the request, and predict, according to the model, each pixel in the image belongs to the element type. Probability to obtain the initial probability map, then optimize the initial probability map based on the conditional random field, and use the segmentation effect map obtained by the optimization to fuse the image with the preset element material to achieve an element in the image The type part is replaced with the purpose of the preset element material; since the semantic segmentation model in this scheme is mainly trained by the deep neural network, and the semantic segmentation of the image using the model is not based only on color and position, etc. Information, but by predicting the probability that each pixel belongs to the type of the element, therefore, the probability of false detection and missed detection can be greatly reduced compared to the existing scheme; in addition, since the scheme can also utilize the conditional random field Optimize the segmented initial probability map so that you can get more detailed scores As a result, greatly improving the accuracy of segmentation, helps to reduce the image distortion and improve image fusion effect.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。A person skilled in the art may understand that all or part of the various steps of the foregoing embodiments may be performed by a program to instruct related hardware. The program may be stored in a computer readable storage medium, and the storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), disk or optical disk.
以上对本申请实施例所提供的一种图像处理方法和装置进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。An image processing method and apparatus provided by the embodiments of the present application are described in detail. The principles and implementations of the present application are described in the specific examples. The description of the above embodiments is only used to help understand the present application. The method and its core idea; at the same time, those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and the scope of application, in summary, the contents of this specification should not be construed as Application restrictions.

Claims (19)

  1. 一种图像处理方法,应用于图像处理装置,所述方法包括:An image processing method is applied to an image processing apparatus, the method comprising:
    接收图像处理请求,所述图像处理请求指示待处理的图像、以及待替换的元素类型;Receiving an image processing request indicating an image to be processed, and an element type to be replaced;
    获取与所述元素类型对应的语义分割模型,所述语义分割模型由深度神经网络训练而成;Obtaining a semantic segmentation model corresponding to the element type, the semantic segmentation model being trained by a deep neural network;
    根据所述语义分割模型,对所述图像中每一像素属于所述元素类型的概率进行预测,得到初始概率图;Determining, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtaining an initial probability map;
    根据所述初始概率图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the initial probability map to obtain a processed image.
  2. 根据权利要求1所述的方法,所述根据所述语义分割模型,对所述图像中每一像素属于所述元素类型的概率进行预测,得到初始概率图,包括:The method according to claim 1, wherein the probability of each pixel in the image belonging to the element type is predicted according to the semantic segmentation model, and an initial probability map is obtained, including:
    将所述图像导入所述语义分割模型,预测所述图像中每一像素属于所述元素类型的概率;Importing the image into the semantic segmentation model, predicting a probability that each pixel in the image belongs to the element type;
    根据所述概率对相应像素在预设蒙版上的颜色进行设置,得到初始概率图。The color of the corresponding pixel on the preset mask is set according to the probability, and an initial probability map is obtained.
  3. 根据权利要求2所述的方法,所述根据所述概率对相应像素在预设蒙版上的颜色进行设置,得到初始概率图,包括:The method according to claim 2, wherein the color of the corresponding pixel on the preset mask is set according to the probability, and an initial probability map is obtained, including:
    确定所述概率是否大于预设阈值;Determining whether the probability is greater than a preset threshold;
    当所述概率大于所述预设阈值时,则将相应像素在预设蒙版上的颜色设置为第一颜色;When the probability is greater than the preset threshold, setting a color of the corresponding pixel on the preset mask to a first color;
    当所述概率小于或等于所述阈值时,则将相应像素在预设蒙版上的颜色设置为第二颜色;When the probability is less than or equal to the threshold, setting a color of the corresponding pixel on the preset mask to a second color;
    在确定所述图像中所有像素在预设蒙版上的颜色均设置完毕后,输出设置颜色后的预设蒙版,得到初始概率图。After determining that all the pixels in the image are set on the preset mask, the preset mask after setting the color is output, and an initial probability map is obtained.
  4. 根据权利要求1所述的方法,所述方法进一步包括:The method of claim 1 further comprising:
    基于条件随机场对所述初始概率图进行优化,得到分割效果图;The initial probability map is optimized based on the conditional random field to obtain a segmentation effect map;
    其中,根据所述初始概率图将所述图像与预设元素素材进行融合,得到处理后图像,包括:The image is merged with the preset element material according to the initial probability map to obtain a processed image, including:
    根据所述分割效果图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the segmentation effect map to obtain a processed image.
  5. 根据权利要求4所述的方法,所述基于条件随机场对所述初始概率图进行优化,得到分割效果图,包括:The method according to claim 4, wherein the conditional random field optimizes the initial probability map to obtain a segmentation effect map, including:
    将所述初始概率图中的像素映射至条件随机场中的节点;Mapping pixels in the initial probability map to nodes in a conditional random field;
    确定节点之间的边约束的相似性;Determining the similarity of edge constraints between nodes;
    根据边约束的相似性对所述初始概率图中像素的分割结果进行调整,得到分割效果图。The segmentation result of the pixels in the initial probability map is adjusted according to the similarity of the edge constraints to obtain a segmentation effect map.
  6. 根据权利要求4或5所述的方法,所述根据所述分割效果图将所述图像与预设元素素材进行融合,得到处理后图像,包括:The method according to claim 4 or 5, wherein the image is merged with the preset element material according to the segmentation effect map to obtain a processed image, including:
    按照预设策略获取可替换的元素素材;Obtaining replaceable element material according to a preset strategy;
    通过融合方法将所述分割效果图中的第一颜色部分与获取到的元素素材相结合,得到第一结合图;Combining the first color portion in the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map;
    通过融合方法将所述分割效果图中的第二颜色部分与所述图像相结合,得到第二结合图;Combining the second color portion in the segmentation effect map with the image by a fusion method to obtain a second combination map;
    将第一结合图和第二结合图进行合成,得到处理后图像。The first combination map and the second combination map are combined to obtain a processed image.
  7. 根据权利要求6所述的方法,所述按照预设策略获取可替换的元素素材,包括:The method according to claim 6, wherein the obtaining the replaceable element material according to the preset policy comprises:
    获取候选图像,对所述候选图像进行随机截取,并将截取到的图像作为可替换的元素素材;或者,Obtaining a candidate image, randomly extracting the candidate image, and using the intercepted image as a replaceable element material; or
    接收用户触发的素材选择指令,根据所述素材选择指令从素材库获取相应的素材,作为可替换的元素素材。Receiving a user-triggered material selection instruction, and acquiring a corresponding material from the material library according to the material selection instruction as a replaceable element material.
  8. 根据权利要求4或5所述的方法,所述根据所述分割效果图将所述图像与预设元素素材进行融合,得到处理后图像之前,还包括:The method according to claim 4 or 5, wherein the image is merged with the preset element material according to the segmentation effect map to obtain the processed image, and further includes:
    对所述分割效果图进行外观模型方法和/或图像形态学操作处理,得 到处理后分割效果图;Performing an appearance model method and/or an image morphology operation process on the segmentation effect map to obtain a segmentation effect map after processing;
    其中,所述根据所述分割效果图将所述图像与预设元素素材进行融合,得到处理后图像,包括:根据处理后分割效果图,将所述图像与预设元素素材进行融合,得到处理后图像。The merging the image with the preset element material according to the segmentation effect map to obtain the processed image includes: merging the image with a preset element material according to the processed segmentation effect map, and obtaining the processing After the image.
  9. 根据权利要求1至5任一项所述的方法,所述获取与所述元素类型对应的语义分割模型之前,还包括:The method according to any one of claims 1 to 5, before the obtaining a semantic segmentation model corresponding to the element type, further comprising:
    获取包含有所述元素类型的训练数据;Obtaining training data containing the type of the element;
    根据所述训练数据,利用深度神经网络对预设的语义分割初始模型进行训练,得到所述元素类型对应的语义分割模型。According to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
  10. 一种图像处理装置,所述装置包括:处理器和存储器,其中,所述存储器中存储可被所述处理器执行的指令,当执行所述指令时,所述处理器用于:An image processing apparatus, the apparatus comprising: a processor and a memory, wherein the memory stores instructions executable by the processor, and when the instructions are executed, the processor is configured to:
    接收图像处理请求,所述图像处理请求指示待处理的图像、以及待替换的元素类型;Receiving an image processing request indicating an image to be processed, and an element type to be replaced;
    获取与所述元素类型对应的语义分割模型,所述语义分割模型由深度神经网络训练而成;Obtaining a semantic segmentation model corresponding to the element type, the semantic segmentation model being trained by a deep neural network;
    根据所述语义分割模型,对所述图像中每一像素属于所述元素类型的概率进行预测,得到初始概率图;Determining, according to the semantic segmentation model, a probability that each pixel in the image belongs to the element type, and obtaining an initial probability map;
    根据所述初始概率图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the initial probability map to obtain a processed image.
  11. 根据权利要求10所述的装置,所述处理器进一步用于:The apparatus of claim 10, the processor further configured to:
    将所述图像导入所述语义分割模型,预测所述图像中每一像素属于所述元素类型的概率;Importing the image into the semantic segmentation model, predicting a probability that each pixel in the image belongs to the element type;
    根据所述概率对相应像素在预设蒙版上的颜色进行设置,得到初始概率图。The color of the corresponding pixel on the preset mask is set according to the probability, and an initial probability map is obtained.
  12. 根据权利要求11所述的装置,所述处理器进一步用于:The apparatus of claim 11 wherein said processor is further configured to:
    确定所述概率是否大于预设阈值;Determining whether the probability is greater than a preset threshold;
    当所述概率大于所述预设阈值时,则将相应像素在预设蒙版上的颜 色设置为第一颜色;When the probability is greater than the preset threshold, setting a color of the corresponding pixel on the preset mask to a first color;
    当所述概率小于或等于所述阈值时,则将相应像素在预设蒙版上的颜色设置为第二颜色;When the probability is less than or equal to the threshold, setting a color of the corresponding pixel on the preset mask to a second color;
    在确定所述图像中所有像素在预设蒙版上的颜色均设置完毕后,输出设置颜色后的预设蒙版,得到初始概率图。After determining that all the pixels in the image are set on the preset mask, the preset mask after setting the color is output, and an initial probability map is obtained.
  13. 根据权利要求10所述的装置,所述处理器进一步用于:The apparatus of claim 10, the processor further configured to:
    基于条件随机场对所述初始概率图进行优化,得到分割效果图;The initial probability map is optimized based on the conditional random field to obtain a segmentation effect map;
    其中,所述处理器进一步用于:Wherein the processor is further configured to:
    根据所述分割效果图将所述图像与预设元素素材进行融合,得到处理后图像。The image is merged with the preset element material according to the segmentation effect map to obtain a processed image.
  14. 根据权利要求13所述的装置,所述处理器进一步用于:The apparatus of claim 13 wherein said processor is further configured to:
    将所述初始概率图中的像素映射至条件随机场中的节点,确定节点之间的边约束的相似性,根据边约束的相似性对所述初始概率图中像素的分割结果进行调整,得到分割效果图。Mapping the pixels in the initial probability map to the nodes in the conditional random field, determining the similarity of the edge constraints between the nodes, and adjusting the segmentation results of the pixels in the initial probability map according to the similarity of the edge constraints, Split the effect map.
  15. 根据权利要求13或14所述的装置,所述处理器进一步用于:The apparatus of claim 13 or 14, the processor further configured to:
    按照预设策略获取可替换的元素素材;Obtaining replaceable element material according to a preset strategy;
    通过融合方法将所述分割效果图中的第一颜色部分与获取到的元素素材相结合,得到第一结合图;Combining the first color portion in the segmentation effect map with the acquired element material by a fusion method to obtain a first combination map;
    通过融合方法将所述分割效果图中的第二颜色部分与所述图像相结合,得到第二结合图;Combining the second color portion in the segmentation effect map with the image by a fusion method to obtain a second combination map;
    将第一结合图和第二结合图进行合成,得到处理后图像。The first combination map and the second combination map are combined to obtain a processed image.
  16. 根据权利要求15所述的装置,所述处理器进一步用于:获取候选图像,对所述候选图像进行随机截取,并将截取到的图像作为可替换的元素素材;或者,The apparatus according to claim 15, the processor is further configured to: acquire a candidate image, randomly intercept the candidate image, and use the intercepted image as a replaceable element material; or
    接收用户触发的素材选择指令,根据所述素材选择指令从素材库获取相应的素材,作为可替换的元素素材。Receiving a user-triggered material selection instruction, and acquiring a corresponding material from the material library according to the material selection instruction as a replaceable element material.
  17. 根据权利要求13或14所述的装置,所述处理器进一步用于:The apparatus of claim 13 or 14, the processor further configured to:
    对所述分割效果图进行外观模型方法和/或图像形态学操作处理,得 到处理后分割效果图;Performing an appearance model method and/or an image morphology operation process on the segmentation effect map to obtain a segmentation effect map after processing;
    根据处理后分割效果图,将所述图像与预设元素素材进行融合,得到处理后图像。According to the processed segmentation effect map, the image is merged with the preset element material to obtain a processed image.
  18. 根据权利要求10至14任一项所述的装置,所述处理器进一步用于:The apparatus according to any one of claims 10 to 14, the processor further configured to:
    获取包含有所述元素类型的训练数据,根据所述训练数据,利用深度神经网络对预设的语义分割初始模型进行训练,得到所述元素类型对应的语义分割模型。The training data including the element type is obtained, and according to the training data, the preset semantic segmentation initial model is trained by using a deep neural network to obtain a semantic segmentation model corresponding to the element type.
  19. 一种非易失性计算机可读存储介质,存储有计算机程序,该计算机程序用于执行所述权利要求1至9任一项所述的方法。A non-transitory computer readable storage medium storing a computer program for performing the method of any one of claims 1 to 9.
PCT/CN2018/080446 2017-03-29 2018-03-26 Image processing method and device, and storage medium WO2018177237A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710199165.X 2017-03-29
CN201710199165.XA CN107025457B (en) 2017-03-29 2017-03-29 Image processing method and device

Publications (1)

Publication Number Publication Date
WO2018177237A1 true WO2018177237A1 (en) 2018-10-04

Family

ID=59525827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/080446 WO2018177237A1 (en) 2017-03-29 2018-03-26 Image processing method and device, and storage medium

Country Status (2)

Country Link
CN (1) CN107025457B (en)
WO (1) WO2018177237A1 (en)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109598678A (en) * 2018-12-25 2019-04-09 维沃移动通信有限公司 A kind of image processing method, device and terminal device
CN110544218A (en) * 2019-09-03 2019-12-06 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN110992371A (en) * 2019-11-20 2020-04-10 北京奇艺世纪科技有限公司 Portrait segmentation method and device based on prior information and electronic equipment
CN111461996A (en) * 2020-03-06 2020-07-28 合肥师范学院 Rapid and intelligent color matching method for image
CN111489359A (en) * 2019-01-25 2020-08-04 银河水滴科技(北京)有限公司 Image segmentation method and device
CN111598902A (en) * 2020-05-20 2020-08-28 北京字节跳动网络技术有限公司 Image segmentation method and device, electronic equipment and computer readable medium
CN111832745A (en) * 2020-06-12 2020-10-27 北京百度网讯科技有限公司 Data augmentation method and device and electronic equipment
CN111832587A (en) * 2019-04-18 2020-10-27 北京四维图新科技股份有限公司 Image semantic annotation method, device and storage medium
CN112037142A (en) * 2020-08-24 2020-12-04 腾讯科技(深圳)有限公司 Image denoising method and device, computer and readable storage medium
CN112508964A (en) * 2020-11-30 2021-03-16 北京百度网讯科技有限公司 Image segmentation method and device, electronic equipment and storage medium
CN112633142A (en) * 2020-12-21 2021-04-09 广东电网有限责任公司电力科学研究院 Power transmission line violation building identification method and related device
CN112800499A (en) * 2020-12-02 2021-05-14 杭州群核信息技术有限公司 Diatom ooze pattern high-order design method based on image processing and real-time material generation capacity
CN112819741A (en) * 2021-02-03 2021-05-18 四川大学 Image fusion method and device, electronic equipment and storage medium
CN112861885A (en) * 2021-03-25 2021-05-28 北京百度网讯科技有限公司 Image recognition method and device, electronic equipment and storage medium
CN113129319A (en) * 2021-04-29 2021-07-16 北京市商汤科技开发有限公司 Image processing method, image processing device, computer equipment and storage medium
CN113554658A (en) * 2020-04-23 2021-10-26 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN113657401A (en) * 2021-08-24 2021-11-16 凌云光技术股份有限公司 Probability map visualization method and device for defect detection
CN117437338A (en) * 2023-10-08 2024-01-23 书行科技(北京)有限公司 Special effect generation method, device and computer readable storage medium

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107025457B (en) * 2017-03-29 2022-03-08 腾讯科技(深圳)有限公司 Image processing method and device
CN107705334B (en) * 2017-08-25 2020-08-25 北京图森智途科技有限公司 Camera abnormity detection method and device
CN107507201A (en) * 2017-09-22 2017-12-22 深圳天琴医疗科技有限公司 A kind of medical image cutting method and device
CN107993191B (en) * 2017-11-30 2023-03-21 腾讯科技(深圳)有限公司 Image processing method and device
CN108009506A (en) * 2017-12-07 2018-05-08 平安科技(深圳)有限公司 Intrusion detection method, application server and computer-readable recording medium
CN111052028B (en) * 2018-01-23 2022-04-05 深圳市大疆创新科技有限公司 System and method for automatic surface and sky detection
CN108305260B (en) * 2018-03-02 2022-04-12 苏州大学 Method, device and equipment for detecting angular points in image
CN108764143B (en) * 2018-05-29 2020-11-24 北京字节跳动网络技术有限公司 Image processing method, image processing device, computer equipment and storage medium
CN110610495B (en) * 2018-06-15 2022-06-07 北京京东尚科信息技术有限公司 Image processing method and system and electronic equipment
CN110910334B (en) * 2018-09-15 2023-03-21 北京市商汤科技开发有限公司 Instance segmentation method, image processing device and computer readable storage medium
CN110163862B (en) * 2018-10-22 2023-08-25 腾讯科技(深圳)有限公司 Image semantic segmentation method and device and computer equipment
CN109741347B (en) * 2018-12-30 2021-03-16 北京工业大学 Iterative learning image segmentation method based on convolutional neural network
CN110310222A (en) * 2019-06-20 2019-10-08 北京奇艺世纪科技有限公司 A kind of image Style Transfer method, apparatus, electronic equipment and storage medium
CN110930296B (en) * 2019-11-20 2023-08-08 Oppo广东移动通信有限公司 Image processing method, device, equipment and storage medium
CN110956221A (en) * 2019-12-17 2020-04-03 北京化工大学 Small sample polarization synthetic aperture radar image classification method based on deep recursive network
CN111210434A (en) * 2019-12-19 2020-05-29 上海艾麒信息科技有限公司 Image replacement method and system based on sky identification
CN111354059B (en) * 2020-02-26 2023-04-28 北京三快在线科技有限公司 Image processing method and device
CN111445486B (en) * 2020-03-25 2023-10-03 腾讯科技(深圳)有限公司 Image processing method, device, equipment and computer readable storage medium
CN111507946A (en) * 2020-04-02 2020-08-07 浙江工业大学之江学院 Element data driven flower type pattern rapid generation method based on similarity sample
CN111915636B (en) * 2020-07-03 2023-10-24 闽江学院 Method and device for positioning and dividing waste targets
CN111862045B (en) * 2020-07-21 2021-09-07 上海杏脉信息科技有限公司 Method and device for generating blood vessel model
CN112866573B (en) * 2021-01-13 2022-11-04 京东方科技集团股份有限公司 Display, fusion display system and image processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070127834A1 (en) * 2005-12-07 2007-06-07 Shih-Jong Lee Method of directed pattern enhancement for flexible recognition
CN102486827A (en) * 2010-12-03 2012-06-06 中兴通讯股份有限公司 Extraction method of foreground object in complex background environment and apparatus thereof
CN103116754A (en) * 2013-01-24 2013-05-22 浙江大学 Batch image segmentation method and batch image segmentation system based on recognition models
CN105574513A (en) * 2015-12-22 2016-05-11 北京旷视科技有限公司 Character detection method and device
CN107025457A (en) * 2017-03-29 2017-08-08 腾讯科技(深圳)有限公司 A kind of image processing method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777180B (en) * 2009-12-23 2012-07-04 中国科学院自动化研究所 Complex background real-time alternating method based on background modeling and energy minimization
CN104133956B (en) * 2014-07-25 2017-09-12 小米科技有限责任公司 Handle the method and device of picture
ES2685977T3 (en) * 2014-09-09 2018-10-15 Icometrix Nv Method and system to analyze image data
CN104463843B (en) * 2014-10-31 2017-05-17 南京邮电大学 Interactive image segmentation method of Android system
CN104636761A (en) * 2015-03-12 2015-05-20 华东理工大学 Image semantic annotation method based on hierarchical segmentation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070127834A1 (en) * 2005-12-07 2007-06-07 Shih-Jong Lee Method of directed pattern enhancement for flexible recognition
CN102486827A (en) * 2010-12-03 2012-06-06 中兴通讯股份有限公司 Extraction method of foreground object in complex background environment and apparatus thereof
CN103116754A (en) * 2013-01-24 2013-05-22 浙江大学 Batch image segmentation method and batch image segmentation system based on recognition models
CN105574513A (en) * 2015-12-22 2016-05-11 北京旷视科技有限公司 Character detection method and device
CN107025457A (en) * 2017-03-29 2017-08-08 腾讯科技(深圳)有限公司 A kind of image processing method and device

Cited By (33)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109598678A (en) * 2018-12-25 2019-04-09 维沃移动通信有限公司 A kind of image processing method, device and terminal device
CN109598678B (en) * 2018-12-25 2023-12-12 维沃移动通信有限公司 Image processing method and device and terminal equipment
CN111489359A (en) * 2019-01-25 2020-08-04 银河水滴科技(北京)有限公司 Image segmentation method and device
CN111489359B (en) * 2019-01-25 2023-05-30 银河水滴科技(北京)有限公司 Image segmentation method and device
CN111832587B (en) * 2019-04-18 2023-11-14 北京四维图新科技股份有限公司 Image semantic annotation method, device and storage medium
CN111832587A (en) * 2019-04-18 2020-10-27 北京四维图新科技股份有限公司 Image semantic annotation method, device and storage medium
CN110544218B (en) * 2019-09-03 2024-02-13 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN110544218A (en) * 2019-09-03 2019-12-06 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN110992371B (en) * 2019-11-20 2023-10-27 北京奇艺世纪科技有限公司 Portrait segmentation method and device based on priori information and electronic equipment
CN110992371A (en) * 2019-11-20 2020-04-10 北京奇艺世纪科技有限公司 Portrait segmentation method and device based on prior information and electronic equipment
CN111461996A (en) * 2020-03-06 2020-07-28 合肥师范学院 Rapid and intelligent color matching method for image
CN111461996B (en) * 2020-03-06 2023-08-29 合肥师范学院 Quick intelligent color matching method for image
CN113554658A (en) * 2020-04-23 2021-10-26 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN111598902A (en) * 2020-05-20 2020-08-28 北京字节跳动网络技术有限公司 Image segmentation method and device, electronic equipment and computer readable medium
CN111598902B (en) * 2020-05-20 2023-05-30 抖音视界有限公司 Image segmentation method, device, electronic equipment and computer readable medium
CN111832745A (en) * 2020-06-12 2020-10-27 北京百度网讯科技有限公司 Data augmentation method and device and electronic equipment
CN111832745B (en) * 2020-06-12 2023-08-01 北京百度网讯科技有限公司 Data augmentation method and device and electronic equipment
CN112037142A (en) * 2020-08-24 2020-12-04 腾讯科技(深圳)有限公司 Image denoising method and device, computer and readable storage medium
CN112037142B (en) * 2020-08-24 2024-02-13 腾讯科技(深圳)有限公司 Image denoising method, device, computer and readable storage medium
CN112508964B (en) * 2020-11-30 2024-02-20 北京百度网讯科技有限公司 Image segmentation method, device, electronic equipment and storage medium
CN112508964A (en) * 2020-11-30 2021-03-16 北京百度网讯科技有限公司 Image segmentation method and device, electronic equipment and storage medium
CN112800499B (en) * 2020-12-02 2023-12-26 杭州群核信息技术有限公司 Diatom ooze pattern high-order design method based on image processing and real-time material generation capability
CN112800499A (en) * 2020-12-02 2021-05-14 杭州群核信息技术有限公司 Diatom ooze pattern high-order design method based on image processing and real-time material generation capacity
CN112633142A (en) * 2020-12-21 2021-04-09 广东电网有限责任公司电力科学研究院 Power transmission line violation building identification method and related device
CN112819741B (en) * 2021-02-03 2024-03-08 四川大学 Image fusion method and device, electronic equipment and storage medium
CN112819741A (en) * 2021-02-03 2021-05-18 四川大学 Image fusion method and device, electronic equipment and storage medium
CN112861885A (en) * 2021-03-25 2021-05-28 北京百度网讯科技有限公司 Image recognition method and device, electronic equipment and storage medium
CN112861885B (en) * 2021-03-25 2023-09-22 北京百度网讯科技有限公司 Image recognition method, device, electronic equipment and storage medium
CN113129319A (en) * 2021-04-29 2021-07-16 北京市商汤科技开发有限公司 Image processing method, image processing device, computer equipment and storage medium
CN113129319B (en) * 2021-04-29 2023-06-23 北京市商汤科技开发有限公司 Image processing method, device, computer equipment and storage medium
CN113657401B (en) * 2021-08-24 2024-02-06 凌云光技术股份有限公司 Probability map visualization method and device for defect detection
CN113657401A (en) * 2021-08-24 2021-11-16 凌云光技术股份有限公司 Probability map visualization method and device for defect detection
CN117437338A (en) * 2023-10-08 2024-01-23 书行科技(北京)有限公司 Special effect generation method, device and computer readable storage medium

Also Published As

Publication number Publication date
CN107025457B (en) 2022-03-08
CN107025457A (en) 2017-08-08

Similar Documents

Publication Publication Date Title
WO2018177237A1 (en) Image processing method and device, and storage medium
KR102469295B1 (en) Remove video background using depth
US11443462B2 (en) Method and apparatus for generating cartoon face image, and computer storage medium
WO2020078027A1 (en) Image processing method, apparatus and device
WO2020078026A1 (en) Image processing method and apparatus, and device
US11189071B2 (en) Electronic device for providing avatar animation and method thereof
CN112262563B (en) Image processing method and electronic device
CN111783647A (en) Training method of face fusion model, face fusion method, device and equipment
WO2021218040A1 (en) Image processing method and apparatus
CN104281847A (en) Point reading method, device and equipment
KR102045575B1 (en) Smart mirror display device
CN108647351B (en) Text image processing method and device, storage medium and terminal
CN111080746B (en) Image processing method, device, electronic equipment and storage medium
CN112270745B (en) Image generation method, device, equipment and storage medium
CN111539960A (en) Image processing method and related device
CN116824016A (en) Rendering model training, video rendering method, device, equipment and storage medium
WO2019120025A1 (en) Photograph adjustment method and apparatus, storage medium and electronic device
CN115131419A (en) Image processing method for forming Tyndall light effect and electronic equipment
CN114037692A (en) Image processing method, mobile terminal and storage medium
US11232616B2 (en) Methods and systems for performing editing operations on media
US20230131418A1 (en) Two-dimensional (2d) feature database generation
EP4330932A1 (en) Texture completion
CN112449249A (en) Video stream processing method and device, electronic equipment and storage medium
CN113347356A (en) Shooting method, shooting device, electronic equipment and storage medium
CN113128277A (en) Generation method of face key point detection model and related equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18778229

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18778229

Country of ref document: EP

Kind code of ref document: A1