CN115131260A - Image processing method, device, equipment, computer readable storage medium and product - Google Patents

Image processing method, device, equipment, computer readable storage medium and product Download PDF

Info

Publication number
CN115131260A
CN115131260A CN202210872116.9A CN202210872116A CN115131260A CN 115131260 A CN115131260 A CN 115131260A CN 202210872116 A CN202210872116 A CN 202210872116A CN 115131260 A CN115131260 A CN 115131260A
Authority
CN
China
Prior art keywords
head
processed
image
target
decoration
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210872116.9A
Other languages
Chinese (zh)
Inventor
刘佳成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202210872116.9A priority Critical patent/CN115131260A/en
Publication of CN115131260A publication Critical patent/CN115131260A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Architecture (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the disclosure provides an image processing method, an image processing device, image processing equipment, a computer readable storage medium and a computer readable product, wherein the method comprises the following steps: acquiring a head decoration request, wherein the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area; performing image processing operation on an image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area; generating a three-dimensional head model corresponding to the image to be processed, and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model; and carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result. Therefore, the display effect of the background displayed on the face part shielded by the target head decoration is achieved under the condition that the target head decoration is matched with the head of the user, the display effect of the head decoration is optimized, and the user experience is improved.

Description

Image processing method, device, equipment, computer readable storage medium and product
Technical Field
Embodiments of the present disclosure relate to the field of image processing technologies, and in particular, to an image processing method, an image processing apparatus, an image processing device, a computer-readable storage medium, and a computer-readable product.
Background
In order to make an image more suitable for the personalized requirements of a user, an existing Application program (APP) provides an image editing function for the user. Through the image editing function, on one hand, a user can perform personalized adjustment on the color and the size of the image, and in addition, the application program also provides contents such as special effects, decorations and stickers, so that the user can further decorate the image to optimize the image display effect.
In practical application, a user can select a two-dimensional or three-dimensional ornament according to actual requirements, and after the ornament selected by the user is obtained, the ornament and a head three-dimensional model corresponding to the user can be directly subjected to fusion operation.
However, when the method is used for decorating the head or the face, the size or the shape of the ornament may not be matched with the size or the shape of the head or the face of the user, and the direct placement of the ornament may result in poor decoration effect, failure to meet the actual requirements of the user, and poor user experience.
Disclosure of Invention
The embodiment of the disclosure provides an image processing method, an image processing device, an image processing apparatus, a computer-readable storage medium and a computer-readable product, which are used for solving the technical problems that the existing head decoration method has poor decoration effect and cannot meet the actual requirements of users.
In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
acquiring a head decoration request, wherein the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
performing image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
generating a three-dimensional head model corresponding to the image to be processed, and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
In a second aspect, an embodiment of the present disclosure provides an image processing apparatus, including:
the head decoration processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a head decoration request, the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
the processing module is used for carrying out image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
the generating module is used for generating a three-dimensional head model corresponding to the image to be processed and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and the fusion module is used for performing fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to cause the at least one processor to perform the image processing method as set forth above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the image processing method according to the first aspect and various possible designs of the first aspect is implemented.
In a fifth aspect, embodiments of the present disclosure provide a computer program product comprising a computer program that, when executed by a processor, implements an image processing method as set forth in the first aspect above and in various possible designs of the first aspect.
According to the image processing method, the image processing device, the image processing equipment, the computer readable storage medium and the product, after the head decoration request is obtained, the background color filling head mask matched with the target head decoration coverage area selected by the user is generated, the three-dimensional head model corresponding to the image to be processed and the target head decoration are fused, and the target three-dimensional model is obtained.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a system architecture upon which the present disclosure is based;
fig. 2 is a schematic flowchart of an image processing method according to an embodiment of the disclosure;
FIG. 3 is a schematic view of a head decoration provided by an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of an image processing method according to another embodiment of the disclosure;
FIG. 5 is a schematic diagram of a mask process provided by an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of mask expansion provided by an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
In view of the above-mentioned technical problems that the existing head decorating method has a poor decorating effect and cannot meet the actual requirements of users, the present disclosure provides an image processing method, apparatus, device, computer-readable storage medium and product.
It should be noted that the present disclosure provides an image processing method, an image processing apparatus, an image processing device, a computer readable storage medium, and an image processing product, which can be applied to various scenes requiring head decoration.
The existing head decoration method is generally that a head decoration effect is directly placed at a corresponding position on a 3D head model under the condition that the original human face shielding relation is not changed. However, the above method cannot achieve a head decoration effect of covering a part of the face without displaying the face regardless of the size and shape of the head, and cannot use a glass material in a place where the face is blocked.
In the process of solving the above technical problem, the inventor finds, through research, that in order to achieve a decorative effect of shielding a part of a face from being displayed, and to use a glass material in a place where the face is shielded, a background color filling head mask matched with a target head decoration coverage area selected by a user may be generated after a head decoration request is obtained, where the background color filling head mask may specifically be a head mask filled with a background color. And preprocessing the target head decoration selected by the user, and fusing the preprocessed target head decoration and the background color filling head mask to obtain a head decoration result.
Fig. 1 is a schematic diagram of a system architecture on which the present disclosure is based, as shown in fig. 1, the system architecture on which the present disclosure is based at least includes: the system comprises a terminal device 11 and a server 12, wherein the server 12 is provided with an image processing device which can be written by adopting languages such as C/C + +, Java, Shell or Python; the terminal device 11 may be a desktop computer, a tablet computer, or the like.
Based on the above system architecture, the image processing apparatus in the server 12 may obtain the head decoration request sent by the terminal device 11, and generate the head decoration result 15 that achieves displaying the background on the face portion blocked by the target head decoration in the case that the target head decoration 13 matches with the head 14 of the user according to the head decoration request.
Fig. 2 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure, and as shown in fig. 2, the method includes:
step 201, obtaining a head decoration request, wherein the head decoration request includes an image to be processed and a target head decoration, and the target head decoration is used for decorating a partial head area.
The execution subject of the embodiment is an image processing apparatus, and the image processing apparatus may be coupled to a server. The server can be in communication connection with the terminal device, so that a head decoration request initiated by a trigger operation on the terminal device by a user can be acquired. Optionally, the image processing apparatus may also be coupled to the terminal device, so as to be able to perform a head decoration operation in response to a head decoration request triggered by a user on the terminal device.
The image processing method provided by the embodiment can be applied to an application scene of fitting on line, and for example, a decorative effect actually worn by a user can be simulated according to a headwear such as a hat selected by the user. Alternatively, the image processing method provided by this embodiment may be applied to an application scenario of image processing, for example, the headwear selected by the user may be added to the head area of the user according to the headwear such as a special effect and a sticker selected by the user. Or, the image processing method provided by the embodiment can be applied to the decoration scene of the digital ornaments. The digital ornament may be made of different materials, for example, it may be made of transparent glass material, or may be made of opaque material. For example, when the target head decoration selected by the user is made of glass, the display effect of displaying the background on the face portion blocked by the target head decoration can be achieved by the image processing method provided by the embodiment under the condition that the target head decoration is matched with the head of the user. The present disclosure does not limit the application scenarios.
In this embodiment, a user may browse and select a head decoration on a terminal device, and after a target head decoration selected by the user is obtained, an image to be processed including at least the head of the user may be obtained, where the target head decoration is used to decorate a partial head region. Specifically, the image to be processed may be acquired in real time through an image acquisition device preset by the terminal device, or a pre-stored image to be processed may be selected from a preset storage path according to a selection operation of a user, which is not limited in this disclosure.
Accordingly, after acquiring the target head device selected by the user and the image to be processed, the terminal device may initiate a head decorating request. Accordingly, the image processing apparatus may acquire the head decorating request.
Step 202, performing image processing operation on the image to be processed according to the head decoration request, and obtaining a background color filling head mask matched with the target head decoration coverage area.
In the present embodiment, in order to optimize the decoration effect of the target head decoration, after the head decoration request is acquired, the image processing operation may be performed on the image to be processed according to the head decoration request.
Alternatively, a segmentation operation may be performed on a head mask in the image to be processed that matches the target head decoration. The head segmentation operation may be implemented by using a head segmentation algorithm, or the head may also be implemented by using any other manner, which is not limited in this disclosure.
Optionally, the pixel value corresponding to the head region in the head mask is 1, and the pixel values corresponding to the other regions are 0, so that the display effect of the target head decoration can be optimized based on the head mask.
Further, the target headwear may be made of a transparent material, such as a glass material, or may be made of an opaque material. When the target head decoration is made of a transparent material, in order to further optimize the display effect, the background may be controlled to be displayed through the transparent material in the area covered by the target head decoration. Therefore, after the head mask matching the target head decoration is obtained, the head mask matching the target head decoration may be subjected to a blurring process to obtain a background color filling head mask matching the target head decoration coverage area.
And 203, generating a three-dimensional head model corresponding to the image to be processed, and performing fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model.
In this embodiment, the target headwear may also be processed accordingly according to the headwear request. The target head decoration may be a three-dimensional decoration model. Therefore, a three-dimensional head model corresponding to the head region in the image to be processed can be generated from the image to be processed in the head decoration request. And carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model.
And 204, carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
In this embodiment, after the target three-dimensional model and the background-color filled head mask are obtained, respectively, a fusion operation may be performed on the target three-dimensional model and the background-color filled head mask to obtain a head decoration result. Because the pixel value corresponding to the head region in the background color filling head mask is 1, and the pixel values corresponding to other regions are 0, the target head decoration can be displayed in a high-quality manner in the coverage region of the target head decoration by performing fusion operation on the target three-dimensional model and the background color filling head mask, and the head of a user can be displayed in other regions. For example, the target head decoration may be a head decoration covering an upper half of a face, and after the image processing is completed, the target head decoration may be displayed on the upper half of the head, and the face of the user may be displayed on the upper half of the head.
Fig. 3 is a schematic diagram of a head decoration provided by an embodiment of the present disclosure, as shown in fig. 3, a target head decoration 31 selected by a user and an image to be processed may be obtained. By dividing the head region 32 in the image to be processed, the head decoration result 33 can be obtained by the image processing operation on the target head decoration 31 and the head region 32. The head decoration result 33 can realize a decorative effect of hiding a part of the face from display.
Further, on the basis of any of the above embodiments, the generating a three-dimensional head model corresponding to the image to be processed includes:
and mapping the texture of the head area in the image to be processed to a preset three-dimensional head model to obtain the three-dimensional head model corresponding to the image to be processed.
In this embodiment, the generation operation of the three-dimensional head model corresponding to the image to be processed may be specifically implemented by adopting a texture mapping manner.
Specifically, the texture of the head region in the image to be processed may be mapped onto a preset three-dimensional head model, so as to obtain a three-dimensional head model corresponding to the image to be processed.
According to the image processing method provided by the embodiment, after the head decoration request is obtained, the background color filling head mask matched with the target head decoration coverage area selected by the user is generated, the three-dimensional head model corresponding to the image to be processed is generated, and the three-dimensional head model corresponding to the image to be processed and the target head decoration are subjected to fusion operation to obtain the target three-dimensional model, so that after the target three-dimensional model and the background color filling head mask are fused, the display effect of displaying the background on the face part shielded by the target head decoration can be achieved under the condition that the target head decoration is matched with the head of the user, the display effect of the head decoration is optimized, and the user experience is improved.
Fig. 4 is a schematic flowchart of an image processing method according to another embodiment of the present disclosure, and based on any of the above embodiments, as shown in fig. 4, step 202 includes:
step 401, performing a segmentation operation on the head region in the image to be processed by using a preset head segmentation algorithm to obtain a mask of the head to be processed.
Step 402, determining a coverage area corresponding to the target head decoration, and performing segmentation operation on the to-be-processed head mask according to the coverage area to obtain a target head mask matched with the coverage area.
And 403, filling the target head mask by adopting a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filled head mask.
In this embodiment, in order to optimize the decoration effect of the target head decoration, after the head decoration request is obtained, an image processing operation may be performed on the image to be processed according to the head decoration request to obtain a background color filling head mask.
Firstly, a preset head segmentation algorithm is used for segmenting a head region in an image to be processed to obtain a mask of the head to be processed. The head segmentation algorithm can accurately realize the segmentation operation of the contents such as the head, the hair and the like.
Further, since the target head decoration may be a decoration covering a portion of the head region, the regions covered by different head decorations may also differ. Therefore, in order to make the target head decoration more fit to the head region of the user and further improve the decoration effect of the target head decoration, after the to-be-processed head mask is obtained, the coverage region corresponding to the target head decoration may be determined. For example, the target head gear may have a footprint of an upper half of a face, a lower half of a face, a hair portion, a left face, a right face, etc. Therefore, after the coverage area corresponding to the target head decoration is determined, the to-be-processed head mask may be segmented according to the coverage area, so as to obtain the target head mask matched with the coverage area. For example, when the coverage area of the target head decoration is the upper half face, the segmentation operation may be performed on the head mask to be processed, and the target head mask including only the upper half face may be obtained.
Further, the target headwear may be made of a transparent material, such as a glass material, or may be made of an opaque material. In order to adapt to different decorative materials, after the head mask to be processed matched with the coverage area is obtained, a preset fuzzy algorithm can be adopted to process the target head mask, and the background color filling head mask is obtained. Specifically, the background color corresponding to the image to be processed can be adopted through the image restoration algorithm to perform filling operation on the target head mask, so that the background color filling head mask is obtained.
In the image processing method provided in this embodiment, after the head decoration request is obtained, a segmentation operation is performed on a head region in an image to be processed, so as to obtain a mask of the head to be processed. The target head mask is obtained by segmenting the to-be-processed head mask according to the coverage area corresponding to the target head decoration, so that the coverage area of the target head mask can be more fit with the target head decoration, and the decoration effect of the target head decoration can be improved in the subsequent fusion process. Furthermore, the background color corresponding to the image to be processed is adopted to fill the target head mask, so that when the target head decoration is made of glass, the background effect can be displayed through the glass, and the display effect of the target head decoration is optimized.
Further, on the basis of any of the above embodiments, step 402 includes:
and determining coordinate information matched with the edge position of the coverage area in the head mask to be processed.
And hiding the region which is not matched with the coverage region in the head mask to be processed according to the coordinate information to obtain the target head mask.
In this embodiment, in order to obtain the to-be-processed head mask matched with the coverage area, the segmentation operation of the to-be-processed head mask may be specifically implemented by coordinates.
Specifically, coordinate information matching the edge position of the coverage area in the head mask to be processed can be determined. And according to the coordinate information, hiding the region, which is not matched with the coverage region, in the head mask to be processed to obtain the head mask to be processed, which is matched with the coverage region.
Fig. 5 is a schematic diagram of mask processing provided by the embodiment of the present disclosure, and as shown in fig. 5, after a head area in an image to be processed is segmented to obtain a head mask 51 to be processed, if a coverage area corresponding to a target head decoration is an upper half face, a lower half face of the head mask 51 to be processed may be hidden to obtain a head mask 52 to be processed, which is matched with the coverage area.
As shown in fig. 5, the coordinate value of the upper left corner of the head mask 51 to be processed may be (0,0) of uv, and the coordinate value of the lower right corner may be (1,1) of uv. Therefore, based on the coordinate values, in order to implement the operation of dividing the to-be-processed head mask corresponding to the top half face, the region with the uv value less than 0.5 may be filtered and hidden, so as to obtain the to-be-processed head mask matching the coverage region.
According to the image processing method provided by the embodiment, the partial hiding operation is performed on the to-be-processed head mask according to the coordinate information matched with the edge position of the coverage area, so that the to-be-processed head mask matched with the coverage area can be accurately reserved, the coverage area of the to-be-processed head mask is more attached to the target head decoration, and the decoration effect of the target head decoration can be improved in the subsequent fusion process.
Further, on the basis of any of the above embodiments, step 403 includes:
and filling the human body region in the image to be processed by adopting the background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain a fuzzy human body image.
And carrying out fusion operation on the blurred human body image and the target head mask to obtain the background color filling head mask.
In this embodiment, in order to obtain a background color filling head mask, a filling operation may be performed on a human body region in an image to be processed by using a background color corresponding to the image to be processed through a preset fuzzy algorithm, so that a scene is migrated in real time, and a fuzzy human body image is obtained. And performing fusion operation on the blurred human body image and the to-be-processed head mask matched with the coverage area, and obtaining an intersection between the blurred human body image and the to-be-processed head mask matched with the coverage area to obtain a background color filled head mask. The preset fuzzy algorithm can be specifically an image restoration algorithm, scene color migration can be performed on the basis of the human body whole body segmentation mask, and filling operation is performed on the human body by adopting the scene color.
Optionally, after the to-be-processed head mask matched with the coverage area is obtained, a preset fuzzy algorithm may also be directly adopted to perform fuzzy processing on the to-be-processed head mask matched with the coverage area, so as to obtain a background color filled head mask.
According to the image processing method provided by the embodiment, the human body region in the image to be processed is filled by adopting the background color corresponding to the image to be processed to obtain the blurred human body image, and the blurred human body image and the head mask to be processed matched with the coverage region are fused, so that the head mask filled with the background color matched with the coverage region can be obtained, and therefore when the target head decoration is made of glass, the background effect can be displayed through glass, and the display effect of the target head decoration is optimized.
Further, on the basis of any of the above embodiments, after step 401, the method further includes:
and expanding the area corresponding to the head mask to be processed.
In this embodiment, there may be some errors in the image processing process, which may cause some incompleteness in edge processing of the generated to-be-processed head mask, for example, some hair pixels may remain at the positions of the details of the hair and are not included in the output result, resulting in jagged residues of the hair edge after the to-be-processed head mask is directly used for image processing.
Therefore, in order to further improve the decoration effect of the target head decoration, the expansion operation may be performed on the region corresponding to the head mask to be processed.
According to the image processing method provided by the embodiment, the expansion operation is performed on the region corresponding to the head mask to be processed, so that the integrity of the edge region can be ensured, the defect of insufficient detail processing is avoided, and the head decoration effect is further improved.
Further, on the basis of any one of the above embodiments, the performing an expansion operation on a region corresponding to the to-be-processed head mask includes:
and traversing each pixel in the image to be processed by adopting a preset rectangular template, wherein the pixel value of the region corresponding to the head mask to be processed in the image to be processed is greater than the pixel value of the region corresponding to the head mask not to be processed.
And in the traversing process, determining whether the pixel value of the central area of the rectangular template is larger than the pixel value of the surrounding area.
And if so, adjusting the pixel value of the area covered by the rectangular template to be the same as the pixel value of the area corresponding to the head mask to be processed.
And detecting whether the traversal operation of each pixel in the image to be processed is finished at present, if not, returning to execute the step of performing the traversal operation of each pixel in the image to be processed by adopting a preset rectangular template until the traversal operation of each pixel in the image to be processed is finished. And if so, judging that the expansion operation on the head mask to be processed is finished currently.
In this embodiment, a rectangular template may be preset, for example, it may be a 3 × 3 rectangular template, and the rectangular template is used to implement the expansion operation on the region corresponding to the mask of the head to be processed.
Specifically, the pixel value of the region corresponding to the to-be-processed head mask in the to-be-processed image is greater than the pixel value of the region corresponding to the non-to-be-processed head mask. For example, the pixel value of the region corresponding to the head mask to be processed is 1, and the pixel values of the other regions are 0.
The method can adopt a preset rectangular template to perform traversal operation on each pixel in an image to be processed, and in the traversal process, whether the pixel value of the central position of the rectangular template is larger than the pixel value of the surrounding area of the rectangular template is detected. If so, the central position of the rectangular template is represented as the covering position of the head mask to be processed, and the covering positions of the head masks to be processed in other areas are not represented. Therefore, the pixel values of the region covered by the rectangular template can be adjusted to the same pixel values as the region corresponding to the head mask to be processed.
And detecting whether the traversal operation of each pixel in the image to be processed is finished at present, and if so, judging that the expansion operation of the head mask to be processed is finished at present. And otherwise, representing that the expansion operation of the head mask to be processed is not completed currently. The step of performing the traversal operation on each pixel in the image to be processed by adopting the preset rectangular template can be returned to be executed until the traversal operation on each pixel in the image to be processed is completed, so that the expansion operation on the head mask to be processed is realized.
Fig. 6 is a schematic diagram of mask expansion provided in the embodiment of the present disclosure, and as shown in fig. 6, a preset 3 × 3 rectangular template 61 may be used to perform traversal operation on an image to be processed 62, where the image to be processed 62 includes a head mask to be processed 63. In the traversal process, the dilation operation of the head mask is performed by comparing the central pixel value with the surrounding pixel values of the rectangular template 61. A final expansion result 64 is obtained.
According to the image processing method provided by the embodiment, the image to be processed is traversed by adopting the preset rectangular template, and the expansion of the mask area is realized according to the comparison between the central pixel and the peripheral pixels of the rectangular template, so that the expansion operation of the mask of the head to be processed can be quickly realized, and the technical problem of poor edge detail processing can be further avoided.
Further, on the basis of any of the above embodiments, before step 204, the method further includes:
and respectively carrying out rendering operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration according to a preset rendering sequence.
And rendering the three-dimensional head model corresponding to the image to be processed after the rendering of the target head decoration is finished.
In this embodiment, the target head decoration has various types, for example, the target head decoration made of glass may further include decoration contents such as flowers. Therefore, in order to completely display the target head decoration so that the target head decoration is not shielded by the details of the face of the user, a rendering sequence may be preset, where the preset rendering sequence is to render the target head decoration preferentially, and after the rendering of the target head decoration is completed, the three-dimensional head model corresponding to the image to be processed is rendered.
Because the three-dimensional head model corresponding to the image to be processed is the texture of the face mapped on the model, the face part displayed in the area uncovered by the target head decoration can be correctly displayed on the basis of depth contrast by only rendering the target head decoration and rendering the three-dimensional head model corresponding to the image to be processed, and the decoration details in the target head decoration cannot be shielded. Therefore, in order to further optimize the decoration effect of the target head decoration, the three-dimensional head model corresponding to the image to be processed and the target head decoration may be rendered according to a preset rendering sequence.
According to the image processing method provided by the embodiment, the target head decoration is rendered preferentially, and the three-dimensional head model corresponding to the image to be processed is rendered after the target head decoration is rendered, so that the correct shielding relation between the target head decoration and the face can be processed, the shielding of the face on the target head decoration is avoided, and the decoration effect is further optimized.
Further, on the basis of any of the above embodiments, after step 204, the method further includes:
and segmenting the ear region in the image to be processed by a preset ear segmentation algorithm.
Accordingly, step 204 includes:
and carrying out fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain the head decoration result.
In this embodiment, for part of the target head decoration, the ears of the user need to be leaked out, and the three-dimensional head model corresponding to the image to be processed does not include the ear part. Therefore, in order to better fit the decoration effect of the target head decoration, a preset ear segmentation algorithm can be adopted to segment the ear region in the image to be processed. And performing fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain a head decoration result.
According to the image processing method provided by the embodiment, the ear region in the image to be processed is segmented through the preset ear segmentation algorithm, and the ear region is added to the final decoration result, so that the integrity of the head can be ensured.
Fig. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure, and as shown in fig. 7, the apparatus includes: an acquisition module 71, a processing module 72, a generation module 73, and a fusion module 74. The obtaining module 71 is configured to obtain a head decoration request, where the head decoration request includes an image to be processed and a target head decoration, and the target head decoration is used to decorate a partial head region. And the processing module 72 is configured to perform an image processing operation on the image to be processed according to the head decoration request, and obtain a background color filling head mask matched with the target head decoration coverage area. And the generating module 73 is configured to generate a three-dimensional head model corresponding to the image to be processed, and perform a fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model. And a fusion module 74, configured to perform fusion operation on the target three-dimensional model and the background color filling head mask, so as to obtain a head decoration result.
Further, on the basis of any of the above embodiments, the processing module is configured to: and carrying out segmentation operation on the head region in the image to be processed through a preset head segmentation algorithm to obtain a head mask to be processed. And determining a coverage area corresponding to the target head decoration, and performing segmentation operation on the head mask to be processed according to the coverage area to obtain the target head mask matched with the coverage area. And filling the target head mask by adopting a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filling head mask.
Further, on the basis of any of the above embodiments, the processing module is configured to: and determining coordinate information matched with the edge position of the coverage area in the head mask to be processed. And hiding the region which is not matched with the coverage region in the head mask to be processed according to the coordinate information to obtain the target head mask.
Further, on the basis of any of the above embodiments, the processing module is configured to: and filling the human body region in the image to be processed by adopting the background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain a fuzzy human body image. And carrying out fusion operation on the blurred human body image and the target head mask to obtain the background color filling head mask.
Further, on the basis of any of the above embodiments, the processing module is configured to: and performing expansion operation on the area corresponding to the head mask to be processed.
Further, on the basis of any one of the above embodiments, the processing module is configured to: and traversing each pixel in the image to be processed by adopting a preset rectangular template, wherein the pixel value of the region corresponding to the head mask to be processed in the image to be processed is greater than the pixel value of the region corresponding to the head mask not to be processed. And in the traversing process, determining whether the pixel value of the central area of the rectangular template is larger than the pixel value of the peripheral area. And if so, adjusting the pixel value of the area covered by the rectangular template to be the same as the pixel value of the area corresponding to the head mask to be processed. And detecting whether the traversal operation of each pixel in the image to be processed is finished at present, if not, returning to execute the step of performing the traversal operation of each pixel in the image to be processed by adopting a preset rectangular template until the traversal operation of each pixel in the image to be processed is finished. And if so, judging that the expansion operation on the head mask to be processed is finished currently.
Further, on the basis of any of the above embodiments, the generating module is configured to: and mapping the texture of the head area in the image to be processed to a preset three-dimensional head model to obtain the three-dimensional head model corresponding to the image to be processed.
Further, on the basis of any one of the above embodiments, the apparatus further includes: and the rendering module is used for respectively rendering the three-dimensional head model corresponding to the image to be processed and the target head decoration according to a preset rendering sequence. And rendering the three-dimensional head model corresponding to the image to be processed after the target head decoration is rendered.
Further, on the basis of any one of the above embodiments, the apparatus further includes: and the segmentation module is used for segmenting the ear region in the image to be processed by a preset ear segmentation algorithm. The fusion module is configured to: and carrying out fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain the head decoration result.
The device provided in this embodiment may be used to implement the technical solution of the above method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
In order to implement the above embodiments, an embodiment of the present disclosure further provides an electronic device, including: a processor and a memory.
The memory stores computer-executable instructions.
The processor executes computer-executable instructions stored by the memory to cause the processor to perform the image processing method according to any of the embodiments described above.
Fig. 8 is a schematic structural diagram of an electronic device provided in the embodiment of the present disclosure, and as shown in fig. 8, the electronic device 800 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 801 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage device 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 807 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, the processes described above with reference to the flow diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The embodiment of the present disclosure further provides a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the image processing method according to any one of the above embodiments is implemented.
The embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for processing an image according to any of the embodiments described above is implemented.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided an image processing method including:
acquiring a head decoration request, wherein the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
performing image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
generating a three-dimensional head model corresponding to the image to be processed, and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
According to one or more embodiments of the present disclosure, the performing an image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area includes:
performing segmentation operation on a head region in the image to be processed through a preset head segmentation algorithm to obtain a head mask to be processed;
determining a coverage area corresponding to the target head decoration, and performing segmentation operation on the head mask to be processed according to the coverage area to obtain a target head mask matched with the coverage area;
and filling the target head mask by adopting a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filling head mask.
According to one or more embodiments of the present disclosure, the determining a coverage area corresponding to the target head decoration, and performing a segmentation operation on the to-be-processed head mask according to the coverage area to obtain the target head mask includes:
determining coordinate information matched with the edge position of the coverage area in the head mask to be processed;
and hiding the region which is not matched with the coverage region in the head mask to be processed according to the coordinate information to obtain the target head mask.
According to one or more embodiments of the present disclosure, the filling operation is performed on the target head mask by using a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filled head mask, including:
filling a human body region in the image to be processed by adopting a preset fuzzy algorithm and a background color corresponding to the image to be processed to obtain a fuzzy human body image;
and carrying out fusion operation on the blurred human body image and the target head mask to obtain the background color filling head mask.
According to one or more embodiments of the present disclosure, after the performing a segmentation operation on the head region in the image to be processed by using a preset head segmentation algorithm to obtain a head mask to be processed, the method further includes:
and performing expansion operation on the area corresponding to the head mask to be processed.
According to one or more embodiments of the present disclosure, the expanding operation on the region corresponding to the head mask to be processed includes:
traversing each pixel in the image to be processed by adopting a preset rectangular template, wherein the pixel value of the region corresponding to the head mask to be processed in the image to be processed is greater than the pixel value of the region corresponding to the head mask not to be processed;
in the traversing process, determining whether the pixel value of the central area of the rectangular template is larger than the pixel value of the peripheral area;
if so, adjusting the pixel value of the area covered by the rectangular template to be the same as the pixel value of the area corresponding to the head mask to be processed;
detecting whether the traversal operation of each pixel in the image to be processed is finished or not at present, if not, returning to the step of executing the traversal operation of each pixel in the image to be processed by adopting a preset rectangular template until the traversal operation of each pixel in the image to be processed is finished; and if so, judging that the expansion operation on the head mask to be processed is finished currently.
According to one or more embodiments of the present disclosure, the generating a three-dimensional head model corresponding to the image to be processed includes:
and mapping the texture of the head area in the image to be processed to a preset three-dimensional head model to obtain the three-dimensional head model corresponding to the image to be processed.
According to one or more embodiments of the present disclosure, before performing a fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model, the method further includes:
respectively rendering the three-dimensional head model corresponding to the image to be processed and the target head decoration according to a preset rendering sequence;
and rendering the three-dimensional head model corresponding to the image to be processed after the target head decoration is rendered.
According to one or more embodiments of the present disclosure, after the performing the fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain the target three-dimensional model, the method further includes:
segmenting an ear region in the image to be processed by a preset ear segmentation algorithm;
the fusion operation of the target three-dimensional model and the background color filling head mask is performed to obtain a head decoration result, and the method comprises the following steps:
and carrying out fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain the head decoration result.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided an image processing apparatus including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a head decoration request, the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
the processing module is used for carrying out image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
the generating module is used for generating a three-dimensional head model corresponding to the image to be processed and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and the fusion module is used for performing fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
According to one or more embodiments of the present disclosure, the processing module is configured to:
performing segmentation operation on a head region in the image to be processed through a preset head segmentation algorithm to obtain a head mask to be processed;
determining a coverage area corresponding to the target head decoration, and performing segmentation operation on the head mask to be processed according to the coverage area to obtain the target head mask matched with the coverage area
And filling the target head mask by adopting the background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filled head mask.
According to one or more embodiments of the present disclosure, the processing module is configured to:
determining coordinate information matched with the edge position of the coverage area in the head mask to be processed;
and hiding the region which is not matched with the coverage region in the head mask to be processed according to the coordinate information to obtain the target head mask.
According to one or more embodiments of the present disclosure, the processing module is configured to:
filling the human body region in the image to be processed by adopting a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain a fuzzy human body image;
and carrying out fusion operation on the blurred human body image and the target head mask to obtain the background color filling head mask.
According to one or more embodiments of the present disclosure, the processing module is configured to:
and expanding the area corresponding to the head mask to be processed.
According to one or more embodiments of the present disclosure, the processing module is configured to:
traversing each pixel in the image to be processed by adopting a preset rectangular template, wherein the pixel value of the region corresponding to the head mask to be processed in the image to be processed is greater than the pixel value of the region corresponding to the head mask not to be processed;
in the traversing process, determining whether the pixel value of the central area of the rectangular template is larger than the pixel value of the peripheral area;
if so, adjusting the pixel value of the area covered by the rectangular template to be the same as the pixel value of the area corresponding to the head mask to be processed;
detecting whether the traversal operation on each pixel in the image to be processed is finished at present, if not, returning to execute the step of performing the traversal operation on each pixel in the image to be processed by adopting a preset rectangular template until the traversal operation on each pixel in the image to be processed is finished; and if so, judging that the expansion operation on the head mask to be processed is finished currently.
According to one or more embodiments of the present disclosure, the generating module is configured to:
and mapping the texture of the head area in the image to be processed to a preset three-dimensional head model to obtain the three-dimensional head model corresponding to the image to be processed.
According to one or more embodiments of the present disclosure, the apparatus further comprises:
the rendering module is used for respectively performing rendering operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration according to a preset rendering sequence;
and rendering the three-dimensional head model corresponding to the image to be processed after the target head decoration is rendered.
According to one or more embodiments of the present disclosure, the apparatus further comprises:
the segmentation module is used for segmenting an ear region in the image to be processed through a preset ear segmentation algorithm;
the fusion module is configured to:
and carrying out fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain the head decoration result.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes computer-executable instructions stored by the memory to cause the at least one processor to perform the image processing method as set forth in the first aspect above and in various possible designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the image processing method as described in the first aspect above and in various possible designs of the first aspect.
In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements an image processing method as described above in the first aspect and various possible designs of the first aspect
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (13)

1. An image processing method, comprising:
acquiring a head decoration request, wherein the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
performing image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
generating a three-dimensional head model corresponding to the image to be processed, and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
2. The method according to claim 1, wherein the performing an image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area comprises:
performing segmentation operation on a head region in the image to be processed through a preset head segmentation algorithm to obtain a head mask to be processed;
determining a coverage area corresponding to the target head decoration, and performing segmentation operation on the head mask to be processed according to the coverage area to obtain a target head mask matched with the coverage area;
and filling the target head mask by adopting the background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filled head mask.
3. The method according to claim 2, wherein the determining a coverage area corresponding to the target head decoration, and performing a segmentation operation on the to-be-processed head mask according to the coverage area to obtain a target head mask matching the coverage area comprises:
determining coordinate information matched with the edge position of the coverage area in the head mask to be processed;
and hiding the region which is not matched with the coverage region in the head mask to be processed according to the coordinate information to obtain the target head mask.
4. The method according to claim 2, wherein the filling operation is performed on the target head mask by using a background color corresponding to the image to be processed through a preset fuzzy algorithm to obtain the background color filled head mask, and the method comprises:
filling a human body region in the image to be processed by adopting a preset fuzzy algorithm and a background color corresponding to the image to be processed to obtain a fuzzy human body image;
and carrying out fusion operation on the blurred human body image and the target head mask to obtain the background color filling head mask.
5. The method according to any one of claim 2, wherein after the segmentation operation is performed on the head region in the image to be processed by using a preset head segmentation algorithm to obtain a head mask to be processed, the method further comprises:
and expanding the area corresponding to the head mask to be processed.
6. The method according to claim 5, wherein the expanding operation on the region corresponding to the head mask to be processed comprises:
traversing each pixel in the image to be processed by adopting a preset rectangular template, wherein the pixel value of the region corresponding to the head mask to be processed in the image to be processed is greater than the pixel value of the region corresponding to the head mask not to be processed;
in the traversing process, determining whether the pixel value of the central area of the rectangular template is larger than the pixel value of the peripheral area;
if so, adjusting the pixel value of the area covered by the rectangular template to be the same as the pixel value of the area corresponding to the head mask to be processed;
detecting whether the traversal operation on each pixel in the image to be processed is finished at present, if not, returning to execute the step of performing the traversal operation on each pixel in the image to be processed by adopting a preset rectangular template until the traversal operation on each pixel in the image to be processed is finished; and if so, judging that the expansion operation on the head mask to be processed is finished currently.
7. The method according to any one of claims 1-6, wherein the generating a three-dimensional head model corresponding to the image to be processed comprises:
and mapping the texture of the head area in the image to be processed to a preset three-dimensional head model to obtain the three-dimensional head model corresponding to the image to be processed.
8. The method according to any one of claims 1 to 6, wherein before performing the fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain the target three-dimensional model, the method further comprises:
respectively rendering the three-dimensional head model corresponding to the image to be processed and the target head decoration according to a preset rendering sequence;
and rendering the three-dimensional head model corresponding to the image to be processed after the target head decoration is rendered.
9. The method according to any one of claims 1 to 6, wherein after performing the fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain the target three-dimensional model, the method further comprises:
segmenting an ear region in the image to be processed by a preset ear segmentation algorithm;
the fusion operation of the target three-dimensional model and the background color filling head mask is performed to obtain a head decoration result, and the method comprises the following steps:
and carrying out fusion operation on the target three-dimensional model, the background color filling head mask and the ear region to obtain the head decoration result.
10. An image processing apparatus characterized by comprising:
the head decoration processing device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a head decoration request, the head decoration request comprises an image to be processed and a target head decoration, and the target head decoration is used for decorating part of a head area;
the processing module is used for carrying out image processing operation on the image to be processed according to the head decoration request to obtain a background color filling head mask matched with the target head decoration coverage area;
the generating module is used for generating a three-dimensional head model corresponding to the image to be processed and carrying out fusion operation on the three-dimensional head model corresponding to the image to be processed and the target head decoration to obtain a target three-dimensional model;
and the fusion module is used for carrying out fusion operation on the target three-dimensional model and the background color filling head mask to obtain a head decoration result.
11. An electronic device, comprising: a processor and a memory;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory, causing the processor to perform the image processing method of any of claims 1 to 9.
12. A computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement the image processing method according to any one of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the method of image processing according to any one of claims 1 to 9.
CN202210872116.9A 2022-07-22 2022-07-22 Image processing method, device, equipment, computer readable storage medium and product Pending CN115131260A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210872116.9A CN115131260A (en) 2022-07-22 2022-07-22 Image processing method, device, equipment, computer readable storage medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210872116.9A CN115131260A (en) 2022-07-22 2022-07-22 Image processing method, device, equipment, computer readable storage medium and product

Publications (1)

Publication Number Publication Date
CN115131260A true CN115131260A (en) 2022-09-30

Family

ID=83384864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210872116.9A Pending CN115131260A (en) 2022-07-22 2022-07-22 Image processing method, device, equipment, computer readable storage medium and product

Country Status (1)

Country Link
CN (1) CN115131260A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385641A (en) * 2023-03-29 2023-07-04 北京百度网讯科技有限公司 Image processing method and device, electronic equipment and storage medium
CN117576298A (en) * 2023-10-09 2024-02-20 中微智创(北京)软件技术有限公司 Battlefield situation target highlighting method based on context separation 3D lens

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116385641A (en) * 2023-03-29 2023-07-04 北京百度网讯科技有限公司 Image processing method and device, electronic equipment and storage medium
CN116385641B (en) * 2023-03-29 2024-03-19 北京百度网讯科技有限公司 Image processing method and device, electronic equipment and storage medium
CN117576298A (en) * 2023-10-09 2024-02-20 中微智创(北京)软件技术有限公司 Battlefield situation target highlighting method based on context separation 3D lens
CN117576298B (en) * 2023-10-09 2024-05-24 中微智创(北京)软件技术有限公司 Battlefield situation target highlighting method based on context separation 3D lens

Similar Documents

Publication Publication Date Title
CN110766777B (en) Method and device for generating virtual image, electronic equipment and storage medium
WO2020019899A1 (en) Data processing method and apparatus for merging regions in map
CN111242881A (en) Method, device, storage medium and electronic equipment for displaying special effects
CN115131260A (en) Image processing method, device, equipment, computer readable storage medium and product
US20230039100A1 (en) Multi-layer reprojection techniques for augmented reality
CN118301261A (en) Special effect display method, device, equipment and medium
CN110378947B (en) 3D model reconstruction method and device and electronic equipment
CN111833461B (en) Method and device for realizing special effect of image, electronic equipment and storage medium
WO2020077913A1 (en) Image processing method and device, and hardware device
CN116310036A (en) Scene rendering method, device, equipment, computer readable storage medium and product
CN115810101A (en) Three-dimensional model stylizing method and device, electronic equipment and storage medium
US20230133416A1 (en) Image processing method and apparatus, and device and medium
CN112766215A (en) Face fusion method and device, electronic equipment and storage medium
CN113613067A (en) Video processing method, device, equipment and storage medium
CN113163135B (en) Animation adding method, device, equipment and medium for video
CN114842120A (en) Image rendering processing method, device, equipment and medium
WO2024125328A1 (en) Live-streaming image frame processing method and apparatus, and device, readable storage medium and product
CN114782659A (en) Image processing method, device, equipment and storage medium
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
CN110047126B (en) Method, apparatus, electronic device, and computer-readable storage medium for rendering image
CN111818265A (en) Interaction method and device based on augmented reality model, electronic equipment and medium
CN111107264A (en) Image processing method, image processing device, storage medium and terminal
CN112099712B (en) Face image display method and device, electronic equipment and storage medium
CN110363860B (en) 3D model reconstruction method and device and electronic equipment
CN115018749A (en) Image processing method, device, equipment, computer readable storage medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination