Image cutting method and device, electronic equipment and readable storage medium

By intelligently identifying and automatically aligning the cropping frame edge with the recommended edge in the image cropping tool, the problem of low cropping efficiency caused by finger obstruction is solved, achieving efficient and accurate image cropping operations.

CN122048962APending Publication Date: 2026-05-15VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2026-01-23
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Due to the limited screen size of electronic devices, users often obscure the cropping area with their fingers when cropping images, making it impossible to observe the edge alignment in real time. This necessitates repeated, slow, and fine-tuning, resulting in low operational efficiency.

Method used

In image cropping and editing mode, the system intelligently identifies the position of the recommended cropping edge line and automatically controls the precise alignment of the two when the distance between the cropping frame edge line and the recommended edge line is less than a preset threshold. The system uses path planning algorithms and easing functions to achieve snap-in control and generate the final cropped image.

Benefits of technology

It improves the efficiency of image cropping, avoids the tedious operation of repeated and slow adjustments by users, and ensures cropping accuracy and convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122048962A_ABST
    Figure CN122048962A_ABST
Patent Text Reader

Abstract

The invention discloses an image cutting method and device, electronic equipment and a readable storage medium, and belongs to the technical field of image processing.The method comprises the steps that under the condition that a first image is in a cutting frame editing state, the position of a cutting frame edge line is determined; under the condition that the distance between the position of the cutting frame edge line and the position of the cutting recommendation edge line is smaller than a preset distance threshold value, the cutting frame edge line is controlled to be aligned with the cutting recommendation edge line; and according to the aligned cutting frame edge lines, determining a cutting image corresponding to the first image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to an image cropping method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] In the era of rapid development of mobile internet and social media, smartphones, tablets, and other electronic devices have become the main tools for people to take, edit, and share images daily. Image editing functions, as one of the core components of electronic device operating systems and various application software, with cropping tools playing a crucial role, allow users to quickly remove redundant parts of images, adjust composition proportions, and highlight visual focal points, thereby improving the visual appeal and information delivery efficiency of images and meeting the needs of diverse application scenarios such as social media sharing, e-commerce display, and document creation.

[0003] However, due to the limited screen size of electronic devices, fingers often obscure the cropping area during operation, preventing users from observing edge alignment in real time. To achieve precise alignment, users need to make repeated, slow, and fine-tuning adjustments, making the process inefficient. Summary of the Invention

[0004] The purpose of this application is to provide an image cropping method, apparatus, electronic device, and readable storage medium that can improve the efficiency of image cropping.

[0005] In a first aspect, embodiments of this application provide an image cropping method, the method comprising: With the first image in cropping frame editing mode, determine the position of the cropping frame edge line; If the distance between the position of the cutting frame edge line and the position of the recommended cutting edge line is less than a preset distance threshold, the cutting frame edge line is aligned with the recommended cutting edge line. Based on the aligned cropping frame edges, determine the cropped image corresponding to the first image.

[0006] Secondly, embodiments of this application provide an image cropping apparatus, the apparatus comprising: The determination module is used to determine the position of the cropping frame edge line when the first image is in the cropping frame editing state; The control module is used to align the edge line of the cutting frame with the recommended cutting edge line when the distance between the position of the cutting frame edge line and the position of the cutting recommended edge line is less than a preset distance threshold. The cropping module is used to determine the cropped image corresponding to the first image based on the aligned edge lines of the cropping frame.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the image cropping method as described in the first aspect.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the image cropping method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the image cropping method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the image cropping method as described in the first aspect.

[0011] In this embodiment, the position of the recommended cropping edge line is intelligently identified and determined when the image is in the cropping editing state. When the distance between the cropping frame edge line operated by the user and the recommended edge line is less than a preset distance threshold, the two are automatically aligned precisely. The cropped image is generated based on the finally aligned cropping frame edge line. This effectively solves the problem of low cropping efficiency caused by finger obstruction and manual fine-tuning. By automatically completing the precise alignment step, the tedious operation of repeated and slow adjustments by the user is avoided, thereby improving the efficiency of image cropping. Attached Figure Description

[0012] Figure 1 This is a flowchart of an image cropping method provided by some embodiments of this application; Figure 2 This is one of the example diagrams of an image cropping method provided in some embodiments of this application; Figure 3 This is the second example diagram of an image cropping method provided in some embodiments of this application; Figure 4 This is the third example diagram of an image cropping method provided in some embodiments of this application; Figure 5 This is a structural block diagram of an image cropping device provided in some embodiments of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in some embodiments of this application; Figure 7This is a schematic diagram of the hardware structure of an electronic device that implements the various embodiments of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0015] To facilitate understanding, some related concepts involved in the embodiments of this application will be introduced first.

[0016] A cropping tool is a functional module in the image editing function of an electronic device that enables selective cropping of image regions. It includes interactive graphical interface components and corresponding control logic, and performs spatial region division and content extraction operations on the image by receiving user operations.

[0017] The cropping box, as the core visual component of the cropping tool, refers to the operable bounding box displayed above the image. It is usually composed of multiple boundary segments and vertices that can be controlled independently or in conjunction. Users can adjust the boundary position, box size, or spatial orientation through touch gestures.

[0018] The edge line of the cut frame refers to the boundary line segment or curve segment that makes up the cut frame.

[0019] Cropping interaction refers to the human-computer interaction process between users and cropping tools through touch operations. This includes dragging, scaling, or rotating the cropping frame edge of the cropping tool, as well as a series of feedback behaviors of electronic devices that update the cropping tool status and image preview effect in real time in response to the operation.

[0020] Subject recognition refers to the technical process of using image analysis algorithms integrated into electronic devices to perform semantic or instance segmentation on the current image in order to identify one or more target objects in the image, including but not limited to physical objects, text regions or people, and extract their contour edge information.

[0021] The image cropping method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0022] Figure 1 This is a flowchart of an image cropping method provided in some embodiments of this application, such as... Figure 1 As shown, the method may include the following steps: step 101, step 102 and step 103.

[0023] In step 101, while the first image is in the cropping frame editing state, the position of the cropping frame edge line is determined.

[0024] In this application embodiment, the first image includes, but is not limited to: an image captured by a camera, an image extracted from a video stream, an image stored locally, an image downloaded from the cloud, and an image that has been preprocessed or generated.

[0025] In this embodiment, the cropping box editing state refers to a specific interactive mode of the image editor in the electronic device. In this mode, a geometric bounding box (i.e., cropping box) covering the image is displayed on the screen. The boundary segments and vertices of the bounding box can be directly manipulated by the user through touch operation. The electronic device responds to the user's operation in real time and updates the visual presentation of the cropping box.

[0026] In this embodiment, the position of the cropping frame edge line refers to the set of spatial coordinates of each boundary line segment constituting the cropping frame in the current image coordinate system.

[0027] In this embodiment, by continuously tracking and determining the real-time position of the cutting frame edge line, a precise spatial reference benchmark is established for subsequent intelligent alignment decisions.

[0028] For example, when a user opens a photo in their phone's photo album and selects the cropping function, a rectangular cropping frame is displayed on the phone screen, overlaying the photo. As the user drags the right edge of the cropping frame, the phone detects the dragging action in real time and determines the current position of the edge line.

[0029] In step 102, if the distance between the position of the cropping frame edge line and the position of the cropping recommended edge line is less than a preset distance threshold, the cropping frame edge line is aligned with the cropping recommended edge line.

[0030] In this embodiment, the recommended cropping edge line is a recommended cropping boundary determined by an image analysis algorithm, which can be superimposed on the first image using a specific visual style (such as a dashed line or a highlighted line).

[0031] In this embodiment, the preset distance threshold can be a fixed value or dynamically adjusted according to image attributes (such as resolution) or user settings.

[0032] In this embodiment of the application, while continuously monitoring the position of the cutting frame edge line, it is compared with the ideal cutting boundary (i.e. the recommended cutting edge line) that is pre-calculated or identified in real time. When the distance between the two enters the trigger range of intelligent assistance, the electronic device automatically takes over the control and completes the precise spatial alignment operation.

[0033] For example, such as Figure 2 As shown, the screen of the electronic device 20 displays an image editing interface 21, which shows a first image 22 to be edited, an operable cropping frame edge line 23, and a cropping recommendation edge line 24 identified by the electronic device 20. When the user drags the cropping frame edge line 23 close to the recommendation edge line 24 and the distance between them is less than a preset threshold, the electronic device 20 automatically controls the edge line 23 to move until it is aligned with the recommendation edge line 24.

[0034] In this embodiment, an automatic alignment mechanism is triggered by a preset distance threshold, transforming the pixel-level alignment in the cropping process, which relies on precise user operation, into an automated operation that can be stably executed by the electronic device. This breaks through the precision limit of manual operation, allowing users to simply drag the cropping box to the vicinity of the recommended cropping edge line, and the subsequent precise positioning is automatically completed by the electronic device, reducing the difficulty of operation. In addition, the triggering mechanism based on the distance threshold ensures that the automated assistance only intervenes when the user clearly needs it, always maintaining the user's control in the cropping process and avoiding excessive intervention in the operation process.

[0035] It should be noted that the shapes of the cropping frame edge lines and the recommended cropping edge lines in this embodiment are not limited to rectangles. They can also include regular geometric shapes such as circles and polygons, as well as free curves that fit the outline of the target object, hand-drawn boundaries, or irregular closed shapes generated based on image semantic segmentation. This design, through adaptive curve alignment and flexible rendering, enables the cropping function to meet the needs of complex shape processing in diverse scenarios such as object extraction and creative design.

[0036] In step 103, the cropped image corresponding to the first image is determined based on the aligned cropping frame edge lines.

[0037] In this embodiment of the application, after alignment is completed, the user confirms the cropping, and the electronic device performs cropping, resampling and other processing on the original image according to the position of the aligned cropping frame, and finally outputs a cropped image that meets the user's composition intention.

[0038] As can be seen from the above embodiments, in this embodiment, by intelligently identifying and determining the position of the recommended cropping edge line when the image is in the cropping editing state, when it is detected that the distance between the cropping frame edge line operated by the user and the recommended edge line is less than a preset distance threshold, the two are automatically controlled to be precisely aligned, and the cropped image is generated based on the finally aligned cropping frame edge line. This effectively solves the problem of low cropping efficiency caused by finger obstruction and manual fine-tuning. By automatically completing the precise alignment step, the tedious operation of repeated and slow adjustments by the user is avoided, thereby improving the efficiency of image cropping.

[0039] In some embodiments provided in this application, step 102 may specifically include the following steps: step 1021.

[0040] In step 1021, if the distance between the position of the cutting frame edge line and the position of the recommended cutting edge line is less than a preset distance threshold, the cutting frame edge line is controlled to snap to the position of the recommended cutting edge line.

[0041] In this embodiment, when the distance between the edge line of the trimming frame and the recommended trimming edge line is less than a preset threshold, the electronic device triggers adsorption control, causing the edge line of the trimming frame to automatically move to a position aligned with the recommended trimming edge line. The adsorption control includes planning a motion trajectory from the current position to the target position and controlling the edge line of the trimming frame to move along that trajectory.

[0042] In this embodiment, the adsorption control may specifically include: determining the motion trajectory based on a path planning algorithm, which considers motion smoothness and visual continuity; controlling the movement speed based on an easing function to simulate the physical adsorption effect; and controlling the final alignment accuracy to reach the sub-pixel level.

[0043] For example, when the user adjusts the upper edge of the cropping frame, the electronic device calculates the distance between the edge line and the recommended cropping edge line in the image in real time; when the distance is less than a preset threshold, the electronic device controls the upper edge to automatically move to a position aligned with the recommended cropping edge line.

[0044] In this embodiment of the application, by means of automatic adsorption control, the fine alignment that originally required repeated manual adjustments by the user is transformed into a precise operation that is automatically completed by electronic devices, thereby improving the efficiency and convenience of the cutting operation while ensuring alignment accuracy.

[0045] Accordingly, the provided image cropping method may also include the following step after step 1021: step 104.

[0046] In step 104, when the edge of the cutting frame snaps to the position of the recommended cutting edge, feedback information is output; wherein the feedback information includes at least one of visual feedback, tactile feedback, and auditory feedback.

[0047] In this embodiment, after the electronic device completes the adsorption operation on the edge of the cutting frame, it outputs feedback information to the user through at least one sensory means to provide a confirmation signal that the operation is complete. This feedback information is used to establish status communication between the electronic device and the user, enhancing the user's perception of the automated process.

[0048] In this embodiment, visual feedback may include at least one of the following: changing the display style of the cropping frame edge line, displaying a dynamic effect at the cropping frame edge line, or displaying a completion indicator on the screen. Tactile feedback may include tactile signals output through a vibration device. Auditory feedback may include prompt sounds output through an audio device.

[0049] In this embodiment, the timing of outputting feedback information is determined based on the positional overlap between the edge line of the cropping box and the recommended cropping edge line, and the output of feedback information is suppressed when the user is detected to be continuously dragging.

[0050] For example, when the upper edge of the cutting frame snaps to the recommended cutting edge line, the electronic device may perform at least one of the following feedbacks: change the display color of the upper edge from blue to gold and maintain it for a first duration; control the vibration device to output a vibration; or play a prompt sound effect.

[0051] As can be seen, in this embodiment of the application, by outputting feedback information, the operation completion node can be clearly identified to the user, enhancing the understandability of the automation process, and supporting the provision of effective completion confirmation to the user in different usage environments, thereby improving the overall interaction efficiency and user experience.

[0052] In some embodiments provided in this application, an image segmentation strategy can be used to perform depth analysis on the first image to identify the cropping boundary positions most likely to match the user's intent, thereby automatically generating cropping recommendation edge lines that conform to different application scenarios. Accordingly, the provided image cropping method may also add the following step before step 102: step 105.

[0053] In step 105, the cropping recommendation edge line of the first image is determined according to the image segmentation strategy; wherein the image segmentation strategy includes at least one of the following: image region strategy, image element strategy, subject strategy, and composition strategy.

[0054] In this embodiment, the image region strategy is a strategy for region division based on the spatial distribution characteristics of the image: electronic devices can identify natural partition boundaries with significant differences in the image by analyzing visual attributes such as color distribution, texture features, and brightness gradients. Specifically, this can be achieved through color clustering algorithms (such as K... This method involves grouping pixels based on color similarity and applying edge detection algorithms (such as the Canny operator) to detect transition edges between regions, or using techniques such as watershed algorithms and superpixel segmentation to identify visually uniform regions. Application scenarios for this strategy include: identifying the sky-ground boundary in vertically partitioned images (such as landscape photos containing both sky and ground); identifying the boundary between the subject and environment in horizontally partitioned images (such as photos containing both subject and background); and identifying the boundaries of each sub-image in multi-regional images (such as collages), using the identified boundaries as recommended cropping edges.

[0055] For example, such as Figure 3 As shown, the first image 32 contains two image regions, one above the other. The screen of the electronic device 30 displays an image editing interface 31, which shows the first image 32 to be edited, the cropping frame edge line 33 that can be operated by the user, and two cropping recommended edge lines 34 and 35 identified by the electronic device 30 based on the image region strategy.

[0056] In this embodiment, the image element strategy is based on the identification and localization of specific visual elements in an image: the electronic device detects specific types of visual elements in the image using computer vision algorithms and uses the boundaries of these elements as cropping references. Specifically, object detection algorithms (such as YOLO and SSD) can be used to identify specific categories of objects, optical character recognition technology can be applied to identify text regions and their bounding boxes, and feature matching algorithms can be used to identify specific patterns or logos. Application scenarios for this strategy include: extracting text structure boundaries for text regions (such as paragraph boundaries and table borders in scanned documents), locating the outlines of specific objects (such as the outlines of products in product images and the face region in portraits), and identifying the outer frames of logos and patterns for graphic elements (such as icon boundaries and logo areas in design drawings), and using the identified element boundaries as recommended cropping edges.

[0057] For example, such as Figure 4 As shown, the first image 42 contains multiple image elements. The screen of the electronic device 40 displays an image editing interface 41, which shows the first image 42 to be edited, the cropping frame edge line 43 that can be operated by the user, and three cropping recommended edge lines 44, 45 and 46 identified by the electronic device based on the image element strategy.

[0058] In this embodiment, the subject strategy focuses on identifying the most prominent or important visual subject in an image: the electronic device accurately locates the core content area of ​​the image through saliency detection and subject segmentation techniques; specifically, it can use saliency detection algorithms (such as DeepSaliency) to identify the visual focus area, apply instance segmentation models (such as Mask R-CNN) to accurately segment the subject outline, and analyze the user's potential attention area through attention mechanisms. Application scenarios for this strategy include: accurately identifying the full or half-body outline of a person in portrait photos, completely preserving the overall shape of a product in product close-ups, and accurately extracting the main outline of an animal in animal photography, using the identified subject outline as a recommended cropping edge line.

[0059] In this embodiment, the composition strategy is based on photographic composition aesthetics principles to generate cropping suggestions: the electronic device follows classic composition rules and calculates ideal cropping boundaries that meet aesthetic standards; specifically, the rule of thirds can be applied to calculate the golden ratio point, the balance center line can be determined according to the principle of symmetry, and the focus of the image can be determined by considering line-of-sight guidance and visual center of gravity. Application scenarios of this strategy include: placing the horizon at one-third of the frame in a rule-of-thirds composition scenario, determining the center alignment line for symmetrical buildings in a symmetrical composition scenario, and determining the cropping boundary along the direction of a road or river in a leading line composition scenario, using the boundary calculated based on composition aesthetics principles as the recommended cropping edge line.

[0060] In some embodiments, the first image has at least two cropping recommendation edge lines; wherein each cropping recommendation edge line corresponds to one of the image segmentation strategies.

[0061] In this embodiment, multiple cropping recommendation edge lines based on different analysis strategies can be generated for the same first image. Each cropping recommendation edge line corresponds to a specific image segmentation strategy (one or more combinations of image region strategy, image element strategy, subject strategy, and composition strategy), forming a multi-dimensional and multi-level cropping suggestion system.

[0062] For example, taking a travel landscape photo containing mountains, lakes, sky, and foreground figures as an example, the electronic device can simultaneously output multiple cropping recommendation edge lines through multi-strategy parallel analysis: Sky identified based on image region strategy Mountain range boundaries, for example, are indicated by blue dashed lines; The complete outline of the person is extracted based on the main strategy, for example, represented by a solid green line; The horizon reference line is generated based on the rule of thirds in the composition strategy, for example, represented by a gold reference line; The boundary of the lake reflection area is identified based on an image element strategy, for example, represented by a purple dashed line.

[0063] Users can select one or more recommended edge lines to focus on based on their current cropping intention, and then perform subsequent cropping and alignment operations based on these lines.

[0064] In this embodiment, by providing cropping recommendation edge lines based on multiple segmentation strategies for the same image, the adaptability and practicality of the cropping method are enhanced. Different strategies complement each other, ensuring that professional suggestions can be generated for various types of images, covering a wide range of scenarios; users can choose from multiple optimization schemes, balancing efficiency and control.

[0065] As can be seen, in terms of scene coverage, the combination of the above four image segmentation strategies can handle all types of images, from natural landscapes to structured documents. Each strategy is deeply optimized for a specific scene, and the electronic device can automatically switch the most suitable strategy combination according to image features. In terms of cropping quality, reliability is improved through multi-dimensional verification, relevance is enhanced by combining context awareness, and the user's cropping intention can be predicted. In terms of user experience, the user's decision-making burden is reduced, the operating efficiency is improved, and the learning threshold is lowered.

[0066] In some embodiments provided in this application, a combined cropping mechanism supporting multiple cropping operations is provided, allowing users to define cropping regions for the same image in multiple rounds, and finally combine multiple cropping regions to generate the final cropped image. This is suitable for complex scenarios that require extracting multiple independent subjects or regions from a single image and combining them into a new image. Accordingly, step 103 above may specifically include the following steps: step 1031, step 1032, and step 1033.

[0067] In step 1031, the first cropping region corresponding to the first image is determined based on the aligned cropping frame edge lines.

[0068] In this embodiment, after completing the initial alignment operation and determining the cropping frame edge line, the electronic device determines and records the first image region to be extracted based on the edge line. Specifically, this includes: mapping the cropping frame edge line to the original image coordinate system, calculating the boundary coordinates of the region it encloses, generating metadata containing information such as position, size, and cropping strategy, and optionally saving a preview image or thumbnail of the region; the obtained first cropping region data can be stored as a temporary cache or persistently saved for subsequent processing steps.

[0069] In step 1032, the first image is again controlled to be in the cropping frame editing state, and the second cropping area corresponding to the first image is determined.

[0070] In this embodiment, while maintaining the original image context, the electronic device can re-enter the cropping and editing state, allowing the user to define a second cropping area. Specific implementation includes: maintaining the display of the first image and resetting or creating a new cropping frame; optionally retaining the operation record and strategy recommendations from the first cropping; providing a visual reference of historical cropping areas through methods such as semi-transparent overlay; supporting the use of the same or different intelligent snapping strategies as the first cropping; and finally determining the second cropping area by completing a second alignment operation.

[0071] In step 1033, the cropped image corresponding to the first image is determined based on the first cropping area and the second cropping area.

[0072] In this embodiment, the electronic device can generate a final cropped image containing corresponding extracted regions based on multiple predefined cropping regions. It supports three processing modes: an independent extraction mode for extracting image content from each region separately, a composite layout mode for combining multiple extracted regions according to a preset or custom layout, and a selective combination mode for allowing users to select portions from multiple cropping regions for combination. The algorithms used in the composite process may include: cropping and resampling each region; optimizing region edges with anti-aliasing, feathering, etc.; processing the background to be transparent, solid color, or original background fragments; and automatically coordinating and optimizing the spacing, alignment, and proportions of the overall layout.

[0073] For example, in a group photo scenario, the complete outline of the first person can be extracted through the first cropping area, the complete outline of the second person can be extracted through the second cropping area, and finally the two extracted images can be combined side by side to generate a new double close-up image, thereby realizing the convenient creation of individual or group close-ups from group photos.

[0074] In product image processing scenarios, the first cropping area can extract the complete shape of the main body of the product, and the second cropping area can extract the product logo or label area. Combining the two generates a specification image suitable for e-commerce display, thereby creating a standardized product display image that meets the platform's requirements.

[0075] In landscape photo processing, distinctive buildings are extracted from the first cropping area, and natural landscape parts are extracted from the second cropping area. The two areas are then combined in a creative layout to generate a more artistic image, suitable for creative photography and social media content creation.

[0076] In document image processing scenarios, the first cropping area extracts text paragraphs, the second cropping area extracts table areas, and the text and table are recombined to generate a simplified document image.

[0077] As can be seen, in this embodiment of the application, by supporting multi-round cropping and multi-region combination, users can meet complex content extraction and combination needs without the need for professional image editing software, thereby improving image cropping efficiency.

[0078] In some embodiments provided in this application, an intelligent extraction and batch reuse mechanism for cropping strategies can be provided, allowing electronic devices to learn the user's cropping strategy from a successful cropping operation and automatically apply the strategy to other similar images in the same image set, achieving an intelligent upgrade from single manual cropping to automated batch processing. Accordingly, the provided image cropping method may further include the following steps after step 103: steps 106 and 107.

[0079] In step 106, the image cropping strategy corresponding to the first image is determined based on the cropped image corresponding to the first image.

[0080] In this embodiment, the electronic device analyzes the completed first image cropping process, extracts and formalizes the cropping decision rules, parameters, and logic contained therein, forming a reusable structured strategy description. Its core extracted elements include: target recognition strategy (the type of image segmentation strategy upon which it is based, such as region, element, subject, or composition strategy), boundary alignment rules (snap trigger threshold and alignment accuracy requirements), composition preferences (white space ratio, subject positional relationship, and application of aesthetic rules), cropping parameters (aspect ratio, output resolution, and edge processing method), and contextual information (the relative positional relationship between the cropped area and the original image).

[0081] In step 107, at least one image is cropped according to an image cropping strategy; wherein at least one image belongs to the same image set as the first image.

[0082] In this embodiment, the extracted image cropping strategy can be applied to other images in the same image set to achieve automated and consistent batch processing.

[0083] In this application embodiment, an image set refers to a group of images that have similar content (same scene, subject or type), related source (same shooting session, folder or album), or consistent purpose (such as product image set, ID photo set).

[0084] In this embodiment of the application, the batch processing flow may include: automatically identifying a set of images similar to the first image; fine-tuning the cropping strategy parameters according to the characteristics of each image; automatically executing the optimized strategy on each image in the set; and performing a quality consistency check on the output results.

[0085] As can be seen, in this embodiment of the application, the extracted image cropping strategy is applied to other images in the same image set to achieve automated and consistent batch processing, which can effectively avoid repetitive work and invalid attempts, reduce repeated attempts by users on similar schemes in different sessions, and improve image cropping efficiency.

[0086] In some embodiments provided in this application, the current cropping interaction can be placed in a continuous editing history by actively presenting the boundary positions determined by previous cropping operations. Accordingly, the provided image cropping method may further include the following step after step 103: step 108.

[0087] In step 108, if the first image is not the first crop, the cropping history edge lines are displayed in the first image.

[0088] In this embodiment, by retrieving and parsing past cropping records associated with the first image (such as cropping coordinates, usage strategies, version information, etc.), these records are reconstructed into visual lines and overlaid on the image layer in a style different from the current operation lines (such as semi-transparent, dashed lines, different colors). These cropping history edge lines are not statically labeled, but retain metadata associated with the original cropping decisions, such as cropping time, the type of intelligent strategy used (such as based on subject recognition or composition rules), and the purpose of cropping.

[0089] As can be seen, in this embodiment, by displaying the trimming history edge lines, a single edit is placed within a continuous historical context, intuitively presenting the evolution trajectory of the trimming approach, allowing users to clearly grasp the path of version iteration. Each history line is associated with a specific decision-making background, supporting users to quickly trace the basis of past choices, thereby avoiding repeated and ineffective attempts and effectively reusing successful solutions. This not only improves the efficiency and consistency of multi-round operations by a single person but also promotes the alignment of standards in team collaboration, making each trimming no longer an isolated event, and enhancing the context awareness capability of the trimming tool and the coherence of the user experience as a whole.

[0090] The image cropping method provided in this application can be executed by an image cropping device. This application uses an image cropping device executing the image cropping method as an example to illustrate the image cropping device provided in this application.

[0091] Figure 5 This is a structural block diagram of an image cropping device provided in some embodiments of this application, such as... Figure 5 As shown, the image cropping device 500 may include: a determining module 501, a control module 502, and a cropping module 503; The determining module 501 is used to determine the position of the cropping frame edge line when the first image is in the cropping frame editing state; The control module 502 is used to align the edge line of the cutting frame with the recommended cutting edge line when the distance between the position of the cutting frame edge line and the position of the cutting recommended edge line is less than a preset distance threshold. The cropping module 503 is used to determine the cropped image corresponding to the first image based on the aligned cropping frame edge lines.

[0092] As can be seen from the above embodiments, in this embodiment, by intelligently identifying and determining the position of the recommended cropping edge line when the image is in the cropping editing state, when it is detected that the distance between the cropping frame edge line operated by the user and the recommended edge line is less than a preset distance threshold, the two are automatically controlled to be precisely aligned, and the cropped image is generated based on the finally aligned cropping frame edge line. This effectively solves the problem of low cropping efficiency caused by finger obstruction and manual fine-tuning. By automatically completing the precise alignment step, the tedious operation of repeated and slow adjustments by the user is avoided, thereby improving the efficiency of image cropping.

[0093] Optionally, as an embodiment, the control module 502 is specifically used to control the edge line of the cutting frame to snap to the position of the recommended cutting edge line when the distance between the position of the cutting frame edge line and the position of the cutting recommendation edge line is less than a preset distance threshold. The image cropping device 500 may further include: The output module is used to output feedback information when the edge line of the cutting frame snaps to the position of the recommended cutting edge line.

[0094] Optionally, as an embodiment, the determining module 501 is further configured to determine the cropping recommendation edge line of the first image according to the image segmentation strategy; wherein the image segmentation strategy includes at least one of the following: image region strategy, image element strategy, subject strategy, and composition strategy.

[0095] Optionally, as an embodiment, the first image has at least two cropping recommendation edge lines; wherein each cropping recommendation edge line corresponds to one of the image segmentation strategies.

[0096] Optionally, as an embodiment, the cropping module 503 is specifically used to determine the first cropping area corresponding to the first image based on the aligned cropping frame edge line; control the first image to be in the cropping frame editing state again, and determine the second cropping area corresponding to the first image; and determine the cropped image corresponding to the first image based on the first cropping area and the second cropping area.

[0097] Optionally, as an embodiment, the cropping module 503 is further configured to determine an image cropping strategy corresponding to the first image based on the cropped image corresponding to the first image; and to crop at least one image according to the image cropping strategy; wherein the at least one image belongs to the same image set as the first image.

[0098] Optionally, as an embodiment, the image cropping device 500 may further include: The display module is used to display the cropping history edge lines in the first image when the first image is not the first crop.

[0099] The image cropping device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0100] The image cropping device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0101] The image cropping device provided in this application embodiment can achieve the above-mentioned... Figure 1 To avoid repetition, the various processes implemented in the method embodiment shown will not be described again here.

[0102] Optionally, such as Figure 6As shown, this application embodiment also provides an electronic device 600, including a processor 601 and a memory 602. The memory 602 stores a program or instructions that can run on the processor 601. When the program or instructions are executed by the processor 601, they implement the various steps of the above-described image cropping method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0103] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0104] Figure 7 This is a schematic diagram of the hardware structure of an electronic device that implements the various embodiments of this application.

[0105] The electronic device 700 includes, but is not limited to, components such as: radio frequency unit 701, network module 702, audio output unit 703, input unit 704, sensor 705, display unit 706, user input unit 707, interface unit 708, memory 709, and processor 710.

[0106] Those skilled in the art will understand that the electronic device 700 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 710 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0107] In some embodiments, the processor 710 is configured to: determine the position of the cropping frame edge line when the first image is in a cropping frame editing state; control the cropping frame edge line to align with the cropping recommended edge line when the distance between the position of the cropping frame edge line and the position of the cropping recommended edge line is less than a preset distance threshold; and determine the cropped image corresponding to the first image based on the aligned cropping frame edge line.

[0108] As can be seen, in this embodiment, by intelligently identifying and determining the position of the recommended cropping edge line when the image is in the cropping editing state, and when it is detected that the distance between the cropping frame edge line operated by the user and the recommended edge line is less than a preset distance threshold, the two are automatically controlled to be precisely aligned, and the cropped image is generated based on the finally aligned cropping frame edge line. This effectively solves the problem of low cropping efficiency caused by finger obstruction and manual fine-tuning. By automatically completing the precise alignment step, the tedious operation of repeated and slow adjustments by the user is avoided, thereby improving the efficiency of image cropping.

[0109] Optionally, as an embodiment, the processor 710 is specifically configured to, when the distance between the position of the cutting frame edge line and the position of the recommended cutting edge line is less than a preset distance threshold, control the cutting frame edge line to snap to the position of the recommended cutting edge line; and output feedback information when the cutting frame edge line snaps to the position of the recommended cutting edge line.

[0110] Optionally, as an embodiment, the processor 710 is further configured to determine the cropping recommendation edge line of the first image according to an image segmentation strategy; wherein the image segmentation strategy includes at least one of the following: image region strategy, image element strategy, subject strategy, and composition strategy.

[0111] Optionally, as an embodiment, the first image has at least two cropping recommendation edge lines; wherein each cropping recommendation edge line corresponds to one of the image segmentation strategies.

[0112] Optionally, as an embodiment, the processor 710 is specifically configured to determine a first cropping region corresponding to the first image based on the aligned cropping frame edge lines; control the first image to be in a cropping frame editing state again, and determine a second cropping region corresponding to the first image; and determine a cropped image corresponding to the first image based on the first cropping region and the second cropping region.

[0113] Optionally, as an embodiment, the processor 710 is further configured to determine an image cropping strategy corresponding to the first image based on the cropped image corresponding to the first image; and to crop at least one image according to the image cropping strategy; wherein the at least one image belongs to the same image set as the first image.

[0114] Optionally, as an embodiment, the display unit 706 is used to display the cropping history edge lines in the first image when the first image is not the first crop.

[0115] It should be understood that, in this embodiment, the input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 706 may include a display panel 7061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0116] The memory 709 can be used to store software programs and various data. The memory 709 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 709 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM). The memory 709 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0117] Processor 710 may include one or more processing units; optionally, processor 710 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 710.

[0118] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image cropping method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0119] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0120] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image cropping method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0121] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0122] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the image cropping method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0123] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0124] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0125] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An image cropping method, characterized in that, The method includes: With the first image in cropping frame editing mode, determine the position of the cropping frame edge line; If the distance between the position of the cutting frame edge line and the position of the recommended cutting edge line is less than a preset distance threshold, the cutting frame edge line is aligned with the recommended cutting edge line. Based on the aligned cropping frame edges, determine the cropped image corresponding to the first image.

2. The method according to claim 1, characterized in that, When the distance between the position of the cropping frame edge line and the position of the recommended cropping edge line is less than a preset distance threshold, controlling the cropping frame edge line to align with the recommended cropping edge line includes: If the distance between the position of the cutting frame edge line and the position of the recommended cutting edge line is less than a preset distance threshold, the cutting frame edge line is controlled to snap to the position of the recommended cutting edge line; The method further includes: When the edge of the cutting frame snaps to the position of the recommended cutting edge, feedback information is output.

3. The method according to claim 1, characterized in that, The method further includes: Based on the image segmentation strategy, the recommended cropping edge line of the first image is determined; wherein, the image segmentation strategy includes at least one of the following: image region strategy, image element strategy, subject strategy, and composition strategy.

4. The method according to claim 3, characterized in that, The first image has at least two cropping recommended edge lines; wherein each cropping recommended edge line corresponds to one of the image segmentation strategies.

5. The method according to claim 3, characterized in that, The step of determining the cropped image corresponding to the first image based on the aligned cropping frame edge lines includes: Based on the aligned cropping frame edge lines, determine the first cropping region corresponding to the first image; The first image is again placed in the cropping frame editing state, and the second cropping area corresponding to the first image is determined. Based on the first cropping region and the second cropping region, determine the cropped image corresponding to the first image.

6. The method according to claim 1, characterized in that, The method further includes: Based on the cropped image corresponding to the first image, determine the image cropping strategy corresponding to the first image; At least one image is cropped according to the image cropping strategy; wherein the at least one image belongs to the same image set as the first image.

7. The method according to claim 1, characterized in that, The method further includes: If the first image is not the first crop, display the cropping history edge lines in the first image.

8. An image cropping device, characterized in that, The device includes: The determination module is used to determine the position of the cropping frame edge line when the first image is in the cropping frame editing state; The control module is used to align the edge line of the cutting frame with the recommended cutting edge line when the distance between the position of the cutting frame edge line and the position of the cutting recommended edge line is less than a preset distance threshold. The cropping module is used to determine the cropped image corresponding to the first image based on the aligned edge lines of the cropping frame.

9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the image cropping method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image cropping method as described in any one of claims 1 to 7.