Image cropping method and electronic device
AssigneeHuawei Technologies Co., Ltd.
InventorsYundie Zhang, Liang Hu, Yifan Ji
Life of this patent
Estimating the term…
Abstract
A method includes obtaining a first image, determining a first target curve of a first region occupied by the first image, where an area of the first region is equal to an area of the first image, determining a target object on the first image, moving the first image to obtain a second image, where a second target curve of a second region in which the target object on the second image is located is close to or overlaps the first target curve, and the second region is an external polygon of the target object, and cropping out an image part that is of the second image and that is moved out of the first region.
Claims20
A method implemented by an electronic device, wherein the method comprises:
- obtaining a first image;
- determining a first target curve of a first region occupied by the first image, wherein a first area of the first region is equal to a second area of the first image;
- determining a target object in the first image;
- moving the first image to obtain a second image, wherein the target object is in the second image, wherein a second target curve of a second region that comprises the target object is proximate to or overlaps the first target curve, and wherein the second region is an external polygon of the target object;
- cropping out an image part of the second image that is moved out of the first region;
- determining a first ratio of a first width of a remaining image on the second image to a second width of a third region that comprises the target object in the remaining image;
- and
- cropping the remaining image to obtain a third image when the first ratio is greater than a first threshold,
- wherein a second ratio of a first distance between a first upper edge of the third region and a second upper edge of the third image to a second distance between a first lower edge of the third region and a second lower edge of the third image is equal to a third ratio of a third distance between the first upper edge and a third upper edge of the remaining image to a fourth distance between the first lower edge and a third lower edge of the remaining image.
A method implemented by an electronic device, wherein the method comprises:
- obtaining a first image;
- determining at least two target curves of a first region that comprises the first image, wherein a first area of the first region is equal to a second area of the first image;
- determining a first center line of a second region that comprises a target object on the first image, wherein the second region is an external polygon of the target object;
- determining a first target curve that is in the at least two target curves and that is proximate to the first center line;
- determining a target size of a second image that is to be obtained after cropping the first image;
- cropping the first image based on the target size and the first target curve to obtain the second image,
- wherein a second target curve of a third region that comprises the second image and is proximate to or overlaps the first target curve, wherein
- the second target curve corresponds to the first target curve, and wherein a third area of the third region is equal to a fourth area of the second image;
- determining a first ratio of a first width of a remaining image on the second image to a second width of a third region that comprises the target object in the remaining image;
- and
- cropping the remaining image to obtain a third image when the first ratio is greater than a first threshold,
- wherein a second ratio of a first distance between a first upper edge of the third region and a second upper edge of the third image to a second distance between a first lower edge of the third region and a second lower edge of the third image is equal to a third ratio of a third distance between the first upper edge and a third upper edge of the remaining image to a fourth distance between the first lower edge and a third lower edge of the remaining image.
An electronic device comprising:
- a memory configured to store a first image and one or more computer programs;
- and
- a processor coupled to the memory, wherein when executed by the processor, the one or more computer programs cause the electronic device to:
- obtain a first image;
- determine a first target curve of a first region occupied by the first image, wherein a first area of the first region is equal to a second area of the first image;
- determine a target object in the first image;
- move the first image to obtain a second image, wherein a second target curve of a second region that comprises the target object is proximate to or overlaps the first target curve, and wherein the second region is an external polygon of the target object;
- crop out an image part of the second image that is moved out of the first region;
- wherein the second target curve is:
- determine a first ratio of a first width of a remaining image on the second image to a second width of a third region that comprises the target object in the remaining image;
- and
- crop the remaining image to obtain a third image when the first ratio is greater than a first threshold,
- wherein a second ratio of a first distance between a first upper edge of the third region and a second upper edge of the third image to a second distance between a first lower edge of the third region and a second lower edge of the third image is equal to a third ratio of a third distance between the first upper edge and a third upper edge of the remaining image to a fourth distance between the first lower edge and a third lower edge of the remaining image.
Dependencies are inferred from the claim text.