Image editing method, electronic device, computer program product and chip system

By determining a reference datum in the target cropping region for geometric correction in the image editing method, the problem of content loss caused by image correction in the prior art is solved, and the original image content is better preserved.

CN122473033APending Publication Date: 2026-07-28HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2025-01-27
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

Existing image geometric correction methods result in significant content loss in the corrected image compared to the original image.

Method used

In image editing methods, geometric correction operations are performed by determining a reference point for the geometric correction operation in the target cropping region, rather than in the entire original image.

Benefits of technology

It reduces content loss caused by geometric correction and preserves the original image content in the corrected target cropping area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122473033A_ABST
    Figure CN122473033A_ABST
Patent Text Reader

Abstract

This application relates to the field of terminal technology and provides an image editing method, electronic device, computer program product, and chip system. The image editing method includes: upon detecting a geometric correction operation targeting a cropped region in an original image, determining a reference datum for the geometric correction operation from the cropped region based on the type of the geometric correction operation; and performing geometric correction on the cropped region based on the reference datum and the geometric correction operation. Since the reference datum for the geometric correction operation targeting the cropped region is determined from a smaller area of ​​the cropped region, rather than from the entire original image, it allows the corrected cropped region to retain as much of the original image content as possible, reducing content loss due to geometric correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to an image editing method, electronic device, computer program product, and chip system. Background Technology

[0002] In daily life, when a target object in a user's photograph is distorted, the user can edit the image (e.g., cropping or geometric correction) to restore the target object to its true shape in the real-world scene, thus improving the image's aesthetics. However, the geometric correction methods provided by related technologies often result in significant content loss in the corrected image compared to the original. Summary of the Invention

[0003] This application provides an image editing method, electronic device, computer program product, and chip system that can retain as much of the original image content as possible in the target cropping area after geometric correction, reducing content loss caused by geometric correction.

[0004] In a first aspect, embodiments of this application provide an image editing method, comprising: when a geometric correction operation is detected targeting a cropping region in an original image, determining a reference datum for the geometric correction operation from the target cropping region according to the type of the geometric correction operation; and performing geometric correction on the target cropping region according to the reference datum and the geometric correction operation.

[0005] The original image can be an image taken by the user through an electronic device, or an image taken by the user through other devices (e.g., a camera) and sent to the electronic device; it can also be an image downloaded by the electronic device from the Internet, etc.

[0006] Optionally, the original image can be any image stored in the electronic device's image library. Alternatively, the original image can be any frame or multiple frames from any video stored in the electronic device's image library.

[0007] The target cropping region can be any rectangular area in the original image.

[0008] The size of the target cropped area is smaller than the size of the original image.

[0009] Geometric correction operations can include free rotation operations and perspective correction operations. Perspective correction operations can include horizontal perspective correction operations and vertical perspective correction operations.

[0010] According to the image editing method provided in the embodiments of this application, since the reference benchmark for the geometric correction operation of the target cropping region is determined from a smaller range of the target cropping region rather than from the entire original image, it is possible to retain as much of the original image content as possible in the corrected target cropping region, thereby reducing the content loss caused by geometric correction.

[0011] In one alternative implementation of the first aspect, determining a reference datum for the geometric correction operation from the target cropping region according to the type of geometric correction operation includes: if the geometric correction operation is a perspective correction operation, determining the straight line containing the edge line corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping region as the reference datum for the perspective correction operation.

[0012] In one optional implementation of the first aspect, when the geometric correction operation is a perspective correction operation, the straight line containing the edge line corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference datum for the perspective correction operation, including: when the geometric correction operation is a perspective correction operation in the horizontal direction and the correction direction of the correction operation is horizontal to the right, the left edge of the target cropping area is determined as the reference datum.

[0013] In one optional implementation of the first aspect, when the geometric correction operation is a perspective correction operation, the straight line containing the edge line corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference datum for the perspective correction operation, including: when the geometric correction operation is a perspective correction operation in the horizontal direction and the correction direction of the correction operation is horizontal to the left, the right edge of the target cropping area is determined as the reference datum.

[0014] In one optional implementation of the first aspect, when the geometric correction operation is a perspective correction operation, the straight line containing the edge line corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference datum for the perspective correction operation, including: when the geometric correction operation is a perspective correction operation in the vertical direction and the correction direction of the correction operation is vertically downward, the upper edge line of the target cropping area is determined as the reference datum.

[0015] In one optional implementation of the first aspect, when the geometric correction operation is a perspective correction operation, the straight line containing the edge line corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference datum for the perspective correction operation, including: when the geometric correction operation is a perspective correction operation in the vertical direction and the correction direction of the correction operation is vertically upward, the lower edge line of the target cropping area is determined as the reference datum.

[0016] In one alternative implementation of the first aspect, determining a reference datum for the geometric correction operation from the target cropping region according to the type of the geometric correction operation includes: if the geometric correction operation is a free rotation operation, determining the center point of the target cropping region as the reference datum for the free rotation operation.

[0017] According to the image editing method provided in this implementation,

[0018] In one alternative implementation of the first aspect, the image editing method further includes:

[0019] If a movement operation of the cropping frame corresponding to the target cropping area is detected, the same geometric correction operation as the target cropping area is performed on the new cropping area selected by the cropping frame.

[0020] According to the image editing method provided in this implementation, since the electronic device can automatically apply the geometric correction operation performed on the target cropping region to the new cropping region when it detects that the cropping box corresponding to the target cropping region has been moved, the user no longer needs to perform manual geometric correction on the new cropping region, thus improving the efficiency of image geometric correction. Furthermore, since the deformation of the original image can adaptively change with the movement of the cropping box, the corrected target cropping region can retain as much of the original image content as possible.

[0021] Secondly, embodiments of this application provide an electronic device, including: one or more processors, and a memory;

[0022] The memory is coupled to one or more processors, and the memory is used to store computer program code, which includes computer instructions. One or more processors call the computer instructions to cause the electronic device to perform an image editing method as described in any of the first aspects above.

[0023] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform an image editing method as described in any of the implementations of the first aspect above.

[0024] Fourthly, embodiments of this application provide a computer program product, including a computer program, which, when run, causes an image editing method as described in any implementation of the first aspect above to be executed.

[0025] Fifthly, embodiments of this application provide a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform an image editing method as described in any of the implementations of the first aspect above.

[0026] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0027] Figure 1 This is a schematic diagram of a shooting scene for an image;

[0028] Figure 2 This is a schematic diagram of an image editing process;

[0029] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0030] Figure 4 An architecture diagram of a software system for an electronic device provided in this application embodiment;

[0031] Figure 5 A schematic flowchart illustrating an image editing method provided in an embodiment of this application;

[0032] Figure 6 A schematic diagram of a user interface involved in an image editing process provided in an embodiment of this application;

[0033] Figure 7 A schematic diagram of a user interface related to a geometric correction operation of an image provided in an embodiment of this application;

[0034] Figure 8 A schematic diagram of a user interface involved in performing a free rotation operation on an image, provided as an embodiment of this application;

[0035] Figure 9 This is a schematic diagram of a user interface involved in performing perspective correction on an image in the horizontal direction, as provided in an embodiment of this application.

[0036] Figure 10 This is a schematic diagram of a user interface involved in performing perspective correction on an image in the horizontal direction, as provided in an embodiment of this application.

[0037] Figure 11 This is a comparative illustration of the corrected images obtained by using the image editing method provided in the embodiments of this application and the image correction method in related technologies, respectively.

[0038] Figure 12A schematic flowchart illustrating an image editing method provided in another embodiment of this application;

[0039] Figure 13 This is a schematic diagram illustrating the effect of an image editing method provided in another embodiment of this application. Detailed Implementation

[0040] It should be noted that the terminology used in the implementation section of the embodiments of this application is only used to explain the specific embodiments of this application and is not intended to limit this application. In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related items, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, "at least one" or "one or more" means one, two or more.

[0041] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0042] References to "one embodiment" or "some embodiments" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0043] In daily life, when a target object in a user's photograph is distorted, the user can edit the image (e.g., cropping or geometric correction) to correct the target object to its true shape in the real-world scene, thereby improving the image's aesthetics. For example, Figure 1 This is a schematic diagram of a scene where an image was taken. For example... Figure 1As shown in (a), when a user stands on flat ground to photograph the scene where building 101 is located, because building 101 is much higher than the user, the user needs to tilt the camera of phone 102 upwards to bring the scene where building 101 is located into the camera's field of view before taking the picture. However, this will cause the building 101 in the captured image to be distorted. Specifically, as shown in (a), Figure 1 As shown in (b), building 101 in the image is distorted into a trapezoid that is narrower at the top and wider at the bottom. In this case, the user can edit the image to restore building 101 to a rectangle.

[0044] For example, Figure 2 This is a diagram illustrating an image editing process. (For example...) Figure 2 As shown, when a user needs to access their phone... Figure 1 When editing images taken in the phone, users can control the phone to enter various states such as... Figure 2 Image editing interface 20 is shown in (a) above. Exemplarily, image editing interface 20 may be configured with a cropping control 201, which allows the user to crop or geometrically correct the image. Geometric correction typically includes rotation, horizontal perspective correction, and vertical perspective correction. Based on this, cropping control 201 may be equipped with a rotation control 2011, a horizontal perspective correction control 2012, and a vertical perspective correction control 2013. Rotation control 2011 allows the user to rotate the image, horizontal perspective correction control 2012 allows the user to adjust the perspective distortion of the image in the horizontal direction, and vertical perspective correction control 2013 allows the user to adjust the perspective distortion of the image in the vertical direction. Since... Figure 1 The image in the image exhibits perspective distortion in the vertical direction, therefore, as... Figure 2 As shown in (b), the user can select the vertical perspective correction control 2013 under the cropping control 201 and drag the corresponding slider of the vertical perspective correction control 2013, for example, drag the corresponding slider of the vertical perspective correction control 2013 to the right to restore the building 101 in the image to a rectangle.

[0045] However, in practice, perspective correction often involves cropping and / or rotating the image, leading to the loss of some content. For example, elements at the image edges may be cropped out due to perspective correction. This loss is particularly pronounced when the user first crops the image and then applies perspective correction to the cropped image. This is because perspective correction is generally based on the edges of the original image. For instance, when a user performs vertical perspective correction, the phone typically rotates the image around its top or bottom edge; similarly, when performing horizontal perspective correction, the phone rotates the image around its top or bottom edge. Figure 2 As shown in (b), when the user drags the slider corresponding to the vertical perspective correction control 2013 to the right to restore the building 101 in the image to a rectangle, the phone rotates the image around the straight line L1 containing the bottom edge of the image. This causes some pixels at the edge of the image (such as some tree branches on the right side of the image) to be moved out of the editing box. For example, as... Figure 2 As shown in (c), when a user crops a small area from an image and performs perspective correction on that area, the phone still rotates the image around the line L1 containing the bottom edge of the original image. This exacerbates the content loss in the geometrically corrected area. For example... Figure 2 As shown in (d) in the image, some of the flowers and all the branches on the right side of the image will be moved out of the frame.

[0046] In view of this, in order to preserve more of the original image's content in the geometrically corrected image, embodiments of this application provide an image editing method. When a geometric correction operation is detected targeting a cropped region in the original image, a reference datum for the geometric correction operation is determined from the cropped region based on the type of the operation. Geometric correction is then performed on the cropped region based on the reference datum and the geometric correction operation. Since the reference datum for the geometric correction operation targeting the cropped region is determined from a smaller area within the cropped region, rather than from the entire original image, it allows the corrected cropped region to retain as much of the original image's content as possible, reducing content loss caused by geometric correction.

[0047] The image editing method provided in this application can be applied to electronic devices. Exemplarily, electronic devices may include cameras, mobile phones, tablets, wearable devices, augmented reality (AR) devices, virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs), etc. This application does not limit the specific type of electronic device.

[0048] The following explanation uses a mobile phone as an example to illustrate the structure of an electronic device. For example, Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180I, a touch sensor 180J, a bone conduction sensor 180K, an ambient light sensor 180L, etc.

[0049] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.

[0050] Camera 193 can be used to capture still images or videos. The electronic device may include one or N cameras 193, where N is an integer greater than 1.

[0051] The display screen 194 can be used to display images or videos, etc. The display screen 194 may include a display panel.

[0052] Electronic devices can achieve display functions through GPUs, displays, and application processors.

[0053] Electronic devices can achieve shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0054] Electronic devices run a software system (i.e., an operating system). This software system can be... system, system, The system, Harmony OS, or other operating systems, etc.

[0055] For example, the software system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture, etc. This application embodiment uses a layered architecture as an example to illustrate the software system of an electronic device.

[0056] Figure 4 This is an architecture diagram of a software system for an electronic device provided in an embodiment of this application. Figure 4As shown, a layered architecture divides the software system of an electronic device into several layers, each with a clear role and division of labor, and the layers communicate with each other through software interfaces. For example, the software system of an electronic device can be divided into four layers, from top to bottom: the application (APP) layer, the application framework layer, the Android Runtime and system libraries, and the kernel layer.

[0057] The application layer can include a series of application packages. Application packages may include, for example, applications for camera, gallery, calendar, calling, maps, navigation, WLAN, Bluetooth, music, video, and SMS.

[0058] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer may include some predefined functions.

[0059] The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system.

[0060] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0061] The application layer and application framework layer run in a virtual machine.

[0062] System libraries can include multiple functional modules. For example: surface manager, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), media libraries, etc.

[0063] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, and sensor drivers.

[0064] The image editing method provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0065] For example, Figure 5 This is a schematic flowchart illustrating an image editing method provided in an embodiment of this application. Figure 5 As shown, the image editing method may include S501 to S502, which are detailed below:

[0066] S501, when the electronic device detects a geometric correction operation targeting a cropped region in the original image, it determines a reference for the geometric correction operation from the cropped region based on the type of the geometric correction operation.

[0067] For example, the original image may be an image taken by the user through an electronic device, or an image taken by the user through another device (e.g., a camera) and sent to the electronic device; it may also be an image downloaded by the electronic device from the Internet, etc. This application embodiment does not limit the source of the original image.

[0068] Optionally, the original image can be any image stored in the electronic device's image library. Alternatively, the original image can be any frame or multiple frames from any video stored in the electronic device's image library.

[0069] For example, Figure 6 This is a schematic diagram of a user interface involved in an image editing process provided in an embodiment of this application. For example... Figure 6 As shown, when a user needs to edit any image in the gallery, the user can... Figure 6 The image shows the gallery app icon 61 as an input click operation. When the electronic device detects that the gallery app icon 61 has been clicked, it can display the following: Figure 6 The gallery interface 62 is shown in (b) of the image.

[0070] For example, such as Figure 6 As shown in (b), the gallery interface 62 can include thumbnails of multiple images. When a user needs to view an image, the user can click on the thumbnail of that image. When the electronic device detects that a thumbnail of an image has been clicked, it can display something like... Figure 6 Image viewing interface 63 shown in (c) of the image.

[0071] For example, such as Figure 6 As shown in (c), the image viewing interface 63 can be configured with an image editing control 631, allowing the user to edit the image by clicking the image editing control 631. When the electronic device detects that the image editing control 631 in the image viewing interface 63 has been clicked, it can display the following: Figure 6 Image editing interface 64 is shown in (d) in the image.

[0072] For example, such as Figure 6As shown in (d), the image editing interface 64 can be configured with an image editing box 641 and an image cropping control 642. The image cropping control 642 can be configured with a free rotation control 6421, a horizontal perspective correction control 6422, a vertical perspective correction control 6423, a directional rotation control 6424, a mirror control 6425, and a slider 6426. The image editing box 641 is used for users to crop the image. For example, users can select the target cropping area by scaling the image editing box 641. The free rotation control 6421 is used for users to rotate the image at any angle. The horizontal perspective correction control 6422 is used for users to adjust the perspective distortion of the image in the horizontal direction. The vertical perspective correction control 6423 is used for users to adjust the perspective distortion of the image in the vertical direction. The directional rotation control 6424 allows users to rotate the image at a preset angle, such as 90 degrees. The mirror control 6425 allows users to mirror the image.

[0073] For example, Figure 7 This is a schematic diagram of a user interface related to a geometric correction operation of an image provided in an embodiment of this application. For example... Figure 7 As shown, when a user wants to crop a region from the original image and perform geometric correction on the cropped region, such as... Figure 7 As shown in (a), the user can select a target cropping region 6411 from the original image by scaling and / or dragging the image editing box 641. For example, the target cropping region 6411 can be a rectangular region of any position and size in the original image, and the size of the target cropping region 6411 is smaller than the size of the original image. After the user selects the target cropping region 6411, the mobile phone can crop the original image according to the target cropping region 6411 to obtain the desired result. Figure 7 The cropped image 71 is shown in (b) above. When a user wants to perform geometric correction on the cropped image 71, the user can perform a geometric correction operation on the cropped image 71. It should be noted that the cropped image 71 in this embodiment is the target cropping area.

[0074] For example, geometric correction operations may include free rotation operations and perspective correction operations. Perspective correction operations may include horizontal perspective correction operations and vertical perspective correction operations. Figure 7As shown in (b) of the image editing interface 64, the user can rotate the cropped image 71 by clicking the free rotation control 6421 in the image editing interface 64 and dragging the corresponding slider 6426 of the free rotation control 6421 to the left or right. The user can perform horizontal perspective correction on the cropped image 71 by clicking the horizontal perspective correction control 6422 in the image editing interface 64 and dragging the slider 6426 of the horizontal perspective correction control 6422 to the left or right. The user can perform vertical perspective correction on the cropped image 71 by clicking the vertical perspective correction control 6423 in the image editing interface 64 and dragging the slider 6426 of the vertical perspective correction control 6423 to the left or right.

[0075] Optionally, when the geometric correction operation is a free rotation operation, the electronic device can determine the center point of the cropped image 71 as the reference datum (i.e., rotation center) for the free rotation operation.

[0076] For example, Figure 8 This is a schematic diagram of a user interface involved in performing a free rotation operation on an image, as provided in an embodiment of this application. Figure 8 As shown in (a), the electronic device can determine the center point A1 of the cropped image 71 as the rotation center of the free rotation operation when it detects that the free rotation space 6421 in the image editing interface 64 is clicked.

[0077] Optionally, when the geometric correction operation is a perspective correction operation, the electronic device can determine the straight line containing the edge line of the four edges of the cropped image 71 that corresponds to the correction direction of the perspective correction operation as the reference reference (i.e., the rotation axis) for the perspective correction operation.

[0078] Specifically, when the geometric correction operation is a perspective correction operation in the horizontal direction, and the correction direction of the perspective correction operation is horizontal to the right, the electronic device can determine the straight line containing the left edge of the cropped image 71 as the reference benchmark for the perspective correction operation. When the geometric correction operation is a perspective correction operation in the horizontal direction, and the correction direction of the perspective correction operation is horizontal to the left, the electronic device can determine the straight line containing the right edge of the cropped image 71 as the reference benchmark for the perspective correction operation.

[0079] For example, Figure 9 This is a schematic diagram of a user interface used in performing horizontal perspective correction on an image, as provided in an embodiment of this application. Figure 9As shown in (a), when the electronic device detects that the horizontal perspective correction space 6422 in the image editing interface 64 has been clicked, and the user drags the slider 6426 corresponding to the horizontal perspective correction space 6422 to the left, the electronic device can determine the left edge Lz of the cropped image 71 as the rotation axis of the horizontal perspective correction operation. Figure 9 As shown in (b), when the electronic device detects that the horizontal perspective correction space 6422 in the image editing interface 64 is clicked and the user drags the slider 6426 corresponding to the horizontal perspective correction space 6422 to the right, the electronic device can determine the right line Ly of the cropped image 71 as the rotation axis of the horizontal perspective correction operation.

[0080] Specifically, when the geometric correction operation is a perspective correction operation in the vertical direction, and the correction direction of the perspective correction operation is vertically downward, the electronic device can determine the straight line containing the upper edge of the cropped image 71 as the reference benchmark for the perspective correction operation. When the geometric correction operation is a perspective correction operation in the vertical direction, and the correction direction of the perspective correction operation is vertically upward, the electronic device can determine the straight line containing the lower edge of the cropped image 71 as the reference benchmark for the perspective correction operation.

[0081] For example, Figure 10 This is a schematic diagram of a user interface used in performing perspective correction on an image in the vertical direction, as provided in an embodiment of this application. Figure 10 As shown in (a), when the electronic device detects that the vertical perspective correction space 6423 in the image editing interface 64 has been clicked, and the user drags the slider 6426 corresponding to the vertical perspective correction space 6423 to the left, the electronic device can determine the upper edge Ls of the cropped image 71 as the rotation axis of the vertical perspective correction operation. Figure 10 As shown in (b), when the electronic device detects that the vertical perspective correction space 6423 in the image editing interface 64 is clicked and the user drags the slider 6426 corresponding to the vertical perspective correction space 6423 to the right, the electronic device can determine the lower edge Lx of the cropped image 71 as the rotation axis of the vertical perspective correction operation.

[0082] S502, the electronic device performs geometric correction on the target cropping area based on the reference datum and geometric correction operation.

[0083] For example, please continue reading Figure 8 ,like Figure 8As shown in (a), when the electronic device detects that the free rotation control 6421 in the image editing interface 64 has been clicked, and the slider 6426 of the free rotation control 6421 has been dragged to the left by the user, the electronic device can rotate the cropped image 71 counterclockwise by a corresponding angle, with the center point A1 of the cropped image 71 as the rotation center, according to the specific scale of the leftward drag of the slider 6426. Figure 8 As shown in (b), when the electronic device detects that the free rotation control 6421 in the image editing interface 64 is clicked and the slider 6426 of the free rotation control 6421 is dragged to the right by the user, the electronic device can rotate the cropped image 71 clockwise by a corresponding angle based on the specific scale of the slider 6426 being dragged to the right, with the center point A1 of the cropped image 71 as the rotation center.

[0084] For example, please continue reading Figure 9 ,like Figure 9 As shown in (a), when the electronic device detects that the horizontal perspective correction control 6422 in the image editing interface 64 has been clicked, and the slider 6426 of the horizontal perspective correction control 6422 has been dragged to the left by the user, the electronic device can rotate the cropped image 71 by a corresponding angle, with the left edge Lz of the cropped image 71 as the rotation axis, according to the specific scale of the leftward drag of the slider 6426. Figure 9 As shown in (b), when the electronic device detects that the horizontal perspective correction control 6422 in the image editing interface 64 is clicked and the slider 6426 of the horizontal perspective correction control 6422 is dragged to the right by the user, the electronic device can rotate the cropped image 71 by a corresponding angle with the right side line Ly of the cropped image 71 as the rotation axis, according to the specific scale of the slider 6426 being dragged to the right.

[0085] For example, please continue reading Figure 10 ,like Figure 10 As shown in (a), when the electronic device detects that the vertical perspective correction control 6423 in the image editing interface 64 has been clicked, and the slider 6426 of the vertical perspective correction control 6423 has been dragged to the left by the user, the electronic device can rotate the cropped image 71 by a corresponding angle, using the left and top edges Ls of the cropped image 71 as the rotation axis, according to the specific scale of the leftward drag of the slider 6426. Figure 10 As shown in (b), when the electronic device detects that the vertical perspective correction control 6423 in the image editing interface 64 is clicked and the slider 6426 of the vertical perspective correction control 6423 is dragged to the right by the user, the electronic device can rotate the cropped image 71 by a corresponding angle with the lower edge Lx of the cropped image 71 as the rotation axis, according to the specific scale of the slider 6426 being dragged to the right.

[0086] Figure 11This diagram illustrates a comparison between the corrected images obtained using the image editing method provided in this application and the image correction method in related technologies. Figure 11 (a) in the figure refers to the image editing method provided in the embodiments of this application, which is used to perform the following operations on the original image: Figure 10 The corrected image obtained after perspective correction operation is shown in (b) above. Figure 11 (b) in the image correction diagram shows the image correction performed on the original image using a relevant technique. Figure 2 The image shown in (d) is the corrected image obtained after the image correction operation. Compare... Figure 11 As can be seen from (a) and (b) in the present application, the image correction method provided in this embodiment, compared with the image correction methods in related technologies, can retain more content of the original image in the corrected image. For example, Figure 11 In the corrected image shown in (a), the flower on the right edge is preserved.

[0087] As can be seen from the above, the image editing method provided in this application embodiment, since the reference benchmark for the geometric correction operation of the cropped image is determined from a smaller cropped image rather than from the entire original image, can retain as much of the content of the original image as possible in the corrected cropped image, reducing the content loss caused by geometric correction.

[0088] Figure 12 This is a schematic flowchart illustrating an image editing method according to another embodiment of this application. Figure 13 As shown, in some other embodiments of this application, after S502, the image editing method may further include S503, which is detailed below:

[0089] S503, when the electronic device detects a movement operation of the clipping frame corresponding to the target clipping area, it performs the same geometric correction operation on the new clipping area selected by the clipping frame as on the target clipping area.

[0090] For example, such as Figure 13 As shown in (a), assuming the electronic device performs perspective correction in the vertical direction on the target cropping region 131, the resulting corrected target cropping region is: Figure 13 As shown in (b) 132. When the electronic device detects a movement operation of the cropping frame corresponding to the corrected target cropping area 132, it performs a perspective correction operation in the same vertical direction as the target cropping area on the new cropping area selected by the cropping frame. For example, suppose the cropping frame corresponding to the target cropping area is moved to... Figure 13As shown in (c) at point 133, the new cropping area 133 selected by the cropping frame is obtained by the electronic device after performing a perspective correction operation in the vertical direction on the new cropping area.

[0091] It should be noted that when the cropping box is moved to a new position, the electronic device performs the same geometric correction operation on the new cropping area selected by the cropping box. Therefore, the deformation of the original image will change as the cropping box moves, as shown below. Figure 13 As shown in (b) and (c), this ensures that the corrected new cropped area retains as much of the original image content as possible. However, as... Figure 13 As shown in (d) in the related technology, when the cropping box is moved, the deformation of the original image does not change accordingly, which leads to a serious loss of content in the corrected image.

[0092] Based on the same technical concept, embodiments of this application also provide an electronic device, which may include one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and one or more processors call the computer instructions to cause the electronic device to perform one or more steps in any of the above method embodiments.

[0093] Based on the same technical concept, embodiments of this application also provide a computer-readable storage medium storing a computer-executable program, which, when invoked by a computer, causes the computer to perform one or more steps in any of the above method embodiments.

[0094] Based on the same technical concept, embodiments of this application also provide a computer program product, including a computer program, which, when run, causes an image editing method as described in any of the implementations of the first aspect above to be executed.

[0095] Based on the same technical concept, embodiments of this application also provide a chip system, including a processor coupled to a memory, which executes a computer-executable program stored in the memory to implement one or more steps in any of the above method embodiments. This chip system can be a single chip or a chip module composed of multiple chips.

[0096] In the above embodiments, the descriptions of each embodiment have different focuses. Parts not described in detail or in a particular embodiment can be referred to in the relevant descriptions of other embodiments. It should be understood that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0097] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0098] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0099] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. An image editing method, characterized in that, include: When a geometric correction operation is detected targeting a cropped region in the original image, a reference reference for the geometric correction operation is determined from the cropped region based on the type of the geometric correction operation. Based on the reference datum and the geometric correction operation, the target cropping region is geometrically corrected.

2. The image editing method according to claim 1, characterized in that, Determining a reference datum for the geometric correction operation from the target cropping region, based on the type of the geometric correction operation, includes: When the geometric correction operation is a perspective correction operation, the straight line containing the edge line of the four edges of the target cropping area that corresponds to the correction direction of the perspective correction operation is determined as the reference datum for the perspective correction operation.

3. The image editing method according to claim 2, characterized in that, When the geometric correction operation is a perspective correction operation, the straight line containing the edge corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference benchmark for the perspective correction operation, including: When the geometric correction operation is a perspective correction operation in the horizontal direction and the correction direction of the operation is horizontal to the right, the left edge of the target cropping area is determined as the reference datum.

4. The image editing method according to claim 2, characterized in that, When the geometric correction operation is a perspective correction operation, the straight line containing the edge corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference benchmark for the perspective correction operation, including: When the geometric correction operation is a perspective correction operation in the horizontal direction and the correction direction of the operation is horizontal to the left, the right line of the target cropping area is determined as the reference datum.

5. The image editing method according to claim 2, characterized in that, When the geometric correction operation is a perspective correction operation, the straight line containing the edge corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference benchmark for the perspective correction operation, including: When the geometric correction operation is a perspective correction operation in the vertical direction and the correction direction of the operation is vertically downward, the upper edge of the target cropping area is determined as the reference datum.

6. The image editing method according to claim 2, characterized in that, When the geometric correction operation is a perspective correction operation, the straight line containing the edge corresponding to the correction direction of the perspective correction operation among the four edges of the target cropping area is determined as the reference benchmark for the perspective correction operation, including: When the geometric correction operation is a perspective correction operation in the vertical direction and the correction direction of the operation is vertically upward, the lower edge of the target cropping area is determined as the reference datum.

7. The image editing method according to claim 1, characterized in that, Determining a reference datum for the geometric correction operation from the target cropping region, based on the type of the geometric correction operation, includes: When the geometric correction operation is a free rotation operation, the center point of the target cropping region is determined as the reference point for the free rotation operation.

8. The image editing method according to any one of claims 1 to 7, characterized in that, After geometric correction of the target cropping area, the following steps are also included: If a movement operation of the cropping frame corresponding to the target cropping area is detected, the same geometric correction operation as the target cropping area is performed on the new cropping area selected by the cropping frame.

9. An electronic device, characterized in that, include: One or more processors, and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the image editing method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, Includes a computer program, which, when run, causes the image editing method as described in any one of claims 1 to 8 to be performed.

11. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the image editing method as described in any one of claims 1 to 8.