Image processing method and electronic equipment

By recognizing user presses on the main area of ​​an image in the gallery, the system performs background removal and generates the result, solving the problem of users being unable to effectively remove background images. This enables quick sharing or saving and improves the user experience.

CN121858016APending Publication Date: 2026-04-14HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, users cannot effectively remove cluttered or irrelevant background images around the main subject in an image from their gallery, which fails to meet users' needs for image cutout and sharing.

Method used

By detecting the user's pressing action in the main area of ​​the image, the system identifies the intention to cut out the image, performs the cutting out process, and generates the cutout result. The result supports floating display and drag-and-drop movement, and users can quickly share or save it through the shortcut icon interface.

Benefits of technology

It improves user experience, accurately identifies the intent to cut out images, resolves gesture conflicts, and enables quick sharing or saving of cutout results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121858016A_ABST
    Figure CN121858016A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method and electronic equipment, and relates to the technical field of image processing. In a scene in which a user browses a picture through a picture library, a matting intention can be accurately recognized according to the pressing operation of the user on the main body region of the picture, that is to say, the user presses the main body region in the first image for a long time, the electronic equipment can be triggered to perform matting processing on the main body image (such as a portrait) at the main body region, and a matting result is obtained; the matting result is supported to be displayed in a floating layer form and can be dragged and moved, a user drags the matting result to trigger the display of a shortcut icon interface and the sharing or saving icon, and the user drags the matting result to the sharing or saving icon, so that the matting result can be quickly shared or saved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image processing method and electronic device. Background Technology

[0002] Currently, when users browse pictures through the gallery of electronic devices, some users have the following image processing needs when there are cluttered or irrelevant background images around the main subject of the picture: In order to obtain better image effects, users want to be able to remove cluttered or irrelevant background images and choose to save or share the main subject image of the picture.

[0003] However, with current technology, when a user selects or long-presses an image in the gallery, it can only trigger the saving or sharing of the entire image, which cannot meet the user's actual needs. Summary of the Invention

[0004] This application provides an image processing method and electronic device that enables quick image cutout in an image library and quick sharing or saving of the cutout results, thereby improving the user experience.

[0005] In a first aspect, this application provides an image processing method, the method comprising: displaying a first image in a gallery interface in response to a user operation; receiving a first press operation by the user on a main body area of ​​the first image; displaying a second image on the first image in response to the first press operation, the second image being a main body image at the main body area; detecting that the second image is being dragged while the first press operation is still in progress; displaying a shortcut icon interface when the second image is dragged to the edge of the screen; and processing the second image according to the function indicated by the first application icon when the second image is dragged to a first application icon in the shortcut icon interface; wherein the first application icon includes a share icon, a save icon, a favorite icon, a note icon, or a print icon.

[0006] The image processing method provided in this application allows for accurate identification of cutout intent based on the user's pressing action on the main area of ​​the photo when browsing photos through a gallery. In other words, when a user long-presses the main area of ​​the first image, the electronic device can trigger the cutout processing of the main image (e.g., a portrait) in the main area to obtain the cutout result (i.e., the second image). The cutout result can be displayed as a floating layer and can be dragged and moved. Dragging the cutout result can trigger the display of a shortcut icon interface and a share or save icon. The user can quickly share or save the cutout result by dragging it to the share or save icon, thus improving the user experience.

[0007] The shortcut icon interface can also be called the Anywhere Door interface.

[0008] In some possible implementations, the main image can be a human figure, or an animal such as a cat or dog, or a plant such as flowers and grass, or a building, etc.

[0009] In some possible implementations, the first press operation is a single-finger press operation.

[0010] In some possible implementations, the first image is an image in the form of a picture or a video.

[0011] In some possible implementations, the method further includes: receiving a second press operation by a user on a non-subject, non-text area of ​​the first image; displaying a scaled-down first image on the first image in response to the second press operation; detecting that the scaled-down first image is being dragged while the second press operation is still in progress; displaying the shortcut icon interface when the scaled-down first image is dragged to the edge of the screen; and processing the first image according to the function indicated by the second application icon when the scaled-down first image is dragged to a second application icon in the shortcut icon interface.

[0012] The image processing method provided in this application can identify a user's intention to process an image and perform corresponding image processing. Taking a picture sharing scenario as an example: On one hand, when a user long-presses on the main subject of an image, the electronic device can recognize that the user intends to cut out the image and share it. Accordingly, in response to the user's long-press operation on the main subject, the electronic device performs cutout processing on the main subject, displays the cutout result and a share icon, and in response to the user dragging the cutout result to the share icon, the electronic device sends the cutout result to the sharing recipient, achieving the purpose of sharing the cutout image. On the other hand, when a user long-presses on a non-main subject in an image, the electronic device can recognize that the user intends to share the entire image. Accordingly, in response to the user's long-press operation on the non-main subject, the electronic device sends the entire image to the sharing recipient, achieving the purpose of sharing the entire image.

[0013] In this embodiment, the image cutout processing and sharing process includes a cutout stage and a sharing stage. The cutout stage includes cutout intent recognition, image compression, cutout detection, drawing cutout animation effects, and displaying a cutout overlay. The sharing stage includes dragging the overlay to display the "Anywhere Door" interface and then dragging it to the share control. Alternatively, the sharing stage includes dragging the overlay to display the "Anywhere Door" interface and then dragging it to the share control. The image cutout processing and sharing process includes press events, drag events, and release events.

[0014] In related technologies, when a user long-presses any position on an image in the gallery, the entire image can be dragged. When the image is dragged to the edge of the electronic device's screen, a shortcut interface can be triggered, which may include multiple shortcut controls such as favorites, share, search, print, or save. If the image is dragged to a specific shortcut control, an action related to that control can be triggered. For example, when the image is dragged to the share control, the electronic device can share the entire image.

[0015] Compared with related technologies, the improvements of this application include: After the improvement, when a user long-presses the main area (e.g., the human body area) of an image in the gallery, the image of that human body area (hereinafter referred to as the human body image) can be dragged. When the human body image is dragged to the screen border of the electronic device, the "Anywhere Door" interface can be triggered. This interface can include multiple shortcut controls such as favorites, share, search, print, or save. If the human body image is dragged to a shortcut control, a processing action related to that control can be triggered. For example, when the human body image is dragged to the share control, the electronic device can share the human body image. Furthermore, when a user long-presses a non-main area of ​​an image in the gallery, the entire image can be dragged. When the human body image is dragged to the screen border of the electronic device, the "Anywhere Door" interface can be triggered, enabling processing such as sharing the entire image.

[0016] It should be noted that when manipulating images in a gallery application, various click, long press, or drag gestures may occur, and different gestures will trigger different image processing methods. To achieve image cutout by pressing on an image displayed in the gallery, the gesture conflict problem needs to be resolved. The image processing method provided in this application embodiment can resolve the gesture conflict problem; the specific implementation method is described below.

[0017] In some possible implementations, the method further includes: responding to the first press operation, identifying the cutout intention based on a first preset duration and obtaining cutout detection data; determining that the first press operation meets a preset long press condition based on a second preset duration and obtaining long press position information; if the first press operation meets the preset long press condition, determining that the first press operation acts on the main area and displaying a cutout animation based on the cutout detection data and the long press position information based on a third preset duration; if the cutout animation is displayed, determining the second image displaying the overlay effect based on a fourth preset duration; wherein the second preset duration includes the first preset duration, and the start time of the second preset duration and the first preset duration are the same.

[0018] For example, the first preset duration can be 100 milliseconds (ms), and the second preset duration can be 400 ms.

[0019] By employing the aforementioned solution in this application, when a user's pressing action on an image in the gallery is detected, the preset image cutout detection algorithm performs multiple judgments to accurately identify the image cutout intention and execute the image cutout process, effectively avoiding gesture conflicts.

[0020] In some possible implementations, the step of responding to the first press operation, identifying the cutout intention and obtaining cutout detection data based on a first preset duration, and determining that the first press operation meets the long press condition and obtaining long press location information based on a second preset duration includes: responding to the first press operation, waiting for the first preset duration; if the first preset duration ends and the first press operation has not triggered any other gesture event besides cutout, then identifying the cutout intention, starting cutout detection, and obtaining the cutout detection data; responding to the first press operation, waiting for the second preset duration; if the second preset duration ends and the first press operation has not triggered any other gesture event besides cutout, then obtaining the long press location information.

[0021] In this embodiment, after detecting a press operation on the first image, a press event is determined to have occurred. In response to the press event, the image cutout intent recognition is initiated first. The processing method for image cutout intent recognition includes: after initiating image cutout intent recognition, waiting for 100ms; if no other event is triggered within this 100ms period, an initial image cutout intent can be identified, and image cutout detection is initiated. After initiating image cutout detection, the first image is compressed, and image cutout detection begins. By performing image cutout detection in advance, the image cutout time can be reduced.

[0022] The above method can accurately identify the intent to cut out images, enabling early detection and saving time. Furthermore, it identifies long-press operations and obtains their location information, facilitating subsequent judgment on whether the long-press operation applies to non-text areas, thus avoiding gesture conflicts and resolving such issues.

[0023] In this embodiment, after initiating the image cutout intent recognition, a 400ms wait is initiated. If the press operation lasts for 400ms, it can be determined that the press operation is a long press. If a long press is determined, the long press location information is obtained, and it is determined whether the long press operation is in a text area or a non-text area. If the long press operation is determined to be in a non-text area, it is determined that this press operation has an image cutout intent, and the process begins to wait for the cutout result. If the long press operation is applied to a non-text area of ​​the animated photo, the animated photo is played, and the process begins to wait for the cutout result. If the long press operation is applied to a text area of ​​the first image, the selected text is highlighted, text recognition processing is performed, and the process abandons the wait for the cutout result.

[0024] In some possible implementations, the matting detection data includes the coordinates of the subject's edge points.

[0025] The step of determining whether the first press operation applies to the main body area and displaying the cutout animation effect based on the cutout detection data and the long press position information, when the first press operation meets the long press condition, based on the third preset duration, includes: determining whether the first press operation applies to a non-text area based on the long press position information; if the first press operation applies to a non-text area, then waiting for the third preset duration; if the main body edge coordinate point is obtained within the third preset duration and the first press operation does not trigger any other gesture events besides cutout, then determining whether the first press operation applies to the main body area based on the main body edge coordinate point and the long press position information; if the first press operation applies to the main body area, then displaying the cutout animation effect along the main body outline of the main body area based on the main body edge coordinate point.

[0026] For example, the third preset duration can be 400ms.

[0027] After determining the intention to cut out the image, a cutout waiting delay (e.g., 400ms) is initiated to wait for the cutout result. That is, after confirming that the long press operation is in a non-text area, the process begins to wait for the cutout result, for example, with a maximum waiting time of 400ms.

[0028] In some cases, if the long press operation does not trigger other gesture functions or other events and the cutout result is received during the cutout waiting delay, the cutout display will be started based on the received cutout result.

[0029] In other words, once the background removal detection is complete, the background removal result can be obtained. If less than 400ms have elapsed since obtaining the result, the background removal waiting delay is canceled, and the background removal display starts immediately. If no background removal result is obtained within the 400ms waiting delay, the background removal function stops executing and the waiting period ends. In other cases, if a long press triggers other gestures or events during the background removal waiting delay, the waiting period ends, and the background removal function stops executing.

[0030] When the cutout display is enabled, cutout animation effects can be drawn to showcase dynamic cutout actions.

[0031] The above solution waits for a third preset time after the first press operation is applied to a non-text area. If no other gesture event other than the cutout is triggered, the cutout animation is then displayed. This avoids gesture conflicts and solves the gesture conflict problem.

[0032] In some possible implementations, the matting detection data includes a subject mask image.

[0033] The step of determining the second image with a floating layer effect based on a fourth preset duration when displaying a cutout animation includes: after displaying the cutout animation along the subject outline, waiting for the fourth preset duration; if the fourth preset duration ends and the first press operation does not trigger any other gesture events besides cutout, then the first image is cut out based on the subject mask image to obtain the second image, and the second image with a floating layer effect is displayed.

[0034] For example, the fourth preset duration can be 400ms.

[0035] When displaying the cutout animation, you can initiate a long press and wait delay (e.g., 400ms). For example, when the cutout display is enabled, wait for 400ms. If no other event is triggered within this 400ms period, the cutout overlay can be enabled.

[0036] The above solution involves displaying the cutout animation along the main body outline and then waiting for a fourth preset time. If no other gesture event other than the cutout is triggered, the cutout is then processed again and the second image with the overlay effect is displayed. This avoids gesture conflicts and resolves the gesture conflict problem.

[0037] In some possible implementations, before displaying the cutout animation, the method further includes: after the second preset duration ends, if the first image is detected to be a dynamic image, then in response to the first press operation, playing the dynamic image; after the third preset duration ends, stopping the playback of the dynamic image.

[0038] The display of the cutout animation effect includes: displaying the cutout animation effect on the first frame of the dynamic image.

[0039] The above method allows pressing on animated images to trigger playback and cutout events separately, thus avoiding and resolving gesture conflicts.

[0040] In some possible implementations, when determining whether the first pressing operation is applied to a non-text area, the method further includes: if it is determined that the first pressing operation is applied to a text area, then highlighting the text area and performing text recognition processing on the text area; if it is determined that the first pressing operation is applied to a non-subject, non-text area, then displaying a scaled-down first image on the first image, the scaled-down first image being draggable.

[0041] The above solution allows for the following: if the first press operation is applied to a text area, text recognition processing is performed instead of the image cutout process, thus avoiding and resolving gesture conflicts. If the first press operation is applied to a non-subject, non-text area, dragging and sharing / saving of the entire image is performed instead of the image cutout process, again avoiding and resolving gesture conflicts.

[0042] In some possible implementations, the method further includes: when the second image is displayed on the first image, if no drag operation is detected, then after the first press operation ends, displaying a shortcut icon menu at the second image, the shortcut icon menu including an icon for adjusting the cutout area; in response to a user's click operation on the icon for adjusting the cutout area, displaying an adjustment node at the outline of the main image in the main area; and in response to a user's movement operation on the adjustment node, obtaining the adjusted second image.

[0043] The above solution allows for secondary adjustments to the cutout results, improving the user experience.

[0044] In some possible implementations, the shortcut icon menu may further include a share icon and / or a save icon; the method may further include: receiving a user's click operation on the share icon and / or save icon; and in response to the click operation, sharing or saving the second image or the adjusted second image.

[0045] The above solution allows for quick sharing or saving of the cutout results after secondary adjustments, improving the user experience.

[0046] In some possible implementations, displaying the second image on the first image includes: identifying the first image as a video image; acquiring a first frame image including human features in the first image; performing image cutout processing on the human features in the first frame image to obtain the second image; and displaying the second image on the first image.

[0047] Secondly, this application provides an image processing apparatus, which includes units for performing the method described in the first aspect above. This apparatus is capable of performing the method described in the first aspect above, and a description of the units within this apparatus is provided in the description of the first aspect above; for brevity, it will not be repeated here.

[0048] The method described in the first aspect above can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a processing module or unit, a display module or unit, etc.

[0049] Thirdly, this application provides an electronic device, which includes a processor, a computer program or instructions stored in a memory, wherein the processor is used to execute the computer program or instructions to cause the method in the first aspect to be performed.

[0050] Fourthly, this application provides a computer-readable storage medium having a computer program (also referred to as instructions or code) stored thereon for implementing the method of the first aspect. For example, when the computer program is executed by a computer, it enables the computer to perform the method of the first aspect.

[0051] Fifthly, this application provides a chip including a processor. The processor is used to read and execute a computer program stored in a memory to perform the methods in the first aspect and any possible implementation thereof. Optionally, the chip further includes a memory connected to the processor via a circuit or wire.

[0052] Sixthly, this application provides a chip system including a processor. The processor is used to read and execute a computer program stored in a memory to perform the methods in the first aspect and any possible implementation thereof. Optionally, the chip system further includes a memory connected to the processor via a circuit or wire.

[0053] In a seventh aspect, this application provides a computer program product comprising a computer program (also referred to as instructions or code), which, when executed by an electronic device, causes the electronic device to implement the method in the first aspect.

[0054] It is understood that the beneficial effects of the second to seventh 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

[0055] Figure 1 A schematic diagram illustrating an improvement to the image processing method provided in an embodiment of this application;

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

[0057] Figure 3 A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;

[0058] Figure 4 A schematic diagram of module interactions in the software architecture of the image processing method provided in the embodiments of this application;

[0059] Figure 5 This is a schematic diagram of the image matting interface provided in an embodiment of the present application;

[0060] Figure 6 A schematic flowchart of an image processing method provided in an embodiment of this application;

[0061] Figure 7 This illustration shows a user interface diagram of image cutout processing and sharing provided in an embodiment of this application;

[0062] Figure 8 This illustration shows a user interface diagram of image cutout processing and sharing provided in an embodiment of this application;

[0063] Figure 9 This diagram illustrates the user interface for triggering the drag-and-drop processing of the entire image.

[0064] Figure 10A The image matting and sharing implementation process and gesture recognition algorithm in the embodiments of this application are shown;

[0065] Figure 10B This illustrates another image matting process and sharing implementation provided by an embodiment of this application;

[0066] Figure 11 This diagram illustrates the workflow of image cutout processing achieved through the interaction of various modules.

[0067] Figure 12 This illustration shows a schematic diagram of the interface for triggering cutout processing and displaying cutout animation effects by long-pressing the subject, as provided in an embodiment of this application.

[0068] Figure 13 This diagram illustrates the process of triggering the sharing of cutout results by dragging the cutout result while displaying the cutout animation effect;

[0069] Figure 14 The diagram illustrates the image processing method provided in this application, including cutout animation, overlay display effect, and drag-and-drop interface. Detailed Implementation

[0070] The embodiments of this application will be further described in detail below with reference to specific examples and the accompanying drawings.

[0071] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0072] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). The interface source code is parsed and rendered on the electronic device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of an electronic device.

[0073] Currently, when users browse pictures through the gallery of electronic devices, some users have the following image processing needs when there are cluttered or irrelevant background images around the main subject of the picture: In order to obtain better image effects, users want to be able to remove cluttered or irrelevant background images and choose to save or share the main subject image of the picture.

[0074] However, with current technology, when a user selects or long-presses an image in the gallery, it can only trigger the saving or sharing of the entire image, which cannot meet the user's actual needs.

[0075] To address the aforementioned issues, this application provides an image processing method and electronic device. In scenarios where users browse photos through a gallery, the device can accurately identify the user's intent to cut out images based on the user's pressing action on the main subject area of ​​the photo. In other words, when a user long-presses on the main subject area of ​​a first image, the electronic device can trigger the device to perform cutout processing on the main subject image (e.g., a portrait) in the main subject area, obtaining the cutout result. This cutout result can be displayed as a floating layer and can be dragged and moved. Dragging the cutout result triggers the display of a shortcut icon interface and a share or save icon. By dragging the cutout result to the share or save icon, the user can quickly share or save the cutout result, improving the user experience.

[0076] To better understand the embodiments of this application, the embodiments of this application will be briefly described below:

[0077] The image processing method provided in this application can identify a user's intention to process an image and perform corresponding image processing. Taking a picture sharing scenario as an example: On one hand, when a user long-presses on the main subject of an image, the electronic device can recognize that the user intends to cut out the image and share it. Accordingly, in response to the user's long-press operation on the main subject, the electronic device performs cutout processing on the main subject, displays the cutout result and a share icon, and in response to the user dragging the cutout result to the share icon, the electronic device sends the cutout result to the sharing recipient, achieving the purpose of sharing the cutout image. On the other hand, when a user long-presses on a non-main subject in an image, the electronic device can recognize that the user intends to share the entire image. Accordingly, in response to the user's long-press operation on the non-main subject, the electronic device sends the entire image to the sharing recipient, achieving the purpose of sharing the entire image.

[0078] Figure 1 An improved schematic diagram of the image processing method provided in the embodiments of this application is shown.

[0079] refer to Figure 1 As shown, before the solution was improved, when a user long-pressed any position on an image in the gallery, the entire image could be dragged. When the entire image was dragged to the edge of the electronic device's screen, a shortcut interface could be triggered, which could include multiple shortcut controls such as favorites, share, search, print, or save. If the entire image was dragged to a shortcut control, then the corresponding action could be triggered. For example, when the entire image was dragged to the share control, the electronic device could share the entire image.

[0080] See again Figure 1 As shown, after the solution is improved, when a user long-presses the main area of ​​an image (e.g., the human body area) in the gallery, the image of that human body area (hereinafter referred to as the human body image) can be dragged. When the human body image is dragged to the screen border of the electronic device, the "Anywhere Door" interface can be triggered. This interface can include multiple shortcut controls such as favorites, sharing, search, printing, or saving. If the human body image is dragged to a shortcut control, the corresponding action can be triggered. For example, when the human body image is dragged to the share control, the electronic device can share the human body image. Furthermore, when a user long-presses a non-main area of ​​an image in the gallery, the entire image can be dragged. When the human body image is dragged to the screen border of the electronic device, the "Anywhere Door" interface can be triggered, enabling actions such as sharing the entire image.

[0081] It's important to note that manipulating images in the gallery app can involve various click, long press, or drag gestures, each triggering different image processing methods. For example, pressing on a text area of ​​a static image will trigger text recognition. Pressing and dragging a non-text area of ​​a static image will open a portal, potentially leading to sharing or saving the entire image. Pressing any area of ​​a live photo will play the live photo. These examples illustrate how various gestures trigger different image processing methods in the gallery app. It's understandable that in actual implementations, other gestures may trigger image processing in various ways.

[0082] To achieve image cutout by pressing on an image displayed in a gallery, the issue of gesture conflict needs to be resolved. The image processing method provided in this application can solve this problem. By using this method, upon detecting a user's pressing action on an image in the gallery, a preset cutout detection algorithm performs multiple checks to accurately identify the cutout intention and execute the cutout process, effectively avoiding gesture conflicts.

[0083] This image processing method first performs gesture recognition to identify the intent to cut out the image. Only after confirming that the user's operation meets the cutout trigger conditions is the image cutout processed. These trigger conditions may include a sufficient press duration and the press location being within the main subject area. The image cutout process includes acquiring the edge coordinates and mask image of the main subject area, performing cutout processing based on these coordinates, and displaying a cutout animation effect to obtain the cutout result. This cutout result, presented as a floating layer, represents the main subject area of ​​the image.

[0084] The following description, in conjunction with the accompanying drawings, describes the electronic device to which the image processing method provided in the embodiments of this application is applied. Exemplary examples show that the electronic device in the embodiments of this application may be a mobile phone, tablet computer, ultra-mobile personal computer (UMPC), netbook, as well as a cellular phone, personal digital assistant (PDA), wearable device (such as a smartwatch, smart bracelet), or other device with image display capabilities. The embodiments of this application do not impose any special limitations on the specific form of the electronic device.

[0085] Figure 2 This illustration shows a hardware structure diagram of an electronic device according to an embodiment of this application. For example, a mobile phone is used as an example. Figure 2As 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, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver (i.e., earpiece) 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 aforementioned sensor module may include pressure sensors and touch sensors.

[0086] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0087] A controller can be the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.

[0088] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0089] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0090] It is understood that the interface connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the electronic device. In other embodiments, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0091] In this embodiment of the application, the electronic device can perform image matting intent recognition, image matting detection, and generation of image matting results in the form of a floating layer, as well as the movement of the image matting results and the sharing or saving of the image matting results through the processor 110.

[0092] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0093] Internal memory 121 can be used to store executable program code, including instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as controlling the switching of the electronic device's operating state), etc. The data storage area may store data created during the use of the electronic device (such as operating status information, switching time information), etc. Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in internal memory 121 and / or instructions stored in memory located within the processor.

[0094] For example, in this embodiment of the application, the processor 110 can execute instructions stored in the internal memory 121 to realize image matting intent recognition, image matting detection, and generation of image matting results in the form of floating layers, as well as the movement of image matting results and the sharing or saving of image matting results.

[0095] The charging management module 140 receives charging input from a charger (such as a wireless charger or a wired charger) to charge the battery 142. The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power various components of the electronic device.

[0096] The wireless communication function of electronic devices can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.

[0097] Electronic devices can achieve shooting functions through image signal processors, cameras 193, video codecs, GPUs, displays 194, and application processors.

[0098] Electronic devices can implement display functions through GPUs, displays 194, and application processors. A GPU is a microprocessor for image processing, connecting the display 194 and the application processor. The GPU performs mathematical and geometric calculations and is used for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0099] Display screen 194 is used to display images, videos, etc. Display screen 194 may include a touch screen and a touch sensor.

[0100] In this embodiment, when the touch sensor detects a touch operation on the touchscreen, the touch sensor sends the touchscreen data to the processor 110. The touchscreen data may include touch duration and touch position parameters.

[0101] In this embodiment, if the processor 110 determines that the touch duration is greater than a first preset duration (e.g., 400ms), then the processor 110 determines whether the touch operation is a long press operation. The processor 110 can also determine whether the touch operation is applied to the main area based on the touch position parameters. If the touch operation is a long press operation applied to the main area and the long press operation does not trigger other gesture responses, then the processor 110 determines to perform image matting processing to obtain the matting result. The processor 110 sends the matting result to the display screen 194, and the display screen 194 displays the matting result.

[0102] In this embodiment, when the display screen 194 shows the cutout result, when the touch sensor detects a touch operation on the touch screen, the touch sensor sends the touch screen data to the processor 110. If the processor 110 determines that the touch duration is greater than a second preset duration (e.g., 400ms) and no other gesture response is triggered, then the processor 110 determines that the touch operation triggers a movement event of the cutout result. The processor 110 instructs the display screen 194 to update the display position of the cutout result, so that the cutout result moves along the trajectory of the touch operation.

[0103] The above is a detailed description of the embodiments of this application using electronic device 100 as an example. It should be understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on electronic device 100. Electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have different component configurations. The various components shown in the figures can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0104] In addition, an operating system runs on top of the aforementioned hardware. This operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. Applications can be installed and run on this operating system.

[0105] The operating system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.

[0106] Figure 3 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.

[0107] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, Android... TM The system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime (Android...). TM The runtime layer, system library layer, hardware abstraction layer (HAL), and kernel layer.

[0108] The application layer can include a series of application packages. For example, the application layer can include a gallery app and a background removal app. The gallery app can include an image display module, a gesture management module, a background removal management module, and a background removal display SDK (software development kit). The background removal app can include a background removal display module, a screen recognition service module, and visual components. The module functions and interaction processes of the gallery app and the background removal app will be discussed in detail below. Figure 4 Please provide a detailed explanation.

[0109] In this embodiment, the application layer may further include a context-aware module, a business logic processing module, and a business presentation module. The context-aware module, business logic processing module, and business presentation module may be independent apps, or they may be integrated into different apps, or they may be integrated into the same app; this application does not impose any limitations.

[0110] The context-aware module, which runs resident or in low-power mode, has the ability to perceive external facts or the environment. It can detect relevant events and obtain event states from other applications at the application layer, application framework layer, system layer, or kernel layer via an application programming interface (API), such as detecting Bluetooth connections, network connections, monitoring user SMS messages, and customizing timers. In this embodiment, the main function of the context-aware module is to listen for long-press events on an image, or for long-press and drag events on an image. The context-aware module can then notify the business logic processing module of the detected information.

[0111] The business logic processing module (e.g., the computing engine) has business logic processing capabilities. It performs data processing or logical judgments based on events monitored by the context-aware module and preset logical algorithms, determining the appropriate image processing method based on the image features contained at the press location. For example, when a long press on the main subject area is detected, the main subject area of ​​the image is cut out, the cutout result is displayed, and the result can be saved or shared in response to the user's action on the cutout result. When a long press on the background area is detected, the "Anywhere Door" interface is triggered, and the entire image can be saved or shared in response to the user's action on the cutout result. When a long press on text is detected, text recognition processing is performed on the text. The "Anywhere Door" interface includes multiple application icons, such as a favorites icon, a share icon, a notes icon, a social media app icon, a save icon, or other possible icons. The specific judgment process will be described in detail below.

[0112] The business presentation module (e.g., YOYO suggestions) is used to display the cutout result with a floating effect on the original image according to the instructions of the business logic processing module, and to move the cutout result to the Any Door interface to save or share it; or to display the cutout menu at the cutout result, which includes controls for adjusting the cutout area, saving controls, and sharing controls.

[0113] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The application framework layer includes some predefined functions. It may include a visual framework module, which includes a background removal interface, background removal plugins, native interfaces, and other modules; this embodiment does not impose any limitations on these.

[0114] The Android runtime is responsible for scheduling and managing the Android system. The Android runtime includes the core libraries and the virtual machine. The core libraries consist of two parts: one part contains the functionalities that Java needs to call, and the other part is the core Android library itself. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0115] System libraries can include multiple functional modules. Examples include: a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The surface manager manages the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The system library layer, also known as the native layer, native service layer, or native framework layer, is a native code platform library that provides native services and link libraries for hardware operations to upper layers.

[0116] The HAL layer is a wrapper around Linux kernel drivers, providing interfaces to higher-level components and shielding them from the implementation details of lower-level hardware. For example, the HAL layer can include display HAL, camera HAL, etc.

[0117] The kernel layer is the layer between hardware and software. It contains at least the display driver, camera driver, and sensor driver. The camera driver, in particular, is responsible for interacting with the camera and its hardware. For example, the camera driver can launch the camera at the hardware level, allowing the launched camera to capture image data.

[0118] For clarity, the diagram also illustrates the hardware layer that interacts with the aforementioned software structure. For example, the hardware layer may include hardware such as displays and sensors.

[0119] Figure 4 This illustration shows a schematic diagram of the interaction process between the gallery application, the image cutout application, and the visual framework module in an embodiment of this application.

[0120] like Figure 4 As shown, the gallery application includes an image display module, a gesture management module, a background removal management module, and a background removal display SDK. The image display unit can be used to implement large image drawing, animated image display, and background removal display. The gallery application also includes a caching module for caching background removal detection results, which include the edge coordinates of the main area and the mask image.

[0121] Among them, the image cutout display SDK of the image library application can call the encapsulated control to interact with the cutout SDK interface of the image cutout application and start the cutout and subject recognition.

[0122] See again Figure 4 As shown, the image matting application includes a matting SDK interface, a matting display module, a screen recognition service module, and visual components. The matting display module can be used to display matting animations, matting menus, and to expand the matting area, allowing for manual adjustment of the automatic matting results. The screen recognition service module can be used to manage multi-subject detection services and matting services.

[0123] The visual components of the image cutout application can interact with the visual framework module.

[0124] See again Figure 4 As shown, the vision framework module includes a matting interface, matting plugins, and a native vision module. The matting interface includes a multi-subject detection plugin SDK and a matting plugin SDK. The matting plugins include a multi-subject detection plugin and an image matting plugin. The multi-subject detection plugin SDK interacts with the multi-subject detection plugin, and the matting plugin SDK interacts with the image matting plugin. The native vision module includes a computer vision (CV) pipeline.

[0125] Reference Figure 4 The triggering of image cutout processing includes user operation entry 1, which triggers image cutout processing from the cutout application, and user operation entry 2, which triggers image cutout processing from the gallery application.

[0126] First, let's explain user operation entry point 1 (background cutout application): In response to user operation, the background cutout application starts and displays the image. The user can then interact with the image to trigger background cutout. For example, the background cutout application interface can display a smart background cutout button. In response to the user clicking the smart background cutout button, the background cutout application starts the background cutout function. After the user selects a certain area, the background cutout result can be displayed on the background cutout application interface. Figure 5 (a) in the diagram illustrates how clicking the Smart Cutout button in the cutout application interface triggers the cutout process. It is understood that the cutout application provides a Smart Cutout button, so clicking the Smart Cutout button directly triggers the cutout process without needing to recognize gestures.

[0127] Further explanation of user operation entry point 2 (Gallery application): In response to user operation, the Gallery application starts and displays an image. The user can perform touch operations on the image (e.g., long press with one finger). The gesture management module determines whether there is an intention to cut out the image based on the user's touch operation. For example, if the touch operation is a long press with one finger on the main object area of ​​the image, it is determined that there is an intention to cut out the image. If the intention to cut out the image is determined, the gesture management module sends a cutout instruction to the cutout management module. The cutout management module, through the cutout display SDK, calls the encapsulated control and sends the cutout instruction to the cutout SDK interface of the cutout application. The cutout SDK interface sends the cutout instruction to the cutout display module and the screen recognition service module. The cutout application starts cutout detection and subject recognition, and then displays the cutout result.

[0128] Figure 5 (b) shows a schematic diagram of triggering the cutout process by long-pressing an image in the Gallery app interface.

[0129] It's important to note that manipulating images in the Gallery app may involve various click, long press, or drag gestures, each triggering different image processing methods. For example, pressing on a text area of ​​a static image will trigger text recognition. Similarly, pressing and dragging a non-text area of ​​a static image will open a portal, potentially leading to sharing or saving the entire image. Finally, pressing any area of ​​a live photo will play the live photo.

[0130] The above examples illustrate various gestures that trigger different image processing methods in a gallery application. It is understood that in actual implementation, there may be other situations where gestures may trigger image processing.

[0131] In other words, to achieve image cutout by pressing on an image displayed in a gallery, the issue of gesture conflict needs to be resolved. The image processing method provided in this application can solve this problem. This method, upon detecting a user's pressing action on an image in the gallery, uses a preset cutout detection algorithm for multiple checks to accurately identify the cutout intention and effectively avoid gesture conflicts.

[0132] Therefore, for user press operations on gallery images, gesture recognition is performed first to identify the intent to cut out the image. Only after confirming that the user's action meets the cutout trigger conditions is the image cutout processed. These trigger conditions may include a sufficient press duration and the press location being within the main subject area. The image cutout process involves acquiring the edge coordinates and mask image of the main subject area, performing cutout processing based on these coordinates, and displaying a cutout animation to obtain the cutout result. This cutout result, presented as a floating layer, represents the main subject area of ​​the image. The detailed cutout process will be explained in detail below.

[0133] It should be noted that although the embodiments of this application are described using the Android system as an example, the basic principles are also applicable to electronic devices based on operating systems such as iOS or Windows.

[0134] The image processing method provided in this application can be executed by the aforementioned electronic device, or by a functional module and / or entity within that electronic device capable of implementing the image processing method. Furthermore, the solution in this application can be implemented in hardware and / or software, the specific implementation depending on actual usage requirements, and this application does not impose any limitations. The following description uses an electronic device as an example, along with the accompanying drawings, to exemplarily illustrate the image processing method provided in this application.

[0135] The embodiments of this application will be described below with reference to the accompanying drawings and through several exemplary embodiments. The methods in the following embodiments can all be implemented in an electronic device having the above-described hardware structure and software architecture. The hardware structure diagram of the electronic device can be as follows: Figure 2 As shown, the software structure block diagram of an electronic device can be as follows: Figure 3 As shown, the embodiments of this application are not limited to this. For ease of explanation, the electronic device used in the embodiments of this application is a mobile phone.

[0136] The image processing method provided in this application is described below with reference to specific embodiments.

[0137] Figure 6 This is a schematic flowchart of the image processing method provided in an embodiment of this application. (Refer to...) Figure 6 As shown, the method includes the following steps S201-S215.

[0138] S201, Received user's press operation on the first image.

[0139] S202. Determine whether the pressing operation is a long press operation in the main area.

[0140] The first image is the one displayed in the gallery interface.

[0141] It should be noted that in the first image, the subject can be a human figure, or it can be something such as a cat, dog, flower, or building. This application does not limit the subject; it can be determined based on actual usage requirements.

[0142] For ease of explanation, this application uses a human portrait as an example. The human portrait is the main subject, and the portrait area is the main subject area. The background area in the first image, excluding the portrait area, is referred to as the non-main subject area.

[0143] By recognizing the user's image processing intent, gesture conflicts can be effectively avoided. The judgment result of S202 can determine whether the image processing intent is to cut out an image or to process the entire image.

[0144] Image processing method one: Image cutout processing

[0145] Image processing method one includes Scene 1 and Scene 2. Scene 1 involves long-pressing the main body of the image to trigger cutout, and dragging the cutout result to trigger the display of the Anywhere Door interface; Scene 2 involves long-pressing the main body of the image to trigger cutout, and releasing the press will display the cutout menu.

[0146] S203. If it is determined that the pressing operation is a long press operation in the main body area, the first image is cut out and the cutout animation is displayed to obtain the main body image.

[0147] The process of "cutting out" the first image refers to cropping along the outline of the main subject at the long-press position in the first image to obtain the image of the main subject.

[0148] Among them, by displaying the cutout animation, the effect of obtaining the main image from the first image through cutout processing can be highlighted, making it easier for users to perceive the cutout effect and improving the user experience.

[0149] For example, the cutout animation could be a line that flashes or moves in a loop around the subject (such as a human figure).

[0150] For example, the cutout animation could be an effect where the entire area of ​​the pressed subject (such as a portrait) flashes or is highlighted.

[0151] S204. Display the main image of the overlay effect on the first image.

[0152] S205. Determine whether there is a drag operation on the main image of the floating layer effect, that is, determine whether the main image is dragged.

[0153] The size of the main image in the overlay effect can be changed according to actual needs.

[0154] For example, after displaying the cutout animation, the main image of the overlay effect is enlarged to prompt the user to complete the cutout and obtain the cutout result of the overlay effect.

[0155] For example, regardless of whether the main image of the overlay effect is dragged, the main image of the overlay effect can be displayed in a smaller size. In this way, the smaller main image will move along the trajectory of the user's drag operation, making it easier for the user to perceive the effect of the cutout result being dragged.

[0156] If it is determined that the main image is being dragged, continue executing S206 (Scenario 1).

[0157] If it is determined that the main image has not been dragged, continue to execute S208 (Scenario 2).

[0158] Scenario 1: After long-pressing the main body of the image to trigger the cutout, dragging the cutout result triggers the display of the Anywhere Door interface.

[0159] S206. Move the main image of the overlay effect along the drag trajectory. When the main image of the overlay effect is dragged to the screen border, trigger the display of the Anywhere Door interface.

[0160] The interface that can display both images and shortcut controls simultaneously is called the Any Door interface.

[0161] The AnyDoor interface displays multiple shortcut controls or icons, such as share controls, save controls, favorite controls, print controls, and / or note controls.

[0162] It should be noted that when displaying the Any Door interface, images can be dragged. When an image is dragged to a shortcut control, the corresponding action of the shortcut control can be triggered. For example, when an image is dragged to the share control, the sharing action can be triggered.

[0163] S207. In response to the user dragging and dropping the main image onto a shortcut control or icon in the interface, perform corresponding processing on the main image. For example, this processing could be sharing, saving, favorite, printing, or adding to notes.

[0164] As can be seen from the above steps S203-S207, long-pressing the main area of ​​the image triggers the cutout process, and the cutout result is obtained. Dragging the cutout result can trigger the display of the Any Door interface. The cutout result can be further dragged to a control on the Any Door interface to achieve the purpose of sharing or saving the cutout result.

[0165] For ease of explanation, the following example demonstrates how to drag and drop the cutout result onto a sharing control or icon.

[0166] Figure 7 This diagram illustrates a user interface for image cutout processing and sharing. Figure 7 As shown in (a) and (b), the electronic device displays a gallery interface, which includes a first image and various controls such as share, favorite, edit, and delete. In response to a user's long-press action on the main subject of the first image, the electronic device performs background removal on the first image, resulting in the main subject image. A floating main subject image is then displayed on top of the first image. This floating main subject image can be dragged. Figure 7 As shown in (c) and (d), in response to the user's drag operation on the cutout result, the electronic device reduces the display size of the cutout result and displays an "Anywhere Door" interface, which includes icons such as a favorite icon, a share icon, a note icon, and a print icon. For example, in response to the user dragging the cutout result to the save icon, the electronic device saves the cutout result.

[0167] Scenario 2: After long-pressing the main body of the image to trigger the cutout, releasing the button will display the cutout menu.

[0168] S208. If the main image is not dragged, determine whether a release event has occurred.

[0169] S209. In the event of a release event, display a cutout menu, which may include controls for adjusting the cutout area, saving, and sharing.

[0170] In some embodiments, if the subject image is not dragged and a release event occurs, a cutout menu can be displayed on the subject image.

[0171] In other embodiments, if a release event occurs when the main image is dragged but not to the screen border, a cutout menu can also be displayed on the main image.

[0172] The adjustment control for the cutout area is used to trigger a secondary cutout of the first image based on the main image.

[0173] It should be noted that if a user is not satisfied with the cutout result, they can choose to adjust the cutout area control to trigger the adjustment of the cutout area and regenerate the cutout result.

[0174] S210. In response to the user's selection of the save control or share control, save or share the main image.

[0175] S211. In response to the user's selection of the control to adjust the cutout area, perform secondary cutout processing on the first image.

[0176] It should be noted that either S210 or S211 above can be executed.

[0177] As can be seen from the above steps S203, S204 and S208-S211, long-pressing the main area of ​​the image triggers the cutout process and obtains the cutout result. After the long-press operation ends, the cutout menu can be triggered to further select a control in the cutout menu to achieve the purpose of adjusting, sharing or saving the cutout result.

[0178] Figure 8 This diagram illustrates another user interface for image cutout processing and sharing. For example... Figure 8 As shown, the electronic device displays a gallery interface, which includes a first image and various controls such as share, favorite, edit, and delete. In response to a user's long-press operation on the main subject of the first image, the electronic device performs background removal processing on the first image, obtaining the background removal result, which is the main subject image. The main subject image is displayed as a floating layer on top of the first image. When the user releases their hand (i.e., the long-press operation ends), the electronic device displays a background removal menu, which may include controls for adjusting the background removal area, sharing, and saving. For example, in response to the user clicking the save control, the electronic device saves the background removal result.

[0179] Image processing method two: Drag and drop the entire image for processing.

[0180] In image processing method two, long-pressing an area outside the main subject triggers processing of the entire image, and dragging the entire image triggers the display of the Anywhere Door interface.

[0181] S212. If it is determined that the pressing operation is not a long press operation in the main body area, determine whether the pressing operation is a long press operation in a non-main body and non-text area.

[0182] S213. If it is determined that the press operation is a long press operation in a non-subject and non-text area, determine whether there is a drag operation.

[0183] S214. If a drag operation is detected, move the first image along the trajectory of the drag operation and trigger the display of the Any Door interface.

[0184] S215. In response to the user dragging and dropping the first image onto the shortcut control in the AnyDoor interface, process the first image. For example, the processing could be sharing, saving, favorite, printing, or adding to notes.

[0185] As can be seen from the above steps S212-S215, long-pressing an area outside the main subject and selecting the entire image by dragging will trigger the display of the Anywhere Door interface. Further dragging to a control on the Anywhere Door interface will achieve the purpose of sharing or saving the entire image.

[0186] Figure 9 This diagram illustrates the user interface for triggering the drag-and-drop process of the entire image. Figure 9 As shown, the electronic device displays a gallery interface, which shows a first image and various controls such as share, favorite, edit, and delete. In response to a user's long-press and drag operation on an area outside the main subject of the first image (e.g., long-pressing and dragging towards the screen edge), the electronic device reduces the display size of the first image and displays a "Door" interface, which includes icons such as favorite, share, notes, and print. For example, in response to a user dragging the first image (the entire image) to the save icon, the electronic device saves the first image.

[0187] It should be noted that image processing method one involves two different implementations of triggering image cutout by long-pressing the main subject area of ​​the image, while image processing method two involves triggering processing of the entire image by long-pressing a non-subject area. These two image processing methods respectively meet different user needs and improve the user experience.

[0188] The above describes the three image processing methods provided in the embodiments of this application. The following uses the image cutout process and the sharing of the cutout results as examples to illustrate the gesture recognition algorithm in the image processing process.

[0189] First, it should be noted that performing gesture operations such as clicking, long-pressing, or dragging on dynamic / static images in the gallery may result in gesture conflicts, triggering other events. The gesture recognition algorithm provided in this application embodiment can avoid gesture conflicts.

[0190] Figure 10A The image cutout processing and sharing implementation process, as well as the gesture recognition algorithm, are illustrated in the embodiments of this application.

[0191] like Figure 10A As shown, the image cutout processing and sharing process includes a cutout stage and a sharing stage. The cutout stage includes cutout intent recognition, image compression, cutout detection, drawing cutout animation effects, and displaying the cutout overlay. The sharing stage includes dragging the overlay to display the "Anywhere Door" interface and then dragging it to the share control. This involves press events, drag events, and release events.

[0192] In the image cutout processing and sharing implementation, the gesture recognition algorithm provided in this application embodiment determines the time intervals through multiple waiting delays. The various waiting delays and the gesture recognition algorithm are described in detail below.

[0193] ① 100ms wait delay: If no other event is triggered, start the image cutout detection.

[0194] After detecting a press operation on the first image, it is determined that a press event has occurred. In response to the press event, the image cutout intent recognition is initiated first.

[0195] In this embodiment, the processing method for identifying the intent to cut out the image includes: after starting the intent to cut out the image, waiting for 100ms; if no other event is triggered within this 100ms period, an intent to cut out the image can be preliminarily identified, and the image cutting out detection is initiated. After initiating the image cutting out detection, the first image is compressed, and the image cutting out detection begins. By performing image cutting out detection in advance, the time spent on image cutting out can be reduced. Here, 100ms is used as an example, and the specific value can be set according to actual needs; this embodiment does not impose any limitations.

[0196] ② 400ms long press delay: Recognizes the intent to cut out the image.

[0197] In this embodiment, the processing method for image cutout intent recognition further includes: after starting image cutout intent recognition, waiting for 400ms; if the pressing operation lasts for 400ms, it can be determined that the pressing operation is a long press operation. Here, 400ms is taken as the long press threshold, which can be defined by the system, and the specific value can be set according to actual needs. This embodiment does not impose any restrictions.

[0198] If a long press operation is confirmed, obtain the long press location information and determine whether the long press operation is in a text area or a non-text area.

[0199] In some embodiments, if it is determined that the long press operation is in a non-text area, then it is determined that the press operation has the intention of image cutout, and the process begins to wait for the image cutout result.

[0200] In some embodiments, the first image is a dynamic photo. If a long press operation is applied to a non-text area of ​​the dynamic photo, the dynamic photo is played, and the user waits for the cutout result.

[0201] In other embodiments, if a long press operation is applied to the text area of ​​the first image, the selected text will be highlighted and text recognition processing will be performed, while waiting for the cutout result will be abandoned.

[0202] ③ 400ms image cutout waiting delay: Waiting for the cutout result.

[0203] After determining the intention to cut out the image, a cutout waiting delay (e.g., 400ms) is initiated to wait for the cutout result. That is, after determining that the long press operation is in a non-text area, the process begins to wait for the cutout result, for example, the maximum waiting time is 400ms. Here, 400ms is used as an example, and the specific value can be set according to actual needs. This application embodiment does not impose any limitations.

[0204] In some cases, during the background removal waiting delay, if the long press operation does not trigger other gesture functions or other events and a background removal result is received, then the background removal display will begin based on the received result. That is, once the background removal detection is complete, the result can be obtained. If less than 400ms has elapsed since obtaining the result, the background removal waiting delay is canceled, and the background removal display begins immediately. If no result is obtained within the 400ms delay, the background removal process stops waiting for a result. In other cases, if the long press operation triggers other gesture functions or other events during the background removal waiting delay, the process stops waiting for a result.

[0205] When the cutout display is enabled, cutout animation effects can be drawn to showcase dynamic cutout actions.

[0206] In some embodiments, the first image is an animated image. If a long press operation is applied to the main area of ​​the animated image while the animated image is playing, the animated image can be stopped after the cutout display is started, and the cover frame image of the animated image can be displayed, with the cutout animation effect displayed on the cover frame image.

[0207] In some embodiments, the first image is a static image or video. If the long press operation is applied to the main area of ​​the static image or video, the cutout animation effect can be directly displayed on the static image or a certain frame of the video.

[0208] In other embodiments, the first image is a static image. If a long-press operation is detected on a non-subject, non-text area of ​​the static image, the electronic device cancels the 400ms cutout delay and does not display the cutout animation. The electronic device can then enable the drag-and-drop feature for the entire image. After the drag-and-drop feature is enabled, the entire image can be dragged and moved when a drag event is detected.

[0209] In other embodiments, the first image is a video. If a long-press operation is detected acting on a non-subject area of ​​the video, the electronic device cancels the 400ms background removal delay and does not display the background removal animation. The electronic device can activate the video drag setting. After the drag setting is completed, the video can be dragged and moved when a drag event is detected.

[0210] ④ Continue holding for 400ms to wait: If no other event is triggered, the overlay will be activated.

[0211] When displaying the cutout animation, you can initiate a long press and wait delay (e.g., 400ms). For example, when the cutout display is enabled, wait for 400ms. If no other event is triggered within this 400ms period, the cutout overlay can be enabled.

[0212] Using the image processing method described above, when it is determined that the pressing operation is a long press operation in the main body area, the first image is processed to cut out and the cutout animation is displayed to obtain the main body image, and then the main body image with the floating layer effect is displayed.

[0213] In some embodiments, the first image is a dynamic image. If a long press is applied to the main area of ​​the dynamic image, a floating effect main image is displayed on the cover frame of the dynamic image. If a drag event is detected on the floating effect main image, the floating effect main image can be dragged and moved. Alternatively, if a long press is applied to a non-main area of ​​the dynamic image, the dynamic image can be dragged and moved when a drag event is detected.

[0214] In some embodiments, when displaying the main image of the overlay effect, if a drag event is detected on the main image of the overlay effect, and the main image of the overlay effect is dragged to the screen border (valid drag), then the Any Door interface is displayed. If the main image of the overlay effect is dragged to the share control in the Any Door interface and a release event occurs, then the sharing of the main image is completed.

[0215] In some embodiments, when displaying the main image of the overlay effect, if a release event occurs without triggering a valid drag, the cutout recognition result (including multiple subject identifiers) and the cutout menu are displayed.

[0216] Among them, "not triggering a valid drag" includes not dragging or moving, as well as dragging but not being dragged to the screen border.

[0217] This application provides two methods for sharing the image cutout results.

[0218] Sharing Method 1: After cutting out the image, display the "Anywhere Door" feature and share the cutout result by dragging and dropping.

[0219] Refer again Figure 10AAs shown, the sharing phase includes dragging the overlay to display the "Anywhere Door" interface and dragging it to the share control. The background removal and sharing process includes press events, drag events, and release events. Specifically, the sharing phase begins with the drag event on the background removal result and ends with the release event after dragging the background removal result to the share control.

[0220] Sharing Method 2: After cutting out the image, a cutout menu will appear. Click on the menu to share the cutout result.

[0221] Figure 10B This illustrates another image matting process and sharing implementation provided by an embodiment of this application. For example... Figure 10B As shown, the sharing phase includes displaying the cutout menu and selecting the share control after detecting a release event. The process of cutting out the image and displaying the cutout menu includes press events, release events, and click events. Specifically, the sharing phase begins with the release event of the press operation and ends with the click event on the share control.

[0222] The following details the module interaction implementation process of the image matting stage in the embodiments of this application.

[0223] Figure 11 The diagram illustrates the workflow of image cutout processing achieved through the interaction of various modules. For example... Figure 11 As shown, the modules involved include a gesture management module, a gallery background removal management module, a background removal display module, and a visual component. The gesture management module, gallery background removal management module, and background removal display SDK are modules within the gallery application, while the visual component is a module within the background removal application. The background removal display SDK in the gallery application can call the visual component in the background removal application to perform background removal detection, and it can also call the background removal display module in the background removal application to perform background removal display.

[0224] S300, the gesture management module receives a press operation from the user on the first image (a press event occurs).

[0225] For example, the first image is a photo displayed in a gallery. The photo includes a portrait 1, and the press operation is applied to the portrait 1.

[0226] S301, The gesture management module detects whether the pressing operation lasts for a first preset duration (e.g., 100ms).

[0227] For example, after the gesture management module receives the user's press operation on the first image, the gesture management module starts a 100-millisecond (ms) timer. If the timer expires and the press operation has not ended, it can be determined that the press operation lasted for 100ms.

[0228] S302. After the press operation lasts for 100ms, the gesture management module determines whether the press has not ended and whether other gesture responses have been triggered.

[0229] S303. If the press operation lasts for 100ms and the press does not end and no other gesture response is triggered, the gesture management module sends the first image to the image cutout management module and submits the cutout detection task.

[0230] If the pressing operation triggers other gesture responses after 100ms, the image cutout processing process will be stopped.

[0231] S304. After the gesture management module submits the image cutout detection task, the gesture management module checks whether the total duration of the pressing operation is greater than or equal to the second preset duration (e.g., 400ms).

[0232] S305. If the total duration of the press operation is greater than or equal to 400ms, the gesture management module determines that the press operation is a long press operation and obtains the long press location information. The long press location information is used to indicate the position of the long press operation in the first image.

[0233] S306. If the long press is on a non-text area, the gesture management module waits for the cutout detection result and sets the cutout waiting time (also known as the third preset time), for example, the cutout waiting time is set to 400ms.

[0234] For example, the gesture management module starts a 400ms timer.

[0235] It should be noted that if a long press is placed on a text area, the long-pressed text area will be highlighted, triggering text recognition. Text recognition is a gesture response different from image cutout processing.

[0236] S307. After receiving the first image, the image cutout management module responds to the cutout detection task by reducing the size of the first image. For example, the longer side of the first image is reduced to 832 pixels.

[0237] S308: The image library cutout management module passes the scaled-down first image and cutout parameters to the visual component, triggering cutout detection.

[0238] The cutout parameters are used to instruct the detection of cutout of the main subject (e.g., a human figure) in the first image. For ease of explanation, the following example illustrates the cutout detection of a human figure.

[0239] S309. The visual component performs matting detection on the first image according to the matting parameters to obtain the matting detection result, which includes edge coordinate points and a mask image.

[0240] The vision component calls the `doImageSegment` function to perform image segmentation detection. The `doImageSegment` function is used to identify human figures in an image, obtain the edge coordinates of the figures, and acquire a mask image of the figures.

[0241] In some embodiments, the edge coordinate points include the edge coordinate points of each portrait in the first image. The mask image includes the mask image of each portrait in the first image.

[0242] In other embodiments, the edge coordinate points include the edge coordinate points of the first portrait in the first image. The mask image is the mask image of the first portrait. For example, the first portrait can be one or more portraits whose display area is greater than a threshold. Alternatively, the first portrait can be one or more portraits corresponding to a user's long-press operation.

[0243] In the mask image, pixels in the human figure area are labeled as 1, while pixels in other areas are labeled as 0.

[0244] It should be noted that the mask image can be used to crop from the first image to obtain the main image of the overlay effect. The specific use of the mask image will be explained below.

[0245] In this embodiment of the application, the touch response efficiency can be accelerated by using a compressed image to obtain a mask image.

[0246] S310, The visual component returns the cutout detection results to the image library cutout management module.

[0247] S311, The image library cutout management module caches the cutout detection results.

[0248] One feature is that edge coordinates can be cached in the cache area to facilitate the rendering of cutout animations based on the edge coordinates.

[0249] The mask image can be cached in the cache area so that image matting can be performed based on the mask image and the first image to obtain the matting result.

[0250] S312, The image library cutout management module sends the cutout detection results to the gesture management module.

[0251] S313, The image library cutout management module sends the cutout detection results to the cutout display SDK.

[0252] This application does not specify the order in which S309 and S310 are executed.

[0253] S314. When the gesture management module receives the image cutout detection result, it determines whether a timeout has occurred (i.e. whether it exceeds 400ms).

[0254] S315. If the gesture management module receives the cutout detection result before the timeout, the gesture management module sends the long press position information to the cutout display module.

[0255] On the one hand, if the gesture management module receives the image cutout detection result before the timeout, the gesture management module continues to execute the image cutout processing flow.

[0256] On the other hand, if the gesture management module receives the cutout detection result after the timeout, or if it still does not receive the cutout detection result after the timeout, the gesture management module stops the cutout processing flow. For example, in this case, the gesture management module can determine the long press operation as a gesture operation that processes the entire image.

[0257] S316. The cutout display SDK receives the cutout detection result and long-press position information, and determines whether the long-press position is within the main body area based on the edge coordinates and long-press position information, and obtains the judgment result.

[0258] For example, the judgment result indicates that the long press position is in the main area.

[0259] S317. The image cutout display SDK returns the judgment result to the gesture management module.

[0260] S318. If the judgment result indicates that the long press position is in the main body area, the gesture management module sets the cutout display parameters.

[0261] If the judgment result indicates that the long press position is not in the main area, the gesture management module will determine not to perform image cutout processing.

[0262] In some embodiments, if the long-press position is not in the main area and a drag operation occurs, the electronic device can display an arbitrary door interface. At this time, the first image can be dragged to the arbitrary door interface to achieve sharing or saving of the first image. This processing method is the image processing method two described above.

[0263] S319. The gesture management module sends the cutout display parameters to the cutout display SDK, triggering the display of the cutout animation.

[0264] S320, the cutout display SDK, draws cutout animations based on cutout display parameters and edge coordinates.

[0265] Among them, the edge coordinate points are the coordinate points of the main outline.

[0266] Among them, the cutout display parameters are parameters that indicate the drawing of cutout animation effects. For example, the cutout display parameters can be lines that flash or move around the subject in a loop.

[0267] Figure 12This illustration shows a schematic diagram of the interface for triggering cutout processing and displaying cutout animation effects by long-pressing the subject, as provided in an embodiment of this application. For example... Figure 12 As shown in (a) above, in the gallery interface, the user long-presses the main subject of the image. Figure 12 As shown in (b), in response to the user's long press operation on the main body of the image, the electronic device triggers the cutout process and displays the cutout animation effect (referred to as cutout animation).

[0268] For example, the cutout animation could be a line (e.g., a dashed line) that flashes or moves in a loop around the subject (e.g., a human figure).

[0269] For example, the cutout animation could be an effect where the entire area of ​​the pressed subject (such as a portrait) flashes or is highlighted.

[0270] This example illustrates the cutout animation effect; other cutout animation effects may also be included in the actual implementation.

[0271] S321 and S322, the gesture management module determines whether the press operation has ended. If the press operation is confirmed to be ended, the gesture management module triggers the display of the cutout menu. The cutout menu includes a share control.

[0272] For example, when a user's finger is detected to have left the screen, a release event occurs, which can determine that the press operation has ended.

[0273] In steps S323 and S324, if the press operation is not yet complete, the gesture management module detects whether there is a drag operation. If a drag operation is detected and the drag is directed towards the screen edge (a drag event occurs), the gesture management module triggers the display of the Any Door interface. The Any Door interface includes a sharing control.

[0274] The above describes the process of triggering image cutout in the image library in the embodiments of this application. The following describes, with reference to the accompanying drawings, the possible implementation methods for sharing the cutout results when displaying the cutout animation effect.

[0275] As described above, the image cutout processing and sharing process includes cutout intent recognition, image compression, cutout detection, drawing cutout animation, displaying a floating layer, and dragging or sharing the cutout result. When a press event occurs, the electronic device determines that the press event meets the cutout trigger condition, recognizes the cutout intent, and then compresses the original image to be cut out (by reducing its size or downsampling). Then, it performs cutout detection on the compressed image to obtain the cutout detection result. Based on the cutout detection result, it draws the cutout animation and displays the cutout result as a floating layer. If a drag event occurs, the cutout result in the floating layer can move with the user's drag. When the cutout result moves to the share icon, a raise-to-share event triggers the sharing action, thus achieving the purpose of sharing the cutout result.

[0276] Figure 13 This diagram illustrates a process for triggering sharing of cutout results by dragging and dropping the cutout result while displaying a cutout animation. The modules involved include a gesture management module, a cutout management module, a cutout display SDK drag-and-drop process, a cutout display SDK cutout process, and a drag-and-drop framework module. The following steps are based on the above... Figure 11 It is executed after S320 in the process.

[0277] S400, the gesture management module receives a long press operation from the user on the first image, with the long press position in the first main area.

[0278] S401, The gesture management module instructs the cutout management module to display the cutout layer.

[0279] S402, The cutout management module displays the cutout layer.

[0280] S403, the gesture management module continues to wait for the fourth preset duration (e.g., 400ms).

[0281] S404. After waiting for 400ms, the gesture management module sends a command to the cutout management module to start the cutout drag-and-drop settings.

[0282] S405, the cutout management module responds to the command to start the cutout drag-and-drop settings by submitting an asynchronous task for the cutout drag-and-drop settings.

[0283] S406, the image cutout management module parses the original image or extracts a frame from the video.

[0284] In some embodiments, the first image is a static image. The image cutout management module can parse the static image and select the first image as the original image (originBitmap) for image cutout processing.

[0285] In other embodiments, the first image is a dynamic image, and the image cutout management module can extract a frame from the dynamic image as the original image for image cutout processing. For example, if the first image is in video format and contains multiple static frame images, the image cutout management module can select a frame from the video as the original image for image cutout processing.

[0286] This application solution allows for the removal of background elements from the original image, resulting in a cutout image that can be saved or shared, thus ensuring the image quality of the cutout result.

[0287] S407 The masking management module retrieves the cached mask image from the storage area and parses the mask image (maskAlphaBitmap) to obtain a single-channel mask image for masking processing.

[0288] In this context, a single-channel mask image refers to an image represented using 0s and 1s. The main subject area is represented by 1s, and areas other than the main subject area are represented by 0s.

[0289] S408 The mask management module sends the parsed mask image to the mask display SDK masking process.

[0290] S409. The image cutout process of the SDK performs image processing (i.e., image cutout processing) based on the mask image and the original image of the first image to obtain the main image of the first main area in the first image.

[0291] Among them, the image can be textured based on the mask image and the original image of the first image, and the main image of the first main body region can be cropped from the original image of the first image.

[0292] S410, The cutout display SDK cutout process sends the main image to the cutout management module.

[0293] S411, The image cutout management module caches the main image.

[0294] S412-S414 The cutout management module calls the Clipdata function to set the drag display parameters, then initiates dragging according to the drag display parameters, and calls the cutout display SDK drag process to complete the setting of drag display parameters, so that the drag process can support drawing the floating layer content and displaying drag animation effects.

[0295] S415 The cutout management module sends drag display parameters to the drag frame module, calls the startDragAndDrop function to trigger the drag event.

[0296] S416 and S417, the drag-and-drop frame module calculates the display position and size of the dragged overlay and creates the overlay (Surface).

[0297] S418 and S419, the drag-and-drop frame module instructs the drag-and-drop process of the cutout display SDK to draw the overlay content. The cutout display SDK drag-and-drop process draws the overlay content.

[0298] Among them, drawing the overlay content refers to the cutout result of drawing the overlay effect.

[0299] S420-S422: When the gesture management module detects that a drag operation has been initiated (drag start operation), it notifies the drag frame module of the initiation of the drag operation. The drag frame module then calls back the drag event (Drag event), instructing the cutout display SDK to display "Drag overlay initiation drag effect" during the drag process. Accordingly, the cutout display SDK will display "Drag overlay initiation drag effect" during the drag process.

[0300] S423-S425: The gesture management module detects a drag-and-drop operation and notifies the drag-and-drop frame module of the operation. The drag-and-drop frame module then calls back the drag event, instructing the cutout display SDK drag-and-drop process to display the "drag-and-drop floating layer shrinking animation" after the drag-and-drop movement. Accordingly, the cutout display SDK drag-and-drop process will display the "drag-and-drop floating layer shrinking animation" after the drag-and-drop movement.

[0301] S426-S427: When the gesture management module detects a release operation, it notifies the drag frame module of the release operation. The drag frame module then calls back the release event (Drop event) and instructs the image cutout display SDK drag process to execute S428A or S428B.

[0302] S428A, the SDK for background removal displays an animation of a floating layer being dragged into a share icon after the drag is released.

[0303] S428B, the image cutout display SDK displays an animation of "drag and drop layer returning to image" after the drag process is released.

[0304] S429-S431, the background removal display SDK drag-and-drop process notifies the gesture management module of the end of dragging, and the gesture management module instructs the background removal management module to exit the background removal display. According to the instruction, the background removal management module exits the background removal display and deletes the background removal cache file. The background removal cache file includes the cached background removal detection results and the cached main image.

[0305] Figure 14 The diagram illustrates the image processing method provided in this application, including cutout animation, overlay display effect, and drag-and-drop interface.

[0306] like Figure 14 As shown in (a), a cutout animation effect is displayed in the main body area when long-pressed. The cutout animation effect is a dotted line that flashes along the outline of the main body.

[0307] like Figure 14 As shown in (b), after displaying the cutout animation, the cutout result of the overlay effect can be displayed. Furthermore, to improve the display effect and better showcase the cutout result, the cutout result of the overlay effect can be enlarged. Specifically, the cutout result of the overlay effect can be enlarged when a user drag-and-drop operation is detected.

[0308] like Figure 14 As shown in (c), after detecting that the user has dragged and moved the cutout result of the overlay effect, the cutout result of the overlay effect is scaled down to more clearly show the movement effect. When the user has dragged and moved the cutout result of the overlay effect to the screen border or edge, the Anywhere Door interface is displayed.

[0309] like Figure 14As shown in (d), the sharing process is completed when the user drags the cutout result of the overlay effect to the share control in the Any Door interface and a release event occurs.

[0310] It should be noted that in the embodiments of this application, "greater than" can be replaced with "greater than or equal to", "less than or equal to" can be replaced with "less than", or "greater than or equal to" can be replaced with "greater than", and "less than" can be replaced with "less than or equal to".

[0311] The various embodiments described herein can be independent solutions or combinations thereof based on their inherent logic, and all such solutions fall within the protection scope of this application.

[0312] The foregoing mainly describes the solutions provided by the embodiments of this application from the perspective of method steps. It is understood that, in order to achieve the above functions, the electronic device implementing this method includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of protection of this application.

[0313] This application embodiment can divide an electronic device into functional modules based on the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, other feasible division methods may exist. The following description uses the division of functional modules according to each function as an example.

[0314] This application also provides a chip coupled to a memory, which is used to read and execute computer programs or instructions stored in the memory to perform the methods in the above embodiments.

[0315] This application also provides an electronic device including a chip for reading and executing computer programs or instructions stored in a memory, causing the methods in the various embodiments to be performed.

[0316] This embodiment also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the image processing method described above.

[0317] This embodiment also provides a computer program product. The computer-readable storage medium stores program code. When the computer program product is run on a computer, it causes the computer to perform the above-mentioned related steps to implement the image processing method in the above embodiment.

[0318] In this embodiment, the electronic device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0319] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0320] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.

[0321] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. In the description of embodiments in this application, unless otherwise stated, "multiple" means two or more; for example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.

[0322] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An image processing method, characterized in that, include: In response to user interaction, the first image is displayed in the gallery interface; Receive the user's first press operation on the main area of ​​the first image; In response to the first press operation, a second image is displayed on the first image, the second image being the main image of the main body region; If the first pressing operation is not completed, the second image is detected to be dragged and moved; When the second image is dragged to the edge of the screen, a shortcut icon interface is displayed; When the second image is dragged to the first application icon in the shortcut icon interface, the second image is processed according to the function indicated by the first application icon; wherein, the first application icon includes a share icon, save icon, favorite icon, note icon or print icon.

2. The method according to claim 1, characterized in that, The method further includes: Receive a second press operation from the user on a non-subject, non-text area in the first image; In response to the second press operation, a scaled-down version of the first image is displayed on top of the first image; If the second pressing operation is not completed, it is detected that the first image, which has been reduced in size, is being dragged and moved; The shortcut icon interface is displayed when the first image, after being reduced in size, is dragged to the edge of the screen; When the first image, after being reduced in size, is dragged to the second application icon in the shortcut icon interface, the first image is processed according to the function indicated by the second application icon.

3. The method according to claim 1, characterized in that, The method further includes: In response to the first press operation, the image cutout intention is identified based on the first preset duration and image cutout detection data is obtained. Based on the second preset duration, the first press operation is determined to meet the preset long press conditions and long press position information is obtained. If the first pressing operation meets the preset long press conditions, based on the third preset duration, the first pressing operation is determined to be applied to the main body area and the cutout animation effect is displayed according to the cutout detection data and the long press position information; When displaying the cutout animation effect, the second image with the overlay effect is determined based on the fourth preset duration; The second preset duration includes the first preset duration, and the start time of the second preset duration and the first preset duration are the same.

4. The method according to claim 3, characterized in that, The step of responding to the first press operation by identifying the cutout intention and obtaining cutout detection data based on a first preset duration, and determining that the first press operation meets the long press condition and obtaining long press position information based on a second preset duration, includes: In response to the first press operation, wait for the first preset time. If the first preset time ends and the first press operation does not trigger any other gesture events besides image cutout, then the image cutout intention is recognized, image cutout detection is started, and the image cutout detection data is obtained. In response to the first press operation, wait for the second preset time. If the second preset time ends and the first press operation does not trigger any other gesture events other than image cutout, then obtain the long press position information.

5. The method according to claim 3, characterized in that, The image matting detection data includes the coordinate points of the subject's edge; When the first press operation meets the long press condition, based on a third preset duration, and according to the cutout detection data and the long press position information, the method determines that the first press operation applies to the main body area and displays the cutout animation effect, including: Determine whether the first press operation is applied to a non-text area based on the long press location information; If the first pressing operation is applied to a non-text area, then wait for the third preset time. If the subject edge coordinates are obtained within the third preset time period and the first press operation does not trigger any other gesture events other than image cutout, then it is determined whether the first press operation is applied to the subject area based on the subject edge coordinates and the long press position information. If the first pressing operation is applied to the main body area, then according to the coordinate points of the main body edge, the cutout animation effect is displayed along the main body outline of the main body area.

6. The method according to claim 3, characterized in that, The image matting detection data includes the subject mask image; When displaying cutout animation effects, determining the second image for displaying the overlay effect based on a fourth preset duration includes: After displaying the cutout animation along the main body outline, wait for the fourth preset time. If the fourth preset time ends and the first press operation does not trigger any other gesture events besides cutout, then perform cutout processing on the first image according to the main body mask image to obtain the second image, and display the second image with a floating layer effect.

7. The method according to claim 3, characterized in that, Before displaying the cutout animation effect, the method further includes: If the first image is detected to be a dynamic image after the second preset duration ends, the dynamic image is played in response to the first press operation; after the third preset duration ends, the playback of the dynamic image is stopped. The display of the cutout animation effect includes: displaying the cutout animation effect on the first frame of the dynamic image.

8. The method according to claim 5, characterized in that, In determining whether the first press operation was applied to a non-text area, the method further includes: If it is determined that the first pressing operation is applied to the text area, the text area is highlighted and text recognition processing is performed on the text area; If it is determined that the first press operation is applied to a non-subject, non-text area, then a scaled-down version of the first image is displayed on the first image, and the scaled-down first image can be dragged and moved.

9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: When the second image is displayed on the first image, if no drag operation is detected, a shortcut icon menu is displayed at the second image after the first press operation ends. The shortcut icon menu includes an icon for adjusting the cutout area. In response to the user's click on the icon for adjusting the cutout area, an adjustment node is displayed at the outline of the main image in the main area; In response to the user's movement operation on the adjustment node, an adjusted second image is obtained.

10. The method according to claim 9, characterized in that, The shortcut icon menu also includes a share icon and / or a save icon; the method further includes: Receive user clicks on the share icon and / or save icon; In response to the click operation, the second image or the adjusted second image is shared or saved.

11. The method according to any one of claims 1 to 10, characterized in that, The main image is a human figure.

12. The method according to claim 11, characterized in that, The first image is an image in the form of a picture or a video; The step of displaying the second image on the first image includes: The first image is identified as a video image; Obtain a first frame image from the first image that includes human facial features; The human features in the first frame image are extracted to obtain the second image; Display the second image on top of the first image.

13. An electronic device, characterized in that, The electronic device includes: 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 method as described in any one of claims 1 to 12.

14. 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 method as described in any one of claims 1 to 12.

15. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 12.