WO2022267402A1 - Image processing method and apparatus, device, and storage medium - Google Patents

Image processing method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2022267402A1
WO2022267402A1 PCT/CN2021/140353 CN2021140353W WO2022267402A1 WO 2022267402 A1 WO2022267402 A1 WO 2022267402A1 CN 2021140353 W CN2021140353 W CN 2021140353W WO 2022267402 A1 WO2022267402 A1 WO 2022267402A1
Authority
WO
WIPO (PCT)
Prior art keywords
nail
key point
processed
key
point
Prior art date
Application number
PCT/CN2021/140353
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 WO2022267402A1 publication Critical patent/WO2022267402A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to an image processing method, device, equipment and storage medium.
  • the embodiment of the present disclosure provides an image processing solution.
  • an image processing method comprising: acquiring a first key point of the nail in a to-be-processed image containing at least one nail, wherein each of the nails corresponds to a plurality of first key points A key point; according to a plurality of first key points of the nail, determine the area to be treated of the nail; obtain a nail material, and the nail material is marked with a plurality of second key points; according to the first key point and the corresponding relationship between the second key point, the nail material is rendered into the region to be processed, and a processed image is obtained.
  • the acquiring the first key point of the nail in the image to be processed including at least one nail includes: inputting the image to be processed into a nail key point detection network to obtain the nail The key point detection result of the nail; the first key point of the nail is obtained according to the key point detection result of the nail, or, the key point detection result of the nail is interpolated, and the nail is obtained according to the interpolated result The first key point.
  • the interpolation processing of the key point detection result of the nail includes: performing curve interpolation on adjacent key points in the key point detection result of the nail; and/or; Linear interpolation is performed on the symmetrical key points in the key point detection results of the nail.
  • the method further includes: determining a target key point among the plurality of first key points of the nail, and the target key point is setting a connection line between the symmetrical key points and The first key point between the first key points corresponding to the top of the nail or the top of the fingertip; move the target key point along the normal direction of the nail for a set distance, wherein the normal direction is based on the Multiple first key points of the nail are determined; the corresponding first key points are updated by using the moved target key points.
  • the set distance corresponds to the first distance between the target key point and the line between the set symmetrical key point, the top of the nail or the top of the fingertip.
  • the second distance between the first key point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance and negatively correlated with the second distance , which is negatively correlated with the length of the link.
  • the nail material is rendered into the area to be processed, and the processed
  • the image includes: according to the correspondence between the first key point and the second key point, acquiring the texture coordinates in the nail material corresponding to the coordinate points to be processed, wherein the coordinate points to be processed are located at the within the area to be processed; acquire the first pixel value of the nail material at the texture coordinate; and obtain the processed image according to the first pixel value of the coordinate point to be processed.
  • the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed and is based on the first obtained by interpolating the key points; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh Yes, the triangular mesh is constructed according to a plurality of first key points of the nail.
  • the method further includes: obtaining a second pixel value of the coordinate point to be processed in the image to be processed; obtaining the processed pixel value according to the first pixel value
  • the image includes: according to the set fusion coefficient, weighting the first pixel value and the second pixel value of the coordinate point to be processed to obtain the target pixel value of the coordinate point to be processed; according to the coordinate point to be processed The target pixel value of the coordinate point is processed to obtain the processed image.
  • an image processing device comprising: a first acquisition unit, configured to acquire a first key point of the nail in an image to be processed containing at least one nail, wherein each of the The nail corresponds to a plurality of first key points; the determination unit is configured to determine the area to be processed of the nail according to the plurality of first key points of the nail; the second acquisition unit is configured to acquire a nail material, the A plurality of second key points are marked on the nail material; a rendering unit is configured to render the nail material into the area to be processed according to the correspondence between the first key point and the second key point , to get the processed image.
  • the first acquisition unit is specifically configured to: input the image to be processed into the nail key point detection network to obtain the key point detection result of the nail; according to the key point detection result of the nail Obtaining the first key point of the nail, or performing interpolation processing on the detection result of the key point of the nail, and obtaining the first key point of the nail according to the interpolated result.
  • the interpolation processing of the key point detection result of the nail includes: performing curve interpolation on adjacent key points in the key point detection result of the nail; and/or; Linear interpolation is performed on the symmetrical key points in the key point detection results of the nail.
  • the device further includes a deformation unit configured to: determine a target key point among the multiple first key points of the nail, and the target key point is one of the set symmetrical key points The first key point between the connecting line and the first key point corresponding to the top of the nail or fingertip; move the target key point along the normal direction of the nail for a set distance, wherein the normal The direction is determined according to a plurality of first key points of the nail; the corresponding first key points are updated by using the moved target key points.
  • the set distance corresponds to the first distance between the target key point and the line between the set symmetrical key point, the top of the nail or the top of the fingertip.
  • the second distance between the first key point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance and negatively correlated with the second distance , which is negatively correlated with the length of the link.
  • the rendering unit is specifically configured to: acquire, according to the correspondence between the first key point and the second key point, the nail material corresponding to the coordinate point to be processed. texture coordinates, wherein, the coordinate point to be processed is located in the area to be processed; the first pixel value of the nail material at the texture coordinate is acquired; according to the first pixel value of the coordinate point to be processed, the The processed image.
  • the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed and is based on the first obtained by interpolating the key points; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh Yes, the triangular mesh is constructed according to a plurality of first key points of the nail.
  • the device further includes a fusion unit configured to: perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to a set fusion coefficient, The target pixel value of the coordinate point to be processed is obtained; the processed image is obtained according to the target pixel value of the coordinate point to be processed.
  • an electronic device the device includes a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to execute the computer instructions
  • the image processing method described in any implementation manner provided by the present disclosure is realized.
  • a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the image processing method described in any implementation manner provided in the present disclosure is implemented.
  • a computer program product including a computer program, and when the program is executed by a processor, the image processing method described in any implementation manner provided in the present disclosure is implemented.
  • the first key point of the nail in the image to be processed including at least one nail is obtained, and according to the number of the nails
  • a first key point determine the area to be processed of the nail
  • the nail material is marked with a plurality of second key points, and finally according to the first key point and the second key point
  • the nail material is rendered into the area to be processed, and the processed image is obtained.
  • FIG. 1 is a flowchart of an image processing method proposed by at least one embodiment of the present disclosure
  • Fig. 2 is a schematic diagram of the first key point of the nail in the image processing method proposed by at least one embodiment of the present disclosure
  • Fig. 3 is a schematic diagram of nail material in the image processing method proposed by at least one embodiment of the present disclosure
  • FIGS. 4A and 4B are schematic diagrams of hand images obtained through the image processing method proposed by at least one embodiment of the present disclosure.
  • FIG. 5 is a flow chart of a method for image processing a hand image proposed by at least one embodiment of the present disclosure
  • Fig. 6 is a schematic structural diagram of an image processing device proposed by at least one embodiment of the present disclosure.
  • Fig. 7 is a schematic structural diagram of an electronic device proposed by at least one embodiment of the present disclosure.
  • At least one embodiment of the present disclosure provides an image processing method
  • the image processing method can be executed by electronic devices such as terminal devices or servers
  • the terminal devices can be fixed terminals or mobile terminals, such as mobile phones, tablet computers, game consoles , desktop computer, advertising machine, all-in-one machine, vehicle-mounted terminal, etc.
  • the server includes a local server or a cloud server, etc.
  • the method can also be implemented by calling a computer-readable instruction stored in a memory by a processor.
  • FIG. 1 shows a flowchart of an image processing method according to at least one embodiment of the present disclosure. As shown in FIG. 1 , the method includes steps 101 to 104 .
  • step 101 a first key point of the nail in an image to be processed containing at least one nail is acquired, wherein each of the nails corresponds to a plurality of first key points.
  • the image to be processed may be a still image or a video image captured in real time, or may be a still image or a video image acquired from a memory or other media.
  • the nails in the embodiments of the present disclosure may be the nails of the hand or the nails of the feet, which is not limited in the present disclosure.
  • the image to be processed can be a separate hand image, or a human body image including the hand area; it can also be a partial hand including one or more nails image.
  • key point detection may be performed on the image to be processed to obtain key points of at least one nail contained in the image to be processed, wherein each nail corresponds to multiple key points.
  • the key points obtained in this step are called the first key points.
  • the first key points are usually located on the edge of the nail, and each first key point is used to represent a specific position of the nail.
  • one nail can correspond to any number of first key points within the range of 12-32.
  • one fingernail corresponds to 16 first key points.
  • the first key point P0 is used to characterize the leftmost point at the bottom of the nail outline
  • the first key point P4 is used to characterize the rightmost point at the bottom of the nail outline
  • the first key point P10 was used to characterize the point located in the topmost middle of the nail outline.
  • the nails shown in FIG. 2 corresponding to 16 first key points are only for example, and one nail may also correspond to other numbers of first key points, which is not limited in the present disclosure.
  • a region to be treated of the nail is determined according to a plurality of first key points of the nail.
  • the region to be treated of the nail can be obtained according to the plurality of first key points corresponding to the nail.
  • step 103 the nail material is acquired, and the nail material is marked with a plurality of second key points.
  • the nail material is a material that can add special effects or beautify the nails (for example, a marked picture of the nail, etc.), and the nail material can be a solid color, or it can contain a pattern, or it can be It is other types, and the embodiment of the present disclosure does not limit the type of nail material.
  • the second key point is marked on the nail material. Similar to the first key point, the second key point is also located on the edge of the nail material, and each second key point is used to characterize a specific point of the nail material. In an embodiment of the present disclosure, all or part of the first key points of the nail correspond one-to-one to multiple second key points of the nail material.
  • the nail material includes 16 second key points, and the nail in the image to be processed also includes 16 first key points, and the 16 second key points are in one-to-one correspondence with the 16 first key points.
  • the nail material includes 12 second key points
  • the nail in the image to be processed includes 16 first key points
  • the 12 second key points are the same as the 12th key points in the above-mentioned 16 first key points.
  • the nail material may correspond to any number of second key points within the range of 12-32.
  • the second key points S0 - S15 are marked on the nail material.
  • the second key points S0-S15 are in one-to-one correspondence with the first key points P0-P15 of the nail in the image to be processed.
  • the neural network used to detect nail key points on the nail material and the neural network used to detect nail key points on the image to be processed may be the same neural network, or use the same The neural network obtained by training the sample set.
  • step 104 according to the corresponding relationship between the first key point and the second key point, the nail material is rendered into the region to be processed to obtain a processed image.
  • the corresponding relationship between the to-be-processed area of the nail can be determined and the corresponding relationship between the nail material can be determined, so that the color and/or pattern of the nail material can be rendered into the to-be-processed area of the nail, so that all The nails present the same color and/or pattern as the nail material, thereby realizing the special effect treatment of the nails or the beautification treatment of the nails.
  • the first key point of the nail in the image to be processed including at least one nail is first obtained, and the area to be processed of the nail is determined according to the plurality of first key points of the nail; then Acquiring nail material, the nail material is marked with a plurality of second key points, and finally according to the correspondence between the first key point and the second key point, rendering the nail material to the pending In the region, the processed image is obtained, and by accurately rendering the nail material to the region to be processed of the nail in the image to be processed, special effect processing and beautification effect processing of the nail in the image to be processed can be realized.
  • the image to be processed may be input into a key point detection network, so as to perform key point detection on the image to be processed.
  • the first key point of the nail may be obtained according to the nail detection result output by the key point detection network.
  • an interpolation process may be performed on the nail detection result output by the nail key detection network, and the first key point of the nail is obtained according to the interpolated result.
  • curve interpolation may be performed on adjacent key points of the nail in the nail detection result.
  • adjacent key points such as P7 and P8, P8 and P9, etc.
  • the key points on the edge of the nail can be arranged more densely, so that the key points are surrounded by The area to be treated maintains the round shape of the nail, which is more consistent with the shape of the real nail.
  • linear interpolation may be performed on the symmetric key points of the nail in the nail detection result.
  • symmetrical key points such as P5 and P15, P7 and P13, etc.
  • the middle area of the nail can also have the first key point, which is beneficial to Subsequently, a triangular mesh is constructed according to the first key point.
  • linear interpolation may be performed on the symmetrical key points while curve interpolation is performed on the adjacent key points of the nail in the nail detection result, so that the arrangement of the first key points on the edge of the nail is denser, and There is also a first key in the middle area of the nail.
  • the embodiment of the present disclosure proposes a method for deforming the key points.
  • the area is slightly longer than the real nail, resulting in more realistic nail effects and nail beautification effects.
  • the target key point is between the line between the symmetrical key points and the first key point corresponding to the top of the nail or fingertip the first key point.
  • the target key point includes the set symmetry key point and the first key point corresponding to the top of the nail or fingertip.
  • the determined target key point is also the first key point for subsequent deformation.
  • the first key point located in the upper half of the nail may be determined as the target key point.
  • all the first key points between the line between P5 and P15 and the corresponding P10 at the top including P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, and P15, can be used as target key points.
  • the target key point is moved by a set distance along the normal direction of the nail, that is, along the growth direction of the nail by a set distance.
  • the normal direction is determined according to a plurality of first key points of the nail.
  • the direction of the line between the first key point at the bottommost middle and the first key point at the topmost middle can be used as the normal direction of the nail.
  • line direction As shown in FIG. 2 , the direction of the line connecting the first key point P2 and P10 may be taken as the normal direction of the nail.
  • the set distance for each target key point to move along the normal direction of the nail can be set by the user, or can be determined according to the positional relationship and position information between the target key point and other first key points.
  • the first key point corresponding to the top of the nail or the top of the fingertip and the line The second distance between the lines and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance, negatively correlated with the second distance, and negatively correlated with the length of the connecting line relevant.
  • the calculation of the set distance corresponding to the target key point P8 in Figure 2 can be based on the first distance l3 between P8 and the line connecting P5 and P15, the second distance l2 between P10 and the line connecting P5 and P15, and P5
  • the length l1 of the connection with P15 is determined.
  • the formula of the set distance ⁇ m is, for example:
  • a is a setting coefficient, which can be adjusted according to the required effect, and the value range of a can be 0.1-0.4.
  • the setting coefficients of each target key point can be the same or different.
  • the setting coefficient a of all target keypoints can be set to 0.2.
  • the corresponding first key point is updated by using the moved target key point. That is, an updated first key point is obtained according to the moved target key point and first key points other than the target key point.
  • the area to be processed of the nail is updated according to the updated first key point of the nail.
  • the area to be treated corresponding to the nail is deformed, and the length of the normal direction of the nail is increased compared with that of the real nail.
  • the deformed area to be processed is more consistent and matches the shape of common nail materials, so that the nail special effects and nail beautification effects closer to reality can be obtained.
  • the rendering of the nail material to the area to be processed may be implemented in the following manner.
  • the texture coordinates in the nail material corresponding to the coordinate points to be processed included in the area to be processed are acquired.
  • the coordinate points to be processed may include the first key point and other coordinate points obtained based on the first key point, and the positional relationship between the other coordinate points and the first key point is known.
  • the size of the nail material is usually fixed, and the texture coordinates of the key points in the nail material can be stored in advance.
  • the texture coordinates in the nail material corresponding to the coordinate points to be processed are obtained, and all the texture coordinates at the texture coordinates are obtained. Describes the first pixel value of the nail material.
  • the texture coordinates in the nail material corresponding to the first key point can be determined, and the corresponding first pixel value can be obtained according to the texture coordinates.
  • the corresponding relationship of the points may determine the texture coordinates in the nail material corresponding to the other coordinate points, and obtain the corresponding first pixel value according to the texture coordinates.
  • the first pixel value in the nail material corresponding to each coordinate point to be processed in the to-be-processed area of the nail can be obtained, so that the color and/or pattern of the nail material can be rendered to the to-be-processed area.
  • special effect processing and beautifying effect processing of nails are realized.
  • the rendering of the nail material to the area to be processed is realized through the corresponding relationship between the first key point and the second key point, and the nail material can be realized according to the area to be processed Adaptive changes are made for realistic nail effects and beautification.
  • the coordinate points to be processed include a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed, and is obtained by interpolating according to the first key point of. That is to say, each coordinate point to be processed included in the area to be processed can be obtained by interpolating the first key point.
  • a triangular mesh may be constructed according to a plurality of first key points of the nail, and an area to be treated of the nail may be determined according to the constructed triangular mesh.
  • the first key point can be obtained by interpolating the detection result output by the nail key point detection network, and the interpolation is performed through the detection result, so that the key points located at the edge of the nail outline are denser, so that the constructed triangular mesh
  • the resulting treated area maintains the round shape of the nail and is more consistent with the shape of the real nail.
  • the coordinate points to be processed may include vertices of the triangular mesh and second interpolation points, wherein the second interpolation points Located in the triangular mesh, it is obtained by interpolating according to the vertices of the triangular mesh, and the triangular mesh is constructed according to a plurality of first key points of the nail. That is to say, the vertices of the triangular mesh are constituted by the first key point, and the second interpolation point located in the triangular mesh is obtained by using the first key point as the vertices of the triangular mesh obtained by interpolation.
  • the second pixel value of the coordinate point to be processed in the image to be processed may also be obtained, that is, the color of the nail itself in the image to be processed may be obtained.
  • the first pixel value and the second pixel value of the coordinate point to be processed are weighted to obtain the target pixel value of the coordinate point to be processed, and finally according to the coordinate point to be processed
  • the target pixel value of the coordinate point is obtained in the processed image.
  • the above fusion process can be expressed according to formula (2):
  • C new represents the target pixel value
  • C 1 represents the first pixel value
  • C 2 represents the second pixel value
  • s 1 represents the set fusion coefficient
  • the set fusion coefficient may be specifically set by the user according to the desired implementation.
  • the achieved nail special effects and beautification effects are more natural and closer to the real nail art effect, see FIG. 4A and the processed image shown in Figure 4B.
  • image processing may be performed on the hand image in the following manner, so as to realize the nail art effect of the hand image.
  • the method may include steps 501 to 506 .
  • a hand image is acquired, and multiple first key points corresponding to each nail in the hand image are acquired.
  • the hand image may be collected in real time, or may be obtained from a storage medium.
  • step 502 the first key point is interpolated, and the corresponding first key point is updated with the new first key point obtained by interpolation.
  • performing interpolation on the first key point includes performing curve interpolation on adjacent key points in the first key point, and/or performing linear interpolation on symmetrical key points in the first key point.
  • step 503 deform the first key point so that the nail region corresponding to the deformed first key point is longer than the length of the nail in the hand image, and use the deformed first key point to update the corresponding The first key point of .
  • the first key point located at the upper half of the nail can be moved by a set distance along the normal direction of the nail.
  • the set distance moved by each first key point can be calculated according to the formula (1).
  • step 504 a triangular mesh is constructed according to the first key point, and a region to be processed that needs to realize the nail art effect is obtained according to the triangular mesh.
  • step 505 the pixel color of the nail material is extracted according to the texture coordinates on the nail material corresponding to the first key point.
  • the nail material may be marked with a second key point corresponding to the first key point, and the first key point is obtained according to the correspondence between the first key point and the second key point
  • the texture coordinates on the corresponding nail material; the texture coordinates on the nail material corresponding to the first key point can also be acquired in other ways.
  • step 506 according to the set fusion coefficient, the pixel color of the nail material corresponding to the first key point is fused with the color of the original pixel in the hand image to obtain a new color.
  • fusion can be performed according to the manner indicated by formula (2).
  • the new color corresponding to each coordinate point in the area to be processed can be obtained by interpolating the first key point, so as to realize the nail art effect on the hand image.
  • the area to be treated can maintain the round shape of the nail, which is more consistent with the shape of the real nail; Blending the colors of the original pixels in the external image can make the nail art effect more natural and closer to the real nail art effect.
  • Fig. 6 shows a schematic structural diagram of an image processing device according to at least one embodiment of the present disclosure.
  • the device may include: a first acquisition unit 601, configured to acquire an image to be processed containing at least one nail A first key point of the nail, wherein each of the nails corresponds to a plurality of first key points; a determination unit 602, configured to determine the area to be treated of the nail according to the plurality of first key points of the nail;
  • the second acquiring unit 603 is used to acquire the nail material marked with a plurality of second key points;
  • the rendering unit 604 is used to obtain the nail material according to the correspondence between the first key point and the second key point relationship, rendering the nail material into the area to be processed to obtain a processed image.
  • the first acquisition unit is specifically configured to: input the image to be processed into the nail key point detection network to obtain the key point detection result of the nail; obtain the nail key point detection result according to the nail key point detection result.
  • the first key point of the nail or, perform interpolation processing on the key point detection result of the nail, and obtain the first key point of the nail according to the interpolated result.
  • the interpolation processing of the key point detection results of the nails includes: performing curve interpolation on adjacent key points in the key point detection results of the nails; and/or; Linear interpolation is performed on the symmetric keypoints in the keypoint detection results.
  • the device further includes a deformation unit, configured to: determine a target key point among the plurality of first key points of the nail, and the target key point is to set a connecting line between symmetrical key points A first key point between the first key points corresponding to the top of the nail or the top of the fingertip; moving the target key point along the normal direction of the nail for a set distance, wherein the normal direction is based on the specified determined by multiple first key points of the nail; using the moved target key points to update the corresponding first key points.
  • a deformation unit configured to: determine a target key point among the plurality of first key points of the nail, and the target key point is to set a connecting line between symmetrical key points A first key point between the first key points corresponding to the top of the nail or the top of the fingertip; moving the target key point along the normal direction of the nail for a set distance, wherein the normal direction is based on the specified determined by multiple first key points of the nail; using the moved target key points to update the corresponding first key points.
  • the set distance is based on the first distance between the target key point and the line between the set symmetric key point and the first key corresponding to the top of the nail or fingertip.
  • the second distance between the point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance, negatively correlated with the second distance, and correlated with the The length of the link is negatively correlated.
  • the rendering unit is specifically configured to: acquire the texture coordinates in the nail material corresponding to the coordinate points to be processed according to the correspondence between the first key point and the second key point, Wherein, the coordinate point to be processed is located in the area to be processed; the first pixel value of the nail material at the texture coordinate is obtained; the processed Image.
  • the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed, and is interpolated according to the first key point obtained; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh, the A triangular mesh is constructed from a plurality of first keypoints of the nail.
  • the device further includes a fusion unit, configured to: perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to the set fusion coefficient to obtain the Processing the target pixel value of the coordinate point; obtaining the processed image according to the target pixel value of the coordinate point to be processed.
  • a fusion unit configured to: perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to the set fusion coefficient to obtain the Processing the target pixel value of the coordinate point; obtaining the processed image according to the target pixel value of the coordinate point to be processed.
  • At least one embodiment of the present disclosure also provides an electronic device. As shown in FIG. 7 , the device includes a memory 701 and a processor 702. The image processing method described in any embodiment of the present disclosure is implemented when the computer instructions are executed.
  • At least one embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image processing method described in any embodiment of the present disclosure is implemented.
  • At least one embodiment of the present disclosure further provides a computer program product, including a computer program, when the program is executed by a processor, the image processing method described in any embodiment of the present disclosure is implemented.
  • one or more embodiments of this specification may be provided as a method, system or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. The form of the product.
  • each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments.
  • the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiment.
  • Embodiments of the subject matter and functional operations described in this specification can be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or in A combination of one or more of .
  • Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, that is, one or more of computer program instructions encoded on a tangible, non-transitory program carrier for execution by or to control the operation of data processing apparatus. Multiple modules.
  • the program instructions may be encoded on an artificially generated propagated signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode and transmit information to a suitable receiver device for transmission by the data
  • the processing means executes.
  • a computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.
  • the processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output.
  • the processes and logic flows can also be performed by, and apparatus can also be implemented as, special purpose logic circuitry, such as an FPGA (Field Programmable Gate Array) or an ASIC (Application Specific Integrated Circuit).
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • Computers suitable for the execution of a computer program include, for example, general and/or special purpose microprocessors, or any other type of central processing unit.
  • a central processing unit will receive instructions and data from a read only memory and/or a random access memory.
  • the essential components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data.
  • a computer will also include, or be operatively coupled to, one or more mass storage devices for storing data, such as magnetic or magneto-optical disks, or optical disks, to receive data therefrom or to It transmits data, or both.
  • mass storage devices for storing data, such as magnetic or magneto-optical disks, or optical disks, to receive data therefrom or to It transmits data, or both.
  • a computer is not required to have such a device.
  • a computer may be embedded in another device such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a Global Positioning System (GPS) receiver, or a device such as a Universal Serial Bus (USB) ) portable storage devices like flash drives, to name a few.
  • PDA personal digital assistant
  • GPS Global Positioning System
  • USB Universal Serial Bus
  • Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices (such as EPROM, EEPROM, and flash memory devices), magnetic disks (such as internal hard disks or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks.
  • semiconductor memory devices such as EPROM, EEPROM, and flash memory devices
  • magnetic disks such as internal hard disks or removable disks
  • magneto-optical disks and CD ROM and DVD-ROM disks.
  • the processor and memory can be supplemented by, or incorporated in, special purpose logic circuitry.

Abstract

Disclosed are an image processing method and apparatus, a device, and a storage medium. The method comprises: obtaining first key points of a fingernail in an image to be processed comprising at least one fingernail, wherein each fingernail corresponds to a plurality of first key points; according to the plurality of first key points of the fingernail, determining an area to be processed of the fingernail; obtaining a fingernail material on which a plurality of second key points is marked; and according to the correspondences between the first key points and the second key points, rendering the fingernail material into said area to obtain a processed image.

Description

图像处理方法、装置、设备以及存储介质Image processing method, device, device and storage medium
相关申请的交叉引用Cross References to Related Applications
本公开要求于2021年6月25日提交的、申请号为202110713524.5、发明名称为“图像处理方法、装置、设备及存储介质”的中国专利申请的优先权,该中国专利申请公开的全部内容以引用的方式并入本文中。This disclosure claims the priority of the Chinese patent application with the application number 202110713524.5 and the title of the invention "image processing method, device, equipment and storage medium" submitted on June 25, 2021. The entire content of the Chinese patent application is disclosed in Incorporated herein by reference.
技术领域technical field
本公开涉及计算机技术领域,具体涉及一种图像处理方法、装置、设备以及存储介质。The present disclosure relates to the field of computer technology, and in particular to an image processing method, device, equipment and storage medium.
背景技术Background technique
目前对于用户拍摄的图像或视频进行的美妆或美颜处理,多集中于面部,而缺乏对于肢体部分,例如对于手部的美化处理,例如美甲操作。这是由于手部指甲区域覆盖面积较少,检测难度高,很难将指甲素材准确地应用于指甲区域,实现较好的美化效果。At present, most of the beautification or beautification processing of images or videos taken by users focuses on the face, but lacks beautification processing on body parts, such as hands, such as manicure operations. This is due to the fact that the hand nail area covers a small area and is difficult to detect. It is difficult to accurately apply nail materials to the nail area to achieve a better beautification effect.
发明内容Contents of the invention
本公开实施例提供一种图像处理方案。The embodiment of the present disclosure provides an image processing solution.
根据本公开的一方面,提供一种图像处理方法,所述方法包括:获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点;根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;获取指甲素材,所述指甲素材上标注有多个第二关键点;根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。According to an aspect of the present disclosure, there is provided an image processing method, the method comprising: acquiring a first key point of the nail in a to-be-processed image containing at least one nail, wherein each of the nails corresponds to a plurality of first key points A key point; according to a plurality of first key points of the nail, determine the area to be treated of the nail; obtain a nail material, and the nail material is marked with a plurality of second key points; according to the first key point and the corresponding relationship between the second key point, the nail material is rendered into the region to be processed, and a processed image is obtained.
结合本公开提供的任一实施方式,所述获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,包括:将所述待处理图像输入指甲关键点检测网络,得到所述指甲的关键点检测结果;根据所述指甲的关键点检测结果得到所述指甲的第一关键点,或,对所述指甲的关键点检测结果进行插值处理,根据插值后的结果得到所述指甲的第一关键点。In combination with any embodiment provided by the present disclosure, the acquiring the first key point of the nail in the image to be processed including at least one nail includes: inputting the image to be processed into a nail key point detection network to obtain the nail The key point detection result of the nail; the first key point of the nail is obtained according to the key point detection result of the nail, or, the key point detection result of the nail is interpolated, and the nail is obtained according to the interpolated result The first key point.
结合本公开提供的任一实施方式,所述对所述指甲的关键点检测结果进行插值 处理,包括:对所述指甲的关键点检测结果中的相邻关键点进行曲线插值;和/或;对所述指甲的关键点检测结果中的对称关键点进行线性插值。In combination with any embodiment provided in the present disclosure, the interpolation processing of the key point detection result of the nail includes: performing curve interpolation on adjacent key points in the key point detection result of the nail; and/or; Linear interpolation is performed on the symmetrical key points in the key point detection results of the nail.
结合本公开提供的任一实施方式,所述方法还包括:确定所述指甲的多个第一关键点中的目标关键点,所述目标关键点为设定对称关键点之间的连线与指甲顶端或指尖顶端对应的第一关键点之间的第一关键点;将所述目标关键点沿所述指甲的法线方向移动设定距离,其中,所述法线方向是根据所述指甲的多个第一关键点确定的;利用移动后的目标关键点更新相应的所述第一关键点。In combination with any implementation manner provided by the present disclosure, the method further includes: determining a target key point among the plurality of first key points of the nail, and the target key point is setting a connection line between the symmetrical key points and The first key point between the first key points corresponding to the top of the nail or the top of the fingertip; move the target key point along the normal direction of the nail for a set distance, wherein the normal direction is based on the Multiple first key points of the nail are determined; the corresponding first key points are updated by using the moved target key points.
结合本公开提供的任一实施方式,所述设定距离根据所述目标关键点与所述设定对称关键点之间的连线之间的第一距离、所述指甲顶端或指尖顶端对应的第一关键点与所述连线之间的第二距离,以及所述连线的长度确定,其中,所述设定距离与所述第一距离正相关,与所述第二距离负相关,与所述连线的长度负相关。In combination with any implementation manner provided by the present disclosure, the set distance corresponds to the first distance between the target key point and the line between the set symmetrical key point, the top of the nail or the top of the fingertip. The second distance between the first key point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance and negatively correlated with the second distance , which is negatively correlated with the length of the link.
结合本公开提供的任一实施方式,所述根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像,包括:根据所述第一关键点和所述第二关键点之间的对应关系,获取待处理坐标点对应的所述指甲素材中的纹理坐标,其中,所述待处理坐标点位于所述待处理区域内;获取所述纹理坐标处的所述指甲素材的第一像素值;根据所述待处理坐标点的第一像素值得到所述处理后的图像。In combination with any implementation manner provided in the present disclosure, according to the correspondence between the first key point and the second key point, the nail material is rendered into the area to be processed, and the processed The image includes: according to the correspondence between the first key point and the second key point, acquiring the texture coordinates in the nail material corresponding to the coordinate points to be processed, wherein the coordinate points to be processed are located at the within the area to be processed; acquire the first pixel value of the nail material at the texture coordinate; and obtain the processed image according to the first pixel value of the coordinate point to be processed.
结合本公开提供的任一实施方式,所述待处理坐标点包括:第一关键点以及第一插值点,其中,所述第一插值点位于所述待处理区域中,是根据所述第一关键点进行插值得到的;和/或,三角网格的顶点以及第二插值点,其中,所述第二插值点位于所述三角网格中,是根据所述三角网格的顶点进行插值得到的,所述三角网格是根据所述指甲的多个第一关键点构建的。In combination with any implementation manner provided by the present disclosure, the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed and is based on the first obtained by interpolating the key points; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh Yes, the triangular mesh is constructed according to a plurality of first key points of the nail.
结合本公开提供的任一实施方式,所述方法还包括:获取所述待处理坐标点在所述待处理图像中的第二像素值;所述根据所述第一像素值得到所述处理后的图像,包括:根据设定融合系数,对所述待处理坐标点的第一像素值和所述第二像素值进行加权处理,得到所述待处理坐标点的目标像素值;根据所述待处理坐标点的目标像素值得到所述处理后的图像。In combination with any implementation manner provided by the present disclosure, the method further includes: obtaining a second pixel value of the coordinate point to be processed in the image to be processed; obtaining the processed pixel value according to the first pixel value The image includes: according to the set fusion coefficient, weighting the first pixel value and the second pixel value of the coordinate point to be processed to obtain the target pixel value of the coordinate point to be processed; according to the coordinate point to be processed The target pixel value of the coordinate point is processed to obtain the processed image.
根据本公开的一方面,提供一种图像处理装置,所述装置包括:第一获取单元,用于获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点;确定单元,用于根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;第二获取单元,用于获取指甲素材,所述指甲素材上标注有多个第 二关键点;渲染单元,用于根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。According to an aspect of the present disclosure, there is provided an image processing device, the device comprising: a first acquisition unit, configured to acquire a first key point of the nail in an image to be processed containing at least one nail, wherein each of the The nail corresponds to a plurality of first key points; the determination unit is configured to determine the area to be processed of the nail according to the plurality of first key points of the nail; the second acquisition unit is configured to acquire a nail material, the A plurality of second key points are marked on the nail material; a rendering unit is configured to render the nail material into the area to be processed according to the correspondence between the first key point and the second key point , to get the processed image.
结合本公开提供的任一实施方式,第一获取单元具体用于:将所述待处理图像输入指甲关键点检测网络,得到所述指甲的关键点检测结果;根据所述指甲的关键点检测结果得到所述指甲的第一关键点,或,对所述指甲的关键点检测结果进行插值处理,根据插值后的结果得到所述指甲的第一关键点。In combination with any implementation manner provided in the present disclosure, the first acquisition unit is specifically configured to: input the image to be processed into the nail key point detection network to obtain the key point detection result of the nail; according to the key point detection result of the nail Obtaining the first key point of the nail, or performing interpolation processing on the detection result of the key point of the nail, and obtaining the first key point of the nail according to the interpolated result.
结合本公开提供的任一实施方式,所述对所述指甲的关键点检测结果进行插值处理,包括:对所述指甲的关键点检测结果中的相邻关键点进行曲线插值;和/或;对所述指甲的关键点检测结果中的对称关键点进行线性插值。In combination with any embodiment provided in the present disclosure, the interpolation processing of the key point detection result of the nail includes: performing curve interpolation on adjacent key points in the key point detection result of the nail; and/or; Linear interpolation is performed on the symmetrical key points in the key point detection results of the nail.
结合本公开提供的任一实施方式,所述装置还包括变形单元,用于:确定所述指甲的多个第一关键点中的目标关键点,所述目标关键点为设定对称关键点之间的连线与指甲顶端或指尖顶端对应的第一关键点之间的第一关键点;将所述目标关键点沿所述指甲的法线方向移动设定距离,其中,所述法线方向是根据所述指甲的多个第一关键点确定的;利用移动后的目标关键点更新相应的所述第一关键点。In combination with any implementation manner provided by the present disclosure, the device further includes a deformation unit configured to: determine a target key point among the multiple first key points of the nail, and the target key point is one of the set symmetrical key points The first key point between the connecting line and the first key point corresponding to the top of the nail or fingertip; move the target key point along the normal direction of the nail for a set distance, wherein the normal The direction is determined according to a plurality of first key points of the nail; the corresponding first key points are updated by using the moved target key points.
结合本公开提供的任一实施方式,所述设定距离根据所述目标关键点与所述设定对称关键点之间的连线之间的第一距离、所述指甲顶端或指尖顶端对应的第一关键点与所述连线之间的第二距离,以及所述连线的长度确定,其中,所述设定距离与所述第一距离正相关,与所述第二距离负相关,与所述连线的长度负相关。In combination with any implementation manner provided by the present disclosure, the set distance corresponds to the first distance between the target key point and the line between the set symmetrical key point, the top of the nail or the top of the fingertip. The second distance between the first key point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance and negatively correlated with the second distance , which is negatively correlated with the length of the link.
结合本公开提供的任一实施方式,所述渲染单元具体用于:根据所述第一关键点和所述第二关键点之间的对应关系,获取待处理坐标点对应的所述指甲素材中的纹理坐标,其中,所述待处理坐标点位于所述待处理区域内;获取所述纹理坐标处的所述指甲素材的第一像素值;根据所述待处理坐标点的第一像素值得到所述处理后的图像。In combination with any of the implementations provided in the present disclosure, the rendering unit is specifically configured to: acquire, according to the correspondence between the first key point and the second key point, the nail material corresponding to the coordinate point to be processed. texture coordinates, wherein, the coordinate point to be processed is located in the area to be processed; the first pixel value of the nail material at the texture coordinate is acquired; according to the first pixel value of the coordinate point to be processed, the The processed image.
结合本公开提供的任一实施方式,所述待处理坐标点包括:第一关键点以及第一插值点,其中,所述第一插值点位于所述待处理区域中,是根据所述第一关键点进行插值得到的;和/或,三角网格的顶点以及第二插值点,其中,所述第二插值点位于所述三角网格中,是根据所述三角网格的顶点进行插值得到的,所述三角网格是根据所述指甲的多个第一关键点构建的。In combination with any implementation manner provided by the present disclosure, the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed and is based on the first obtained by interpolating the key points; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh Yes, the triangular mesh is constructed according to a plurality of first key points of the nail.
结合本公开提供的任一实施方式,所述装置还包括融合单元,用于:根据设定融合系数,对所述待处理坐标点的第一像素值和所述第二像素值进行加权处理,得到所述待处理坐标点的目标像素值;根据所述待处理坐标点的目标像素值得到所述处理后的图像。In combination with any embodiment provided in the present disclosure, the device further includes a fusion unit configured to: perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to a set fusion coefficient, The target pixel value of the coordinate point to be processed is obtained; the processed image is obtained according to the target pixel value of the coordinate point to be processed.
根据本公开的一方面,提供一种电子设备,所述设备包括存储器、处理器,所述存储器用于存储可在处理器上运行的计算机指令,所述处理器用于在执行所述计算机指令时实现本公开提供的任一实施方式所述的图像处理方法。According to an aspect of the present disclosure, there is provided an electronic device, the device includes a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to execute the computer instructions The image processing method described in any implementation manner provided by the present disclosure is realized.
根据本公开的一方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本公开提供的任一实施方式所述的图像处理方法。According to an aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the image processing method described in any implementation manner provided in the present disclosure is implemented.
根据本公开的一方面,提供一种计算机程序产品,包括计算机程序,所述程序被处理器执行时实现本公开提供的任一实施方式所述的图像处理方法。According to an aspect of the present disclosure, a computer program product is provided, including a computer program, and when the program is executed by a processor, the image processing method described in any implementation manner provided in the present disclosure is implemented.
本公开一个或多个实施例的图像处理方法、装置、设备及计算机可读存储介质,首先获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,并根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;之后获取指甲素材,所述指甲素材上标注有多个第二关键点,最后根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像,通过将指甲素材精准地渲染到待处理图像中指甲的待处理区域,可以实现对于待处理图像中指甲的特效处理以及美化效果处理。According to the image processing method, device, device and computer-readable storage medium of one or more embodiments of the present disclosure, first, the first key point of the nail in the image to be processed including at least one nail is obtained, and according to the number of the nails A first key point, determine the area to be processed of the nail; then obtain the nail material, the nail material is marked with a plurality of second key points, and finally according to the first key point and the second key point The corresponding relationship between them, the nail material is rendered into the area to be processed, and the processed image is obtained. By accurately rendering the nail material to the area to be processed of the nail in the image to be processed, the Special effect treatment and beautification effect treatment of nails.
附图说明Description of drawings
为了更清楚地说明本说明书一个或多个实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书一个或多个实施例中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of one or more embodiments of this specification, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only one or more For some embodiments described in the multiple embodiments, for those skilled in the art, other drawings can also be obtained according to these drawings on the premise of not paying creative efforts.
图1是本公开至少一个实施例提出的图像处理方法的流程图;FIG. 1 is a flowchart of an image processing method proposed by at least one embodiment of the present disclosure;
图2是本公开至少一个实施例提出的图像处理方法中指甲的第一关键点示意图;Fig. 2 is a schematic diagram of the first key point of the nail in the image processing method proposed by at least one embodiment of the present disclosure;
图3是本公开至少一个实施例提出的图像处理方法中指甲素材的示意图;Fig. 3 is a schematic diagram of nail material in the image processing method proposed by at least one embodiment of the present disclosure;
图4A和图4B是通过本公开至少一个实施例提出的图像处理方法得到的手部图像的示意图;4A and 4B are schematic diagrams of hand images obtained through the image processing method proposed by at least one embodiment of the present disclosure;
图5是本公开至少一个实施例提出的对手部图像进行图像处理的方法流程图;FIG. 5 is a flow chart of a method for image processing a hand image proposed by at least one embodiment of the present disclosure;
图6是本公开至少一个实施例提出的图像处理装置的结构示意图;Fig. 6 is a schematic structural diagram of an image processing device proposed by at least one embodiment of the present disclosure;
图7是本公开至少一个实施例提出的电子设备的结构示意图。Fig. 7 is a schematic structural diagram of an electronic device proposed by at least one embodiment of the present disclosure.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉 及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present disclosure as recited in the appended claims.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations. In addition, the term "at least one" herein means any one of a variety or any combination of at least two of the more, for example, including at least one of A, B, and C, which may mean including from A, Any one or more elements selected from the set formed by B and C.
本公开至少一个实施例提供了一种图像处理方法,所述图像处理方法可以由终端设备或服务器等电子设备执行,所述终端设备可以是固定终端或移动终端,例如手机、平板电脑、游戏机、台式机、广告机、一体机、车载终端等等,所述服务器包括本地服务器或云端服务器等,所述方法还可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。At least one embodiment of the present disclosure provides an image processing method, the image processing method can be executed by electronic devices such as terminal devices or servers, and the terminal devices can be fixed terminals or mobile terminals, such as mobile phones, tablet computers, game consoles , desktop computer, advertising machine, all-in-one machine, vehicle-mounted terminal, etc., the server includes a local server or a cloud server, etc., and the method can also be implemented by calling a computer-readable instruction stored in a memory by a processor.
图1示出根据本公开至少一个实施例的图像处理方法的流程图,如图1所示,所述方法包括步骤101至步骤104。FIG. 1 shows a flowchart of an image processing method according to at least one embodiment of the present disclosure. As shown in FIG. 1 , the method includes steps 101 to 104 .
在步骤101中,获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点。In step 101, a first key point of the nail in an image to be processed containing at least one nail is acquired, wherein each of the nails corresponds to a plurality of first key points.
其中,所述待处理图像可以是实时拍摄的静态图像或者视频图像,也可以是从存储器或者其他介质中获取的静态图像或者视频图像。并且,本公开实施例中的指甲可以是手部的指甲,也可以是脚部的指甲,本公开对此不进行限制。以所述指甲为手部的指甲为例,所述待处理图像可以是单独的手部图像,或者是包含了手部区域的人体图像;也可以是包含了一个或多个指甲的局部手部图像。Wherein, the image to be processed may be a still image or a video image captured in real time, or may be a still image or a video image acquired from a memory or other media. Moreover, the nails in the embodiments of the present disclosure may be the nails of the hand or the nails of the feet, which is not limited in the present disclosure. Taking the nail as the nail of the hand as an example, the image to be processed can be a separate hand image, or a human body image including the hand area; it can also be a partial hand including one or more nails image.
在一个示例中,可以对所述待处理图像进行关键点检测,以得到所述待处理图像中所包含的至少一个指甲的关键点,其中,每个所述指甲对应于多个关键点。为了将从所述待处理图像中获取的关键点与后续获得的关键点进行区分,将本步骤中所得到的关键点称为第一关键点。In an example, key point detection may be performed on the image to be processed to obtain key points of at least one nail contained in the image to be processed, wherein each nail corresponds to multiple key points. In order to distinguish the key points obtained from the image to be processed from the key points obtained subsequently, the key points obtained in this step are called the first key points.
所述第一关键点通常位于指甲边缘上,每个第一关键点用于表征所述指甲的特定位置点。在通常情况下,一个指甲可以对应12~32范围内任意数目的第一关键点。以图2所示的第一关键点示意图为例,一个指甲对应于16个第一关键点。如图2所示,第一关键点P0用于表征位于指甲轮廓最底部的最左侧的点,第一关键点P4用于表征位于指甲轮廓最底部的最右侧的点,第一关键点P10用于表征位于指甲轮廓的最顶部中间 的点。本领域技术人员应当了解,图2所示的指甲对应于16个第一关键点仅用于示例,一个指甲还可以对应于其他数目的第一关键点,本公开对此不进行限制。The first key points are usually located on the edge of the nail, and each first key point is used to represent a specific position of the nail. In general, one nail can correspond to any number of first key points within the range of 12-32. Taking the schematic diagram of the first key point shown in FIG. 2 as an example, one fingernail corresponds to 16 first key points. As shown in Figure 2, the first key point P0 is used to characterize the leftmost point at the bottom of the nail outline, the first key point P4 is used to characterize the rightmost point at the bottom of the nail outline, and the first key point P10 was used to characterize the point located in the topmost middle of the nail outline. Those skilled in the art should understand that the nails shown in FIG. 2 corresponding to 16 first key points are only for example, and one nail may also correspond to other numbers of first key points, which is not limited in the present disclosure.
在步骤102中,根据所述指甲的多个第一关键点,确定所述指甲的待处理区域。In step 102, a region to be treated of the nail is determined according to a plurality of first key points of the nail.
在本公开实施例中,由于所述第一关键点位于指甲边缘上,因此根据所述指甲对应的多个第一关键点,可以得到所述指甲的待处理区域。In the embodiment of the present disclosure, since the first key point is located on the edge of the nail, the region to be treated of the nail can be obtained according to the plurality of first key points corresponding to the nail.
在步骤103中,获取指甲素材,所述指甲素材上标注有多个第二关键点。In step 103, the nail material is acquired, and the nail material is marked with a plurality of second key points.
其中,所述指甲素材是可以为指甲添加了特效或者进行了美化的素材(例如,进行了标注的指甲的图片等),所述指甲素材可以是纯色的,也可以是包含图案的,也可以是其他类型的,本公开实施例对于指甲素材的类型不进行限制。Wherein, the nail material is a material that can add special effects or beautify the nails (for example, a marked picture of the nail, etc.), and the nail material can be a solid color, or it can contain a pattern, or it can be It is other types, and the embodiment of the present disclosure does not limit the type of nail material.
在本公开实施例中,所述指甲素材上标注有第二关键点。所述第二关键点与所述第一关键点类似,也是位于指甲素材的边缘上,并且每个第二关键点用于表征所述指甲素材的特定位置点。在本公开实施例中,所述指甲的第一关键点的全部或部分与所述指甲素材的多个第二关键点一一对应。例如,指甲素材包括16个第二关键点,所述待处理图像中的指甲同样包括16个第一关键点,该16个第二关键点是与16个第一关键点一一对应的。又例如,指甲素材包括12个第二关键点,所述待处理图像中的指甲包括16个第一关键点,该12个第二关键点是与上述16个第一关键点中的12个第一关键点一一对应的。其中,所述指甲素材可以对应12~32范围内任意数目的第二关键点。In the embodiment of the present disclosure, the second key point is marked on the nail material. Similar to the first key point, the second key point is also located on the edge of the nail material, and each second key point is used to characterize a specific point of the nail material. In an embodiment of the present disclosure, all or part of the first key points of the nail correspond one-to-one to multiple second key points of the nail material. For example, the nail material includes 16 second key points, and the nail in the image to be processed also includes 16 first key points, and the 16 second key points are in one-to-one correspondence with the 16 first key points. For another example, the nail material includes 12 second key points, and the nail in the image to be processed includes 16 first key points, and the 12 second key points are the same as the 12th key points in the above-mentioned 16 first key points. There is a one-to-one correspondence between key points. Wherein, the nail material may correspond to any number of second key points within the range of 12-32.
如图3所示,所述指甲素材上标注有第二关键点S0~S15。其中,第二关键点S0~S15与待处理图像中指甲的第一关键点P0~P15是一一对应的。As shown in FIG. 3 , the second key points S0 - S15 are marked on the nail material. Wherein, the second key points S0-S15 are in one-to-one correspondence with the first key points P0-P15 of the nail in the image to be processed.
在本公开实施例中,用于对指甲素材进行指甲关键点检测的神经网络,与用于对所述待处理图像进行指甲关键点检测的神经网络,可以是同一个神经网络,或者是利用相同的样本集训练得到的神经网络。In the embodiment of the present disclosure, the neural network used to detect nail key points on the nail material and the neural network used to detect nail key points on the image to be processed may be the same neural network, or use the same The neural network obtained by training the sample set.
在步骤104中,根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。In step 104, according to the corresponding relationship between the first key point and the second key point, the nail material is rendered into the region to be processed to obtain a processed image.
对于所述待处理图像中的其中一个指甲,在获得了所述指甲对应的第一关键点后,根据所述指甲的多个第一关键点与所述指甲素材的多个第二关键点之间的对应关系,可以确定所述指甲的待处理区域与所述指甲素材的对应关系,从而可以将所述指甲素材的颜色和/或图案,渲染到所述指甲的待处理区域中,使所述指甲呈现出与所述指甲素材相同的颜色和/或图案,从而实现了指甲的特效处理或者指甲的美化效果处理。For one of the nails in the image to be processed, after obtaining the first key point corresponding to the nail, according to the relationship between the multiple first key points of the nail and the multiple second key points of the nail material The corresponding relationship between the to-be-processed area of the nail can be determined and the corresponding relationship between the nail material can be determined, so that the color and/or pattern of the nail material can be rendered into the to-be-processed area of the nail, so that all The nails present the same color and/or pattern as the nail material, thereby realizing the special effect treatment of the nails or the beautification treatment of the nails.
在本公开实施例中,首先获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,并根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;之后获取 指甲素材,所述指甲素材上标注有多个第二关键点,最后根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像,通过将指甲素材精准地渲染到待处理图像中指甲的待处理区域,可以实现对于待处理图像中指甲的特效处理以及美化效果处理。In an embodiment of the present disclosure, the first key point of the nail in the image to be processed including at least one nail is first obtained, and the area to be processed of the nail is determined according to the plurality of first key points of the nail; then Acquiring nail material, the nail material is marked with a plurality of second key points, and finally according to the correspondence between the first key point and the second key point, rendering the nail material to the pending In the region, the processed image is obtained, and by accurately rendering the nail material to the region to be processed of the nail in the image to be processed, special effect processing and beautification effect processing of the nail in the image to be processed can be realized.
在本公开实施例中,可以将所述待处理图像输入关键点检测网络,以对所述待处理图像进行关键点检测。In the embodiment of the present disclosure, the image to be processed may be input into a key point detection network, so as to perform key point detection on the image to be processed.
在一些实现方式中,可以根据所述关键点检测网络输出的指甲检测结果得到所述指甲的第一关键点。In some implementation manners, the first key point of the nail may be obtained according to the nail detection result output by the key point detection network.
在一些实现方式中,可以对所述指甲关键检测网络输出的指甲检测结果进行插值处理,根据插值后的结果得到所述指甲的第一关键点。In some implementation manners, an interpolation process may be performed on the nail detection result output by the nail key detection network, and the first key point of the nail is obtained according to the interpolated result.
在一个示例中,可以对所述指甲检测结果中所述指甲的相邻关键点进行曲线插值。以图2为例,对于相邻关键点,例如P7与P8,P8与P9等等,通过进行曲线插值,可以使位于指甲边缘的关键点的排列更密集,从而使所述关键点所包围形成的待处理区域保持指甲的圆润形态,与真实指甲的形状更加一致。In an example, curve interpolation may be performed on adjacent key points of the nail in the nail detection result. Taking Figure 2 as an example, for adjacent key points, such as P7 and P8, P8 and P9, etc., by performing curve interpolation, the key points on the edge of the nail can be arranged more densely, so that the key points are surrounded by The area to be treated maintains the round shape of the nail, which is more consistent with the shape of the real nail.
在一个示例中,可以对所述指甲检测结果中所述指甲的对称关键点进行线性插值。仍以图2为例,对于对称关键点,例如P5与P15,P7与P13等等,通过进行线性插值,可以使所述指甲的中间区域(非指甲边缘)也具有第一关键点,有利于后续根据所述第一关键点进行三角网格的构建。In an example, linear interpolation may be performed on the symmetric key points of the nail in the nail detection result. Still taking Figure 2 as an example, for symmetrical key points, such as P5 and P15, P7 and P13, etc., by performing linear interpolation, the middle area of the nail (non-nail edge) can also have the first key point, which is beneficial to Subsequently, a triangular mesh is constructed according to the first key point.
在一个示例中,可以在对所述指甲检测结果中指甲的相邻关键点进行曲线插值的同时,也对对称关键点进行线性插值,使得位于指甲边缘的第一关键点的排列更密集,并且在指甲的中间区域也具有第一关键点。In an example, linear interpolation may be performed on the symmetrical key points while curve interpolation is performed on the adjacent key points of the nail in the nail detection result, so that the arrangement of the first key points on the edge of the nail is denser, and There is also a first key in the middle area of the nail.
由于待处理图像中包含的指甲代表了真实指甲,而指甲素材的面积通常是大于真实指甲的面积的,本公开实施例提出了一种对关键点进行变形的方法,关键点变形后的待处理区域略长于真实指甲,得到更加接近真实的指甲特效和指甲美化效果。Since the nail contained in the image to be processed represents the real nail, and the area of the nail material is usually larger than the area of the real nail, the embodiment of the present disclosure proposes a method for deforming the key points. The area is slightly longer than the real nail, resulting in more realistic nail effects and nail beautification effects.
首先,确定所述指甲的多个第一关键点中的目标关键点,所述目标关键点为设定对称关键点之间的连线与指甲顶端或指尖顶端对应的第一关键点之间的第一关键点。其中,所述目标关键点包括所述设定对称关键点以及所述指甲顶端或指尖顶端对应的第一关键点。First, determine the target key point among the plurality of first key points of the nail, the target key point is between the line between the symmetrical key points and the first key point corresponding to the top of the nail or fingertip the first key point. Wherein, the target key point includes the set symmetry key point and the first key point corresponding to the top of the nail or fingertip.
在本步骤中,所确定的目标关键点也即后续进行变形的第一关键点。以图2所示的第一关键点为例,可以将位于指甲上半部分的第一关键点确定为目标关键点。例如,可以将P5与P15之间的连线与顶端对应的P10之间的所有第一关键点,包括P5、P6、 P7、P8、P9、P10、P11、P12、P13、P14、P15,作为目标关键点。In this step, the determined target key point is also the first key point for subsequent deformation. Taking the first key point shown in FIG. 2 as an example, the first key point located in the upper half of the nail may be determined as the target key point. For example, all the first key points between the line between P5 and P15 and the corresponding P10 at the top, including P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, and P15, can be used as target key points.
接下来,将所述目标关键点沿所述指甲的法线方向移动设定距离,也即沿着指甲的生长方向移动设定距离。其中,所述法线方向是根据所述指甲的多个第一关键点确定的。Next, the target key point is moved by a set distance along the normal direction of the nail, that is, along the growth direction of the nail by a set distance. Wherein, the normal direction is determined according to a plurality of first key points of the nail.
在一个示例中,可以将所述指甲的第一关键点中,位于最底端中间的第一关键点与位于最顶端中间的第一关键点之间的连线方向,作为所述指甲的法线方向。如图2所示,可以将第一关键点P2与P10之间的连线方向,作为所述指甲的法线方向。In an example, among the first key points of the nail, the direction of the line between the first key point at the bottommost middle and the first key point at the topmost middle can be used as the normal direction of the nail. line direction. As shown in FIG. 2 , the direction of the line connecting the first key point P2 and P10 may be taken as the normal direction of the nail.
各个目标关键点沿指甲的法线方向移动的设定距离,可以是用户自行设定的,也可以是根据所述目标关键点与其他第一关键点的位置关系以及位置信息确定的。The set distance for each target key point to move along the normal direction of the nail can be set by the user, or can be determined according to the positional relationship and position information between the target key point and other first key points.
在一个示例中,可以根据所述目标关键点与所述设定对称关键点之间的连线之间的第一距离、所述指甲顶端或指尖顶端对应的第一关键点与所述连线之间的第二距离,以及所述连线的长度确定,其中,所述设定距离与所述第一距离正相关,与所述第二距离负相关,与所述连线的长度负相关。In an example, according to the first distance between the target key point and the line between the set symmetrical key point, the first key point corresponding to the top of the nail or the top of the fingertip and the line The second distance between the lines and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance, negatively correlated with the second distance, and negatively correlated with the length of the connecting line relevant.
以计算图2中的目标关键点P8对应的设定距离为例,可以根据P8与P5和P15连线之间的第一距离l3、P10与P5和P15连线的第二距离l2,以及P5和P15连线的长度l1确定。所述设定距离Δm的公式例如为:Taking the calculation of the set distance corresponding to the target key point P8 in Figure 2 as an example, it can be based on the first distance l3 between P8 and the line connecting P5 and P15, the second distance l2 between P10 and the line connecting P5 and P15, and P5 The length l1 of the connection with P15 is determined. The formula of the set distance Δm is, for example:
Figure PCTCN2021140353-appb-000001
Figure PCTCN2021140353-appb-000001
其中,a为设定系数,可以根据需要的效果进行调整,a的取值范围可以是0.1~0.4。各个目标关键点的设定系数可以相同,也可以不同。例如,可以将所有目标关键点的设定系数a设置为0.2。Wherein, a is a setting coefficient, which can be adjusted according to the required effect, and the value range of a can be 0.1-0.4. The setting coefficients of each target key point can be the same or different. For example, the setting coefficient a of all target keypoints can be set to 0.2.
利用移动后的目标关键点更新相应的所述第一关键点。也即,根据移动后的目标关键点,以及所述目标关键点以外的第一关键点,得到更新后的第一关键点。The corresponding first key point is updated by using the moved target key point. That is, an updated first key point is obtained according to the moved target key point and first key points other than the target key point.
最后,根据所述指甲更新后的第一关键点,更新所述指甲的待处理区域。Finally, the area to be processed of the nail is updated according to the updated first key point of the nail.
在本公开实施例中,根据沿指甲的法线方向移动目标关键点,使得指甲对应的待处理区域产生了形变,相较于真实指甲在法线方向上长度有所增加。形变后的待处理区域与常见的指甲素材的形状更加一致和匹配,从而可以得到更加接近真实的指甲特效和指甲美化效果。In the embodiment of the present disclosure, according to moving the target key point along the normal direction of the nail, the area to be treated corresponding to the nail is deformed, and the length of the normal direction of the nail is increased compared with that of the real nail. The deformed area to be processed is more consistent and matches the shape of common nail materials, so that the nail special effects and nail beautification effects closer to reality can be obtained.
在一些实施例中,可以通过以下方式实现指甲素材到所述待处理区域的渲染。In some embodiments, the rendering of the nail material to the area to be processed may be implemented in the following manner.
首先,根据所述第一关键点和所述第二关键点之间的对应关系,获取所述待处理区域包含的待处理坐标点对应的所述指甲素材中的纹理坐标。其中,所述待处理坐标点可以包括第一关键点以及基于所述第一关键点得到的其他坐标点,并且所述其他坐标 点与所述第一关键点的位置关系是已知的。所述指甲素材的大小通常是固定的,所述指甲素材中的关键点的纹理坐标可以被预先存储。Firstly, according to the correspondence between the first key point and the second key point, the texture coordinates in the nail material corresponding to the coordinate points to be processed included in the area to be processed are acquired. Wherein, the coordinate points to be processed may include the first key point and other coordinate points obtained based on the first key point, and the positional relationship between the other coordinate points and the first key point is known. The size of the nail material is usually fixed, and the texture coordinates of the key points in the nail material can be stored in advance.
接下来,根据所述第一关键点和所述第二关键点之间的对应关系,获取所述待处理坐标点对应的所述指甲素材中的纹理坐标,并获取所述纹理坐标处的所述指甲素材的第一像素值。Next, according to the correspondence between the first key point and the second key point, the texture coordinates in the nail material corresponding to the coordinate points to be processed are obtained, and all the texture coordinates at the texture coordinates are obtained. Describes the first pixel value of the nail material.
由于所述指甲的第一关键点的全部或部分与所述指甲素材的多个第二关键点一一对应的,因此,根据所述第一关键点所对应的第二关键点在所述指甲素材中的纹理坐标,则可以确定所述第一关键点对应的所述指甲素材中的纹理坐标,并根据所述纹理坐标获得相应的第一像素值。Since all or part of the first key point of the nail is in one-to-one correspondence with multiple second key points of the nail material, according to the second key point corresponding to the first key point in the nail texture coordinates in the material, then the texture coordinates in the nail material corresponding to the first key point can be determined, and the corresponding first pixel value can be obtained according to the texture coordinates.
对于根据所述第一关键点得到的其他坐标点,由于所述其他坐标点与所述第一关键点的相对位置关系是己知的,因此根据所述第一关键点与所述第二关键点的对应关系,可以确定所述其他坐标点所对应的所述指甲素材中的纹理坐标,并根据所述纹理坐标获得相应的第一像素值。For other coordinate points obtained according to the first key point, since the relative position relationship between the other coordinate points and the first key point is known, according to the first key point and the second key point The corresponding relationship of the points may determine the texture coordinates in the nail material corresponding to the other coordinate points, and obtain the corresponding first pixel value according to the texture coordinates.
通过以上方法,则可以得到所述指甲的待处理区域中,各个待处理坐标点对应的指甲素材中的第一像素值,从而可以将所述指甲素材的颜色和/或图案渲染到所述待处理区域中,实现指甲的特效处理和美化效果处理。Through the above method, the first pixel value in the nail material corresponding to each coordinate point to be processed in the to-be-processed area of the nail can be obtained, so that the color and/or pattern of the nail material can be rendered to the to-be-processed area. In the processing area, special effect processing and beautifying effect processing of nails are realized.
在本公开实施例中,通过所述第一关键点和所述第二关键点之间的对应关系实现所述指甲素材到待处理区域的渲染,可以实现所述指甲素材根据所述待处理区域进行适应性变化,从而得到逼真的指甲特效和美化效果。In the embodiment of the present disclosure, the rendering of the nail material to the area to be processed is realized through the corresponding relationship between the first key point and the second key point, and the nail material can be realized according to the area to be processed Adaptive changes are made for realistic nail effects and beautification.
在一些实现方式中,所述待处理坐标点包括第一关键点以及第一插值点,其中,所述第一插值点位于所述待处理区域中,是根据所述第一关键点进行插值得到的。也即是说,可以通过对第一关键点进行插值处理,得到所述待处理区域中所包含的各个待处理坐标点。In some implementations, the coordinate points to be processed include a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed, and is obtained by interpolating according to the first key point of. That is to say, each coordinate point to be processed included in the area to be processed can be obtained by interpolating the first key point.
在一些实施方式中,可以根据所述指甲的多个第一关键点构建三角网格,并根据所构建的三角网格确定所述指甲的待处理区域。其中,所述第一关键点可以是对于指甲关键点检测网络输出的检测结果进行插值得到的,通过检测结果进行插值,使得位于指甲轮廓的边缘关键点更加密集,从而使构建的三角网格所形成的待处理区域保持指甲的圆润形态,与真实指甲的形状更加一致。In some implementations, a triangular mesh may be constructed according to a plurality of first key points of the nail, and an area to be treated of the nail may be determined according to the constructed triangular mesh. Wherein, the first key point can be obtained by interpolating the detection result output by the nail key point detection network, and the interpolation is performed through the detection result, so that the key points located at the edge of the nail outline are denser, so that the constructed triangular mesh The resulting treated area maintains the round shape of the nail and is more consistent with the shape of the real nail.
在根据所述指甲的多个第一关键点构建了三角网格的情况下,所述待处理坐标点可以包括所述三角网格的顶点以及第二插值点,其中,所述第二插值点位于所述三角网格中,是根据所述三角网格的顶点进行插值得到的,所述三角网格是根据所述指甲的 多个第一关键点构建的。也即是说,所述三角网格的顶点由所述第一关键点构成,而位于所述三角网格中的第二插值点,是通过对作为三角网格的顶点的所述第一关键点进行插值得到的。In the case that a triangular mesh is constructed according to a plurality of first key points of the nail, the coordinate points to be processed may include vertices of the triangular mesh and second interpolation points, wherein the second interpolation points Located in the triangular mesh, it is obtained by interpolating according to the vertices of the triangular mesh, and the triangular mesh is constructed according to a plurality of first key points of the nail. That is to say, the vertices of the triangular mesh are constituted by the first key point, and the second interpolation point located in the triangular mesh is obtained by using the first key point as the vertices of the triangular mesh obtained by interpolation.
在一些实现方式中,还可以获得所述待处理坐标点在所述待处理图像中的第二像素值,也即获得所述待处理图像中指甲自身的颜色。接下来,根据设定融合系数,对所述待处理坐标点的第一像素值和所述第二像素值进行加权处理,得到所述待处理坐标点的目标像素值,最后根据所述待处理坐标点的目标像素值得到所述处理后的图像。上述进行融合的过程可以根据公式(2)进行表示:In some implementation manners, the second pixel value of the coordinate point to be processed in the image to be processed may also be obtained, that is, the color of the nail itself in the image to be processed may be obtained. Next, according to the set fusion coefficient, the first pixel value and the second pixel value of the coordinate point to be processed are weighted to obtain the target pixel value of the coordinate point to be processed, and finally according to the coordinate point to be processed The target pixel value of the coordinate point is obtained in the processed image. The above fusion process can be expressed according to formula (2):
C new=C 1*s 1+C 2*(1-s 1)   (2) C new =C 1 *s 1 +C 2 *(1-s 1 ) (2)
其中,C new表示目标像素值,C 1表示第一像素值,C 2表示第二像素值,s 1表示设定融合系数,所述设定融合系数可以是用户根据所需实现具体设置的。在本公开实施例中,通过将指甲素材的颜色将所述待处理图像中指甲自身的颜色进行融合,所实现的指甲特效和美化效果更加自然,也更加接近于真实的美甲效果,参见图4A和图4B所示的处理后的图像。 Wherein, C new represents the target pixel value, C 1 represents the first pixel value, C 2 represents the second pixel value, s 1 represents the set fusion coefficient, and the set fusion coefficient may be specifically set by the user according to the desired implementation. In the embodiment of the present disclosure, by combining the color of the nail material with the color of the nail itself in the image to be processed, the achieved nail special effects and beautification effects are more natural and closer to the real nail art effect, see FIG. 4A and the processed image shown in Figure 4B.
在一些实施方式中,可以通过以下方式对手部图像进行图像处理,以实现手部图像的美甲效果。如图5所示,该方法可以包括步骤501至506。In some implementation manners, image processing may be performed on the hand image in the following manner, so as to realize the nail art effect of the hand image. As shown in FIG. 5 , the method may include steps 501 to 506 .
在步骤501中,获取手部图像,并获取所述手部图像中各个指甲对应的多个第一关键点。其中,所述手部图像可以是实时采集的,也可以是从存储介质中获取的。In step 501, a hand image is acquired, and multiple first key points corresponding to each nail in the hand image are acquired. Wherein, the hand image may be collected in real time, or may be obtained from a storage medium.
在步骤502中,对所述第一关键点进行插值,并利用插值得到的新的第一关键点更新相应的所述第一关键点。In step 502, the first key point is interpolated, and the corresponding first key point is updated with the new first key point obtained by interpolation.
其中,对所述第一关键点进行插值包括对第一关键点中的相邻关键点进行曲线插值,和/或对所述第一关键点中的对称关键点进行线性插值。Wherein, performing interpolation on the first key point includes performing curve interpolation on adjacent key points in the first key point, and/or performing linear interpolation on symmetrical key points in the first key point.
在步骤503中,对所述第一关键点进行变形处理,使变形后的第一关键点对应的指甲区域长于所述手部图像中指甲的长度,并利用变形后的第一关键点更新相应的所述第一关键点。In step 503, deform the first key point so that the nail region corresponding to the deformed first key point is longer than the length of the nail in the hand image, and use the deformed first key point to update the corresponding The first key point of .
在本步骤中,可以将位于指甲上半部分的第一关键点,沿所述指甲的法线方向移动设定距离。其中,每个第一关键点移动的设定距离可以根据公式(1)进行计算。In this step, the first key point located at the upper half of the nail can be moved by a set distance along the normal direction of the nail. Wherein, the set distance moved by each first key point can be calculated according to the formula (1).
在步骤504中,根据所述第一关键点构建三角网格,并根据所述三角网格得到需要实现美甲效果的待处理区域。In step 504, a triangular mesh is constructed according to the first key point, and a region to be processed that needs to realize the nail art effect is obtained according to the triangular mesh.
在步骤505中,根据所述第一关键点对应的指甲素材上的纹理坐标,提取所述指甲素材的像素颜色。In step 505, the pixel color of the nail material is extracted according to the texture coordinates on the nail material corresponding to the first key point.
在本步骤中,所述指甲素材上可以标注有与第一关键点对应的第二关键点,根据所述第一关键点和所述第二关键点之间的对应关系,得到第一关键点对应的指甲素材上的纹理坐标;也可以根据其他方式获取第一关键点对应的指甲素材上的纹理坐标。In this step, the nail material may be marked with a second key point corresponding to the first key point, and the first key point is obtained according to the correspondence between the first key point and the second key point The texture coordinates on the corresponding nail material; the texture coordinates on the nail material corresponding to the first key point can also be acquired in other ways.
在步骤506中,根据设定融合系数,针对所述第一关键点对应的指甲素材的像素颜色和手部图像中原像素的颜色进行融合,得到新的颜色。具体地,可以根据公式(2)所指示的方式进行融合。In step 506, according to the set fusion coefficient, the pixel color of the nail material corresponding to the first key point is fused with the color of the original pixel in the hand image to obtain a new color. Specifically, fusion can be performed according to the manner indicated by formula (2).
在本步骤中,可以通过对第一关键点进行插值,得到待处理区域中各个坐标点对应的新的颜色,从而实现对手部图像的美甲效果。In this step, the new color corresponding to each coordinate point in the area to be processed can be obtained by interpolating the first key point, so as to realize the nail art effect on the hand image.
在本公开实施例中,通过对指甲对应的第一关键点进行插值以及变形处理,可以使待处理区域保持指甲的圆润形态,与真实指甲的形状更加一致;并通过将指甲素材的颜色与手部图像中原像素的颜色进行融合,可以使实现的美甲效果更加自然,也更加接近于真实的美甲效果。In the embodiment of the present disclosure, by performing interpolation and deformation processing on the first key point corresponding to the nail, the area to be treated can maintain the round shape of the nail, which is more consistent with the shape of the real nail; Blending the colors of the original pixels in the external image can make the nail art effect more natural and closer to the real nail art effect.
图6示出根据本公开至少一个实施例的图像处理装置的结构示意图,如图6所示,该装置可以包括:第一获取单元601,用于获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点;确定单元602,用于根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;第二获取单元603,用于获取指甲素材,所述指甲素材上标注有多个第二关键点;渲染单元604,用于根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。Fig. 6 shows a schematic structural diagram of an image processing device according to at least one embodiment of the present disclosure. As shown in Fig. 6, the device may include: a first acquisition unit 601, configured to acquire an image to be processed containing at least one nail A first key point of the nail, wherein each of the nails corresponds to a plurality of first key points; a determination unit 602, configured to determine the area to be treated of the nail according to the plurality of first key points of the nail; The second acquiring unit 603 is used to acquire the nail material marked with a plurality of second key points; the rendering unit 604 is used to obtain the nail material according to the correspondence between the first key point and the second key point relationship, rendering the nail material into the area to be processed to obtain a processed image.
在一些实施方式中,第一获取单元具体用于:将所述待处理图像输入指甲关键点检测网络,得到所述指甲的关键点检测结果;根据所述指甲的关键点检测结果得到所述指甲的第一关键点,或,对所述指甲的关键点检测结果进行插值处理,根据插值后的结果得到所述指甲的第一关键点。In some embodiments, the first acquisition unit is specifically configured to: input the image to be processed into the nail key point detection network to obtain the key point detection result of the nail; obtain the nail key point detection result according to the nail key point detection result. The first key point of the nail, or, perform interpolation processing on the key point detection result of the nail, and obtain the first key point of the nail according to the interpolated result.
在一些实施方式中,所述对所述指甲的关键点检测结果进行插值处理,包括:对所述指甲的关键点检测结果中的相邻关键点进行曲线插值;和/或;对所述指甲的关键点检测结果中的对称关键点进行线性插值。In some embodiments, the interpolation processing of the key point detection results of the nails includes: performing curve interpolation on adjacent key points in the key point detection results of the nails; and/or; Linear interpolation is performed on the symmetric keypoints in the keypoint detection results.
在一些实施方式中,所述装置还包括变形单元,用于:确定所述指甲的多个第一关键点中的目标关键点,所述目标关键点为设定对称关键点之间的连线与指甲顶端或指尖顶端对应的第一关键点之间的第一关键点;将所述目标关键点沿所述指甲的法线方向移动设定距离,其中,所述法线方向是根据所述指甲的多个第一关键点确定的;利用移动后的目标关键点更新相应的所述第一关键点。In some embodiments, the device further includes a deformation unit, configured to: determine a target key point among the plurality of first key points of the nail, and the target key point is to set a connecting line between symmetrical key points A first key point between the first key points corresponding to the top of the nail or the top of the fingertip; moving the target key point along the normal direction of the nail for a set distance, wherein the normal direction is based on the specified determined by multiple first key points of the nail; using the moved target key points to update the corresponding first key points.
在一些实施方式中,所述设定距离根据所述目标关键点与所述设定对称关键点之间的连线之间的第一距离、所述指甲顶端或指尖顶端对应的第一关键点与所述连线之间的第二距离,以及所述连线的长度确定,其中,所述设定距离与所述第一距离正相关,与所述第二距离负相关,与所述连线的长度负相关。In some implementations, the set distance is based on the first distance between the target key point and the line between the set symmetric key point and the first key corresponding to the top of the nail or fingertip. The second distance between the point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance, negatively correlated with the second distance, and correlated with the The length of the link is negatively correlated.
在一些实施方式中,所述渲染单元具体用于:根据所述第一关键点和所述第二关键点之间的对应关系,获取待处理坐标点对应的所述指甲素材中的纹理坐标,其中,所述待处理坐标点位于所述待处理区域内;获取所述纹理坐标处的所述指甲素材的第一像素值;根据所述待处理坐标点的第一像素值得到所述处理后的图像。In some implementations, the rendering unit is specifically configured to: acquire the texture coordinates in the nail material corresponding to the coordinate points to be processed according to the correspondence between the first key point and the second key point, Wherein, the coordinate point to be processed is located in the area to be processed; the first pixel value of the nail material at the texture coordinate is obtained; the processed Image.
在一些实施方式中,所述待处理坐标点包括:第一关键点以及第一插值点,其中,所述第一插值点位于所述待处理区域中,是根据所述第一关键点进行插值得到的;和/或,三角网格的顶点以及第二插值点,其中,所述第二插值点位于所述三角网格中,是根据所述三角网格的顶点进行插值得到的,所述三角网格是根据所述指甲的多个第一关键点构建的。In some implementations, the coordinate points to be processed include: a first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed, and is interpolated according to the first key point obtained; and/or, the vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh, the A triangular mesh is constructed from a plurality of first keypoints of the nail.
在一些实施方式中,所述装置还包括融合单元,用于:根据设定融合系数,对所述待处理坐标点的第一像素值和所述第二像素值进行加权处理,得到所述待处理坐标点的目标像素值;根据所述待处理坐标点的目标像素值得到所述处理后的图像。In some embodiments, the device further includes a fusion unit, configured to: perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to the set fusion coefficient to obtain the Processing the target pixel value of the coordinate point; obtaining the processed image according to the target pixel value of the coordinate point to be processed.
本公开至少一个实施例还提供了一种电子设备,如图7所示,所述设备包括存储器701、处理器702,存储器701用于存储可在处理器上运行的计算机指令,处理器702用于在执行所述计算机指令时实现本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure also provides an electronic device. As shown in FIG. 7 , the device includes a memory 701 and a processor 702. The image processing method described in any embodiment of the present disclosure is implemented when the computer instructions are executed.
本公开至少一个实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image processing method described in any embodiment of the present disclosure is implemented.
本公开至少一个实施例还提供了一种计算机程序产品,包括计算机程序,所述程序被处理器执行时实现本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure further provides a computer program product, including a computer program, when the program is executed by a processor, the image processing method described in any embodiment of the present disclosure is implemented.
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that one or more embodiments of this specification may be provided as a method, system or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. The form of the product.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于数据处理设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单, 相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiment.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的行为或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
本说明书中描述的主题及功能操作的实施例可以在以下中实现:数字电子电路、有形体现的计算机软件或固件、包括本说明书中公开的结构及其结构性等同物的计算机硬件、或者它们中的一个或多个的组合。本说明书中描述的主题的实施例可以实现为一个或多个计算机程序,即编码在有形非暂时性程序载体上以被数据处理装置执行或控制数据处理装置的操作的计算机程序指令中的一个或多个模块。可替代地或附加地,程序指令可以被编码在人工生成的传播信号上,例如机器生成的电、光或电磁信号,该信号被生成以将信息编码并传输到合适的接收机装置以由数据处理装置执行。计算机存储介质可以是机器可读存储设备、机器可读存储基板、随机或串行存取存储器设备、或它们中的一个或多个的组合。Embodiments of the subject matter and functional operations described in this specification can be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or in A combination of one or more of . Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, that is, one or more of computer program instructions encoded on a tangible, non-transitory program carrier for execution by or to control the operation of data processing apparatus. Multiple modules. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagated signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode and transmit information to a suitable receiver device for transmission by the data The processing means executes. A computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.
本说明书中描述的处理及逻辑流程可以由执行一个或多个计算机程序的一个或多个可编程计算机执行,以通过根据输入数据进行操作并生成输出来执行相应的功能。所述处理及逻辑流程还可以由专用逻辑电路—例如FPGA(现场可编程门阵列)或ASIC(专用集成电路)来执行,并且装置也可以实现为专用逻辑电路。The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output. The processes and logic flows can also be performed by, and apparatus can also be implemented as, special purpose logic circuitry, such as an FPGA (Field Programmable Gate Array) or an ASIC (Application Specific Integrated Circuit).
适合用于执行计算机程序的计算机包括,例如通用和/或专用微处理器,或任何其他类型的中央处理单元。通常,中央处理单元将从只读存储器和/或随机存取存储器接收指令和数据。计算机的基本组件包括用于实施或执行指令的中央处理单元以及用于存储指令和数据的一个或多个存储器设备。通常,计算机还将包括用于存储数据的一个或多个大容量存储设备,例如磁盘、磁光盘或光盘等,或者计算机将可操作地与此大容量存储设备耦接以从其接收数据或向其传送数据,抑或两种情况兼而有之。然而,计算机不是必须具有这样的设备。此外,计算机可以嵌入在另一设备中,例如移动电话、个人数字助理(PDA)、移动音频或视频播放器、游戏操纵台、全球定位系统(GPS)接收机、或例如通用串行总线(USB)闪存驱动器的便携式存储设备,仅举几例。Computers suitable for the execution of a computer program include, for example, general and/or special purpose microprocessors, or any other type of central processing unit. Generally, a central processing unit will receive instructions and data from a read only memory and/or a random access memory. The essential components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include, or be operatively coupled to, one or more mass storage devices for storing data, such as magnetic or magneto-optical disks, or optical disks, to receive data therefrom or to It transmits data, or both. However, a computer is not required to have such a device. In addition, a computer may be embedded in another device such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a Global Positioning System (GPS) receiver, or a device such as a Universal Serial Bus (USB) ) portable storage devices like flash drives, to name a few.
适合于存储计算机程序指令和数据的计算机可读介质包括所有形式的非易失性存储器、媒介和存储器设备,例如包括半导体存储器设备(例如EPROM、EEPROM 和闪存设备)、磁盘(例如内部硬盘或可移动盘)、磁光盘以及CD ROM和DVD-ROM盘。处理器和存储器可由专用逻辑电路补充或并入专用逻辑电路中。Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices (such as EPROM, EEPROM, and flash memory devices), magnetic disks (such as internal hard disks or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks. The processor and memory can be supplemented by, or incorporated in, special purpose logic circuitry.
虽然本说明书包含许多具体实施细节,但是这些不应被解释为限制任何发明的范围或所要求保护的范围,而是主要用于描述特定发明的具体实施例的特征。本说明书内在多个实施例中描述的某些特征也可以在单个实施例中被组合实施。另一方面,在单个实施例中描述的各种特征也可以在多个实施例中分开实施或以任何合适的子组合来实施。此外,虽然特征可以如上所述在某些组合中起作用并且甚至最初如此要求保护,但是来自所要求保护的组合中的一个或多个特征在一些情况下可以从该组合中去除,并且所要求保护的组合可以指向子组合或子组合的变型。While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any inventions or of what may be claimed, but rather as primarily describing features of particular embodiments of particular inventions. Certain features that are described in this specification in multiple embodiments can also be implemented in combination in a single embodiment. On the other hand, various features that are described in a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Furthermore, although features may function in certain combinations as described above and even be initially so claimed, one or more features from a claimed combination may in some cases be removed from that combination and the claimed A protected combination can point to a subcombination or a variant of a subcombination.
类似地,虽然在附图中以特定顺序描绘了操作,但是这不应被理解为要求这些操作以所示的特定顺序执行或顺次执行、或者要求所有例示的操作被执行,以实现期望的结果。在某些情况下,多任务和并行处理可能是有利的。此外,上述实施例中的各种系统模块和组件的分离不应被理解为在所有实施例中均需要这样的分离,并且应当理解,所描述的程序组件和系统通常可以一起集成在单个软件产品中,或者封装成多个软件产品。Similarly, while operations are depicted in the figures in a particular order, this should not be construed as requiring that those operations be performed in the particular order shown, or sequentially, or that all illustrated operations be performed, to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can often be integrated together in a single software product in, or packaged into multiple software products.
由此,主题的特定实施例已被描述。其他实施例在所附权利要求书的范围以内。在某些情况下,权利要求书中记载的动作可以以不同的顺序执行并且仍实现期望的结果。此外,附图中描绘的处理并非必需所示的特定顺序或顺次顺序,以实现期望的结果。在某些实现中,多任务和并行处理可能是有利的。Thus, certain embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some implementations, multitasking and parallel processing may be advantageous.
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in the scope of protection of one or more embodiments of this specification.

Claims (12)

  1. 一种图像处理方法,其特征在于,所述方法包括:An image processing method, characterized in that the method comprises:
    获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点;Acquiring a first key point of the nail in the image to be processed containing at least one nail, wherein each of the nails corresponds to a plurality of first key points;
    根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;determining a region to be treated of the nail according to a plurality of first key points of the nail;
    获取指甲素材,所述指甲素材上标注有多个第二关键点;Acquiring nail material, where multiple second key points are marked on the nail material;
    根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。According to the corresponding relationship between the first key point and the second key point, the nail material is rendered into the area to be processed to obtain a processed image.
  2. 根据权利要求1所述的方法,其特征在于,所述获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,包括:The method according to claim 1, wherein the acquiring the first key point of the nail in the image to be processed comprising at least one nail comprises:
    将所述待处理图像输入指甲关键点检测网络,得到所述指甲的关键点检测结果;Input the image to be processed into the nail key point detection network to obtain the key point detection result of the nail;
    根据所述指甲的关键点检测结果得到所述指甲的第一关键点,或,对所述指甲的关键点检测结果进行插值处理,根据插值后的结果得到所述指甲的第一关键点。Obtain the first key point of the nail according to the key point detection result of the nail, or perform interpolation processing on the key point detection result of the nail, and obtain the first key point of the nail according to the interpolated result.
  3. 根据权利要求2所述的方法,其特征在于,所述对所述指甲的关键点检测结果进行插值处理,包括:The method according to claim 2, wherein the interpolation processing of the key point detection results of the nails includes:
    对所述指甲的关键点检测结果中的相邻关键点进行曲线插值;和/或;Curve interpolation is performed on adjacent key points in the key point detection results of the nail; and/or;
    对所述指甲的关键点检测结果中的对称关键点进行线性插值。Linear interpolation is performed on the symmetrical key points in the key point detection results of the nail.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further comprises:
    确定所述指甲的多个第一关键点中的目标关键点,所述目标关键点为设定对称关键点之间的连线与指尖顶端对应的第一关键点之间的第一关键点;Determine the target key point among the plurality of first key points of the nail, the target key point is the first key point between the line between the symmetrical key points and the first key point corresponding to the top of the fingertip ;
    将所述目标关键点沿所述指甲的法线方向移动设定距离,其中,所述法线方向是根据所述指甲的多个第一关键点确定的;moving the target key point by a set distance along the normal direction of the nail, wherein the normal direction is determined according to a plurality of first key points of the nail;
    利用移动后的目标关键点更新相应的所述第一关键点。The corresponding first key point is updated by using the moved target key point.
  5. 根据权利要求4所述的方法,其特征在于,所述设定距离根据所述目标关键点与所述设定对称关键点之间的连线之间的第一距离、所述指尖顶端对应的第一关键点与所述连线之间的第二距离,以及所述连线的长度确定,其中,所述设定距离与所述第一距离正相关,与所述第二距离负相关,与所述连线的长度负相关。The method according to claim 4, wherein the set distance is based on the first distance between the connecting line between the target key point and the set symmetric key point, the top of the fingertip corresponds to The second distance between the first key point and the connecting line, and the length of the connecting line are determined, wherein the set distance is positively correlated with the first distance and negatively correlated with the second distance , which is negatively correlated with the length of the link.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像,包括:The method according to any one of claims 1 to 5, characterized in that, according to the corresponding relationship between the first key point and the second key point, the nail material is rendered to the In the processing area, the processed image is obtained, including:
    根据所述第一关键点和所述第二关键点之间的对应关系,获取待处理坐标点对应 的所述指甲素材中的纹理坐标,其中,所述待处理坐标点位于所述待处理区域内;According to the correspondence between the first key point and the second key point, the texture coordinates in the nail material corresponding to the coordinate points to be processed are obtained, wherein the coordinate points to be processed are located in the area to be processed Inside;
    获取所述纹理坐标处的所述指甲素材的第一像素值;Acquiring the first pixel value of the nail material at the texture coordinate;
    根据所述待处理坐标点的第一像素值得到所述处理后的图像。The processed image is obtained according to the first pixel value of the coordinate point to be processed.
  7. 根据权利要求6所述的方法,其特征在于,所述待处理坐标点包括:The method according to claim 6, wherein the coordinate points to be processed comprise:
    第一关键点以及第一插值点,其中,所述第一插值点位于所述待处理区域中,是根据所述第一关键点进行插值得到的;和/或,A first key point and a first interpolation point, wherein the first interpolation point is located in the area to be processed and is obtained by interpolation according to the first key point; and/or,
    三角网格的顶点以及第二插值点,其中,所述第二插值点位于所述三角网格中,是根据所述三角网格的顶点进行插值得到的,所述三角网格是根据所述指甲的多个第一关键点构建的。The vertices of the triangular mesh and the second interpolation point, wherein the second interpolation point is located in the triangular mesh and is obtained by interpolation according to the vertices of the triangular mesh, and the triangular mesh is obtained according to the Nails are built with multiple first key points.
  8. 根据权利要求6或7所述的方法,其特征在于,所述方法还包括:The method according to claim 6 or 7, characterized in that the method further comprises:
    获取所述待处理坐标点在所述待处理图像中的第二像素值;Acquiring a second pixel value of the coordinate point to be processed in the image to be processed;
    所述根据所述第一像素值得到所述处理后的图像,包括:The obtaining the processed image according to the first pixel value includes:
    根据设定融合系数,对所述待处理坐标点的第一像素值和所述第二像素值进行加权处理,得到所述待处理坐标点的目标像素值;Perform weighting processing on the first pixel value and the second pixel value of the coordinate point to be processed according to the set fusion coefficient to obtain the target pixel value of the coordinate point to be processed;
    根据所述待处理坐标点的目标像素值得到所述处理后的图像。The processed image is obtained according to the target pixel value of the coordinate point to be processed.
  9. 一种图像处理装置,其特征在于,所述装置包括:An image processing device, characterized in that the device comprises:
    第一获取单元,用于获取包含至少一个指甲的待处理图像中所述指甲的第一关键点,其中,每个所述指甲对应于多个第一关键点;A first acquisition unit, configured to acquire a first key point of the nail in the image to be processed including at least one nail, wherein each of the nails corresponds to a plurality of first key points;
    确定单元,用于根据所述指甲的多个第一关键点,确定所述指甲的待处理区域;A determination unit, configured to determine the area to be treated of the nail according to the plurality of first key points of the nail;
    第二获取单元,用于获取指甲素材,所述指甲素材上标注有多个第二关键点;The second acquiring unit is used to acquire the nail material, and the nail material is marked with a plurality of second key points;
    渲染单元,用于根据所述第一关键点和所述第二关键点之间的对应关系,将所述指甲素材渲染到所述待处理区域中,得到处理后的图像。A rendering unit, configured to render the nail material into the region to be processed according to the correspondence between the first key point and the second key point, to obtain a processed image.
  10. 一种电子设备,其特征在于,所述设备包括存储器、处理器,所述存储器用于存储在处理器上运行的计算机指令,所述处理器用于在执行所述计算机指令时实现权利要求1至8任一项所述的方法。An electronic device, characterized in that the device comprises a memory and a processor, the memory is used to store computer instructions executed on the processor, and the processor is used to implement claims 1 to 1 when executing the computer instructions. 8. The method described in any one.
  11. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现权利要求1至8任一所述的方法。A computer-readable storage medium, on which a computer program is stored, wherein, when the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
  12. 一种计算机程序产品,包括计算机程序,其特征在于,所述程序被处理器执行时实现权利要求1至8任一所述的方法。A computer program product, comprising a computer program, characterized in that, when the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
PCT/CN2021/140353 2021-06-25 2021-12-22 Image processing method and apparatus, device, and storage medium WO2022267402A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110713524.5 2021-06-25
CN202110713524.5A CN113222993A (en) 2021-06-25 2021-06-25 Image processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022267402A1 true WO2022267402A1 (en) 2022-12-29

Family

ID=77081408

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/140353 WO2022267402A1 (en) 2021-06-25 2021-12-22 Image processing method and apparatus, device, and storage medium

Country Status (3)

Country Link
CN (1) CN113222993A (en)
TW (1) TW202301179A (en)
WO (1) WO2022267402A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113222993A (en) * 2021-06-25 2021-08-06 北京市商汤科技开发有限公司 Image processing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111047526A (en) * 2019-11-22 2020-04-21 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium
CN112150580A (en) * 2019-06-28 2020-12-29 腾讯科技(深圳)有限公司 Image processing method and device, intelligent terminal and storage medium
CN112183388A (en) * 2020-09-30 2021-01-05 北京字节跳动网络技术有限公司 Image processing method, apparatus, device and medium
US10976829B1 (en) * 2019-06-03 2021-04-13 Facebook, Inc. Systems and methods for displaying augmented-reality objects
CN113222993A (en) * 2021-06-25 2021-08-06 北京市商汤科技开发有限公司 Image processing method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112991358A (en) * 2020-09-30 2021-06-18 北京字节跳动网络技术有限公司 Method for generating style image, method, device, equipment and medium for training model
CN112767288B (en) * 2021-03-19 2023-05-12 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10976829B1 (en) * 2019-06-03 2021-04-13 Facebook, Inc. Systems and methods for displaying augmented-reality objects
CN112150580A (en) * 2019-06-28 2020-12-29 腾讯科技(深圳)有限公司 Image processing method and device, intelligent terminal and storage medium
CN111047526A (en) * 2019-11-22 2020-04-21 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium
CN112183388A (en) * 2020-09-30 2021-01-05 北京字节跳动网络技术有限公司 Image processing method, apparatus, device and medium
CN113222993A (en) * 2021-06-25 2021-08-06 北京市商汤科技开发有限公司 Image processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113222993A (en) 2021-08-06
TW202301179A (en) 2023-01-01

Similar Documents

Publication Publication Date Title
US10043308B2 (en) Image processing method and apparatus for three-dimensional reconstruction
CN110058685B (en) Virtual object display method and device, electronic equipment and computer-readable storage medium
US9811894B2 (en) Image processing method and apparatus
US9865063B2 (en) Method and system for image feature extraction
CN110072046B (en) Image synthesis method and device
WO2020248900A1 (en) Panoramic video processing method and apparatus, and storage medium
WO2021082801A1 (en) Augmented reality processing method and apparatus, system, storage medium and electronic device
CN110070063B (en) Target object motion recognition method and device and electronic equipment
WO2014146561A1 (en) Thumbnail generating method and system
JP2022550948A (en) 3D face model generation method, device, computer device and computer program
CN107644423B (en) Scene segmentation-based video data real-time processing method and device and computing equipment
CN110084154B (en) Method and device for rendering image, electronic equipment and computer readable storage medium
CN111357034A (en) Point cloud generation method, system and computer storage medium
WO2022267402A1 (en) Image processing method and apparatus, device, and storage medium
CN111199169A (en) Image processing method and device
CN107766803B (en) Video character decorating method and device based on scene segmentation and computing equipment
CN108960012B (en) Feature point detection method and device and electronic equipment
CN109981989B (en) Method and device for rendering image, electronic equipment and computer readable storage medium
TWI711004B (en) Picture processing method and device
CN110309721B (en) Video processing method, terminal and storage medium
CN110047126B (en) Method, apparatus, electronic device, and computer-readable storage medium for rendering image
CN111258413A (en) Control method and device of virtual object
CN110941327A (en) Virtual object display method and device
EP3007137A1 (en) Image processing device, image processing method, and program
CN115086625A (en) Correction method, device and system of projection picture, correction equipment and projection 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: 21946876

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE