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

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

Info

Publication number
WO2022193466A1
WO2022193466A1 PCT/CN2021/102171 CN2021102171W WO2022193466A1 WO 2022193466 A1 WO2022193466 A1 WO 2022193466A1 CN 2021102171 W CN2021102171 W CN 2021102171W WO 2022193466 A1 WO2022193466 A1 WO 2022193466A1
Authority
WO
WIPO (PCT)
Prior art keywords
target area
target
image
points
adjusted
Prior art date
Application number
PCT/CN2021/102171
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 WO2022193466A1 publication Critical patent/WO2022193466A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/462Salient features, e.g. scale invariant feature transforms [SIFT]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person

Definitions

  • the present disclosure relates to the field of computer vision, and in particular, to an image processing method and apparatus, an electronic device and a storage medium.
  • the present disclosure proposes an image processing scheme.
  • an image processing method comprising:
  • the multiple pixel points in the target area are respectively performed Adjusting, determining the adjusted target area, including: dividing the to-be-processed image into a plurality of image grids; using pixels located on any of the image grids in the target area as target pixels; The position of the target pixel point and the position of the key point in the target area are adjusted, and a plurality of pixel points in the target area are adjusted to determine the adjusted target area.
  • the adjustment is performed on a plurality of pixels in the target area according to the position of the target pixel and the position of the key point in the target area, and the adjusted pixel is determined.
  • the target area includes: determining the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; adjusting the target area according to the first adjustment distance Adjust a plurality of pixels in the target area to determine the adjusted target area; or, according to the first adjustment distance, determine the second adjustment distance of the pixels located in the image grid in the target area; The second adjustment distance adjusts a plurality of pixels in the target area to determine the adjusted target area; or, according to the first adjustment distance or the second adjustment distance, adjusts the pixels in the target area Adjust multiple pixels to determine the adjusted target area.
  • the determining the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area includes: according to the target pixel point The relevant key points of the neck in the area are used to determine the first target position in the human object; according to the actual distance between the target pixel point and the first target position, the adjustment ratio of the target pixel point is determined; According to the adjustment ratio of the target pixel point and the preset distance, the first adjustment distance of the target pixel point is obtained.
  • the determining, according to the first adjustment distance, the second adjustment distance of the pixel points located in the image grid in the target area includes: adjusting the target pixel point The first adjustment distance is interpolated to obtain the second adjustment distance of the pixel point in the image grid where the target pixel point is located.
  • the adjustment is performed on a plurality of pixels in the target area according to the position of the target pixel and the position of the key point in the target area, and the adjusted pixel is determined.
  • the target area includes: determining the second target position in the human object according to the outline key points in the key points of the human object; according to the position of the target pixel point and the key point in the target area position, respectively adjusting a plurality of pixel points in the target area to the second target position to obtain an adjusted target area.
  • the determining the second target position in the human object according to the contour key points in the key points of the human object includes: adding the left shoulder included in the contour key points The center position of the area formed by the key point, the right shoulder key point, the left underarm key point, and the right underarm key point is taken as the second target position.
  • the acquiring the key points of the human object in the image to be processed and the target area of the human object includes: performing limb key point recognition and/or outline key point recognition on the image to be processed, and obtaining the object to be processed.
  • the generating the target image according to the to-be-processed image and the adjusted target area includes: rendering the material of the target area in the to-be-processed image to the adjusted target area. The location of the target area to generate the target image.
  • an image processing apparatus including:
  • an acquisition module used to acquire key points of the human object in the image to be processed and a target area of the human object, wherein the target area includes a neck area and/or a head area
  • an adjustment module used for according to the target area The positions of at least part of the pixel points in the area, and the positions of the key points in the target area, respectively adjust a plurality of pixel points in the target area to determine the adjusted target area
  • the target image generation module using generating a target image according to the to-be-processed image and the adjusted target area.
  • the adjustment module is configured to: divide the image to be processed into a plurality of image grids; use a pixel point located on any of the image grids in the target area as a target pixel point; according to the position of the target pixel point and the position of the key point in the target area, adjust a plurality of pixel points in the target area to determine the adjusted target area.
  • the adjustment module is further configured to: determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; Adjust a plurality of pixels in the target area according to the first adjustment distance to determine the adjusted target area; or, according to the first adjustment distance, determine that the image grid in the target area is located in the image grid the second adjustment distance of the pixels in the target area; adjust a plurality of pixels in the target area according to the second adjustment distance to determine the adjusted target area; or, according to the first adjustment distance or the The second adjustment distance is to adjust a plurality of pixel points in the target area to determine the adjusted target area.
  • the adjustment module is further configured to: determine the first target position in the human object according to the relevant key points of the neck in the target area; According to the actual distance between the first target positions, the adjustment ratio of the target pixel is determined; according to the adjustment ratio of the target pixel and the preset distance, the first adjustment distance of the target pixel is obtained.
  • the adjustment module is further configured to: perform interpolation processing on the first adjustment distance of the target pixel to obtain the second adjustment distance of the pixel in the image grid where the target pixel is located. Adjust the distance.
  • the adjustment module is configured to: determine the second target position in the human object according to the contour key points in the key points of the human object; according to the position of the target pixel point According to the position of the key point in the target area, a plurality of pixel points in the target area are respectively adjusted to the second target position to obtain an adjusted target area.
  • the adjustment module is further configured to: combine the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the outline key points into the area formed by the key point The center position of , as the second target position.
  • the acquisition module is configured to: perform body key point recognition and/or outline key point recognition on the image to be processed, and obtain the key points of the human object in the image to be processed, wherein the The key points include limb key points and/or contour key points; according to the key points of the human body object, the human body objects in the to-be-processed image are divided into regions to obtain multiple human body regions; from the multiple human body regions The neck region and/or head region are extracted to obtain the target region.
  • the target image generation module is configured to: render the material of the target area in the to-be-processed image to the adjusted position of the target area to generate the target image.
  • an electronic device comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to: execute the above image processing method.
  • a computer-readable storage medium having computer program instructions stored thereon, the computer program instructions implementing the above-mentioned image processing method when executed by a processor.
  • a computer program product comprising computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in an electronic device
  • the processor in the electronic device executes the image processing method described above.
  • the key points of the human object in the image to be processed and the target area of the human object are acquired, and the position of at least a part of the pixel points in the target area and the positions of the key points in the target area are adjusted to the target area.
  • a plurality of pixel points are adjusted respectively to determine an adjusted target area, so as to generate a target image based on the adjusted target area and the image to be processed.
  • FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
  • FIG. 2 shows a schematic diagram of a limb key point according to an embodiment of the present disclosure.
  • FIG. 3 shows a schematic diagram of contour key points according to an embodiment of the present disclosure.
  • FIG. 4 shows a schematic diagram of region division of a human object according to an embodiment of the present disclosure.
  • FIG. 5 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
  • FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
  • FIG. 7 shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure.
  • FIG. 8 shows a schematic diagram of an application example according to the present disclosure.
  • FIG. 9 shows a schematic diagram of an application example according to the present disclosure.
  • FIG. 10 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 11 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • the method can be applied to an image processing apparatus or an image processing system, and the image processing apparatus can be a terminal device, a server, or other processing devices.
  • the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, Personal Digital Assistant (PDA), handheld device, computing device, in-vehicle device, available wearable devices, etc.
  • the image processing method may be applied to a cloud server or a local server, and the cloud server may be a public cloud server or a private cloud server, which can be flexibly selected according to actual conditions.
  • the image processing method can also be implemented by the processor calling computer-readable instructions stored in the memory.
  • the image processing method may include:
  • Step S11 Acquire key points of the human object in the image to be processed and a target area of the human object, where the target area includes a neck area and/or a head area.
  • the image to be processed may be any image including a human body object, and the number of human body objects included in the to-be-processed image is not limited in the embodiments of the present disclosure, and may include one human body object or multiple human body objects. Human objects can be the same object or different objects.
  • the number of images to be processed is not limited in the embodiments of the present disclosure, and may be one or multiple. In the case of multiple images to be processed, the image processing method proposed in the embodiments of the present disclosure can simultaneously The image to be processed is processed.
  • the key points of the human object in the image to be processed, and the number and types of key points included in the key points are not limited in the embodiments of the present disclosure.
  • the key points of the human object may include limb key points and/or contour key points.
  • the limb key points may be key points used for locating various parts of the human body, and the implementation manner thereof may be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments.
  • FIG. 2 shows a schematic diagram of a limb key point according to an embodiment of the present disclosure.
  • the limb key point may include a head key point 0, a neck key point 1, and a left shoulder key point Point 2, Right Shoulder Key Point 3, Left Elbow Key Point 4, Right Elbow Key Point 5, Left Hand Key Point 6, Right Key Point 7, Left Hip Key Point 8, Right Hip Key Point 9, Left Knee Key Point 10, Right One or more of the key points such as the knee key point 11 , the left foot key point 12 , and the right foot key point 13 .
  • the contour key point may be a key point used for locating each part of the edge of the human body contour, and the implementation manner thereof may be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments.
  • 3 shows a schematic diagram of a contour key point according to an embodiment of the present disclosure. As shown in the figure, in a possible implementation manner, the contour key point may include at least one of 59 key points distributed along the body contour or multiple points.
  • the target area of the human object may be one or more areas in the image to be processed that have processing requirements, and the implementation method may be flexibly selected according to the actual situation.
  • the target area may only include the head area or the neck area; in a possible implementation, the target area may include both the head area and the neck area.
  • the division manner of the head area and the neck area can be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments.
  • the area between the head key point and the neck key point in the body key points may be divided into the head area, and the body key points located above the left shoulder key point and the right shoulder key point , and the area below the neck key point is divided into the neck area; in some possible implementations, it can also be divided into the head area and the neck area according to the assistance of the outline key points, for example, according to the left neck key in Figure 3
  • the area between point 0 and the right neck key point 58 is divided into neck area and so on.
  • the target area may not consider key points, but may be divided by other methods, such as directly performing area range recognition on the target area in the image to be processed.
  • step S11 can be flexibly selected according to the actual situation, which is not limited in this embodiment of the present disclosure.
  • the key points of the human object and the target area of the human object can be acquired at the same time; in some possible implementations, the key points of the human object can also be acquired first, and the target area is determined according to the key points; In some possible implementations, the target area can also be extracted from the human object first, and then the key points of the target area are identified to obtain the key points of the human object located in the target area.
  • Step S12 according to the positions of at least part of the pixel points in the target area and the positions of key points in the target area, respectively adjust a plurality of pixel points in the target area to determine the adjusted target area.
  • At least some of the pixels in the target area may be one or more pixels in the target area, and the at least some of the pixels may be used for subsequent adjustment of the entire target area.
  • the implementation of at least some of the pixels can be flexibly determined.
  • at least some of the pixels can be sampling points obtained by sampling the target area, or on the division boundary obtained by further dividing the target area. point and so on. How to obtain at least part of the pixel points, the implementation of which can be found in the following disclosed embodiments, which will not be expanded here.
  • the key points in the target area may be the key points located within the target area among the multiple key points obtained in step S11, such as the head key points or neck key points in the limb key points, and the outline key points.
  • the key points of the left neck or the right neck can be flexibly selected according to the actual situation.
  • a plurality of pixel points in the target area may be adjusted respectively to obtain the adjusted target area.
  • the number and type of pixels included in the plurality of pixels in the target area are not limited in the embodiments of the present disclosure.
  • the multiple pixels may be each pixel in the target area; in a possible implementation, the multiple pixels may include at least some of the pixels mentioned in the above disclosed embodiments point; in some possible implementations, the plurality of pixel points may also include other pixel points other than at least some of the pixel points in the target area, and the like.
  • How to adjust multiple pixels in the target area according to the positions of at least some of the pixels and key points in the target area, and the adjustment method can be flexibly determined according to the actual situation, for example, according to at least some of the pixels and the target area.
  • the position of the key point determines the adjustment direction and/or adjustment distance of multiple pixel points, etc., so as to realize operations such as stretching or deformation of the target area.
  • the adjusted target area may deform or move relative to the target area of the image to be processed. Compared with the target area in the image to be processed, the adjusted target area has a better visual effect.
  • Step S13 generating a target image according to the image to be processed and the adjusted target area.
  • the target image may be an image with better visual effect obtained after processing.
  • the method of generating the target image based on the image to be processed and the adjusted target area can be flexibly selected according to the actual situation, such as rendering the texture of the target area in the image to be processed to the position of the adjusted target area, or The target area is fused or superimposed with the image to be processed.
  • step S13 please refer to the subsequent disclosed embodiments, which will not be expanded here.
  • the key points of the human object in the image to be processed and the target area of the human object are acquired, and the position of at least a part of the pixel points in the target area and the positions of the key points in the target area are adjusted to the target area.
  • a plurality of pixel points are adjusted respectively to determine an adjusted target area, so as to generate a target image based on the adjusted target area and the image to be processed.
  • step S11 may include:
  • the human object in the image to be processed is divided into regions to obtain multiple human regions;
  • the neck region and/or head region are extracted from multiple body regions to obtain the target region.
  • the implementation of the limb key points and the outline key points can be found in the above disclosed embodiments.
  • the manner of performing limb key point identification and/or contour key point identification is not limited in the embodiments of the present disclosure.
  • it can be implemented through a neural network.
  • the images to be processed can be input into the limb key point recognition neural network and the contour key point recognition neural network respectively, so as to obtain the limb key points and contour key points respectively.
  • Process the position in the image; in a possible implementation, the image to be processed can also be directly input into the key point recognition neural network to obtain the limb key points and contour key points output by the key point recognition neural network in the image to be processed location, etc.
  • the manner of dividing the area of the human object in the image to be processed can be flexibly determined according to the actual situation.
  • 4 shows a schematic diagram of region division of a human object according to an embodiment of the present disclosure (in order to protect the object in the image, part of the face in the figure is subjected to mosaic processing, and the same is true for subsequent images), as shown in the figure
  • a plurality of limb key points and outline key points of the human object in the image to be processed can be obtained by identifying them as the key points of the human object, and some or all of the key points are formed by connecting them. Rectangular or other shaped regions to obtain multiple body regions of a human subject.
  • the method of extracting the neck region and/or head region from multiple human body regions can be flexibly determined according to the actual situation.
  • the head region can be extracted from the multiple human body regions.
  • the rectangular area formed by connecting the key points and the neck key points is used as the head area, and the rectangle formed by connecting the neck key points, left shoulder key points, right shoulder key points, left armpit key points, and right armpit key points, etc. area as the neck area.
  • key point recognition can be used to determine the position of each key point in the human body on the one hand, and provide an adjustment basis for the subsequent adjustment of the target area;
  • the target area is easily determined from the image to be processed and the overall efficiency of image processing is improved.
  • step S12 may include:
  • Step S121 Divide the image to be processed into a plurality of image grids.
  • dividing the image to be processed into a plurality of image grids may be the image grid division of the entire image to be processed, or the image grid division of a part of the image to be processed (such as the target area, etc.).
  • the shape of the image grid can also be flexibly determined according to the actual situation, and can be a triangle, a rectangle, or other polygons, etc., and in some possible implementations, it can also be divided into a fan shape or a circle, and the like.
  • the grid division method can be flexibly determined according to the actual situation.
  • the to-be-processed image or target area can be divided into a preset number of image grids, and the preset number of values can be determined according to the actual situation.
  • Flexible settings such as certain numerical values in the range of 10 to 90,000, etc., are not limited in the embodiments of the present disclosure.
  • the image to be processed may be evenly divided into a 112 ⁇ 112 rectangular image grid.
  • the image grid can also be divided by pixel sampling.
  • one or more sampling points can be extracted from the image to be processed by averaging or random sampling.
  • the adjacent sampling points in the one or more sampling points are connected to form any shape mentioned in the above disclosed embodiments, and then a plurality of image grids can be obtained.
  • step S122 a pixel point located on any image grid in the target area is used as a target pixel point.
  • At least part of the pixels from the target area may be determined as target pixels.
  • vertices on each image grid and/or points located on the edge of each image grid included in the target area may be used as target pixel points.
  • some of the image meshes included in the target area may be selected as the target image meshes, and then the vertices and/or the vertices of these target image meshes and/or located in the target image meshes may be selected.
  • the point on the edge of the image grid is used as the target pixel point.
  • the selection method of the target image grid is not limited in the embodiments of the present disclosure, and the target image grid can be determined by random sampling or sampling at specific intervals from all the image grids included in the target area;
  • the image grid to which the key points in the target area belong can be used as the target image grid, etc.
  • Step S123 according to the position of the target pixel point and the position of the key point in the target area, adjust a plurality of pixel points in the target area, and determine the adjusted target area.
  • a plurality of pixel points in the target area can be adjusted to determine the adjusted target area.
  • the adjustment method can be flexibly determined according to the actual situation. For details, please refer to the following disclosed embodiments, which will not be expanded here.
  • representative target pixels in the target area can be obtained by screening in a convenient way, reducing the computational complexity of data processing in image processing, and improving the overall speed and efficiency of image processing.
  • step S123 may include:
  • the first adjustment distance may be the distance that the target pixel needs to move during the adjustment process, and the method for determining the first adjustment distance can be flexibly changed according to different key points in the selected target area.
  • the disclosed embodiments are not expanded here.
  • the multiple pixels in the target area are adjusted according to the first adjustment distance, and the adjustment method can be flexibly changed.
  • a plurality of target pixels in the target area may be moved by a first adjustment distance, and the remaining pixels are not adjusted to obtain an adjusted target area; in a possible implementation, , it is also possible to move multiple target pixels in the target area by the first adjustment distance, and move the pixels in the image grid where the target pixels are located with the movement of the target pixels, and then obtain the adjusted target area.
  • the number of target pixels can be multiple, and the positions of different target pixels are different from the positions of key points in the target area, the corresponding first adjustment distances of different target pixels can vary, Therefore, after the adjustment based on the first adjustment distance, the multiple pixels in the target area still have a relatively natural overall effect on the basis of deformation, which realizes the gradual adjustment of the target area, and improves the effect and naturalness of image processing. degree.
  • step S123 may further include: determining, according to the first adjustment distance, a second adjustment distance of the pixels located in the image grid in the target area; pixel points are adjusted to determine the adjusted target area.
  • the second adjustment distance may be the distance that other pixels in the target area other than the target pixel need to move during the adjustment process, and the determination method of the second adjustment distance can be flexibly selected according to the actual situation,
  • the adjustment distance is interpolated, or the first adjustment distance corresponding to the target pixel that is closest to the remaining pixels is used as the adjustment distance of the remaining pixels.
  • determining the second adjustment distance please refer to the following disclosed embodiments, which will not be described here.
  • each pixel in the target area may be adjusted according to the second adjustment distance to obtain an adjusted target area; in a possible implementation, the target area may also be adjusted from the target Among the remaining pixels in the area except the target pixel, select some of the pixels by random or specific interval sampling, and adjust the selected part of the pixels according to the second adjustment distance to obtain the adjusted pixel. target area.
  • the continuity of pixel point adjustment in the target area can be further improved, thereby further improving the effect and naturalness of image processing.
  • step S123 may further include:
  • multiple pixels in the target area are adjusted to determine the adjusted target area.
  • the adjustment of multiple pixels in the target area may be to adjust the target pixels in the target area according to the first adjustment distance, and adjust the remaining pixels according to the second adjustment distance. Adjust the distance to make adjustments to determine the adjusted target area.
  • multiple pixels in the target area are adjusted according to the first adjustment distance or the second adjustment distance, and the adjustment method may be the fusion of the above disclosed embodiments, which will not be repeated here.
  • the overall progressive adjustment of most of the pixels in the target area can be achieved, which can further improve the effect and naturalness of image processing, and at the same time ensure the image Adjusted comprehensiveness and completeness.
  • the first adjustment distance of the target pixel point which may include:
  • Step S1231 determining the first target position in the human object according to the relevant key points of the neck in the target area;
  • Step S1232 according to the actual distance between the target pixel point and the first target position, determine the adjustment ratio of the target pixel point;
  • Step S1233 Obtain the first adjustment distance of the target pixel according to the adjustment ratio of the target pixel and the preset distance.
  • the relevant key points of the neck may include the neck key points among the limb key points mentioned in the above disclosed embodiments, and may also include the left neck key points and the contour key points mentioned in the above disclosed embodiments. Right neck key point.
  • the first target position may be the position coordinates used to calculate the first adjustment distance, and the first target position may be determined according to some key points in the relevant key points, or may be jointly determined by the relevant key points, and is not limited to the following disclosures. Example.
  • the first target position may be the middle position of the left neck key point and the right neck key point; in a possible implementation manner, the first target position may also be the position of the neck key point ; In a possible implementation manner, the first target position may also be the center position of the area determined by the three points of the left neck key point, the right neck key point and the neck key point.
  • the actual distance between the target pixel and the first target position can be determined.
  • the actual distance can be used to determine the adjustment ratio of the target pixel, wherein the adjustment ratio can reflect the degree of adjustment of the target pixel. How to determine the adjustment ratio according to the actual distance can be flexibly selected according to the actual situation.
  • the adjustment ratio can be inversely related to the actual distance, that is, the closer the pixel is to the first target position, the farther it moves during the adjustment process, so that the human object in the image to be processed can be stretched more naturally.
  • the length of the head and neck can achieve better human beautification.
  • the first adjustment distance of the target pixel point can be obtained.
  • the length of the preset distance can be flexibly set according to the actual situation.
  • the preset distance can be a fixed value; in some possible implementations, the preset distance can also be based on The actual situation in the image to be processed is determined flexibly.
  • the preset distance can be determined according to the length of the neck in the image to be processed, such as 0.1 to 2 times the length of the neck in the image to be processed, or other values range etc.
  • the manner of determining the first adjustment distance can be expressed by the following formula (1) and formula (2):
  • the first adjustment distance moves is the first adjustment distance
  • ratio is the adjustment ratio
  • the first target position is the middle position of the left neck key point and the right neck key point. It can be seen from the above formula that, in an example, the adjustment ratio is inverse to the actual distance. Therefore, the first adjustment distance is also inversely related to the actual distance.
  • the distance between the target pixel point and the neck related key points in the target area can be used to flexibly adjust different target pixel points by using different first adjustment distances, thereby further improving the adjustment of the target area.
  • the progressive nature of the process improves the naturalness and effect of the stretching effect while stretching the head and neck of the human subject in the image to be processed.
  • determining the second adjustment distance of the pixels located in the image grid in the target area according to the first adjustment distance may include:
  • the target pixel can be the vertex of the image grid or the pixel on the edge of the image grid. Therefore, in a possible implementation manner, the image grid where the target pixel is located The pixels in the image grid can be located between the vertices or edge points of the image grid. Based on the positional relationship between these pixels and the target pixel, these pixels can be determined by performing interpolation calculation through interpolation processing. the second adjustment distance.
  • the method of interpolation processing is not limited in the embodiments of the present disclosure, and any method that can realize interpolation calculation, such as Lagrangian interpolation, piecewise interpolation, etc., can be used as the realization method of interpolation processing.
  • interpolation processing can be used to quickly and conveniently determine the second adjustment distances of multiple pixels in the target area, thereby effectively reducing the computational complexity of image processing and improving the efficiency of image processing.
  • step S123 may include:
  • the plurality of pixel points in the target area are respectively adjusted to the second target position to obtain the adjusted target area.
  • the second target position may be a position used to determine the moving direction of a plurality of pixel points in the target area, and the position may be determined according to one or some key points in the contour key points.
  • the selection of the second target position can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments.
  • the center position of the area formed by the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the contour key points may be used as the second target position .
  • the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point may respectively correspond to the points 1, 57, 12 and 46 in FIG. 3 mentioned in the above disclosed embodiments.
  • the center position determined by the above points can be the center position of the chest in the human body object, and the center position is taken as the second target position, and the plurality of pixels in the target area of the head and neck are directed to the second target position.
  • the adjustment can naturally stretch the head and neck of the human object, increase the overall proportion of the length of the head and neck in the upper body of the human object, and effectively optimize the proportion of the upper body of the human object.
  • the method of adjusting the plurality of pixel points in the target area to the second target position respectively can refer to the above-mentioned various disclosed embodiments for determining the adjustment distance, and this is not the case here. Repeat.
  • Various implementation manners of step S123 in the embodiments of the present disclosure may be implemented by combining with each other, and the combining manners and sequences are not limited in the embodiments of the present disclosure.
  • the adjustment direction of each pixel point in the target area can be determined by using the second target position determined by the contour points of the human body, thereby effectively increasing the proportion of the adjusted target area in the human body object, and achieving better Effects optimized for human objects.
  • step S13 may include:
  • the material of the target area in the image to be processed may be image textures corresponding to multiple pixels in the target area in the image to be processed, such as color or shape, and its implementation can be flexibly based on the actual situation of the image to be processed Decide.
  • the manner of rendering the material of the target area to the position of the adjusted target area is not limited in the embodiments of the present disclosure.
  • the adjusted target area may be directly combined with the target area in the image to be processed.
  • the corresponding relationship between pixel points is used to realize the rendering of the corresponding texture; in some possible implementations, each target pixel point contained in the target area can also be connected into a triangular mesh, and then based on the triangular mesh, the material rendering is realized, etc. .
  • the original image form of the target area can be maintained while adjusting the target area, so that the obtained target image is more natural and real, and the effect of image processing is improved.
  • FIG. 7 shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure.
  • the image processing apparatus 20 may include:
  • the acquiring module 21 is configured to acquire the key points of the human object in the image to be processed and the target area of the human object, wherein the target area includes the neck area and/or the head area.
  • the adjustment module 22 is configured to adjust a plurality of pixel points in the target area according to the positions of at least some of the pixel points in the target area and the positions of key points in the target area to determine the adjusted target area.
  • the target image generation module 23 is configured to generate a target image according to the image to be processed and the adjusted target area.
  • the adjustment module is used to: divide the image to be processed into a plurality of image grids; use the pixels located on any image grid in the target area as target pixels; The position and the position of the key points in the target area are adjusted to multiple pixel points in the target area to determine the adjusted target area.
  • the adjustment module is further configured to: determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; A plurality of pixel points are adjusted to determine the adjusted target area; or, according to the first adjustment distance, the second adjustment distance of the pixel points located in the image grid in the target area is determined; Adjusting multiple pixels to determine the adjusted target area; or, adjusting multiple pixels in the target area according to the first adjustment distance or the second adjustment distance to determine the adjusted target area.
  • the adjustment module is further configured to: determine the first target position in the human object according to the relevant key points of the neck in the target area; according to the actual distance between the target pixel point and the first target position , determine the adjustment ratio of the target pixel point; obtain the first adjustment distance of the target pixel point according to the adjustment ratio of the target pixel point and the preset distance.
  • the adjustment module is further configured to: perform interpolation processing on the first adjustment distance of the target pixel point to obtain the second adjustment distance of the pixel point in the image grid where the target pixel point is located.
  • the adjustment module is used to: determine the second target position in the human object according to the contour key points in the key points of the human object; according to the position of the target pixel point and the position of the key point in the target area , respectively adjusting a plurality of pixel points in the target area to the second target position to obtain an adjusted target area.
  • the adjustment module is further used to: set the center position of the area formed by the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the contour key points, as the second target location.
  • the acquisition module is used to: perform limb key point recognition and/or outline key point recognition on the image to be processed, and obtain key points of the human object in the image to be processed, wherein the key points of the human object include limbs key points and/or contour key points; according to the key points of the human object, the human object in the image to be processed is divided into regions to obtain multiple human body regions; the neck region and/or head region are extracted from the multiple human body regions, Get the target area.
  • the target image generation module is used for: rendering the material of the target area in the to-be-processed image to the adjusted position of the target area to generate the target image.
  • FIGS 8 and 9 show schematic diagrams of an application example of the present disclosure.
  • the application example of the present disclosure proposes an image processing method, and the image processing method may include the following processes:
  • the image to be processed is divided into 112*112 rectangular image grids (the grid in the figure is only an exemplary division, and the actual division method is more dense).
  • the target area may be the area where the head and neck are located.
  • the vertices of the image grid contained in the target area are used as target pixels.
  • some solid points in the figure are some exemplary representations of target pixels, and these target pixels are respectively directed to the second target position.
  • the moving distance of the target pixel point ie, the first adjustment distance
  • formula (1) and formula (2) in the above disclosed embodiments.
  • Move the pixels within the image grid in the target area to the second target position, and the moving distance (ie the second adjustment distance) of the pixels within the image grid can be determined according to the first position of the vertex of the image grid to which it belongs. Adjust the distance to interpolate.
  • the texture corresponding to the target area in the image to be processed is rendered to the position of the adjusted target area, and the processed target image can be obtained, as shown in Figure 9. It can be seen from the comparison that the processed target image, Human subjects have better head-to-neck ratios, and the overall look of the image is very natural.
  • the image processing method proposed in the application example of the present disclosure can not only stretch the head and neck of the human object in the target image, but also can be extended to other parts of the human object.
  • For the implementation method refer to the above disclosed embodiments. It is not repeated here.
  • the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
  • the computer-readable storage medium may be a volatile computer-readable storage medium or a non-volatile computer-readable storage medium.
  • An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to perform the above method.
  • Embodiments of the present disclosure also provide a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device When running, the processor in the electronic device executes the above method.
  • the above-mentioned memory can be a volatile memory (volatile memory), such as RAM; or a non-volatile memory (non-volatile memory), such as ROM, flash memory (flash memory), hard disk (Hard Disk Drive) , HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memory, and provide instructions and data to the processor.
  • volatile memory such as RAM
  • non-volatile memory such as ROM, flash memory (flash memory), hard disk (Hard Disk Drive) , HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memory, and provide instructions and data to the processor.
  • the above-mentioned processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It can be understood that, for different devices, the electronic device used to implement the function of the processor may also be other, which is not specifically limited in the embodiment of the present disclosure.
  • the electronic device may be provided as a terminal, server or other form of device.
  • an embodiment of the present disclosure further provides a computer program, which implements the above method when the computer program is executed by a processor.
  • FIG. 10 is a block diagram of an electronic device 800 according to an embodiment of the present disclosure.
  • electronic device 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. terminal.
  • an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814 , and the communication component 816 .
  • the processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above.
  • processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components.
  • processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. Memory 804 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • Power supply assembly 806 provides power to various components of electronic device 800 .
  • Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
  • Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 810 is configured to output and/or input audio signals.
  • audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 800 is in operating modes, such as calling mode, recording mode, and voice recognition mode.
  • the received audio signal may be further stored in memory 804 or transmitted via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 .
  • the sensor assembly 814 can detect the on/off state of the electronic device 800, the relative positioning of the components, such as the display and the keypad of the electronic device 800, the sensor assembly 814 can also detect the electronic device 800 or one of the electronic device 800 Changes in the position of components, presence or absence of user contact with the electronic device 800 , orientation or acceleration/deceleration of the electronic device 800 and changes in the temperature of the electronic device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices.
  • Electronic device 800 may access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related personnel information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
  • NFC near field communication
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmed gate array
  • controller microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • a non-volatile computer-readable storage medium such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
  • FIG. 11 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure.
  • the electronic device 1900 may be provided as a server.
  • electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource, represented by memory 1932, for storing instructions executable by processing component 1922, such as applications.
  • An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions.
  • the processing component 1922 is configured to execute instructions to perform the above-described methods.
  • the electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input output (I/O) interface 1958 .
  • Electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
  • a non-volatile computer-readable storage medium such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
  • the present disclosure may be a system, method and/or computer program product.
  • the computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
  • a computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Non-exhaustive list of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM) or flash memory), static random access memory (SRAM), portable compact disk read only memory (CD-ROM), digital versatile disk (DVD), memory sticks, floppy disks, mechanically coded devices, such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • flash memory static random access memory
  • SRAM static random access memory
  • CD-ROM compact disk read only memory
  • DVD digital versatile disk
  • memory sticks floppy disks
  • mechanically coded devices such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • Computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
  • the computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • a network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
  • Computer program instructions for carrying out operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages.
  • Source or object code written in any combination, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as the "C" language or similar programming languages.
  • the computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through the Internet connect).
  • electronic circuits such as programmable logic circuits, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state personnel information of computer readable program instructions.
  • Computer readable program instructions can be executed to implement various aspects of the present disclosure.
  • These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • Apparatus For Radiation Diagnosis (AREA)
  • Image Processing (AREA)

Abstract

The present disclosure relates to an image processing method and apparatus, and an electronic device and a storage medium. The method comprises: acquiring a key point of a human body object in an image to be processed and a target region of the human body object, wherein the target region comprises a neck region and/or a head region; according to the positions of at least some of the pixel points in the target region and the position of the key point in the target region, respectively adjusting a plurality of pixel points in the target region, so as to determine an adjusted target region; and generating a target image according to said image and the adjusted target region.

Description

图像处理方法及装置、电子设备和存储介质Image processing method and device, electronic device and storage medium
本申请要求在2021年03月19日提交中国专利局、申请号为202110297088.8、申请名称为“图像处理方法及装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110297088.8 and the application title "Image Processing Method and Device, Electronic Device and Storage Medium" filed with the China Patent Office on March 19, 2021, the entire contents of which are incorporated by reference in this application.
技术领域technical field
本公开涉及计算机视觉领域,尤其涉及一种图像处理方法及装置、电子设备和存储介质。The present disclosure relates to the field of computer vision, and in particular, to an image processing method and apparatus, an electronic device and a storage medium.
背景技术Background technique
随着计算机视觉技术的发展,对图像中的人物进行美化已成为一种愈发常见的操作。然而美化的功能往往局限于面部的妆容修改,或是针对腿部和腰部的瘦身,如何全面自然地对人体进行美化,成为目前一个亟待解决的问题。With the development of computer vision technology, beautifying people in images has become an increasingly common operation. However, the function of beautification is often limited to the modification of facial makeup, or the slimming of legs and waist. How to beautify the human body in a comprehensive and natural way has become an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本公开提出了一种图像处理方案。The present disclosure proposes an image processing scheme.
根据本公开的一方面,提供了一种图像处理方法,包括:According to an aspect of the present disclosure, an image processing method is provided, comprising:
获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,其中,所述目标区域包括颈部区域和/或头部区域;根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域;根据所述待处理图像以及所述调整后的目标区域,生成目标图像。Acquiring key points of a human object in the image to be processed and a target area of the human object, wherein the target area includes a neck area and/or a head area; according to the positions of at least some of the pixels in the target area, and The positions of the key points in the target area are adjusted respectively for a plurality of pixel points in the target area to determine the adjusted target area; according to the to-be-processed image and the adjusted target area, generate target image.
在一种可能的实现方式中,所述根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域,包括:将所述待处理图像划分为多个图像网格;将所述目标区域中位于任一所述图像网格上的像素点作为目标像素点;根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, according to the positions of at least part of the pixel points in the target area and the positions of the key points in the target area, the multiple pixel points in the target area are respectively performed Adjusting, determining the adjusted target area, including: dividing the to-be-processed image into a plurality of image grids; using pixels located on any of the image grids in the target area as target pixels; The position of the target pixel point and the position of the key point in the target area are adjusted, and a plurality of pixel points in the target area are adjusted to determine the adjusted target area.
在一种可能的实现方式中,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域,包括:根据所述目标像素点的位置与所述目标区域中所述关键点的位置,确定所述目标像素点的第一调整距离;根据所述第一调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据所述第一调整距离,确定所述目标区域中位于所述图像网格内的像素点的第二调整距离;根据所述第二调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据所述第一调整距离或所述第二调整距离,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, the adjustment is performed on a plurality of pixels in the target area according to the position of the target pixel and the position of the key point in the target area, and the adjusted pixel is determined. The target area includes: determining the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; adjusting the target area according to the first adjustment distance Adjust a plurality of pixels in the target area to determine the adjusted target area; or, according to the first adjustment distance, determine the second adjustment distance of the pixels located in the image grid in the target area; The second adjustment distance adjusts a plurality of pixels in the target area to determine the adjusted target area; or, according to the first adjustment distance or the second adjustment distance, adjusts the pixels in the target area Adjust multiple pixels to determine the adjusted target area.
在一种可能的实现方式中,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,确定所述目标像素点的第一调整距离,包括:根据所述目标区域中颈部的相关关键点,确定所述人体对象中的第一目标位置;根据所述目标像素点与所述第一目标位置之间的实际距离,确定所述目标像素点的调整比例;根据所述目标像素点的调整比例,以及预设距离,得到所述目标像素点的第一调整距离。In a possible implementation manner, the determining the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area includes: according to the target pixel point The relevant key points of the neck in the area are used to determine the first target position in the human object; according to the actual distance between the target pixel point and the first target position, the adjustment ratio of the target pixel point is determined; According to the adjustment ratio of the target pixel point and the preset distance, the first adjustment distance of the target pixel point is obtained.
在一种可能的实现方式中,所述根据所述第一调整距离,确定所述目标区域中位于所述图像网格内的像素点的第二调整距离,包括:对所述目标像素点的第一调整距离进行插值处理,得到所述目标像素点所在的图像网格内的像素点的第二调整距离。In a possible implementation manner, the determining, according to the first adjustment distance, the second adjustment distance of the pixel points located in the image grid in the target area includes: adjusting the target pixel point The first adjustment distance is interpolated to obtain the second adjustment distance of the pixel point in the image grid where the target pixel point is located.
在一种可能的实现方式中,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域,包括:根据所述人体对象的关键点中的轮廓关键点,确定所述人体对象中的第二目标位置; 根据所述目标像素点的位置与所述目标区域中所述关键点的位置,分别将所述目标区域中的多个像素点向所述第二目标位置进行调整,得到调整后的目标区域。In a possible implementation manner, the adjustment is performed on a plurality of pixels in the target area according to the position of the target pixel and the position of the key point in the target area, and the adjusted pixel is determined. The target area includes: determining the second target position in the human object according to the outline key points in the key points of the human object; according to the position of the target pixel point and the key point in the target area position, respectively adjusting a plurality of pixel points in the target area to the second target position to obtain an adjusted target area.
在一种可能的实现方式中,所述根据所述人体对象的关键点中的轮廓关键点,确定所述人体对象中的第二目标位置,包括:将所述轮廓关键点中包括的左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点所构成区域的中心位置,作为所述第二目标位置。In a possible implementation manner, the determining the second target position in the human object according to the contour key points in the key points of the human object includes: adding the left shoulder included in the contour key points The center position of the area formed by the key point, the right shoulder key point, the left underarm key point, and the right underarm key point is taken as the second target position.
在一种可能的实现方式中,所述获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,包括:对待处理图像进行肢体关键点识别和/或轮廓关键点识别,得到待处理图像中人体对象的关键点,其中,所述人体对象的关键点包括肢体关键点和/或轮廓关键点;根据所述人体对象的关键点,对所述待处理图像中的人体对象进行区域划分,得到多个人体区域;从所述多个人体区域中提取颈部区域和/或头部区域,得到所述目标区域。In a possible implementation manner, the acquiring the key points of the human object in the image to be processed and the target area of the human object includes: performing limb key point recognition and/or outline key point recognition on the image to be processed, and obtaining the object to be processed. Process the key points of the human object in the image, wherein the key points of the human object include limb key points and/or outline key points; according to the key points of the human object, the human object in the to-be-processed image is subjected to a region analysis. Divide to obtain a plurality of human body regions; extract a neck region and/or a head region from the plurality of human body regions to obtain the target region.
在一种可能的实现方式中,所述根据所述待处理图像以及所述调整后的目标区域,生成目标图像,包括:将所述待处理图像中目标区域的素材,渲染至所述调整后的目标区域位置,生成目标图像。In a possible implementation manner, the generating the target image according to the to-be-processed image and the adjusted target area includes: rendering the material of the target area in the to-be-processed image to the adjusted target area. The location of the target area to generate the target image.
根据本公开的一方面,提供了一种图像处理装置,包括:According to an aspect of the present disclosure, an image processing apparatus is provided, including:
获取模块,用于获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,其中,所述目标区域包括颈部区域和/或头部区域;调整模块,用于根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域;目标图像生成模块,用于根据所述待处理图像以及所述调整后的目标区域,生成目标图像。an acquisition module, used to acquire key points of the human object in the image to be processed and a target area of the human object, wherein the target area includes a neck area and/or a head area; an adjustment module, used for according to the target area The positions of at least part of the pixel points in the area, and the positions of the key points in the target area, respectively adjust a plurality of pixel points in the target area to determine the adjusted target area; the target image generation module, using generating a target image according to the to-be-processed image and the adjusted target area.
在一种可能的实现方式中,所述调整模块用于:将所述待处理图像划分为多个图像网格;将所述目标区域中位于任一所述图像网格上的像素点作为目标像素点;根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, the adjustment module is configured to: divide the image to be processed into a plurality of image grids; use a pixel point located on any of the image grids in the target area as a target pixel point; according to the position of the target pixel point and the position of the key point in the target area, adjust a plurality of pixel points in the target area to determine the adjusted target area.
在一种可能的实现方式中,所述调整模块进一步用于:根据所述目标像素点的位置与所述目标区域中所述关键点的位置,确定所述目标像素点的第一调整距离;根据所述第一调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据所述第一调整距离,确定所述目标区域中位于所述图像网格内的像素点的第二调整距离;根据所述第二调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据所述第一调整距离或所述第二调整距离,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, the adjustment module is further configured to: determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; Adjust a plurality of pixels in the target area according to the first adjustment distance to determine the adjusted target area; or, according to the first adjustment distance, determine that the image grid in the target area is located in the image grid the second adjustment distance of the pixels in the target area; adjust a plurality of pixels in the target area according to the second adjustment distance to determine the adjusted target area; or, according to the first adjustment distance or the The second adjustment distance is to adjust a plurality of pixel points in the target area to determine the adjusted target area.
在一种可能的实现方式中,所述调整模块进一步用于:根据所述目标区域中颈部的相关关键点,确定所述人体对象中的第一目标位置;根据所述目标像素点与所述第一目标位置之间的实际距离,确定所述目标像素点的调整比例;根据所述目标像素点的调整比例,以及预设距离,得到所述目标像素点的第一调整距离。In a possible implementation manner, the adjustment module is further configured to: determine the first target position in the human object according to the relevant key points of the neck in the target area; According to the actual distance between the first target positions, the adjustment ratio of the target pixel is determined; according to the adjustment ratio of the target pixel and the preset distance, the first adjustment distance of the target pixel is obtained.
在一种可能的实现方式中,所述调整模块进一步用于:对所述目标像素点的第一调整距离进行插值处理,得到所述目标像素点所在的图像网格内的像素点的第二调整距离。In a possible implementation manner, the adjustment module is further configured to: perform interpolation processing on the first adjustment distance of the target pixel to obtain the second adjustment distance of the pixel in the image grid where the target pixel is located. Adjust the distance.
在一种可能的实现方式中,所述调整模块用于:根据所述人体对象的关键点中的轮廓关键点,确定所述人体对象中的第二目标位置;根据所述目标像素点的位置与所述目标区域中所述关键点的位置,分别将所述目标区域中的多个像素点向所述第二目标位置进行调整,得到调整后的目标区域。In a possible implementation manner, the adjustment module is configured to: determine the second target position in the human object according to the contour key points in the key points of the human object; according to the position of the target pixel point According to the position of the key point in the target area, a plurality of pixel points in the target area are respectively adjusted to the second target position to obtain an adjusted target area.
在一种可能的实现方式中,所述调整模块进一步用于:将所述轮廓关键点中包括的左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点所构成区域的中心位置,作为所述第二目标位置。In a possible implementation manner, the adjustment module is further configured to: combine the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the outline key points into the area formed by the key point The center position of , as the second target position.
在一种可能的实现方式中,所述获取模块用于:对待处理图像进行肢体关键点识别和/或轮廓关键点识别,得到待处理图像中人体对象的关键点,其中,所述人体对象的关键点包括肢体关键点和/或轮廓关键点;根据所述人体对象的关键点,对所述待处理图像中的人体对象进行区域划分,得到多个人体区域;从所述多个人体区域中提取颈部区域和/或头部区域,得到所述目标区域。In a possible implementation manner, the acquisition module is configured to: perform body key point recognition and/or outline key point recognition on the image to be processed, and obtain the key points of the human object in the image to be processed, wherein the The key points include limb key points and/or contour key points; according to the key points of the human body object, the human body objects in the to-be-processed image are divided into regions to obtain multiple human body regions; from the multiple human body regions The neck region and/or head region are extracted to obtain the target region.
在一种可能的实现方式中,所述目标图像生成模块用于:将所述待处理图像中目标区域的素材,渲染至所述调整后的目标区域位置,生成目标图像。In a possible implementation manner, the target image generation module is configured to: render the material of the target area in the to-be-processed image to the adjusted position of the target area to generate the target image.
根据本公开的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:执行上述图像处理方法。According to an aspect of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to: execute the above image processing method.
根据本公开的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述图像处理方法。According to an aspect of the present disclosure, there is provided a computer-readable storage medium having computer program instructions stored thereon, the computer program instructions implementing the above-mentioned image processing method when executed by a processor.
根据本公开的一方面,提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行用于实现上述图像处理方法。According to an aspect of the present disclosure, a computer program product is provided, comprising computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in an electronic device When running in the processor, the processor in the electronic device executes the image processing method described above.
在本公开实施例中,通过获取待处理图像中人体对象的关键点以及人体对象的目标区域,并根据目标区域中至少部分像素点的位置,以及目标区域中关键点的位置对目标区域中的多个像素点分别进行调整,确定调整后的目标区域,从而基于调整后的目标区域与待处理图像来生成目标图像。通过上述过程,一方面可以对目标图像中人体对象的头颈部等目标区域进行美化,提升人体美化的全面性和自然程度;另一方面根据目标区域中的至少部分像素点来对目标区域中的多个像素点进行调整,可以减少调整过程中处理的数据量,提高美化的效率和效果。In the embodiment of the present disclosure, the key points of the human object in the image to be processed and the target area of the human object are acquired, and the position of at least a part of the pixel points in the target area and the positions of the key points in the target area are adjusted to the target area. A plurality of pixel points are adjusted respectively to determine an adjusted target area, so as to generate a target image based on the adjusted target area and the image to be processed. Through the above process, on the one hand, the target area such as the head and neck of the human object in the target image can be beautified, so as to improve the comprehensiveness and naturalness of the human body beautification; It can reduce the amount of data processed in the adjustment process and improve the efficiency and effect of beautification.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the technical solutions of the present disclosure.
图1示出根据本公开一实施例的图像处理方法的流程图。FIG. 1 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
图2示出根据本公开一实施例的肢体关键点的示意图。FIG. 2 shows a schematic diagram of a limb key point according to an embodiment of the present disclosure.
图3示出根据本公开一实施例的轮廓关键点的示意图。FIG. 3 shows a schematic diagram of contour key points according to an embodiment of the present disclosure.
图4示出根据本公开一实施例的对人体对象进行区域划分的示意图。FIG. 4 shows a schematic diagram of region division of a human object according to an embodiment of the present disclosure.
图5示出根据本公开一实施例的图像处理方法的流程图。FIG. 5 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
图6示出根据本公开一实施例的图像处理方法的流程图。FIG. 6 shows a flowchart of an image processing method according to an embodiment of the present disclosure.
图7示出根据本公开一实施例的图像处理装置的框图。FIG. 7 shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure.
图8示出根据本公开一应用示例的示意图。FIG. 8 shows a schematic diagram of an application example according to the present disclosure.
图9示出根据本公开一应用示例的示意图。FIG. 9 shows a schematic diagram of an application example according to the present disclosure.
图10示出根据本公开实施例的一种电子设备的框图。FIG. 10 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
图11示出根据本公开实施例的一种电子设备的框图。FIG. 11 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures denote elements that have the same or similar functions. While various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and A and B exist independently B these three cases. In addition, the term "at least one" herein refers to any combination of any one of the plurality or at least two of the plurality, for example, including at least one of A, B, and C, and may mean including from A, B, and C. Any one or more elements selected from the set of B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are set forth in the following detailed description. It will be understood by those skilled in the art that the present disclosure may be practiced without certain specific details. In some instances, methods, means, components and circuits well known to those skilled in the art have not been described in detail so as not to obscure the subject matter of the present disclosure.
图1示出根据本公开一实施例的图像处理方法的流程图,该方法可以应用于图像处理装置或图像处理系统等,图像处理装置可以为终端设备、服务器或者其他处理设备等。其中,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等。在一个示例中,该图像处理方法可以应用于云端服务器或本地服务器,云端服务器可以为公有云服务器,也可以为私有云服务器,根据实际情况灵活选择即可。1 shows a flowchart of an image processing method according to an embodiment of the present disclosure. The method can be applied to an image processing apparatus or an image processing system, and the image processing apparatus can be a terminal device, a server, or other processing devices. Wherein, the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, Personal Digital Assistant (PDA), handheld device, computing device, in-vehicle device, available wearable devices, etc. In one example, the image processing method may be applied to a cloud server or a local server, and the cloud server may be a public cloud server or a private cloud server, which can be flexibly selected according to actual conditions.
在一些可能的实现方式中,该图像处理方法也可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。In some possible implementations, the image processing method can also be implemented by the processor calling computer-readable instructions stored in the memory.
如图1所示,在一种可能的实现方式中,所述图像处理方法可以包括:As shown in FIG. 1, in a possible implementation manner, the image processing method may include:
步骤S11,获取待处理图像中人体对象的关键点以及人体对象的目标区域,其中,目标区域包括颈部区域和/或头部区域。Step S11: Acquire key points of the human object in the image to be processed and a target area of the human object, where the target area includes a neck area and/or a head area.
其中,待处理图像可以是包含人体对象的任意图像,待处理图像中包含的人体对象的数量在本公开实施例中不做限制,可以包含一个人体对象,也可以包含多个人体对象,不同的人体对象可以为相同的对象,也可以为不同的对象。The image to be processed may be any image including a human body object, and the number of human body objects included in the to-be-processed image is not limited in the embodiments of the present disclosure, and may include one human body object or multiple human body objects. Human objects can be the same object or different objects.
待处理图像的数量在本公开实施例中也不做限制,可以为一个也可以为多个,在待处理图像为多个的情况下,本公开实施例提出的图像处理方法可以同时对多个待处理图像进行处理。The number of images to be processed is not limited in the embodiments of the present disclosure, and may be one or multiple. In the case of multiple images to be processed, the image processing method proposed in the embodiments of the present disclosure can simultaneously The image to be processed is processed.
待处理图像中人体对象的关键点,其包含的关键点数量与种类在本公开实施例中均不做限制。在一种可能的实现方式中,人体对象的关键点可以包括肢体关键点和/或轮廓关键点。The key points of the human object in the image to be processed, and the number and types of key points included in the key points are not limited in the embodiments of the present disclosure. In a possible implementation, the key points of the human object may include limb key points and/or contour key points.
其中,肢体关键点可以是用于对人体中的各部位进行定位的关键点,其实现方式可以根据实际情况灵活选择,不局限于下述各公开实施例。图2示出根据本公开一实施例的肢体关键点的示意图,如图所示,在一种可能的实现方式中,肢体关键点可以包括头部关键点0、颈部关键点1、左肩关键点2、右肩关键点3、左肘关键点4、右肘关键点5、左手关键点6、右手关键点7、左胯骨关键点8、右胯骨关键点9、左膝关键点10、右膝关键点11、左脚关键点12以及右脚关键点13等关键点中的一个或多个点。The limb key points may be key points used for locating various parts of the human body, and the implementation manner thereof may be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments. FIG. 2 shows a schematic diagram of a limb key point according to an embodiment of the present disclosure. As shown in the figure, in a possible implementation manner, the limb key point may include a head key point 0, a neck key point 1, and a left shoulder key point Point 2, Right Shoulder Key Point 3, Left Elbow Key Point 4, Right Elbow Key Point 5, Left Hand Key Point 6, Right Key Point 7, Left Hip Key Point 8, Right Hip Key Point 9, Left Knee Key Point 10, Right One or more of the key points such as the knee key point 11 , the left foot key point 12 , and the right foot key point 13 .
轮廓关键点可以是用于对人体轮廓边沿的各部分进行定位的关键点,其实现方式可以根据实际情况灵活选择,不局限于下述各公开实施例。图3示出根据本公开一实施例的轮廓关键点的示意图,如图所示,在一种可能的实现方式中,轮廓关键点可以至少包括沿身体轮廓分布的59个关键点中的一个或多个点。The contour key point may be a key point used for locating each part of the edge of the human body contour, and the implementation manner thereof may be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments. 3 shows a schematic diagram of a contour key point according to an embodiment of the present disclosure. As shown in the figure, in a possible implementation manner, the contour key point may include at least one of 59 key points distributed along the body contour or multiple points.
人体对象的目标区域可以是待处理图像中具有处理需求的一个或多个区域,其实现方式可以根据实际情况灵活选择。在一种可能的实现方式中,目标区域可以仅包括头部区域或颈部区域;在一种可能的实现方式中,目标区域可以同时包括头部区域和颈部区 域。其中,头部区域与颈部区域的划分方式可以根据实际情况灵活选择,不局限于下述各公开实施例。在一种可能的实现方式中,可以将肢体关键点中的头部关键点与颈部关键点之间的区域划分为头部区域,将肢体关键点中位于左肩关键点以及右肩关键点以上,且颈部关键点以下的区域划分为颈部区域;在一些可能的实现方式中,还可以根据轮廓关键点的辅助来划分为头部区域和颈部区域,比如根据图3中左脖子关键点0和右脖子关键点58之间的区域划分为颈部区域等。在一种可能的实现方式中,目标区域也可以不考虑关键点,而是通过其他方式进行划分,比如直接对待处理图像中的目标区域进行区域范围识别等。The target area of the human object may be one or more areas in the image to be processed that have processing requirements, and the implementation method may be flexibly selected according to the actual situation. In a possible implementation, the target area may only include the head area or the neck area; in a possible implementation, the target area may include both the head area and the neck area. The division manner of the head area and the neck area can be flexibly selected according to the actual situation, and is not limited to the following disclosed embodiments. In a possible implementation manner, the area between the head key point and the neck key point in the body key points may be divided into the head area, and the body key points located above the left shoulder key point and the right shoulder key point , and the area below the neck key point is divided into the neck area; in some possible implementations, it can also be divided into the head area and the neck area according to the assistance of the outline key points, for example, according to the left neck key in Figure 3 The area between point 0 and the right neck key point 58 is divided into neck area and so on. In a possible implementation manner, the target area may not consider key points, but may be divided by other methods, such as directly performing area range recognition on the target area in the image to be processed.
步骤S11的实现方式可以根据实际情况灵活选择,在本公开实施例中不做限制。在一些可能的实现方式中,可以同时获取人体对象的关键点,以及人体对象的目标区域;在一些可能的实现方式中,还可以先获取人体对象的关键点,并根据关键点确定目标区域;在一些可能的实现方式中,还可以先从人体对象中提取目标区域,然后再对目标区域进行关键点识别,得到位于目标区域内的人体对象的关键点等。步骤S11的一些可能的实现方式详见下述各公开实施例,在此先不做展开。The implementation manner of step S11 can be flexibly selected according to the actual situation, which is not limited in this embodiment of the present disclosure. In some possible implementations, the key points of the human object and the target area of the human object can be acquired at the same time; in some possible implementations, the key points of the human object can also be acquired first, and the target area is determined according to the key points; In some possible implementations, the target area can also be extracted from the human object first, and then the key points of the target area are identified to obtain the key points of the human object located in the target area. Some possible implementation manners of step S11 are detailed in the following disclosed embodiments, which are not expanded here.
步骤S12,根据目标区域中至少部分像素点的位置,以及目标区域中关键点的位置,对目标区域中的多个像素点分别进行调整,确定调整后的目标区域。Step S12, according to the positions of at least part of the pixel points in the target area and the positions of key points in the target area, respectively adjust a plurality of pixel points in the target area to determine the adjusted target area.
其中,目标区域中的至少部分像素点,可以是目标区域中的一个或多个像素点,该至少部分像素点可以用于后续对目标区域的整体进行调整。至少部分像素点的实现方式可以灵活决定,在一些可能的实现方式中,至少部分像素点可以是对目标区域进行采样所得到的采样点,或是对目标区域进行进一步划分所得到的划分边界上的点等。如何获取至少部分像素点,其实现方式可以详见下述各公开实施例,在此先不做展开。Wherein, at least some of the pixels in the target area may be one or more pixels in the target area, and the at least some of the pixels may be used for subsequent adjustment of the entire target area. The implementation of at least some of the pixels can be flexibly determined. In some possible implementations, at least some of the pixels can be sampling points obtained by sampling the target area, or on the division boundary obtained by further dividing the target area. point and so on. How to obtain at least part of the pixel points, the implementation of which can be found in the following disclosed embodiments, which will not be expanded here.
目标区域中的关键点,可以是步骤S11中获取的多个关键点中,位于目标区域以内的关键点,比如肢体关键点中的头部关键点或颈部关键点,以及轮廓关键点中的左脖子关键点或右脖子关键点等,包含哪些关键点可以根据实际情况灵活选择。The key points in the target area may be the key points located within the target area among the multiple key points obtained in step S11, such as the head key points or neck key points in the limb key points, and the outline key points. The key points of the left neck or the right neck can be flexibly selected according to the actual situation.
根据至少部分像素点以及目标区域中的关键点的位置,可以对目标区域中的多个像素点分别进行调整,来得到调整后的目标区域。其中,目标区域中的多个像素点,其包含的像素点数量与类型在本公开实施例中不做限制。在一种可能的实现方式中,多个像素点可以为目标区域中的每个像素点;在一种可能的实现方式中,多个像素点可以包括上述公开实施例中提到的至少部分像素点;在一些可能的实现方式中,多个像素点还可以包括目标区域中除至少部分像素点以外的其他像素点等。According to the positions of at least some of the pixel points and the key points in the target area, a plurality of pixel points in the target area may be adjusted respectively to obtain the adjusted target area. The number and type of pixels included in the plurality of pixels in the target area are not limited in the embodiments of the present disclosure. In a possible implementation, the multiple pixels may be each pixel in the target area; in a possible implementation, the multiple pixels may include at least some of the pixels mentioned in the above disclosed embodiments point; in some possible implementations, the plurality of pixel points may also include other pixel points other than at least some of the pixel points in the target area, and the like.
如何根据至少部分像素点与目标区域中的关键点的位置,来对目标区域中的多个像素点进行调整,调整的方式可以根据实际情况灵活决定,比如根据至少部分像素点与目标区域中的关键点的位置确定多个像素点的调整方向和/或调整距离等,以实现对目标区域的拉伸或变形等操作。详细的调整方式可以详见下述各公开实施例,在此先不做展开。How to adjust multiple pixels in the target area according to the positions of at least some of the pixels and key points in the target area, and the adjustment method can be flexibly determined according to the actual situation, for example, according to at least some of the pixels and the target area. The position of the key point determines the adjustment direction and/or adjustment distance of multiple pixel points, etc., so as to realize operations such as stretching or deformation of the target area. For detailed adjustment methods, refer to the following disclosed embodiments, which will not be described here.
由于调整过程中目标区域的多个像素点的位置可能会发生变化,因此,在一种可能的实现方式中,调整后的目标区域,相对于待处理图像的目标区域可能会发生形变或移动,使得调整后的目标区域相对于待处理图像中的目标区域,具有更好的视觉效果。Since the positions of multiple pixels in the target area may change during the adjustment process, in a possible implementation manner, the adjusted target area may deform or move relative to the target area of the image to be processed. Compared with the target area in the image to be processed, the adjusted target area has a better visual effect.
步骤S13,根据待处理图像以及调整后的目标区域,生成目标图像。Step S13, generating a target image according to the image to be processed and the adjusted target area.
其中,目标图像可以为处理后所得到的具有更好视觉效果的图像。根据待处理图像以及调整后的目标区域来生成目标图像的方式,可以根据实际情况灵活选择,比如将待处理图像中目标区域的纹理渲染至调整后的目标区域的位置,或是将调整后的目标区域与待处理图像进行融合或叠加等。步骤S13的一些可能的实现方式可以详见后续各公开实施例,在此先不做展开。The target image may be an image with better visual effect obtained after processing. The method of generating the target image based on the image to be processed and the adjusted target area can be flexibly selected according to the actual situation, such as rendering the texture of the target area in the image to be processed to the position of the adjusted target area, or The target area is fused or superimposed with the image to be processed. For some possible implementation manners of step S13, please refer to the subsequent disclosed embodiments, which will not be expanded here.
在本公开实施例中,通过获取待处理图像中人体对象的关键点以及人体对象的目标区域,并根据目标区域中至少部分像素点的位置,以及目标区域中关键点的位置对目标 区域中的多个像素点分别进行调整,确定调整后的目标区域,从而基于调整后的目标区域与待处理图像来生成目标图像。通过上述过程,一方面可以对目标图像中人体对象的头颈部等目标区域进行美化,提升人体美化的全面性和自然程度;另一方面根据目标区域中的至少部分像素点来对目标区域中的多个像素点进行调整,可以减少调整过程中处理的数据量,提高美化的效率和效果。In the embodiment of the present disclosure, the key points of the human object in the image to be processed and the target area of the human object are acquired, and the position of at least a part of the pixel points in the target area and the positions of the key points in the target area are adjusted to the target area. A plurality of pixel points are adjusted respectively to determine an adjusted target area, so as to generate a target image based on the adjusted target area and the image to be processed. Through the above process, on the one hand, the target area such as the head and neck of the human object in the target image can be beautified, so as to improve the comprehensiveness and naturalness of the human body beautification; It can reduce the amount of data processed in the adjustment process and improve the efficiency and effect of beautification.
在一种可能的实现方式中,步骤S11可以包括:In a possible implementation manner, step S11 may include:
对待处理图像进行肢体关键点识别和/或轮廓关键点识别,得到待处理图像中人体对象的关键点;Perform body key point recognition and/or outline key point recognition on the image to be processed to obtain the key points of the human object in the image to be processed;
根据人体对象的关键点,对待处理图像中的人体对象进行区域划分,得到多个人体区域;According to the key points of the human object, the human object in the image to be processed is divided into regions to obtain multiple human regions;
从多个人体区域中提取颈部区域和/或头部区域,得到目标区域。The neck region and/or head region are extracted from multiple body regions to obtain the target region.
其中,肢体关键点与轮廓关键点的实现方式详见上述各公开实施例。进行肢体关键点识别和/或轮廓关键点识别的方式在本公开实施例中不做限制。在一种可能的实现方式中,可以通过神经网络来实现,比如可以将待处理图像分别输入肢体关键点识别神经网络以及轮廓关键点识别神经网络,来分别得到肢体关键点和轮廓关键点在待处理图像中的位置;在一种可能的实现方式中,还可以将待处理图像直接输入关键点识别神经网络,来得到关键点识别神经网络输出的肢体关键点与轮廓关键点在待处理图像中的位置等。The implementation of the limb key points and the outline key points can be found in the above disclosed embodiments. The manner of performing limb key point identification and/or contour key point identification is not limited in the embodiments of the present disclosure. In a possible implementation, it can be implemented through a neural network. For example, the images to be processed can be input into the limb key point recognition neural network and the contour key point recognition neural network respectively, so as to obtain the limb key points and contour key points respectively. Process the position in the image; in a possible implementation, the image to be processed can also be directly input into the key point recognition neural network to obtain the limb key points and contour key points output by the key point recognition neural network in the image to be processed location, etc.
对待处理图像中人体对象进行区域划分的方式可以根据实际情况灵活决定,在一些可能的实现方式中可以参考上述各公开实施例中头部区域与颈部区域的划分方式。图4示出根据本公开一实施例的对人体对象进行区域划分的示意图(为了对图像中的对象进行保护,图中人脸的部分部位进行了马赛克处理,后续图像同理),如图所示,在一种可能的实现方式中,可以通过识别得到待处理图像中人体对象的多个肢体关键点与轮廓关键点作为人体对象的关键点,并将其中的部分或全部关键点通过连接形成矩形或其他形状的区域,以得到人体对象的多个人体区域。The manner of dividing the area of the human object in the image to be processed can be flexibly determined according to the actual situation. For some possible implementation manners, reference may be made to the manner of dividing the head area and the neck area in the above disclosed embodiments. 4 shows a schematic diagram of region division of a human object according to an embodiment of the present disclosure (in order to protect the object in the image, part of the face in the figure is subjected to mosaic processing, and the same is true for subsequent images), as shown in the figure In a possible implementation manner, a plurality of limb key points and outline key points of the human object in the image to be processed can be obtained by identifying them as the key points of the human object, and some or all of the key points are formed by connecting them. Rectangular or other shaped regions to obtain multiple body regions of a human subject.
从多个人体区域中提取颈部区域和/或头部区域的方式可以根据实际情况灵活决定,如图4所示,在一些可能的实现方式中,可以在多个人体区域中,将头部关键点与颈部关键点连接而形成的矩形区域作为头部区域,将颈部关键点、左肩关键点、右肩关键点、左腋下关键点以及右腋下关键点等连接而成的矩形区域作为颈部区域。The method of extracting the neck region and/or head region from multiple human body regions can be flexibly determined according to the actual situation. As shown in FIG. 4, in some possible implementations, the head region can be extracted from the multiple human body regions. The rectangular area formed by connecting the key points and the neck key points is used as the head area, and the rectangle formed by connecting the neck key points, left shoulder key points, right shoulder key points, left armpit key points, and right armpit key points, etc. area as the neck area.
通过本公开实施例,可以将利用关键点识别,一方面确定人体中的各关键点位置,为后续的目标区域调整提供调整依据;另一方面基于确定的关键点,可以对人体对象中的多个区域进行划分,从而便捷地从待处理图像中确定目标区域,提高图像处理的整体效率。Through the embodiments of the present disclosure, key point recognition can be used to determine the position of each key point in the human body on the one hand, and provide an adjustment basis for the subsequent adjustment of the target area; The target area is easily determined from the image to be processed and the overall efficiency of image processing is improved.
图5示出根据本公开一实施例的图像处理方法的流程图,如图所示,在一种可能的实现方式中,步骤S12可以包括:5 shows a flowchart of an image processing method according to an embodiment of the present disclosure. As shown in the figure, in a possible implementation, step S12 may include:
步骤S121,将待处理图像划分为多个图像网格。Step S121: Divide the image to be processed into a plurality of image grids.
其中,将待处理图像划分为多个图像网格,可以是对待处理图像整体进行图像网格的划分,也可以是对待处理图像中的部分区域(比如目标区域等)进行图像网格的划分。Wherein, dividing the image to be processed into a plurality of image grids may be the image grid division of the entire image to be processed, or the image grid division of a part of the image to be processed (such as the target area, etc.).
图像网格的形状同样可以根据实际情况灵活决定,可以为三角形、矩形或其他多边形等,在一些可能的实现方式中,也可以划分为扇形或圆形等。The shape of the image grid can also be flexibly determined according to the actual situation, and can be a triangle, a rectangle, or other polygons, etc., and in some possible implementations, it can also be divided into a fan shape or a circle, and the like.
网格划分的方式可以根据实际情况灵活决定,在一种可能的实现方式中,可以是将待处理图像或目标区域平均划分为预设数量的图像网格,预设数量的数值可以根据实际情况灵活设定,比如10~90000等数量范围内的某些数值等,在本公开实施例中不做限制。在一个示例中,可以将待处理图像平均划分为112×112个矩形的图像网格。The grid division method can be flexibly determined according to the actual situation. In a possible implementation method, the to-be-processed image or target area can be divided into a preset number of image grids, and the preset number of values can be determined according to the actual situation. Flexible settings, such as certain numerical values in the range of 10 to 90,000, etc., are not limited in the embodiments of the present disclosure. In one example, the image to be processed may be evenly divided into a 112×112 rectangular image grid.
在一些可能的实现方式中,也可以通过像素点采样的方式来实现图像网格的划分,举例来说,可以通过平均或随机采样等方式,从待处理图像中提取得到一个或多个采样 点作为图像网格的顶点,则将这一个或多个采样点中的相邻采样点连接成上述公开实施例中提到的任意形状,则可以得到多个图像网格。In some possible implementations, the image grid can also be divided by pixel sampling. For example, one or more sampling points can be extracted from the image to be processed by averaging or random sampling. As the vertices of the image grid, the adjacent sampling points in the one or more sampling points are connected to form any shape mentioned in the above disclosed embodiments, and then a plurality of image grids can be obtained.
步骤S122,将目标区域中位于任一图像网格上的像素点作为目标像素点。In step S122, a pixel point located on any image grid in the target area is used as a target pixel point.
基于划分的图像网格,可以从目标区域中确定至少部分像素点作为目标像素点。在一种可能的实现方式中,可以将目标区域中包含的每个图像网格上的顶点和/或位于每个图像网格边沿上的点作为目标像素点。在一些可能的实现方式中,也可以从目标区域中包含的多个图像网格中,选定其中部分图像网格作为目标图像网格,然后将这些目标图像网格的顶点和/或位于目标图像网格边沿上的点作为目标像素点。其中,目标图像网格的选定方式在本公开实施例中不做限制,可以从目标区域包含的所有图像网格中进行随机抽样或是以特定间隔进行抽样,来确定目标图像网格;也可以将目标区域中的关键点所属的图像网格,作为目标图像网格等。Based on the divided image grid, at least part of the pixels from the target area may be determined as target pixels. In a possible implementation manner, vertices on each image grid and/or points located on the edge of each image grid included in the target area may be used as target pixel points. In some possible implementations, some of the image meshes included in the target area may be selected as the target image meshes, and then the vertices and/or the vertices of these target image meshes and/or located in the target image meshes may be selected. The point on the edge of the image grid is used as the target pixel point. The selection method of the target image grid is not limited in the embodiments of the present disclosure, and the target image grid can be determined by random sampling or sampling at specific intervals from all the image grids included in the target area; The image grid to which the key points in the target area belong can be used as the target image grid, etc.
步骤S123,根据目标像素点的位置与目标区域中关键点的位置,对目标区域中的多个像素点进行调整,确定调整后的目标区域。Step S123 , according to the position of the target pixel point and the position of the key point in the target area, adjust a plurality of pixel points in the target area, and determine the adjusted target area.
基于目标像素点以及目标区域中关键点在待处理图像中的位置,可以对目标区域中的多个像素点进行调整,从而确定调整后的目标区域。如上述各公开实施例所述,调整的方式可以根据实际情况灵活决定,详见下述各公开实施例,在此同样先不做展开。Based on the target pixel points and the positions of key points in the target area in the image to be processed, a plurality of pixel points in the target area can be adjusted to determine the adjusted target area. As described in the above disclosed embodiments, the adjustment method can be flexibly determined according to the actual situation. For details, please refer to the following disclosed embodiments, which will not be expanded here.
通过本公开实施例,可以通过较为便捷地方式筛选得到目标区域中比较具有代表性的目标像素点,降低图像处理中数据处理的运算量,并提高图像处理的整体速度和效率。Through the embodiments of the present disclosure, representative target pixels in the target area can be obtained by screening in a convenient way, reducing the computational complexity of data processing in image processing, and improving the overall speed and efficiency of image processing.
在一种可能的实现方式中,步骤S123可以包括:In a possible implementation, step S123 may include:
根据目标像素点的位置与目标区域中关键点的位置,确定目标像素点的第一调整距离;根据第一调整距离对目标区域中的多个像素点进行调整,确定调整后的目标区域。Determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; adjust a plurality of pixel points in the target area according to the first adjustment distance to determine the adjusted target area.
其中,第一调整距离可以是目标像素点在调整过程中所需移动的距离,第一调整距离的确定方式,可以根据选择的目标区域中关键点的不同而灵活发生变化,详见下述各公开实施例,在此先不做展开。The first adjustment distance may be the distance that the target pixel needs to move during the adjustment process, and the method for determining the first adjustment distance can be flexibly changed according to different key points in the selected target area. The disclosed embodiments are not expanded here.
根据第一调整距离对目标区域中的多个像素点进行调整,调整方式可以灵活变化。在一种可能的实现方式中,可以是将目标区域中的多个目标像素点移动第一调整距离,其余像素点不进行调整,来得到调整后的目标区域;在一种可能的实现方式中,也可以是将目标区域中的多个目标像素点移动第一调整距离,并将目标像素点所在的图像网格内的像素点随着目标像素点的移动而移动,继而得到调整后的目标区域。The multiple pixels in the target area are adjusted according to the first adjustment distance, and the adjustment method can be flexibly changed. In a possible implementation, a plurality of target pixels in the target area may be moved by a first adjustment distance, and the remaining pixels are not adjusted to obtain an adjusted target area; in a possible implementation, , it is also possible to move multiple target pixels in the target area by the first adjustment distance, and move the pixels in the image grid where the target pixels are located with the movement of the target pixels, and then obtain the adjusted target area.
由于目标像素点的数量可以为多个,而不同的目标像素点的位置相对于目标区域中关键点的位置是不同的,因此不同的目标像素点,其对应的第一调整距离可以发生变化,从而使得目标区域中的多个像素点在基于第一调整距离进行调整后,在形变的基础上仍具有较为自然的整体效果,实现了目标区域的渐变式调整,提高了图像处理的效果和自然程度。Since the number of target pixels can be multiple, and the positions of different target pixels are different from the positions of key points in the target area, the corresponding first adjustment distances of different target pixels can vary, Therefore, after the adjustment based on the first adjustment distance, the multiple pixels in the target area still have a relatively natural overall effect on the basis of deformation, which realizes the gradual adjustment of the target area, and improves the effect and naturalness of image processing. degree.
在一种可能的实现方式中,步骤S123还可以包括:根据第一调整距离,确定目标区域中位于图像网格内的像素点的第二调整距离;根据第二调整距离对目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, step S123 may further include: determining, according to the first adjustment distance, a second adjustment distance of the pixels located in the image grid in the target area; pixel points are adjusted to determine the adjusted target area.
其中,第二调整距离可以是目标区域内除目标像素点以外的其余像素点在调整过程中所需移动的距离,第二调整距离的确定方式,可以根据实际情况灵活选择,比如可以根据第一调整距离进行插值计算,或是将其余像素点距离最近的目标像素点对应的第一调整距离,作为该其余像素点的调整距离等。确定第二调整距离的一些可能的实现方式详见下述各公开实施例,在此也先不做展开。The second adjustment distance may be the distance that other pixels in the target area other than the target pixel need to move during the adjustment process, and the determination method of the second adjustment distance can be flexibly selected according to the actual situation, The adjustment distance is interpolated, or the first adjustment distance corresponding to the target pixel that is closest to the remaining pixels is used as the adjustment distance of the remaining pixels. For some possible implementation manners of determining the second adjustment distance, please refer to the following disclosed embodiments, which will not be described here.
根据第二调整距离对目标区域中的多个像素点进行调整,调整方式同样可以灵活变化。在一种可能的实现方式中,可以是将目标区域中的每个像素点均按照第二调整距离进行调整,以得到调整后的目标区域;在一种可能的实现方式中,还可以从目标区域中 除目标像素点以外的其余像素点中,以随机或特定间隔采样的方式,选择其中的部分像素点,并将选择的这部分像素点按照第二调整距离进行调整,来得到调整后的目标区域。The multiple pixels in the target area are adjusted according to the second adjustment distance, and the adjustment method can also be flexibly changed. In a possible implementation, each pixel in the target area may be adjusted according to the second adjustment distance to obtain an adjusted target area; in a possible implementation, the target area may also be adjusted from the target Among the remaining pixels in the area except the target pixel, select some of the pixels by random or specific interval sampling, and adjust the selected part of the pixels according to the second adjustment distance to obtain the adjusted pixel. target area.
通过引入第二调整距离,可以进一步提高目标区域中像素点调整的连续性,从而进一步提高图像处理的效果和自然程度。By introducing the second adjustment distance, the continuity of pixel point adjustment in the target area can be further improved, thereby further improving the effect and naturalness of image processing.
在一种可能的实现方式中,步骤S123还可以包括:In a possible implementation, step S123 may further include:
根据第一调整距离或第二调整距离,对目标区域中的多个像素点进行调整,确定调整后的目标区域。According to the first adjustment distance or the second adjustment distance, multiple pixels in the target area are adjusted to determine the adjusted target area.
其中,根据第一调整距离或第二调整距离,对目标区域中的多个像素点进行调整,可以是将目标区域中的目标像素点按照第一调整距离进行调整,将其余像素点按照第二调整距离进行调整,以确定调整后的目标区域。在一些可能的实现方式中,根据第一调整距离或第二调整距离对目标区域中的多个像素点进行调整,其调整方式可以为上述各公开实施例的融合,在此不再赘述。Wherein, according to the first adjustment distance or the second adjustment distance, the adjustment of multiple pixels in the target area may be to adjust the target pixels in the target area according to the first adjustment distance, and adjust the remaining pixels according to the second adjustment distance. Adjust the distance to make adjustments to determine the adjusted target area. In some possible implementations, multiple pixels in the target area are adjusted according to the first adjustment distance or the second adjustment distance, and the adjustment method may be the fusion of the above disclosed embodiments, which will not be repeated here.
通过基于第一调整距离或第二调整距离,对目标区域进行调整,可以实现目标区域中大部分像素点的整体渐进式调整,在进一步提高图像处理的效果和自然程度的同时,还可以保障图像调整后的全面性和完整性。By adjusting the target area based on the first adjustment distance or the second adjustment distance, the overall progressive adjustment of most of the pixels in the target area can be achieved, which can further improve the effect and naturalness of image processing, and at the same time ensure the image Adjusted comprehensiveness and completeness.
图6示出根据本公开一实施例的图像处理方法的流程图,如图所示,在一种可能的实现方式中,根据目标像素点的位置与目标区域中所述关键点的位置,确定目标像素点的第一调整距离,可以包括:6 shows a flowchart of an image processing method according to an embodiment of the present disclosure. As shown in the figure, in a possible implementation manner, according to the position of the target pixel point and the position of the key point in the target area, determine The first adjustment distance of the target pixel point, which may include:
步骤S1231,根据目标区域中颈部的相关关键点,确定人体对象中的第一目标位置;Step S1231, determining the first target position in the human object according to the relevant key points of the neck in the target area;
步骤S1232,根据目标像素点与第一目标位置之间的实际距离,确定目标像素点的调整比例;Step S1232, according to the actual distance between the target pixel point and the first target position, determine the adjustment ratio of the target pixel point;
步骤S1233,根据目标像素点的调整比例,以及预设距离,得到目标像素点的第一调整距离。Step S1233: Obtain the first adjustment distance of the target pixel according to the adjustment ratio of the target pixel and the preset distance.
其中,颈部的相关关键点,可以包括上述公开实施例中提到的肢体关键点中的颈部关键点,也可以包括上述公开实施例中提到的轮廓关键点中的左脖子关键点与右脖子关键点。The relevant key points of the neck may include the neck key points among the limb key points mentioned in the above disclosed embodiments, and may also include the left neck key points and the contour key points mentioned in the above disclosed embodiments. Right neck key point.
第一目标位置可以是用于计算第一调整距离的位置坐标,第一目标位置可以根据相关关键点中的部分关键点所确定,也可以通过相关关键点共同确定,不局限于下述各公开实施例。The first target position may be the position coordinates used to calculate the first adjustment distance, and the first target position may be determined according to some key points in the relevant key points, or may be jointly determined by the relevant key points, and is not limited to the following disclosures. Example.
在一种可能的实现方式中,第一目标位置可以是左脖子关键点与右脖子关键点的中间位置;在一种可能的实现方式中,第一目标位置也可以是颈部关键点的位置;在一种可能的实现方式中,第一目标位置也可以是左脖子关键点、右脖子关键点与颈部关键点三个点所确定的区域的中心位置。In a possible implementation manner, the first target position may be the middle position of the left neck key point and the right neck key point; in a possible implementation manner, the first target position may also be the position of the neck key point ; In a possible implementation manner, the first target position may also be the center position of the area determined by the three points of the left neck key point, the right neck key point and the neck key point.
根据目标像素点在待处理图像中的位置坐标,以及步骤S1232所确定的第一目标位置的位置坐标,可以确定目标像素点与第一目标位置之间的实际距离。该实际距离可以用于确定目标像素点的调整比例,其中,调整比例可以反映目标像素点调整的远近程度,如何根据实际距离确定调整比例,其计算方式可以根据实际情况灵活选择,在一些可能的实现方式中,调整比例可以与实际距离反向相关,即距离第一目标位置越近的像素点,在调整过程中其移动的距离越远,从而可以较为自然地拉伸待处理图像中人体对象的头颈长度,实现具有较好效果的人体美化。According to the position coordinates of the target pixel in the image to be processed and the position coordinates of the first target position determined in step S1232, the actual distance between the target pixel and the first target position can be determined. The actual distance can be used to determine the adjustment ratio of the target pixel, wherein the adjustment ratio can reflect the degree of adjustment of the target pixel. How to determine the adjustment ratio according to the actual distance can be flexibly selected according to the actual situation. In some possible In the implementation mode, the adjustment ratio can be inversely related to the actual distance, that is, the closer the pixel is to the first target position, the farther it moves during the adjustment process, so that the human object in the image to be processed can be stretched more naturally. The length of the head and neck can achieve better human beautification.
基于目标像素点的调整比例,以及预设距离,可以得到目标像素点的第一调整距离。其中,预设距离的长度可以根据实际情况灵活设定,在一种可能的实现方式中,该预设距离可以是一个固定的数值;在一些可能的实现方式中,该预设距离也可以根据待处理图像中的实际情况灵活决定,在一个示例中,该预设距离可以根据待处理图像中颈部长度所确定,比如是待处理图像中颈部长度的0.1~2倍,或是其他数值范围等。Based on the adjustment ratio of the target pixel point and the preset distance, the first adjustment distance of the target pixel point can be obtained. The length of the preset distance can be flexibly set according to the actual situation. In one possible implementation, the preset distance can be a fixed value; in some possible implementations, the preset distance can also be based on The actual situation in the image to be processed is determined flexibly. In an example, the preset distance can be determined according to the length of the neck in the image to be processed, such as 0.1 to 2 times the length of the neck in the image to be processed, or other values range etc.
基于上述各公开实施例,在一个示例中,确定第一调整距离的方式可以通过下述公式(1)和公式(2)进行表述:Based on the above disclosed embodiments, in an example, the manner of determining the first adjustment distance can be expressed by the following formula (1) and formula (2):
move=ratio×预设距离                       (1)move=ratio×preset distance (1)
Figure PCTCN2021102171-appb-000001
Figure PCTCN2021102171-appb-000001
其中,move为第一调整距离,ratio为调整比例,第一目标位置为左脖子关键点与右脖子关键点的中间位置,通过上述公式可以看出,在一个示例中,调整比例与实际距离反向相关,故第一调整距离也与实际距离反向相关。Among them, move is the first adjustment distance, ratio is the adjustment ratio, and the first target position is the middle position of the left neck key point and the right neck key point. It can be seen from the above formula that, in an example, the adjustment ratio is inverse to the actual distance. Therefore, the first adjustment distance is also inversely related to the actual distance.
通过本公开实施例,可以利用目标像素点和目标区域中颈部相关关键点之间的距离,来灵活对不同的目标像素点采用不同的第一调整距离进行调整,从而进一步提升目标区域在调整过程中的渐进性,在拉伸待处理图像中人体对象头颈部的同时,提高了拉伸效果的自然程度和效果。Through the embodiments of the present disclosure, the distance between the target pixel point and the neck related key points in the target area can be used to flexibly adjust different target pixel points by using different first adjustment distances, thereby further improving the adjustment of the target area. The progressive nature of the process improves the naturalness and effect of the stretching effect while stretching the head and neck of the human subject in the image to be processed.
在一种可能的实现方式中,根据第一调整距离,确定目标区域中位于图像网格内的像素点的第二调整距离,可以包括:In a possible implementation manner, determining the second adjustment distance of the pixels located in the image grid in the target area according to the first adjustment distance may include:
对目标像素点的第一调整距离进行插值处理,得到目标像素点所在的图像网格内的像素点的第二调整距离。Interpolate the first adjustment distance of the target pixel to obtain the second adjustment distance of the pixel in the image grid where the target pixel is located.
如上述各公开实施例所述,目标像素点可以为图像网格的顶点,或是图像网格边沿上的像素点,因此,在一种可能的实现方式中,目标像素点所在的图像网格内的像素点,均可以位于该图像网格的顶点或边沿点的连线之间,基于这些像素点与目标像素点之间的位置关系,通过插值处理进行插值计算,即可确定这些像素点的第二调整距离。As described in the above disclosed embodiments, the target pixel can be the vertex of the image grid or the pixel on the edge of the image grid. Therefore, in a possible implementation manner, the image grid where the target pixel is located The pixels in the image grid can be located between the vertices or edge points of the image grid. Based on the positional relationship between these pixels and the target pixel, these pixels can be determined by performing interpolation calculation through interpolation processing. the second adjustment distance.
插值处理的方式在本公开实施例中不做限制,如拉格朗日插值、分段插值等任何可以实现插值计算的方法,均可以作为插值处理的实现方式。The method of interpolation processing is not limited in the embodiments of the present disclosure, and any method that can realize interpolation calculation, such as Lagrangian interpolation, piecewise interpolation, etc., can be used as the realization method of interpolation processing.
通过本公开实施例,可以利用插值处理,快速便捷地确定目标区域中的多个像素点的第二调整距离,从而有效减小了图像处理的计算量,提高了图像处理的效率。Through the embodiments of the present disclosure, interpolation processing can be used to quickly and conveniently determine the second adjustment distances of multiple pixels in the target area, thereby effectively reducing the computational complexity of image processing and improving the efficiency of image processing.
在一些可能的实现方式中,除了确定目标区域中多个像素点的调整距离以外,还可以确定这些像素点的调整方向,因此,在一种可能的实现方式中,步骤S123可以包括:In some possible implementations, in addition to determining the adjustment distances of multiple pixels in the target area, the adjustment directions of these pixels can also be determined. Therefore, in a possible implementation, step S123 may include:
根据人体对象的关键点中的轮廓关键点,确定人体对象中的第二目标位置;Determine the second target position in the human object according to the contour key points in the key points of the human object;
根据目标像素点的位置与目标区域中关键点之间的位置,分别将目标区域中的多个像素点向第二目标位置进行调整,得到调整后的目标区域。According to the position of the target pixel point and the position between the key points in the target area, the plurality of pixel points in the target area are respectively adjusted to the second target position to obtain the adjusted target area.
其中,第二目标位置可以是用于确定目标区域中多个像素点移动方向的位置,该位置可以根据轮廓关键点中的某个或某些关键点来确定。第二目标位置的选择可以根据实际情况灵活决定,不局限于下述各公开实施例。Wherein, the second target position may be a position used to determine the moving direction of a plurality of pixel points in the target area, and the position may be determined according to one or some key points in the contour key points. The selection of the second target position can be flexibly determined according to the actual situation, and is not limited to the following disclosed embodiments.
在一种可能的实现方式中,可以将轮廓关键点中包括的左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点所构成区域的中心位置,作为第二目标位置。In a possible implementation manner, the center position of the area formed by the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the contour key points may be used as the second target position .
其中,左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点可以分别对应上述公开实施例中提到的图3中的点1、57、12和46,通过图3可以看出,上述各点确定的中心位置,可以是人体对象中胸部的中心位置,将该中心位置作为第二目标位置,对头颈部的目标区域中的多个像素点朝向该第二目标位置进行调整,可以对人体对象的头颈部进行自然地拉伸,提高头颈部的长度在人体对象上半身中的总体占比,实现人体对象上半身比例地有效优化。Wherein, the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point may respectively correspond to the points 1, 57, 12 and 46 in FIG. 3 mentioned in the above disclosed embodiments. It can be seen that the center position determined by the above points can be the center position of the chest in the human body object, and the center position is taken as the second target position, and the plurality of pixels in the target area of the head and neck are directed to the second target position. The adjustment can naturally stretch the head and neck of the human object, increase the overall proportion of the length of the head and neck in the upper body of the human object, and effectively optimize the proportion of the upper body of the human object.
根据目标像素点的位置与目标区域中关键点的位置,分别将目标区域中的多个像素点向第二目标位置进行调整的方式,可以参考上述确定调整距离的各公开实施例,在此不再赘述。本公开实施例中步骤S123的各类实现方式可以通过相互结合来实现,结合的 方式与顺序在本公开实施例中均不做限制。According to the position of the target pixel point and the position of the key point in the target area, the method of adjusting the plurality of pixel points in the target area to the second target position respectively can refer to the above-mentioned various disclosed embodiments for determining the adjustment distance, and this is not the case here. Repeat. Various implementation manners of step S123 in the embodiments of the present disclosure may be implemented by combining with each other, and the combining manners and sequences are not limited in the embodiments of the present disclosure.
通过本公开实施例,可以利用人体轮廓点所确定的第二目标位置来确定目标区域中各像素点的调整方向,从而有效提高调整后的目标区域在人体对象中的所占比例,实现较好效果的人体对象优化。Through the embodiment of the present disclosure, the adjustment direction of each pixel point in the target area can be determined by using the second target position determined by the contour points of the human body, thereby effectively increasing the proportion of the adjusted target area in the human body object, and achieving better Effects optimized for human objects.
在一种可能的实现方式中,步骤S13可以包括:In a possible implementation manner, step S13 may include:
将待处理图像中目标区域的素材,渲染至调整后的目标区域位置,生成目标图像。Render the material in the target area of the to-be-processed image to the adjusted target area position to generate the target image.
其中,待处理图像中目标区域的素材,可以是待处理图像中目标区域中多个像素点所分别对应的图像纹理,比如颜色或是形状等,其实现方式可以根据待处理图像的实际情况灵活决定。The material of the target area in the image to be processed may be image textures corresponding to multiple pixels in the target area in the image to be processed, such as color or shape, and its implementation can be flexibly based on the actual situation of the image to be processed Decide.
将目标区域的素材渲染至调整后的目标区域位置的方式在本公开实施例中不做限制,在一种可能的实现方式中,可以直接将调整后的目标区域与待处理图像中目标区域内像素点的对应关系,来实现对应纹理的渲染;在一些可能的实现方式中,还可以将目标区域中包含的各目标像素点连接为三角网格,然后基于三角网格,实现素材的渲染等。The manner of rendering the material of the target area to the position of the adjusted target area is not limited in the embodiments of the present disclosure. In a possible implementation manner, the adjusted target area may be directly combined with the target area in the image to be processed. The corresponding relationship between pixel points is used to realize the rendering of the corresponding texture; in some possible implementations, each target pixel point contained in the target area can also be connected into a triangular mesh, and then based on the triangular mesh, the material rendering is realized, etc. .
通过本公开实施例,可以在调整目标区域的同时,保持目标区域原有的图像形式,从而使得得到的目标图像更加自然真实,提升图像处理的效果。Through the embodiments of the present disclosure, the original image form of the target area can be maintained while adjusting the target area, so that the obtained target image is more natural and real, and the effect of image processing is improved.
图7示出根据本公开一实施例的图像处理装置的框图。如图所示,所述图像处理装置20可以包括:FIG. 7 shows a block diagram of an image processing apparatus according to an embodiment of the present disclosure. As shown in the figure, the image processing apparatus 20 may include:
获取模块21,用于获取待处理图像中人体对象的关键点以及人体对象的目标区域,其中,目标区域包括颈部区域和/或头部区域。The acquiring module 21 is configured to acquire the key points of the human object in the image to be processed and the target area of the human object, wherein the target area includes the neck area and/or the head area.
调整模块22,用于根据目标区域中至少部分像素点的位置,以及目标区域中关键点的位置,对目标区域中的多个像素点分别进行调整,确定调整后的目标区域。The adjustment module 22 is configured to adjust a plurality of pixel points in the target area according to the positions of at least some of the pixel points in the target area and the positions of key points in the target area to determine the adjusted target area.
目标图像生成模块23,用于根据待处理图像以及调整后的目标区域,生成目标图像。The target image generation module 23 is configured to generate a target image according to the image to be processed and the adjusted target area.
在一种可能的实现方式中,调整模块用于:将待处理图像划分为多个图像网格;将目标区域中位于任一图像网格上的像素点作为目标像素点;根据目标像素点的位置与目标区域中关键点的位置,对目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, the adjustment module is used to: divide the image to be processed into a plurality of image grids; use the pixels located on any image grid in the target area as target pixels; The position and the position of the key points in the target area are adjusted to multiple pixel points in the target area to determine the adjusted target area.
在一种可能的实现方式中,调整模块进一步用于:根据目标像素点的位置与目标区域中关键点的位置,确定目标像素点的第一调整距离;根据第一调整距离对目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据第一调整距离,确定目标区域中位于图像网格内的像素点的第二调整距离;根据第二调整距离对目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,根据第一调整距离或第二调整距离,对目标区域中的多个像素点进行调整,确定调整后的目标区域。In a possible implementation manner, the adjustment module is further configured to: determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; A plurality of pixel points are adjusted to determine the adjusted target area; or, according to the first adjustment distance, the second adjustment distance of the pixel points located in the image grid in the target area is determined; Adjusting multiple pixels to determine the adjusted target area; or, adjusting multiple pixels in the target area according to the first adjustment distance or the second adjustment distance to determine the adjusted target area.
在一种可能的实现方式中,调整模块进一步用于:根据目标区域中颈部的相关关键点,确定人体对象中的第一目标位置;根据目标像素点与第一目标位置之间的实际距离,确定目标像素点的调整比例;根据目标像素点的调整比例,以及预设距离,得到目标像素点的第一调整距离。In a possible implementation manner, the adjustment module is further configured to: determine the first target position in the human object according to the relevant key points of the neck in the target area; according to the actual distance between the target pixel point and the first target position , determine the adjustment ratio of the target pixel point; obtain the first adjustment distance of the target pixel point according to the adjustment ratio of the target pixel point and the preset distance.
在一种可能的实现方式中,调整模块进一步用于:对目标像素点的第一调整距离进行插值处理,得到目标像素点所在的图像网格内的像素点的第二调整距离。In a possible implementation manner, the adjustment module is further configured to: perform interpolation processing on the first adjustment distance of the target pixel point to obtain the second adjustment distance of the pixel point in the image grid where the target pixel point is located.
在一种可能的实现方式中,调整模块用于:根据人体对象的关键点中的轮廓关键点,确定人体对象中的第二目标位置;根据目标像素点的位置与目标区域中关键点的位置,分别将目标区域中的多个像素点向第二目标位置进行调整,得到调整后的目标区域。In a possible implementation manner, the adjustment module is used to: determine the second target position in the human object according to the contour key points in the key points of the human object; according to the position of the target pixel point and the position of the key point in the target area , respectively adjusting a plurality of pixel points in the target area to the second target position to obtain an adjusted target area.
在一种可能的实现方式中,调整模块进一步用于:将轮廓关键点中包括的左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点所构成区域的中心位置,作为第二目标位置。In a possible implementation manner, the adjustment module is further used to: set the center position of the area formed by the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the contour key points, as the second target location.
在一种可能的实现方式中,获取模块用于:对待处理图像进行肢体关键点识别和/或轮廓关键点识别,得到待处理图像中人体对象的关键点,其中,人体对象的关键点包 括肢体关键点和/或轮廓关键点;根据人体对象的关键点,对待处理图像中的人体对象进行区域划分,得到多个人体区域;从多个人体区域中提取颈部区域和/或头部区域,得到目标区域。In a possible implementation manner, the acquisition module is used to: perform limb key point recognition and/or outline key point recognition on the image to be processed, and obtain key points of the human object in the image to be processed, wherein the key points of the human object include limbs key points and/or contour key points; according to the key points of the human object, the human object in the image to be processed is divided into regions to obtain multiple human body regions; the neck region and/or head region are extracted from the multiple human body regions, Get the target area.
在一种可能的实现方式中,目标图像生成模块用于:将待处理图像中目标区域的素材,渲染至调整后的目标区域位置,生成目标图像。In a possible implementation manner, the target image generation module is used for: rendering the material of the target area in the to-be-processed image to the adjusted position of the target area to generate the target image.
应用场景示例Application Scenario Example
图8与图9示出根据本公开一应用示例的示意图,如图所示,本公开应用示例提出了一种图像处理方法,该图像处理方法可以包括如下过程:8 and 9 show schematic diagrams of an application example of the present disclosure. As shown in the figures, the application example of the present disclosure proposes an image processing method, and the image processing method may include the following processes:
如图8所示,将待处理的图像分割为112*112个矩形的图像网格(图中的网格仅为示例性划分,实际划分方式更为密集)。As shown in FIG. 8 , the image to be processed is divided into 112*112 rectangular image grids (the grid in the figure is only an exemplary division, and the actual division method is more dense).
识别待处理图像中的肢体关键点和轮廓关键点,作为人体对象的关键点;根据人体对象的关键点中位于头部以及胸部以上的关键点,来获得待处理部位(即上述公开实施例中的目标区域)的图像,在本公开应用示例中,目标区域可以是头部与颈部所在的区域。Identify the limb key points and contour key points in the image to be processed as the key points of the human body object; obtain the part to be processed according to the key points above the head and the chest in the key points of the human body object (that is, in the above disclosed embodiments In the application example of the present disclosure, the target area may be the area where the head and neck are located.
如图3所示,根据轮廓关键点中左肩膀关键点1、右肩膀关键点57、左腋下关键点12以及右腋下关键点46的坐标,获取这些关键点所构成区域的中心位置,作为第二目标位置。As shown in Figure 3, according to the coordinates of the left shoulder key point 1, the right shoulder key point 57, the left underarm key point 12 and the right underarm key point 46 in the outline key points, the center position of the area formed by these key points is obtained, as the second target location.
将目标区域中包含的图像网格的顶点作为目标像素点,如图8所示,图中部分实心点为目标像素点的一些示例性表示,并将这些目标像素点分别向第二目标位置的方向移动,目标像素点的移动距离(即第一调整距离)可以通过上述公开实施例中的公式(1)与公式(2)进行计算。The vertices of the image grid contained in the target area are used as target pixels. As shown in Figure 8, some solid points in the figure are some exemplary representations of target pixels, and these target pixels are respectively directed to the second target position. When the direction moves, the moving distance of the target pixel point (ie, the first adjustment distance) can be calculated by formula (1) and formula (2) in the above disclosed embodiments.
将目标区域中位于图像网格以内的像素点向第二目标位置移动,图像网格以内的像素点的移动距离(即第二调整距离),可以根据其所属的图像网格的顶点的第一调整距离进行插值计算所得到。Move the pixels within the image grid in the target area to the second target position, and the moving distance (ie the second adjustment distance) of the pixels within the image grid can be determined according to the first position of the vertex of the image grid to which it belongs. Adjust the distance to interpolate.
将待处理的图像中目标区域对应的纹理,渲染到调整后的目标区域的位置处,可以得到处理后的目标图像,如图9所示,通过对比可以看出,经过处理后的目标图像,其中的人体对象具有更好的头颈比例,且图像的整体效果也十分自然。The texture corresponding to the target area in the image to be processed is rendered to the position of the adjusted target area, and the processed target image can be obtained, as shown in Figure 9. It can be seen from the comparison that the processed target image, Human subjects have better head-to-neck ratios, and the overall look of the image is very natural.
本公开应用示例中提出的图像处理方法,除了可以对目标图像中人体对象的头颈部进行拉伸以外,还可以扩展应用至人体对象的其他部位,其实现方式可以参考上述各公开实施例,在此不再赘述。The image processing method proposed in the application example of the present disclosure can not only stretch the head and neck of the human object in the target image, but also can be extended to other parts of the human object. For the implementation method, refer to the above disclosed embodiments. It is not repeated here.
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例,限于篇幅,本公开不再赘述。It can be understood that the above-mentioned method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle and logic.
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that in the above method of the specific implementation, the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its function and possible Internal logic is determined.
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是易失性计算机可读存储介质或非易失性计算机可读存储介质。Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented. The computer-readable storage medium may be a volatile computer-readable storage medium or a non-volatile computer-readable storage medium.
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为上述方法。An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to perform the above method.
本公开实施例还提出一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述方法。Embodiments of the present disclosure also provide a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device When running, the processor in the electronic device executes the above method.
在实际应用中,上述存储器可以是易失性存储器(volatile memory),例如RAM;或者非易失性存储器(non-volatile memory),例如ROM,快闪存储器(flash memory),硬 盘(Hard Disk Drive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的存储器的组合,并向处理器提供指令和数据。In practical applications, the above-mentioned memory can be a volatile memory (volatile memory), such as RAM; or a non-volatile memory (non-volatile memory), such as ROM, flash memory (flash memory), hard disk (Hard Disk Drive) , HDD) or solid-state drive (Solid-State Drive, SSD); or a combination of the above types of memory, and provide instructions and data to the processor.
上述处理器可以为ASIC、DSP、DSPD、PLD、FPGA、CPU、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本公开实施例不作具体限定。The above-mentioned processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It can be understood that, for different devices, the electronic device used to implement the function of the processor may also be other, which is not specifically limited in the embodiment of the present disclosure.
电子设备可以被提供为终端、服务器或其它形态的设备。The electronic device may be provided as a terminal, server or other form of device.
基于前述实施例相同的技术构思,本公开实施例还提供了一种计算机程序,该计算机程序被处理器执行时实现上述方法。Based on the same technical concept as the foregoing embodiments, an embodiment of the present disclosure further provides a computer program, which implements the above method when the computer program is executed by a processor.
图10是根据本公开实施例的一种电子设备800的框图。例如,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。FIG. 10 is a block diagram of an electronic device 800 according to an embodiment of the present disclosure. For example, electronic device 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. terminal.
参照图10,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。10, an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814 , and the communication component 816 .
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. Memory 804 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。 Power supply assembly 806 provides power to various components of electronic device 800 . Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。 Audio component 810 is configured to output and/or input audio signals. For example, audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 800 is in operating modes, such as calling mode, recording mode, and voice recognition mode. The received audio signal may be further stored in memory 804 or transmitted via communication component 816 . In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 . For example, the sensor assembly 814 can detect the on/off state of the electronic device 800, the relative positioning of the components, such as the display and the keypad of the electronic device 800, the sensor assembly 814 can also detect the electronic device 800 or one of the electronic device 800 Changes in the position of components, presence or absence of user contact with the electronic device 800 , orientation or acceleration/deceleration of the electronic device 800 and changes in the temperature of the electronic device 800 . Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关人员信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 may access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related personnel information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium, such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
图11是根据本公开实施例的一种电子设备1900的框图。例如,电子设备1900可以被提供为一服务器。参照图11,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。FIG. 11 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. 11, electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource, represented by memory 1932, for storing instructions executable by processing component 1922, such as applications. An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Additionally, the processing component 1922 is configured to execute instructions to perform the above-described methods.
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。The electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input output (I/O) interface 1958 . Electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。The present disclosure may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是――但不限于――电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身, 诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。A computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (non-exhaustive list) of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM) or flash memory), static random access memory (SRAM), portable compact disk read only memory (CD-ROM), digital versatile disk (DVD), memory sticks, floppy disks, mechanically coded devices, such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above. Computer-readable storage media, as used herein, are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。The computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态人员信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。Computer program instructions for carrying out operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages. Source or object code, written in any combination, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as the "C" language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through the Internet connect). In some embodiments, electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state personnel information of computer readable program instructions. Computer readable program instructions can be executed to implement various aspects of the present disclosure.
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。Aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams. These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本 技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Various embodiments of the present disclosure have been described above, and the foregoing descriptions are exemplary, not exhaustive, and not limiting of the disclosed embodiments. Numerous modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (13)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,其中,所述目标区域包括颈部区域和/或头部区域;Acquiring the key points of the human object in the image to be processed and the target area of the human object, wherein the target area includes the neck area and/or the head area;
    根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域;According to the positions of at least some of the pixel points in the target area and the positions of the key points in the target area, respectively adjust a plurality of pixel points in the target area to determine the adjusted target area;
    根据所述待处理图像以及所述调整后的目标区域,生成目标图像。A target image is generated according to the to-be-processed image and the adjusted target area.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域,包括:The method according to claim 1, wherein, according to the positions of at least some of the pixel points in the target area and the positions of the key points in the target area Pixel points are adjusted separately to determine the adjusted target area, including:
    将所述待处理图像划分为多个图像网格;dividing the to-be-processed image into a plurality of image grids;
    将所述目标区域中位于任一所述图像网格上的像素点作为目标像素点;Taking the pixel points located on any of the image grids in the target area as the target pixel points;
    根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。According to the position of the target pixel point and the position of the key point in the target area, a plurality of pixel points in the target area are adjusted to determine the adjusted target area.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域,包括:The method according to claim 2, wherein the adjusting a plurality of pixel points in the target area according to the position of the target pixel point and the position of the key point in the target area, Determine the adjusted target area, including:
    根据所述目标像素点的位置与所述目标区域中所述关键点的位置,确定所述目标像素点的第一调整距离;根据所述第一调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,Determine the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area; Click to adjust to determine the adjusted target area; or,
    根据所述第一调整距离,确定所述目标区域中位于所述图像网格内的像素点的第二调整距离;根据所述第二调整距离对所述目标区域中的多个像素点进行调整,确定调整后的目标区域;或者,According to the first adjustment distance, determine the second adjustment distance of the pixel points in the image grid in the target area; adjust a plurality of pixel points in the target area according to the second adjustment distance , to determine the adjusted target area; or,
    根据所述第一调整距离或所述第二调整距离,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域。According to the first adjustment distance or the second adjustment distance, a plurality of pixels in the target area are adjusted to determine an adjusted target area.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,确定所述目标像素点的第一调整距离,包括:The method according to claim 3, wherein the determining the first adjustment distance of the target pixel point according to the position of the target pixel point and the position of the key point in the target area comprises:
    根据所述目标区域中颈部的相关关键点,确定所述人体对象中的第一目标位置;Determine the first target position in the human object according to the relevant key points of the neck in the target area;
    根据所述目标像素点与所述第一目标位置之间的实际距离,确定所述目标像素点的调整比例;Determine the adjustment ratio of the target pixel point according to the actual distance between the target pixel point and the first target position;
    根据所述目标像素点的调整比例,以及预设距离,得到所述目标像素点的第一调整距离。According to the adjustment ratio of the target pixel point and the preset distance, the first adjustment distance of the target pixel point is obtained.
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据所述第一调整距离,确定所述目标区域中位于所述图像网格内的像素点的第二调整距离,包括:The method according to claim 3 or 4, wherein the determining, according to the first adjustment distance, the second adjustment distance of the pixels located in the image grid in the target area, comprising:
    对所述目标像素点的第一调整距离进行插值处理,得到所述目标像素点所在的图像网格内的像素点的第二调整距离。Interpolating the first adjustment distance of the target pixel point to obtain the second adjustment distance of the pixel point in the image grid where the target pixel point is located.
  6. 根据权利要求2至5中任意一项所述的方法,其特征在于,所述根据所述目标像素点的位置与所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点进行调整,确定调整后的目标区域,包括:The method according to any one of claims 2 to 5, characterized in that, according to the position of the target pixel point and the position of the key point in the target area, the plurality of Adjust the pixel points to determine the adjusted target area, including:
    根据所述人体对象的关键点中的轮廓关键点,确定所述人体对象中的第二目标位置;determining the second target position in the human object according to the contour key points in the key points of the human object;
    根据所述目标像素点的位置与所述目标区域中所述关键点的位置,分别将所述目标区域中的多个像素点向所述第二目标位置进行调整,得到调整后的目标区域。According to the position of the target pixel point and the position of the key point in the target area, a plurality of pixel points in the target area are respectively adjusted to the second target position to obtain an adjusted target area.
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述人体对象的关键点中的轮廓关键点,确定所述人体对象中的第二目标位置,包括:The method according to claim 6, wherein the determining the second target position in the human object according to the contour key points in the key points of the human object comprises:
    将所述轮廓关键点中包括的左肩膀关键点、右肩膀关键点、左腋下关键点以及右腋下关键点所构成区域的中心位置,作为所述第二目标位置。The center position of the area formed by the left shoulder key point, the right shoulder key point, the left underarm key point and the right underarm key point included in the outline key points is taken as the second target position.
  8. 根据权利要求1至7中任意一项所述的方法,其特征在于,所述获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,包括:The method according to any one of claims 1 to 7, wherein the acquiring the key points of the human object in the image to be processed and the target area of the human object comprises:
    对待处理图像进行肢体关键点识别和/或轮廓关键点识别,得到待处理图像中人体对象的关键点,其中,所述人体对象的关键点包括肢体关键点和/或轮廓关键点;Performing limb key point identification and/or contour key point identification on the image to be processed, to obtain the key points of the human object in the to-be-processed image, wherein the key points of the human object include limb key points and/or contour key points;
    根据所述人体对象的关键点,对所述待处理图像中的人体对象进行区域划分,得到多个人体区域;According to the key points of the human object, the human object in the to-be-processed image is divided into regions to obtain a plurality of human regions;
    从所述多个人体区域中提取颈部区域和/或头部区域,得到所述目标区域。The target region is obtained by extracting a neck region and/or a head region from the plurality of body regions.
  9. 根据权利要求1至8中任意一项所述的方法,其特征在于,所述根据所述待处理图像以及所述调整后的目标区域,生成目标图像,包括:The method according to any one of claims 1 to 8, wherein the generating a target image according to the to-be-processed image and the adjusted target area comprises:
    将所述待处理图像中目标区域的素材,渲染至所述调整后的目标区域位置,生成目标图像。Rendering the material of the target area in the to-be-processed image to the adjusted target area position to generate a target image.
  10. 一种图像处理装置,其特征在于,包括:An image processing device, comprising:
    获取模块,用于获取待处理图像中人体对象的关键点以及所述人体对象的目标区域,其中,所述目标区域包括颈部区域和/或头部区域;an acquisition module, configured to acquire the key points of the human object in the image to be processed and the target area of the human object, wherein the target area includes the neck area and/or the head area;
    调整模块,用于根据所述目标区域中至少部分像素点的位置,以及所述目标区域中所述关键点的位置,对所述目标区域中的多个像素点分别进行调整,确定调整后的目标区域;The adjustment module is configured to adjust a plurality of pixel points in the target area according to the positions of at least part of the pixel points in the target area and the positions of the key points in the target area, and determine the adjusted pixel points. target area;
    目标图像生成模块,用于根据所述待处理图像以及所述调整后的目标区域,生成目标图像。A target image generation module, configured to generate a target image according to the to-be-processed image and the adjusted target area.
  11. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
    其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至9中任意一项所述的方法。wherein the processor is configured to invoke the memory-stored instructions to perform the method of any one of claims 1-9.
  12. 一种计算机可读存储介质,其上存储有计算机程序指令,其特征在于,所述计算机程序指令被处理器执行时实现权利要求1至9中任意一项所述的方法。A computer-readable storage medium on which computer program instructions are stored, characterized in that, when the computer program instructions are executed by a processor, the method described in any one of claims 1 to 9 is implemented.
  13. 一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行用于实现权利要求1-9中的任一权利要求所述的方法。A computer program product comprising computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, which when executed in a processor of an electronic device, the electronic A processor in the device executes the method for implementing any of claims 1-9.
PCT/CN2021/102171 2021-03-19 2021-06-24 Image processing method and apparatus, and electronic device and storage medium WO2022193466A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110297088.8 2021-03-19
CN202110297088.8A CN112767288B (en) 2021-03-19 2021-03-19 Image processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022193466A1 true WO2022193466A1 (en) 2022-09-22

Family

ID=75691120

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/102171 WO2022193466A1 (en) 2021-03-19 2021-06-24 Image processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN112767288B (en)
WO (1) WO2022193466A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112767288B (en) * 2021-03-19 2023-05-12 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium
CN113222993A (en) * 2021-06-25 2021-08-06 北京市商汤科技开发有限公司 Image processing method, device, equipment and storage medium
CN114913549B (en) * 2022-05-25 2023-07-07 北京百度网讯科技有限公司 Image processing method, device, equipment and medium
CN114820679B (en) * 2022-07-01 2023-04-18 小米汽车科技有限公司 Image labeling method and device electronic device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080037836A1 (en) * 2006-08-09 2008-02-14 Arcsoft, Inc. Method for driving virtual facial expressions by automatically detecting facial expressions of a face image
CN107657590A (en) * 2017-09-01 2018-02-02 北京小米移动软件有限公司 Image processing method and device
CN107680033A (en) * 2017-09-08 2018-02-09 北京小米移动软件有限公司 Image processing method and device
CN108198141A (en) * 2017-12-28 2018-06-22 北京奇虎科技有限公司 Realize image processing method, device and the computing device of thin face special efficacy
CN109359618A (en) * 2018-10-30 2019-02-19 北京市商汤科技开发有限公司 A kind of image processing method and its device, equipment and storage medium
CN109376671A (en) * 2018-10-30 2019-02-22 北京市商汤科技开发有限公司 Image processing method, electronic equipment and computer-readable medium
CN110298785A (en) * 2019-06-29 2019-10-01 北京字节跳动网络技术有限公司 Image beautification method, device and electronic equipment
CN111243011A (en) * 2018-11-29 2020-06-05 北京市商汤科技开发有限公司 Key point detection method and device, electronic equipment and storage medium
CN112767288A (en) * 2021-03-19 2021-05-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109087238B (en) * 2018-07-04 2021-04-23 北京市商汤科技开发有限公司 Image processing method and apparatus, electronic device, and computer-readable storage medium
CN109472753B (en) * 2018-10-30 2021-09-07 北京市商汤科技开发有限公司 Image processing method and device, computer equipment and computer storage medium
CN109949237A (en) * 2019-03-06 2019-06-28 北京市商汤科技开发有限公司 Image processing method and device, vision facilities and storage medium
CN110060348B (en) * 2019-04-26 2023-08-11 北京迈格威科技有限公司 Face image shaping method and device
CN111145084B (en) * 2019-12-25 2023-06-16 北京市商汤科技开发有限公司 Image processing method and device, image processing equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080037836A1 (en) * 2006-08-09 2008-02-14 Arcsoft, Inc. Method for driving virtual facial expressions by automatically detecting facial expressions of a face image
CN107657590A (en) * 2017-09-01 2018-02-02 北京小米移动软件有限公司 Image processing method and device
CN107680033A (en) * 2017-09-08 2018-02-09 北京小米移动软件有限公司 Image processing method and device
CN108198141A (en) * 2017-12-28 2018-06-22 北京奇虎科技有限公司 Realize image processing method, device and the computing device of thin face special efficacy
CN109359618A (en) * 2018-10-30 2019-02-19 北京市商汤科技开发有限公司 A kind of image processing method and its device, equipment and storage medium
CN109376671A (en) * 2018-10-30 2019-02-22 北京市商汤科技开发有限公司 Image processing method, electronic equipment and computer-readable medium
CN111243011A (en) * 2018-11-29 2020-06-05 北京市商汤科技开发有限公司 Key point detection method and device, electronic equipment and storage medium
CN110298785A (en) * 2019-06-29 2019-10-01 北京字节跳动网络技术有限公司 Image beautification method, device and electronic equipment
CN112767288A (en) * 2021-03-19 2021-05-07 北京市商汤科技开发有限公司 Image processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112767288A (en) 2021-05-07
CN112767288B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
WO2022193466A1 (en) Image processing method and apparatus, and electronic device and storage medium
CN107680033B (en) Picture processing method and device
WO2022179025A1 (en) Image processing method and apparatus, electronic device, and storage medium
KR102018887B1 (en) Image preview using detection of body parts
WO2020135529A1 (en) Pose estimation method and apparatus, and electronic device and storage medium
WO2020007241A1 (en) Image processing method and apparatus, electronic device, and computer-readable storage medium
CN110889382A (en) Virtual image rendering method and device, electronic equipment and storage medium
CN110991327A (en) Interaction method and device, electronic equipment and storage medium
TW202209343A (en) Image processing method and apparatus, electronic device, and storage medium
CN107341777B (en) Picture processing method and device
CN107977934B (en) Image processing method and device
WO2016127671A1 (en) Image filter generating method and device
CN109325908B (en) Image processing method and device, electronic equipment and storage medium
US11308692B2 (en) Method and device for processing image, and storage medium
TWI718631B (en) Method, device and electronic apparatus for face image processing and storage medium thereof
CN111243011A (en) Key point detection method and device, electronic equipment and storage medium
WO2019227916A1 (en) Image processing method and apparatus, electronic device and storage medium
WO2022088750A1 (en) Image generation method and electronic device
WO2015196715A1 (en) Image retargeting method and device and terminal
WO2022134475A1 (en) Point cloud map construction method and apparatus, electronic device, storage medium and program
WO2022121577A1 (en) Image processing method and apparatus
WO2023273499A1 (en) Depth measurement method and apparatus, electronic device, and storage medium
WO2023051356A1 (en) Virtual object display method and apparatus, and electronic device and storage medium
TW202121343A (en) Image processing method and apparatus, electronic device, and storage medium
CN111815750A (en) Method and device for polishing image, electronic equipment and storage medium

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: 21931051

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21931051

Country of ref document: EP

Kind code of ref document: A1