CN115100029A - Image processing method, image processing device, electronic equipment and storage medium - Google Patents

Image processing method, image processing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115100029A
CN115100029A CN202210730478.4A CN202210730478A CN115100029A CN 115100029 A CN115100029 A CN 115100029A CN 202210730478 A CN202210730478 A CN 202210730478A CN 115100029 A CN115100029 A CN 115100029A
Authority
CN
China
Prior art keywords
deformation
determining
pixel point
liquefaction
region
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210730478.4A
Other languages
Chinese (zh)
Inventor
沈怀烨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202210730478.4A priority Critical patent/CN115100029A/en
Publication of CN115100029A publication Critical patent/CN115100029A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the disclosure relates to an image processing method, an image processing device, an electronic device and a storage medium, wherein the method comprises the following steps: determining a deformation area corresponding to a target part to be liquefied in the image; responding to the movement operation of the deformation area, and determining a deformation coefficient corresponding to a pixel point according to the movement direction and the initial position of the pixel point in the deformation area; and determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position. By adopting the scheme, the target position of the pixel point after liquefaction can be determined according to the deformation coefficient corresponding to each pixel point in the deformation area, so that the deformation of the pixel point is finely achieved, a better liquefaction effect is favorably obtained, and the special effect shape determined according to the pixel value corresponding to the deformed target position is more attractive.

Description

Image processing method, image processing device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image processing method and apparatus, an electronic device, and a storage medium.
Background
In practical applications of image processing technology, it is often necessary to process an image of a person to obtain a beautified image that meets expectations, such as face thinning, waist waisting, etc. for a human face in the image.
In the related art, when a person in an image is beautified, usually, a rough area is subjected to image pixel value shift to achieve a liquefaction effect, and it is difficult to achieve relatively fine pixel position deformation, thereby resulting in poor liquefaction effect of the image.
Disclosure of Invention
In order to solve the above technical problems, or at least partially solve the above technical problems, the present disclosure provides an image processing method, an apparatus, an electronic device, and a storage medium.
The embodiment of the present disclosure provides an image processing method, including:
determining a deformation area corresponding to a target part to be liquefied in the image;
responding to the movement operation of the deformation area, and determining a deformation coefficient corresponding to a pixel point according to the movement direction and the initial position of the pixel point in the deformation area;
and determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position.
An embodiment of the present disclosure further provides an image processing apparatus, including:
the first determining module is used for determining a deformation area corresponding to a target part to be liquefied in the image;
the second determining module is used for responding to the moving operation of the deformation area and determining the deformation coefficient corresponding to the pixel point according to the moving direction and the initial position of the pixel point in the deformation area;
and the processing module is used for determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position.
An embodiment of the present disclosure further provides an electronic device, which includes: a processor; a memory for storing the processor-executable instructions; the processor is used for reading the executable instructions from the memory and executing the instructions to realize the image processing method provided by the embodiment of the disclosure.
The embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program for executing the image processing method provided by the embodiment of the present disclosure.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages: according to the image processing scheme provided by the embodiment of the disclosure, a deformation region corresponding to a target portion to be liquefied in an image is determined, then, in response to a moving operation on the deformation region, a deformation coefficient corresponding to a pixel point is determined according to a moving direction and an initial position of the pixel point in the deformation region, a pixel value corresponding to the target position after the pixel point is moved is determined based on the deformation coefficient, and a special effect shape after the target portion is liquefied is determined according to the pixel value of the target position. By adopting the technical scheme, the target position of the pixel point after liquefaction can be determined according to the deformation coefficient corresponding to each pixel point in the deformation area, so that the deformation of the pixel point is finely realized, a better liquefaction effect is favorably obtained, and the special effect shape determined according to the pixel value corresponding to the target position after deformation is more attractive.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a schematic flowchart of an image processing method according to an embodiment of the disclosure;
FIG. 2 is a schematic diagram comparing liquefaction of shoulders in an image into right angle shoulders in an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of an image processing method according to another embodiment of the disclosure;
FIG. 4 is an exemplary diagram of a circular area provided by one embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating the variation of a circular area during an iterative liquefaction process in accordance with an embodiment of the present disclosure;
FIG. 6 is a schematic diagram illustrating an effect variation of an iterative liquefaction process for liquefying shoulders in an image into right-angle shoulders according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
In order to solve the above problem, embodiments of the present disclosure provide an image processing method, which is described below with reference to specific embodiments.
Fig. 1 is a flowchart illustrating an image processing method according to an embodiment of the present disclosure, where the method may be executed by an image processing apparatus, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 1, the image processing method includes:
step 101, determining a deformation area corresponding to a target part to be liquefied in an image.
For example, the target region to be liquefied in the image may be automatically determined. For example, a region corresponding to the liquefaction operation type may be determined from the image as the target region by means of image recognition according to a preset liquefaction operation type, where the liquefaction operation type may be, but is not limited to, at least one of face thinning, waist tightening, right-angle shoulders, and the like. For example, if the type of the liquefaction operation is a right-angle shoulder, the region where the shoulder is located may be identified from the image by means of image recognition, and the identified shoulder may be determined as the target region to be subjected to the liquefaction operation.
For example, a target region to be liquefied in the image may be specified by a user. For example, when a user clicks on shoulders in the image, the shoulders are determined as target portions to be liquefied. For another example, when a user clicks a face in an image, the face is determined as a target portion to be liquefied.
In the embodiment of the disclosure, for a target portion to be liquefied in an image, a deformation region corresponding to the target portion may be determined.
The shape of the deformation region may be preset according to actual requirements, for example, the shape of the deformation region may be a circle, a triangle, a rectangle, or the like. It will be appreciated that for a preset shape, the parameters are known. For example, when the preset shape is a circle, the radius of the circle is known. In addition, the position of the center of the circle in the target region may be preset, for example, the position of the center of the circle in the corresponding region may be set to be different according to the type of the liquefaction operation.
In the embodiment of the disclosure, for a target portion to be liquefied in an image, a deformation region corresponding to the target portion may be determined based on a preset shape, and the shape of the deformation region is consistent with the preset shape.
Exemplarily, assuming that the shape of the deformation region is a circle, a circle region corresponding to the target site may be determined as the deformation region, wherein a center of the deformation region may be determined according to a mapping relationship between a preset liquefaction operation type and a position of the center in the corresponding site, and a radius of the deformation region is a radius of the preset circle. For example, if it is assumed that, in the preset mapping relationship, for the liquefaction operation type of waist pinching, the position of the preset center of the circle at the waist is the middle of the waist, and the target portion is the waist, the determined deformation region is a circular region having the middle of the waist as the center of the circle and the preset radius as the radius.
And 102, responding to the movement operation of the deformation area, and determining a deformation coefficient corresponding to a pixel point according to the movement direction and the initial position of the pixel point in the deformation area.
Wherein the moving direction may be preset, and for each liquefaction operation type, the corresponding moving direction may be preset. Or, the moving direction may also be determined according to the deformation region and a preset liquefaction shape, for each liquefaction operation type, a corresponding liquefaction shape may be preset, the target portion may be liquefied into a special effect shape that is consistent with or close to the liquefaction shape by performing the liquefaction operation, and then each target portion to be subjected to the liquefaction operation corresponds to the preset liquefaction shape, and then the moving direction of the pixel during deformation may be determined according to the deformation region and the liquefaction shape corresponding to the target portion.
For example, when the liquefaction operation type is a right-angle shoulder and the target portion is a shoulder, the liquefaction shape may be determined to be a right angle, and if the deformation region is a circle, the moving direction may be determined to be a connection line between the center of the circle of the deformation region and a vertex of the right angle.
In the embodiment of the present disclosure, after the deformation region corresponding to the target portion is determined, the deformation region may be controlled to move according to a preset moving direction, or move according to the determined moving direction, and in response to the moving operation on the deformation region, the deformation coefficient corresponding to the pixel point may be determined according to the moving direction and the initial position of the pixel point in the deformation region before liquefaction.
Illustratively, a coordinate point can be selected in the moving direction as a reference point, and for each pixel point in the deformation region, the corresponding relationship between the preset combinations of different distances and different included angles and the deformation coefficient can be queried according to the target vertical distance from the initial position of the pixel point to the moving direction and the target included angle between the pixel point and the reference point, so as to determine the target deformation coefficient corresponding to the combination of the target vertical distance and the target included angle as the deformation coefficient corresponding to the pixel point.
Illustratively, a functional relationship between the deformation coefficient and the initial positions and the moving direction of the pixels may be predefined, and based on the functional relationship, the deformation coefficient corresponding to each pixel is determined according to the moving direction and the initial position of each pixel.
Step 103, determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining a special effect shape of the liquefied target position according to the pixel value of the target position.
In the embodiment of the disclosure, after the deformation coefficient corresponding to each pixel point in the deformation region is determined, the position of the pixel point may be shifted based on the deformation coefficient of each pixel point to obtain the target position of each pixel point after moving, and the pixel value corresponding to the target position is determined, and then the special effect shape of the target portion after liquefaction is obtained based on the determined pixel value of each target position, thereby achieving the liquefaction effect of the target portion in the image.
For example, when determining the pixel value corresponding to the target position, the determination may be made according to the moving direction. For example, if the moving direction is moving outward from the initial position, i.e., extending outward, the pixel value corresponding to the target position should be consistent with the pixel value at the initial position to achieve the effect of liquefying outward, the pixel value at the initial position may be assigned to the target position, and the pixel value at the initial position is still the original pixel value. For another example, if the moving direction is inward movement from the initial position, i.e., inward contraction, the pixel value corresponding to the target position should be consistent with the pixel value of the initial position, but the pixel value of the initial position is covered by another pixel value, e.g., a pixel value corresponding to a background color is given to the initial position to achieve the effect of inward liquefaction, the pixel value of the initial position may be given to the target position, and the initial position may be given to another suitable pixel value.
Because in this scheme, the deformation coefficient of every pixel in the deformation region is confirmed, and then the position of pixel is squinted based on the deformation coefficient that each pixel corresponds respectively, so as to reach the purpose of carrying out liquefaction processing to the target part, thereby the liquefaction processing to the target part has arrived pixel meticulously, compare in the scheme that carries out the skew of image pixel to a rough region among the prior art, the position skew of meticulous to pixel can realize the deformation to the accurate position, for example carry out liquefaction processing to shoulder position and come the swift current shoulder shape to become the right angle shoulder, thereby can reach better liquefaction effect.
Fig. 2 is a schematic diagram illustrating a comparison of liquefying shoulders in an image into right-angle shoulders in an embodiment of the present disclosure, where a left image in fig. 2 is an original image before liquefaction, a right image in fig. 2 is a final image obtained by performing right-angle shoulder liquefaction on shoulders in the original image in the left image by using the image processing method of the present disclosure, and it can be seen from comparing the left image and the right image in fig. 2 that, by using the solution of the present disclosure, liquefaction processing can be performed on shoulders of a person, so that a liquefaction effect close to a right angle is obtained.
According to the image processing scheme provided by the embodiment of the disclosure, the deformation area corresponding to the target part to be liquefied in the image is determined, the movement operation of the deformation area is responded, the deformation coefficient corresponding to the pixel point is determined according to the movement direction and the initial position of the pixel point in the deformation area, the pixel value corresponding to the target position after the pixel point is moved is further determined based on the deformation coefficient, and the special effect shape after the target part is liquefied is determined according to the pixel value of the target position. By adopting the scheme, the target position of the pixel point after liquefaction can be determined according to the deformation coefficient corresponding to each pixel point in the deformation area, so that the deformation of the pixel point is finely achieved, a better liquefaction effect is favorably obtained, and the special effect shape determined according to the pixel value corresponding to the deformed target position is more attractive.
Fig. 3 is a schematic flowchart of an image processing method according to another embodiment of the present disclosure, and as shown in fig. 3, in an alternative implementation manner of the present disclosure, on the basis of the foregoing embodiment, step 102 may include the following sub-steps:
step 201, determining a deformation reference line corresponding to the moving direction in the deformation region, and obtaining a position parameter from the initial position to the deformation reference line of a pixel point in the deformation region.
The deformation reference line is a standard line used for determining the position parameters of all pixel points in the deformation area. In the embodiment of the present disclosure, the selection of the deformed reference lines and the number of the deformed reference lines may be preset according to actual requirements. For example, for a circular deformation area, the number of deformation reference lines may be set to be 2, and the number is a straight line passing through a dot and parallel to a straight line in the moving direction, and a straight line passing through a dot and perpendicular to the moving direction. For another example, for a deformed area of an equilateral triangle, if the moving direction passes through a central point and a vertex of the equilateral triangle, the number of the deformed reference lines can be preset to be 1, that is, the straight line where the moving direction is located serves as the deformed reference line, or the number of the deformed reference lines can also be preset to be 2, that is, the straight line where the moving direction is located and the base of the equilateral triangle perpendicular to the moving direction are respectively; and so on. The number of deformed reference lines and the selection of deformed reference lines are not limited by the present disclosure.
In the embodiment of the present disclosure, in response to the movement operation of the deformation region, a deformation reference line corresponding to the movement direction may be determined in the deformation region according to the shape of the deformation region, and then, for each pixel point in the deformation region, a position parameter between each pixel point from the initial position to the determined deformation reference line may be obtained.
The position parameter may be, but is not limited to, at least one of a vertical distance between an initial position of the pixel point and the deformation reference line, and an included angle between the initial position of the pixel point and a fixed coordinate point on the deformation reference line.
In an optional implementation manner of the present disclosure, the deformation region may be a circular region, in which case, determining a deformation reference line corresponding to the moving direction in the deformation region, and acquiring a position parameter between a pixel point in the deformation region from an initial position to the deformation reference line may include: determining a first diameter consistent with the moving direction and a second diameter perpendicular to the first diameter in the circular area, wherein the second diameter and the first diameter are line segments perpendicular to each other through the center of a circle; determining a first distance between a pixel point within the circular region from the initial position to the first diameter and a second distance from the initial position to the second diameter.
Exemplarily, fig. 4 is an exemplary diagram of a circular area provided in an embodiment of the present disclosure, as shown in fig. 4, a center of the circular area is a point C, a radius is R, and a moving direction is a linear direction in which a line segment CM is located. Then, in the circular area as shown in fig. 4, a line segment EA coinciding with the moving direction may be determined as the first diameter, and a line segment FB perpendicular to EA may be determined as the second diameter. Therefore, for any pixel point X in the circular region, based on a common calculation formula of the distance from the point to the line, a first distance from the initial position of the pixel point X before liquefaction to the first diameter, that is, D in fig. 4, may be determined 1 And a second distance between the pixel point X from the initial position before liquefaction to the second diameter, i.e., D in fig. 4, can be determined 2 ,D 1 And D 2 Namely the position parameter between the initial position of the pixel point X in the circular area before liquefaction and the deformation reference line.
In the embodiment of the disclosure, when the deformation region is a circular region, a first diameter consistent with the moving direction and a second diameter perpendicular to the first diameter are determined in the circular region, and then a first distance between a pixel point in the circular region and the first diameter and a second distance between the pixel point in the circular region and the second diameter are determined, where the first distance and the second distance are position parameters between the pixel point in the deformation region and a deformation reference line from the initial position, and thus, the position parameters from each pixel point in the circular region to the deformation reference line are different, and then the deformation coefficients corresponding to the pixel points determined according to the position parameters of the pixel points subsequently are also different, so as to provide data support for realizing fine position offset to the pixel points.
In an optional embodiment of the present disclosure, the deformation area may be an equilateral triangle area, if the moving direction is a straight line direction passing through a central point and a vertex of the equilateral triangle, the moving direction is perpendicular to the base corresponding to the vertex, a line segment from the vertex to the base may be used as one deformation reference line, and the base may be used as another deformation reference line, so as to calculate distances from an initial position to two deformation reference lines respectively for any pixel point X in the equilateral triangle area, and use the obtained two distances as position parameters.
Step 202, determining a deformation coefficient corresponding to the pixel point according to the position parameter.
In the embodiment of the present disclosure, after the position parameter from the initial position to the deformation reference line of the pixel point in the deformation region is determined, the deformation coefficient corresponding to the pixel point may be determined according to the determined position parameter.
For example, a corresponding deformation coefficient calculation formula may be preset for deformation regions of different shapes and each liquefied shape, where the deformation coefficient calculation formula takes the determined position parameter as a parameter, and based on the deformation coefficient calculation formula and the position parameter of the pixel point, a deformation coefficient corresponding to the pixel point may be determined.
The liquefaction shape refers to a special effect shape which is preset and expected to be obtained by liquefaction according to different liquefaction operation types. For example, the liquefaction operation type is a right-angle shoulder, and the liquefaction shape can be preset to be a right angle; for another example, the liquefaction operation type is a waisting operation, and the liquefaction shape may be preset to a concave arc shape.
Therefore, when the deformation coefficient corresponding to the pixel point is determined, the matched calculation formula can be selected from a plurality of preset deformation coefficient calculation formulas according to the shape of the deformation area and the liquefaction shape corresponding to the liquefaction operation, and the position parameters of each pixel point are brought into the determined calculation formula to obtain the deformation coefficient corresponding to each pixel point.
In an optional embodiment of the present disclosure, in a case where the deformation region is a circular region and the liquefaction shape is a sharp corner shape, determining the deformation coefficient corresponding to the pixel point according to the position parameter may include:
acquiring a first preset weight and a second preset weight which are matched with the angle of the sharp corner shape;
calculating a difference result of the radius length of the circular region and the first distance, and a first product of the difference result and the first weight;
acquiring a second product of the second distance and the second weight, and a summation result of the first product and the second product;
and calculating the ratio of the summation result to the radius length as a deformation coefficient corresponding to the pixel point and the sharp corner shape.
The present disclosure does not limit the tip angle of the tip shape, and the tip angle may be an acute angle, a right angle, or an obtuse angle. The first weight and the second weight may be set in advance, and different combinations of the first weight and the second weight are set for different angles of the pointed shape, wherein each set of the first weight and the second weight is 1 later. For example, the angle of the sharp corner shape is 90 °, the first weight is set to 0.2, and the second weight is set to 0.8; the angle of the sharp corner shape is 60 degrees, the first weight is preset to be 0.4, and the second weight is preset to be 0.6; and so on.
In the embodiment of the present disclosure, when the deformation region is a circular region and the liquefaction shape is a sharp corner shape, a weight combination of a first weight and a second weight that is matched with the angle of the sharp corner shape may be determined from preset correspondence between different angles and weight combinations according to the angle of the sharp corner shape. Then, a difference result of the radius length of the circular region and the first distance may be calculated and multiplied by the first weight to obtain a first product, and the second distance and the second weight may be multiplied to obtain a second product, and a summation result of the first product and the second product may be calculated. And finally, calculating the ratio of the summation result to the radius length of the circular area, and taking the obtained ratio as a deformation coefficient corresponding to the pixel point and the sharp corner shape. The above calculation process can be expressed as shown in the following formula (1).
Figure BDA0003713105090000111
Wherein F represents the deformation coefficient of the pixel point, R represents the radius length of the circular area, and D 1 Denotes a first distance, D 2 Denotes the second distance, λ 1 Denotes a first weight, λ 2 Representing the second weight.
In the embodiment of the disclosure, when the deformed region is a circular region and the liquefied shape is a pointed shape, by obtaining a first weight and a second weight which are preset and matched with an angle of the pointed shape, calculating a difference result between a radius length of the circular region and a first distance, a first product of the difference result and the first weight, a second product of the second distance and the second weight, and a sum result of the first product and the second product, and further calculating a ratio of the sum result and the radius length as a deformation coefficient corresponding to the pixel point and the pointed shape, a deformation coefficient corresponding to each pixel point and the pointed shape in the circular region can be obtained, and a condition is provided for obtaining a special effect shape close to the liquefied shape for liquefaction.
According to the image processing scheme, the deformation reference line corresponding to the moving direction is determined in the deformation area, the position parameters from the initial position of the pixel point in the deformation area to the deformation reference line are obtained, and then the deformation coefficient corresponding to the pixel point is determined according to the position parameters, so that the deformation coefficient corresponding to each pixel point in the deformation area can be obtained, and data support is provided for achieving the fine liquefaction effect of the pixel point.
In an optional embodiment of the present disclosure, when determining the pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, the first deformation amount corresponding to the pixel point may be determined according to the liquefaction parameter corresponding to the deformation region and the moving direction, the second deformation amount corresponding to the pixel point may be determined according to the first deformation amount and the deformation coefficient, and finally, the pixel value corresponding to the target position after the pixel point is moved may be determined according to the initial position of the pixel point and the second deformation amount.
The liquefaction parameters corresponding to different deformation areas can be preset according to actual requirements. For example, for a circular deformation area, the liquefaction parameters may be preset to be related to the radius of the circular area, the position of the center of the circle, and the initial position of a pixel point in the circular area; for another example, for a deformed region of an equilateral triangle, the liquefaction parameters may be preset to be related to the position of the center point of the equilateral triangle region, the length of the middle line of the equilateral triangle region, and the initial positions of the pixels in the equilateral triangle region; and so on.
In the embodiment of the disclosure, when the pixel value corresponding to the target position after each pixel point in the deformation region is moved is calculated, a proper liquefaction parameter may be selected according to the deformation region, and then the product of the liquefaction parameter and the movement direction is calculated to obtain the first deformation amount corresponding to the pixel point. Then, a product between the first deformation amount and the deformation coefficient of the pixel point can be calculated to obtain a second deformation amount corresponding to the pixel point. And finally, according to the initial position and the second type variable of the pixel point, the target position of the pixel point after movement can be determined, and further the pixel value corresponding to the target position is determined. Wherein the target position is assigned to the same pixel value as the initial position.
For example, a difference between the initial position of the pixel point and the second shape variable may be calculated, and the obtained difference may be determined as the target position of the pixel point after liquefaction.
Further, in an optional implementation manner of the present disclosure, in a case that the deformation area is a circular area, when calculating the first deformation amount corresponding to the pixel point, the radius length and the deformation degree factor of the circular area may be obtained first, and then the radius length and the deformation degree factor are calculated according to a preset algorithm to determine the first deformation amount corresponding to the pixel point based on the vector of the moving direction and the vector from the initial position of the pixel point to the position of the center of the circle.
The deformation degree factor can be preset, and corresponding deformation degree factors can be preset for deformation areas of different shapes. The preset algorithm may be a calculation formula predefined according to actual requirements, a corresponding calculation formula may be predefined for deformation regions of different shapes, and during calculation, a suitable calculation formula is selected according to the shape of the deformation region to calculate the first deformation amount.
In the embodiment of the disclosure, for a circular deformation area, the radius length and the deformation degree factor corresponding to the circular area can be obtained, and then the first deformation amount corresponding to the pixel point is obtained according to the vector of the moving direction, the vector from the initial position of the pixel point to the position of the circle center, the deformation degree factor and the radius length by calculation according to a preset algorithm.
Exemplarily, when the deformation region is a circular region, the first deformation amount of the pixel point X in the circular region may be calculated by a preset algorithm shown in the following formula (2), and the target position of the pixel point X after liquefaction may be calculated by the following formula (3).
Figure BDA0003713105090000131
Figure BDA0003713105090000132
Wherein Q represents a first deformation amount corresponding to the pixel point X, F represents a deformation coefficient of the pixel point X,
Figure BDA0003713105090000133
which represents the initial position of the pixel point X,
Figure BDA0003713105090000134
the target position of the pixel point X after liquefaction is represented, R represents the radius length of the circular area,
Figure BDA0003713105090000135
indicates the center position of the center C of the circular area, s indicates a deformation degree factor,
Figure BDA0003713105090000136
indicates the position of the coordinate point M in the moving direction,
Figure BDA0003713105090000137
a vector representing the direction of the movement,
Figure BDA0003713105090000138
and representing the vector from the initial position of the pixel point X to the position of the center of a circle.
In an optional embodiment of the present disclosure, it is considered that the moving direction mainly plays a role of controlling the moving direction of the pixel, and therefore, when the target position of the pixel after moving is calculated, the length of the vector of the moving direction may not be considered, so that the above formula (2) and formula (3) may be optimized, and the target position of the pixel after liquefaction is calculated by using the following formula (4).
Figure BDA0003713105090000139
The meaning of each part in the formula (4) can refer to the explanation of the meaning of each part in the above formulas (2) and (3), and is not described herein again.
In the embodiment of the disclosure, a first deformation amount corresponding to a pixel point is determined according to a liquefaction parameter and a moving direction corresponding to a deformation region, a second deformation amount corresponding to a pixel point is determined according to the first deformation amount and the deformation coefficient, and a pixel value corresponding to a target position after the pixel point is moved is determined according to an initial position and the second deformation amount of the pixel point.
In consideration of the fact that a better special effect shape may not be achieved by one-time liquefaction treatment, in order to obtain a better liquefaction effect and make the liquefied special effect shape more approximate to an expected liquefied shape, in an optional implementation manner of the present disclosure, a multi-deformation superposition manner may be adopted to fit to obtain a special effect shape approximating to the liquefied shape. Therefore, in the embodiment of the present disclosure, after determining the liquefied special effect shape of the target portion according to the pixel value of the target position, the method may further include:
determining a deformation enhancing region at a position closer to the special effect shape along the moving direction;
responding to the movement operation of the deformation enhancement area along the movement direction, and determining the deformation coefficient corresponding to the pixel point and the liquefaction shape according to the movement direction and the initial position of the pixel point in the deformation enhancement area;
determining a pixel value corresponding to a target position of the pixel point after the pixel point is subjected to enhanced liquefaction based on the deformation coefficient corresponding to the liquefaction shape, and acquiring an enhanced special effect shape of the target part after liquefaction according to the pixel value of the target position after the enhanced liquefaction;
and according to the set liquefaction iteration times for enhancing the special effect shape, repeatedly determining a new deformation enhancement area at a position closer to the special effect shape along the moving direction to carry out liquefaction enhancement processing.
It is understood that the shape of the deformation enhancing region is the same as the shape of the deformation region at the time of the first liquefaction process, for example, if the deformation region is a circular region, the determined deformation enhancing region is also a circular region.
In the embodiment of the present disclosure, after the special effect shape of the target portion after liquefaction is determined for the first time, a new deformation region may be determined, and the newly determined deformation region may be referred to as a deformation enhancement region, where the deformation enhancement region is a new deformation region determined at a position closer to the special effect shape along the moving direction, and a size of the deformation enhancement region compared to a previous deformation region may be determined according to the liquefaction shape, for example, if the liquefaction shape is a sharp corner, the deformation enhancement region may be smaller than the previous deformation region, the liquefaction shape is an arc, and the deformation enhancement region may be larger than the previous deformation region, and so on.
Then, for the newly determined deformation enhancing region, in response to the movement operation of the deformation enhancing region along the moving direction, deformation coefficients corresponding to the pixel points in the deformation enhancing region and the liquefaction shape may be determined according to the moving direction and the initial positions of the pixel points in the deformation enhancing region, further, the pixel value corresponding to the target position after the enhancement liquefaction of each pixel point in the deformation enhancing region is determined based on the deformation coefficient corresponding to the liquefaction shape, and the enhanced special effect shape after the liquefaction of the target position is obtained according to the pixel value of the target position after the enhancement liquefaction. And then, determining a new deformation enhancement area at a position closer to the special effect shape along the moving direction again to carry out liquefaction enhancement processing, and repeating the liquefaction processing steps until the number of times of liquefaction processing reaches the preset number of times of liquefaction iteration for enhancing the special effect shape.
The number of liquefaction iterations may be preset according to actual requirements, for example, the number of liquefaction iterations may be set to 4 or 6.
It can be understood that, in each liquefaction processing process, for the steps of determining the deformation coefficient of the pixel point in the new deformation enhanced region and determining the pixel value corresponding to the target position after the pixel point is liquefied based on the deformation coefficient, reference may be made to the relevant description in the foregoing embodiment, and the difference is that the relevant parameters (such as the circle center position and the radius length of the circular region) of the deformation enhanced region and the initial position of the pixel point in the deformation enhanced region are changed, but the implementation principle is similar, and therefore, a detailed description of the specific process of the liquefaction enhanced processing is not described here.
In the embodiment of the disclosure, after determining the special effect shape of the liquefied target portion according to the pixel value of the target position, determining a deformation enhancing region at a position closer to the special effect shape along the moving direction, responding to the moving operation of the deformation enhancing region along the moving direction, determining the deformation coefficient corresponding to the pixel point and the liquefied shape according to the moving direction and the initial position of the pixel point in the deformation enhancing region, further determining the pixel value corresponding to the target position of the pixel point after the liquefaction enhancement is performed based on the deformation coefficient corresponding to the liquefied shape, obtaining the enhanced special effect shape of the liquefied target portion according to the pixel value of the target position after the liquefaction enhancement, and repeating the liquefaction enhancement processing of determining a new deformation enhancing region at a position closer to the special effect shape along the moving direction according to the set number of liquefaction iterations for enhancing the special effect shape, thus, by repeating the liquefaction processing a plurality of times, a special effect shape closer to a desired liquefaction shape can be obtained, and the liquefaction effect can be improved.
Further, in an alternative embodiment of the present disclosure, in a case where the deformation region is a circular region and the liquefied shape is a pointed shape, determining the deformation enhancing region at a position closer to the special effect shape along the moving direction may include:
setting a new circle center position at a position closer to the special effect shape along the moving direction, and determining a new radius length, wherein the new radius length is smaller than the radius length of the last circular area;
and determining a circular enhanced area according to the new circle center position and the new radius length.
In the embodiment of the present disclosure, when the deformation region is a circular region and the liquefaction shape is a sharp corner shape, a new circle center position may be set at a position closer to the special effect shape along the moving direction, and a new radius length may be determined, and the new radius length is smaller than the radius length of the previous circular region, and then, the circular enhancement region may be determined according to the new circle center position and the new radius length.
Illustratively, fig. 5 is a schematic diagram of a change of a circular area during an iterative liquefaction process according to an embodiment of the present disclosure. In FIG. 5, point C 1 、C 2 、C 3 And C 4 The center of each circle is the center of a circle in different circular areas, M is a coordinate point in the moving direction, and the line connecting the center of each circle and M is a straight line in which the moving direction is located, namely the center of each circle is in the moving direction. As shown in fig. 5, in the liquefaction iteration process, the center of the circular area is closer to the point M than the center of the previous circular area, that is, closer to the position of the special effect shape, and the radius length of the circular area is smaller than the radius length of the previous circular area at each liquefaction iteration. The liquefaction iteration can deform a sharp-angled shape.
Fig. 6 is a schematic diagram illustrating effect changes of an iterative process of liquefying shoulders in an image into right-angled shoulders according to an embodiment of the present disclosure, and as shown in fig. 6, if a special effect shape obtained after a first liquefaction process is not a good right-angled shoulder, a deformed region is re-determined on the basis of a result of the first liquefaction process, and a second liquefaction process is continued, and the obtained special effect shape is improved in comparison with the first liquefaction effect, but is still not a good right angle, and a deformed region is re-determined on the basis of a result of the second liquefaction process, and a third liquefaction process is continued. And continuing to carry out the fourth liquefaction treatment to obtain the special effect shape closer to the right-angle shoulder. If the preset liquefaction iteration times are 4 times, stopping the iteration after carrying out the fourth liquefaction treatment, wherein the obtained special effect shape is the final liquefaction result, and if the preset liquefaction iteration times are more than 4 times, continuing the next liquefaction treatment until the liquefaction treatment times reach the preset liquefaction iteration times.
Fig. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure, where the apparatus may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 7, the image processing apparatus 70 includes: a first determination module 710, a second determination module 720, and a processing module 730.
The first determining module 710 is configured to determine a deformation region corresponding to a target portion to be liquefied in an image;
a second determining module 720, configured to determine, in response to the moving operation on the deformation region, a deformation coefficient corresponding to a pixel point according to a moving direction and an initial position of the pixel point in the deformation region;
the processing module 730 is configured to determine a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determine the special effect shape of the liquefied target portion according to the pixel value of the target position.
In an optional implementation of the present disclosure, the second determining module 720 may include:
an obtaining unit, configured to determine a deformation reference line corresponding to the moving direction in the deformation region, and obtain a position parameter between a pixel point in the deformation region from the initial position to the deformation reference line;
and the first determining unit is used for determining the deformation coefficient corresponding to the pixel point according to the position parameter.
Further, in an optional embodiment of the present disclosure, in a case that the deformation region is a circular region, the obtaining unit is further configured to:
determining a first diameter consistent with the moving direction and a second diameter perpendicular to the first diameter in the circular area, wherein the second diameter and the first diameter are line segments perpendicular to each other through the center of a circle;
determining a first distance between a pixel point within the circular region from the initial position to the first diameter and a second distance from the initial position to the second diameter.
In an alternative embodiment of the present disclosure, in a case where the deformation region is a circular region and the liquefied shape is a pointed shape, the first determination unit is further configured to:
acquiring a first preset weight and a second preset weight which are matched with the angle of the sharp corner shape;
calculating a difference result of the radius length of the circular region and the first distance, and a first product of the difference result and the first weight;
acquiring a second product of the second distance and the second weight, and a summation result of the first product and the second product;
and calculating the ratio of the summation result to the radius length as a deformation coefficient corresponding to the pixel point and the sharp corner shape.
In an optional implementation manner of the present disclosure, the processing module 730 includes:
a second determining unit, configured to determine a first deformation amount corresponding to the pixel point according to the liquefaction parameter corresponding to the deformation region and the moving direction;
a third determining unit, configured to determine a second deformation amount corresponding to the pixel point according to the first deformation amount and the deformation coefficient;
and the fourth determining unit is used for determining the pixel value corresponding to the target position of the pixel point after the pixel point is moved according to the initial position of the pixel point and the second shape variable.
Further, in an optional embodiment of the present disclosure, in case that the deformation region is a circular region, the second determining unit is further configured to:
acquiring the radius length and the deformation degree factor of the circular area;
and calculating the radius length and the deformation degree factor according to a preset algorithm to determine a first deformation amount corresponding to the pixel point based on the vector of the moving direction and the vector from the initial position of the pixel point to the position of the circle center.
In an optional implementation manner of the present disclosure, the first determining module 710 is further configured to:
determining a deformation enhancing region at a position closer to the special effect shape along the moving direction;
the second determining module 720 is further configured to:
responding to the movement operation of the deformation enhancement area along the movement direction, and determining the deformation coefficient corresponding to the pixel point and the liquefaction shape according to the movement direction and the initial position of the pixel point in the deformation enhancement area;
the processing module 730 is further configured to:
determining a pixel value corresponding to a target position of the pixel point after the enhanced liquefaction is carried out based on the deformation coefficient corresponding to the liquefaction shape, and acquiring an enhanced special effect shape of the target position after the liquefaction according to the pixel value of the target position after the enhanced liquefaction;
the image processing apparatus 70 further includes:
and a control module, configured to control the first determining module 710, the second determining module 720, and the processing module 730 to repeatedly determine a new deformation enhancing region at a position closer to the special effect shape along the moving direction for performing liquefaction enhancement processing according to the set number of liquefaction iterations for enhancing the special effect shape.
Further, in an optional embodiment of the present disclosure, in a case that the deformation region is a circular region and the liquefaction shape is a pointed shape, the first determining module 710 is further configured to:
setting a new circle center position at a position closer to the special effect shape along the moving direction, and determining a new radius length, wherein the new radius length is smaller than the radius length of the last circular area;
and determining a circular enhanced area according to the new circle center position and the new radius length.
The image processing device provided by the embodiment of the disclosure can execute the image processing method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
To implement the above embodiments, the present disclosure also proposes a computer program product comprising a computer program/instructions which, when executed by a processor, implements the image processing method in the above embodiments.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Referring now specifically to fig. 8, a schematic diagram of a structure suitable for implementing an electronic device 800 in embodiments of the present disclosure is shown. The electronic device 800 in the disclosed embodiment may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, or the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program performs the above-described functions defined in the image processing method of the embodiment of the present disclosure when executed by the processing apparatus 801.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: determining a deformation area corresponding to a target part to be liquefied in the image; responding to the movement operation of the deformation area, and determining a deformation coefficient corresponding to a pixel point according to the movement direction and the initial position of the pixel point in the deformation area; and determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In accordance with one or more embodiments of the present disclosure, there is provided an electronic device including:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instructions from the memory and executing the instructions to realize the image processing method provided by the present disclosure.
According to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing any of the image processing methods provided by the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (11)

1. An image processing method, characterized by comprising:
determining a deformation area corresponding to a target part to be liquefied in the image;
responding to the movement operation of the deformation area, and determining a deformation coefficient corresponding to a pixel point according to the movement direction and the initial position of the pixel point in the deformation area;
and determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position.
2. The method according to claim 1, wherein the determining a deformation coefficient corresponding to the pixel point according to the moving direction and the initial position of the pixel point in the deformation region comprises:
determining a deformation reference line corresponding to the moving direction in the deformation area, and acquiring position parameters of pixel points in the deformation area from the initial position to the deformation reference line;
and determining the deformation coefficient corresponding to the pixel point according to the position parameter.
3. The method according to claim 2, wherein, in the case where the deformation region is a circular region,
the determining a deformation reference line corresponding to the moving direction in the deformation region and obtaining the position parameters of the pixel points in the deformation region from the initial position to the deformation reference line includes:
determining a first diameter consistent with the moving direction and a second diameter perpendicular to the first diameter in the circular area, wherein the second diameter and the first diameter are line segments perpendicular to each other through the center of a circle;
determining a first distance between a pixel point within the circular region from the initial position to the first diameter and a second distance from the initial position to the second diameter.
4. The method according to claim 3, wherein in the case that the liquefaction shape is a sharp corner shape, the determining the deformation coefficient corresponding to the pixel point according to the position parameter includes:
acquiring a first preset weight and a second preset weight which are matched with the angle of the sharp corner shape;
calculating a difference result of the radius length of the circular region and the first distance, and a first product of the difference result and the first weight;
obtaining a second product of the second distance and the second weight, and a summation result of the first product and the second product;
and calculating the ratio of the summation result to the radius length as a deformation coefficient corresponding to the pixel point and the sharp corner shape.
5. The method according to claim 1, wherein the determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient comprises:
determining a first deformation amount corresponding to the pixel point according to the liquefaction parameter corresponding to the deformation area and the moving direction;
determining a second deformation quantity corresponding to the pixel point according to the first deformation quantity and the deformation coefficient;
and determining a pixel value corresponding to the target position of the pixel point after the pixel point is moved according to the initial position and the second shape variable of the pixel point.
6. The method according to claim 5, wherein, in the case where the deformation region is a circular region, the determining a first deformation amount corresponding to the pixel point from the liquefaction parameter corresponding to the deformation region and the moving direction includes:
acquiring the radius length and the deformation degree factor of the circular area;
and calculating the radius length and the deformation degree factor according to a preset algorithm to determine a first deformation amount corresponding to the pixel point based on the vector of the moving direction and the vector from the initial position of the pixel point to the position of the circle center.
7. The method according to any one of claims 1 to 6, further comprising, after determining the liquefied special effect shape of the target portion according to the pixel value of the target position:
determining a deformation enhancing region at a position closer to the special effect shape along the moving direction;
responding to the movement operation of the deformation enhancement area along the movement direction, and determining the deformation coefficient corresponding to the pixel point and the liquefaction shape according to the movement direction and the initial position of the pixel point in the deformation enhancement area;
determining a pixel value corresponding to a target position of the pixel point after the enhanced liquefaction is carried out based on the deformation coefficient corresponding to the liquefaction shape, and acquiring an enhanced special effect shape of the target position after the liquefaction according to the pixel value of the target position after the enhanced liquefaction;
and according to the set liquefaction iteration times for enhancing the special effect shape, repeatedly determining a new deformation enhancing area at a position closer to the special effect shape along the moving direction to carry out liquefaction enhancing treatment.
8. The method according to claim 7, wherein in the case where the deformation region is a circular region and the liquefaction shape is a pointed shape,
determining a deformation enhancing region at a position closer to the special effect shape along the moving direction, including:
setting a new circle center position at a position closer to the special effect shape along the moving direction, and determining a new radius length, wherein the new radius length is smaller than the radius length of the last circular area;
and determining a circular enhanced area according to the new circle center position and the new radius length.
9. An image processing apparatus characterized by comprising:
the first determining module is used for determining a deformation area corresponding to a target part to be liquefied in the image;
the second determining module is used for responding to the moving operation of the deformation area and determining the deformation coefficient corresponding to the pixel point according to the moving direction and the initial position of the pixel point in the deformation area;
and the processing module is used for determining a pixel value corresponding to the target position after the pixel point is moved based on the deformation coefficient, and determining the special effect shape of the liquefied target position according to the pixel value of the target position.
10. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instructions from the memory and executing the instructions to realize the image processing method of any one of the claims 1 to 8.
11. A computer-readable storage medium, characterized in that the storage medium stores a computer program for executing the image processing method of any one of claims 1 to 8.
CN202210730478.4A 2022-06-24 2022-06-24 Image processing method, image processing device, electronic equipment and storage medium Pending CN115100029A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210730478.4A CN115100029A (en) 2022-06-24 2022-06-24 Image processing method, image processing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210730478.4A CN115100029A (en) 2022-06-24 2022-06-24 Image processing method, image processing device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115100029A true CN115100029A (en) 2022-09-23

Family

ID=83293531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210730478.4A Pending CN115100029A (en) 2022-06-24 2022-06-24 Image processing method, image processing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115100029A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024120223A1 (en) * 2022-12-09 2024-06-13 北京字跳网络技术有限公司 Image processing method and apparatus, and device, storage medium and computer program product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024120223A1 (en) * 2022-12-09 2024-06-13 北京字跳网络技术有限公司 Image processing method and apparatus, and device, storage medium and computer program product

Similar Documents

Publication Publication Date Title
CN110069191B (en) Terminal-based image dragging deformation implementation method and device
CN110837332A (en) Face image deformation method and device, electronic equipment and computer readable medium
CN115100029A (en) Image processing method, image processing device, electronic equipment and storage medium
CN111243085B (en) Training method and device for image reconstruction network model and electronic equipment
CN112257582A (en) Foot posture determination method, device, equipment and computer readable medium
CN110223220B (en) Method and device for processing image
CN111915532B (en) Image tracking method and device, electronic equipment and computer readable medium
CN110069195B (en) Image dragging deformation method and device
CN114234984B (en) Indoor positioning track smoothing method, system and equipment based on difference matrix
CN110969233A (en) Two-dimensional code generation method and device and hardware device
CN114723600A (en) Method, device, equipment, storage medium and program product for generating cosmetic special effect
CN110070479B (en) Method and device for positioning image deformation dragging point
CN111290692B (en) Picture display method and device, electronic equipment and computer readable medium
CN112764629B (en) Augmented reality interface display method, device, equipment and computer readable medium
CN111724329B (en) Image processing method and device and electronic equipment
CN114693859A (en) Highlight rendering method, highlight rendering device, highlight rendering medium and electronic equipment
CN116109744A (en) Fluff rendering method, device, equipment and medium
CN113672122A (en) Image processing method and device and electronic equipment
CN111460334A (en) Information display method and device and electronic equipment
CN111583139A (en) Blush adjusting method, blush adjusting device, electronic equipment and computer readable medium
CN110825480A (en) Picture display method and device, electronic equipment and computer readable storage medium
CN114816606B (en) Self-adaptive adjustment method and device of window graduated scale, electronic equipment and medium
CN111415382B (en) Method and device for processing human body arm body beautification in picture and electronic equipment
CN112215774B (en) Model training and image defogging methods, apparatus, devices and computer readable media
CN113741749B (en) Cursor position updating method and device and electronic equipment

Legal Events

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