Image cutting method, electronic equipment, storage medium and program product
By pre-cropping and section recognition analysis of long images, updating the cropping frame to generate the target cropping frame, the problems of image distortion and semantic integrity in long image processing are solved, and the accuracy and review efficiency of text recognition and semantic analysis are improved.
Patent Information
- Application Number
- CN202510748273.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-12
AI Technical Summary
When processing long images, existing technologies directly scale the images, causing image distortion and affecting the accuracy of text detection, while brute force cropping destroys semantic integrity, leading to information loss and affecting the effectiveness of the review system.
The image is divided into multiple sub-images through the pre-cropping frame, and the plate recognition analysis and cluster merging are performed. The cropping frame is updated according to the plate information and the target cropping frame is generated to ensure the integrity of the image content.
It improves the accuracy of subsequent text recognition and semantic analysis, and optimizes the quality and efficiency of image review.
Smart Images

Figure CN120635102A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image cropping method, electronic equipment, storage medium, and program product. Background Art
[0002] During the intelligent review process for insurance institutions' marketing materials, long images, due to their large aspect ratio, present a challenge. These long images are widely used in mobile presentations, WeChat official account articles, and posters, and contain rich text and image information. However, this unusual aspect ratio poses challenges to subsequent text detection and semantic analysis algorithms.
[0003] There are currently two main approaches to addressing the need for long image review. The first is to directly use the original image for subsequent algorithm recognition processing. The second method is brute-force image cropping, which involves automatically cropping a portion of the image based on preset rules or algorithms to meet the algorithm input requirements.
[0004] However, directly using the original image to process long images maintains the integrity of the image, but the image scaling adaptation algorithm will cause image distortion, seriously affecting the accuracy of text detection; and although brute force cropping avoids image distortion, it may destroy semantic integrity, cause information loss, and affect the overall efficiency of the review system. Therefore, how to efficiently and accurately process long images has become an urgent problem to be solved in the development of intelligent review systems. Summary of the Invention
[0005] The embodiments of the present application provide an image cropping method, an electronic device, a storage medium, and a program product, which crop images with a large aspect ratio to avoid the problem of inaccurate algorithms such as text detection caused by severe deformation and distortion of the image during scaling.
[0006] In a first aspect, an embodiment of the present application provides an image cropping method, comprising:
[0007] Get the image to be cropped;
[0008] Pre-cropping the image to be cropped according to a pre-cropping frame to obtain a plurality of sub-images, wherein the pre-cropping frame is determined according to a width value and a height value of the image to be cropped;
[0009] Performing identification and analysis on the plurality of sub-images respectively to obtain the section information of all sections on the sub-images;
[0010] Clustering and merging the blocks in the multiple sub-graphs according to the block information to obtain a target block;
[0011] updating the candidate cropping frame according to the target section to obtain a target cropping frame, wherein the candidate cropping frame is determined according to the pre-cropping frame;
[0012] The image to be cropped is cropped according to the target cropping frame to obtain multiple target images.
[0013] Optionally, before pre-cropping the image to be cropped according to the pre-cropping frame, the method further includes:
[0014] Determining the aspect ratio of the image to be cropped according to the image to be cropped;
[0015] Determining whether the aspect ratio is greater than a preset value;
[0016] If the aspect ratio is greater than the preset value, determining the image overlap ratio and the pre-cropping size according to the width and height of the image to be cropped;
[0017] A pre-cropping frame is determined according to the pre-cropping size and the image overlap ratio.
[0018] Optionally, the block information includes: first block coordinates and block confidence, and clustering and merging blocks in multiple sub-images according to the block information to obtain a target block includes:
[0019] Adding the first panel coordinates and the upper left corner coordinates of the pre-cropping frame to obtain second panel coordinates, wherein the second panel coordinates are in the same coordinate system;
[0020] The blocks are merged according to the block confidence and the second block coordinates to obtain a target block.
[0021] Optionally, merging the blocks according to the block confidence and the second block coordinates to obtain a target block includes:
[0022] Sorting and classifying the unmerged sections according to the section confidence to obtain sections to be merged, wherein the sections to be merged are sections with the highest section confidence ranking;
[0023] Determining a plurality of first intersection-over-union ratios according to the second block coordinates of the block to be merged and the unmerged block;
[0024] Determine a first candidate block according to the first intersection-over-union ratio, where the first candidate block corresponds to a block to be merged and at least one unmerged block;
[0025] Taking a union of the first candidate blocks to determine a second candidate block, where the block coordinates of the second candidate block contain all the first candidate blocks;
[0026] The second candidate section is input into the section list and classified and stored to obtain multiple target sections.
[0027] Optionally, determining a first candidate section according to the first intersection-over-union ratio includes:
[0028] determining in sequence whether the first intersection-over-union ratio is greater than a threshold;
[0029] If the first intersection-over-union ratio is greater than the threshold, determining the two blocks corresponding to the first intersection-over-union ratio as first candidate blocks;
[0030] If the first intersection-in-union ratio is not greater than the threshold, the unmerged blocks corresponding to the first intersection-in-union ratio are released, and the unmerged blocks are sorted again based on confidence until no unmerged blocks exist.
[0031] Optionally, the second candidate section is input into a section list and classified and stored to obtain multiple target sections, including:
[0032] Determine whether the section list is empty;
[0033] If the section list is empty, the second candidate section is used as the target section and stored in the section list;
[0034] If the block list is not empty, determining a second intersection-over-union ratio between the second candidate block and the target block;
[0035] Determining whether the second intersection-over-union ratio is less than the threshold;
[0036] If the second intersection-over-union ratio is less than the threshold, storing the second candidate block as the target block in the block list;
[0037] If the second intersection-over-union ratio is not less than the threshold, a union is taken between the second block corresponding to the second intersection-over-union ratio and the target block to obtain a new target block and store it.
[0038] Optionally, updating the candidate cropping frame according to the target section to obtain the target cropping frame includes:
[0039] For any cropping frame of all candidate cropping frames, traverse the block coordinates of all target blocks according to the coordinates of the candidate cropping frame;
[0040] In the case where the candidate cropping frame truncates the target block, determining a truncation edge of the candidate cropping frame;
[0041] Determining a first distance and a second distance between the truncated edge and the upper and lower edges of the target block respectively;
[0042] If the first distance is smaller than the second distance, determining the edge corresponding to the first distance as the cropping edge;
[0043] If the first distance is not less than the second distance, determining the edge corresponding to the second distance as the cropping edge;
[0044] A target cropping frame is determined according to the candidate cropping frames and the cropping edges.
[0045] In a second aspect, an embodiment of the present application provides an image cropping device, comprising:
[0046] An acquisition module, used to acquire the image to be cropped;
[0047] a processing module, configured to perform pre-cropping processing on the image to be cropped according to a pre-cropping frame to obtain a plurality of sub-images, wherein the pre-cropping frame is determined according to a width value and a height value of the image to be cropped;
[0048] The processing module is further configured to perform identification and analysis on the plurality of sub-images to obtain the section information of all sections on the sub-images;
[0049] The processing module is further configured to perform clustering and merging processing on the blocks in the plurality of sub-graphs according to the block information to obtain a target block;
[0050] The processing module is further configured to update the candidate cropping frame according to the target section to obtain a target cropping frame, wherein the candidate cropping frame is determined according to the pre-cropping frame;
[0051] The processing module is further configured to perform cropping processing on the image to be cropped according to the target cropping frame to obtain multiple target images.
[0052] Optionally, the device further includes: a determination module and a judgment module;
[0053] The determining module is configured to determine the aspect ratio of the image to be cropped based on the image to be cropped;
[0054] The judging module is configured to judge whether the aspect ratio is greater than a preset value;
[0055] The determining module is further configured to determine the image overlap ratio and the pre-cropping size according to the width and height of the image to be cropped if the aspect ratio is greater than the preset value;
[0056] The determining module is further configured to determine a pre-cropping frame according to the pre-cropping size and the image overlap ratio.
[0057] Optionally, the processing module is further configured to add the first panel coordinates and the upper left corner coordinates of the pre-cropping frame to obtain second panel coordinates, wherein the second panel coordinates are in the same coordinate system;
[0058] The processing module is further configured to merge the blocks according to the block confidence and the second block coordinates to obtain a target block.
[0059] Optionally, the processing module is further configured to sort and classify the unmerged sections according to the section confidence to obtain sections to be merged, wherein the sections to be merged are sections with the highest section confidence ranking;
[0060] The determining module is further configured to determine a plurality of first intersection-over-union ratios based on the second block coordinates of the block to be merged and the unmerged block;
[0061] The determining module is further configured to determine a first candidate block according to the first intersection-over-union ratio, where the first candidate block corresponds to one block to be merged and at least one unmerged block;
[0062] The determining module is further configured to take a union of the first candidate blocks to determine a second candidate block, wherein the block coordinates of the second candidate block include all the first candidate blocks;
[0063] The processing module is further configured to input the second candidate section into a section list, and perform classification and storage processing to obtain a plurality of target sections.
[0064] Optionally, the judgment module is further configured to sequentially judge whether the first intersection-over-union ratio is greater than a threshold;
[0065] The determining module is further configured to determine the two blocks corresponding to the first intersection-over-union ratio as first candidate blocks if the first intersection-over-union ratio is greater than the threshold;
[0066] The processing module is further configured to release the unmerged blocks corresponding to the first intersection-and-union ratio if the first intersection-and-union ratio is not greater than the threshold, and perform confidence sorting on the unmerged blocks again until no unmerged blocks exist.
[0067] Optionally, the judgment module is further used to judge whether the section list is empty;
[0068] The determining module is further configured to, if the section list is empty, use the second candidate section as the target section and store it in the section list;
[0069] The determining module is further configured to determine a second intersection-over-union ratio between the second candidate block and the target block if the block list is not empty;
[0070] The judging module is further configured to judge whether the second intersection-over-union ratio is less than the threshold;
[0071] The determining module is further configured to store the second candidate block as a target block in the block list if the second intersection-over-union ratio is less than the threshold;
[0072] The determining module is further configured to, if the second intersection-and-union ratio is not less than the threshold, take the union of the second block corresponding to the second intersection-and-union ratio and the target block to obtain and store a new target block.
[0073] Optionally, the processing module is further configured to traverse the block coordinates of all target blocks according to the coordinates of any one of all candidate cropping frames;
[0074] The determining module is further configured to determine a truncation edge of the candidate cropping frame when the candidate cropping frame truncates the target section;
[0075] The determining module is further configured to respectively determine a first distance and a second distance between the truncated edge and the upper and lower edges of the target block;
[0076] The determining module is further configured to determine the edge corresponding to the first distance as the cropping edge if the first distance is smaller than the second distance;
[0077] The determining module is further configured to determine the edge corresponding to the second distance as the cropping edge if the first distance is not less than the second distance;
[0078] The determining module is further configured to determine a target cropping frame based on the candidate cropping frames and the cropping edges.
[0079] In a third aspect, an embodiment of the present application provides an image cropping device, comprising: a memory, a processor;
[0080] The memory stores computer-executable instructions;
[0081] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0082] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementation methods of the first aspect.
[0083] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0084] The image cropping method, electronic device, storage medium and program product provided in the embodiments of the present application obtain an image to be cropped, and then preliminarily crop it according to a preset cropping frame to obtain a series of sub-images. Then, an identification and analysis process is performed on each sub-image to collect specific information of all panels. Using this information, clustering and merging operations are performed on the panels in the sub-image to determine the target panel. Based on the target panel, the candidate cropping frame is adjusted and optimized to generate the final target cropping frame. Finally, this target cropping frame is applied to accurately crop the original image to obtain multiple target images. This method crops the image according to the position layout of the panels, ensures the integrity of the image content, enhances the accuracy of subsequent steps such as text recognition and semantic analysis, and thus optimizes the quality and efficiency of image review. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0086] Figure 1 A schematic diagram of an existing image cropping method provided in this application;
[0087] Figure 2 A schematic diagram of another existing image cropping method provided by this application;
[0088] Figure 3 A schematic diagram of the process of an image cropping method provided in this application Figure 1 ;
[0089] Figure 4 A schematic diagram of the process of an image cropping method provided in this application Figure 2 ;
[0090] Figure 5 A schematic diagram of the process of an image cropping method provided in this application Figure 3 ;
[0091] Figure 6 A schematic diagram of the section merging of an image cropping method provided in this application;
[0092] Figure 7 A schematic diagram of the process of an image cropping method provided in this application Figure 4 ;
[0093] Figure 8 A schematic diagram of panel merging for another image cropping method provided by this application;
[0094] Figure 9 A schematic diagram of the process of an image cropping method provided in this application Figure 5 ;
[0095] Figure 10 A schematic diagram of updating a candidate cropping frame in an image cropping method provided by this application;
[0096] Figure 11 A schematic structural diagram of an image cropping device provided in this application;
[0097] Figure 12 This is a structural diagram of an image cropping device provided in this application.
[0098] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0099] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0100] According to regulatory requirements, insurance institutions must comply with relevant regulations when conducting marketing and promotional activities. To this end, the compliance department requires each business department to submit relevant marketing and promotional materials for review before product launch. However, relying solely on manual review has limited scope and slow review times, hindering standardized sales practices. To standardize our company's marketing and promotional practices while reducing audit manpower, we have developed an intelligent review system and AI-powered audit tools. This system automatically implements unified standards for all marketing and promotional materials across all departments, improving review timelines, meeting marketing needs, and reducing customer complaints.
[0101] Intelligent image review services usually include multiple deep learning algorithms such as text detection, text recognition, and semantic analysis. The accuracy of the text detection algorithm is more sensitive to the size of the input image.
[0102] Typically, images must be fixed in size or scaled proportionally before being fed into a text detection model. However, when the input image has a large aspect ratio, any scaling method will cause image distortion, leading to missed text areas and reduced text detection algorithm accuracy. In such cases, cropping the image is often recommended.
[0103] Figure 1 This is a schematic diagram of an existing image cropping method provided by this application, such as Figure 1As shown in the figure, the most common cropping solution for images with a large aspect ratio is to crop them according to the preset size with no overlapping sub-images. However, when faced with images with rich elements and complex layout, this simple and rough cropping solution is likely to cause damage to semantic information. For example, the cropping position may just cut off the text line, causing the text recognition algorithm to miss the detection and information loss, affecting the accuracy of subsequent semantic analysis and reducing the quality of image review.
[0104] Figure 2 This is a schematic diagram of another existing image cropping method provided by this application, such as Figure 2 As shown in the figure, another cropping method is to allow the sub-images to overlap during cropping, but the choice of the overlap rate between sub-images needs to be carefully evaluated. If the overlap rate is too low, large areas such as tables and charts will still be truncated, which is not conducive to subsequent semantic analysis. If the overlap rate is too high, it will cause subsequent algorithms such as text recognition to repeat recognition, increasing unnecessary algorithm resource consumption.
[0105] In response to the above problems, this application proposes an image cropping method. First, the image to be cropped is pre-cropped into multiple sub-images according to the preset cropping size and overlap ratio. Next, each sub-image is positioned and clustered using a layout analysis algorithm. Finally, the secondary cropping coordinates are calculated based on the position of the full-image layout, and the image to be cropped is cropped, and the final cropped image list is output. This application is the first step in the intelligent image review service. It is used to effectively crop input images with a large aspect ratio, improve the accuracy of subsequent algorithms such as text recognition and semantic analysis, and thus improve the quality of image review and improve review efficiency.
[0106] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0107] Figure 3 A schematic diagram of the process of an image cropping method provided in this application Figure 1 , the execution subject of this application is the intelligent audit system, such as Figure 3 As shown, the method includes:
[0108] S101: Acquire an image to be cropped.
[0109] It can be understood that obtaining the image to be cropped is the first step in image cropping. This step usually involves importing or loading the image to be cropped from an image source, such as a scanning device or storage device. The image to be cropped can be a mobile insurance product introduction picture, WeChat public account article, marketing event poster, etc., which requires retaining the complete section information in the picture. After obtaining the image, it will be loaded into the image processing software or algorithm in preparation for subsequent cropping processing.
[0110] S102: Pre-cropping the image to be cropped according to the pre-cropping frame to obtain multiple sub-images.
[0111] The pre-cropping frame is determined according to the width and height of the image to be cropped.
[0112] As you can understand, the pre-cropping frame is intended to divide the image to be cropped into multiple smaller sub-images, reducing the scope of subsequent processing and improving processing efficiency. The size and position of the pre-cropping frame can be adjusted based on the specific cropping requirements and image content to ensure that the size of each sub-image meets the algorithm's requirements. The specific steps for determining the pre-cropping frame are detailed below and will not be repeated here.
[0113] S103: performing identification and analysis on the plurality of sub-images respectively to obtain the section information of all sections on the sub-images.
[0114] As you can understand, the sub-graph is traversed and the layout analysis algorithm is used to obtain the section information for each section within the sub-graph. This section information includes section type (such as text paragraph, table, chart, etc.), rectangle coordinates (top left and bottom right corner coordinates), and confidence level. The layout analysis algorithm obtains the position coordinates of each section in the image to ensure that semantic information is not destroyed when processing images with rich elements and complex layouts. By applying advanced image processing algorithms and machine learning techniques, the layout analysis algorithm can accurately identify each section in the image and extract their position coordinates. This coordinate information can help us accurately crop the desired image elements.
[0115] S104: Clustering and merging the blocks in the multiple sub-graphs according to the block information to obtain a target block.
[0116] As you can understand, after obtaining the sub-image's tile information, these tiles need to be clustered and merged. The purpose of cluster merging is to group similar or related tiles from multiple sub-images together to form multiple target tiles for the cropped image. This step helps reduce redundant information and improves the accuracy and practicality of the cropping results. The cluster merging algorithm is executed based on a tile similarity metric to ensure that the merged target tiles accurately reflect the important content of the image.
[0117] S105: updating the candidate cropping frame according to the target section to obtain the target cropping frame.
[0118] The candidate cropping frame is determined based on the pre-cropping frame.
[0119] It can be understood that in order to ensure the integrity of the image content, the pre-cropping frame has a certain overlap rate when cropping. At this time, multiple target panels have been identified, so the overlap rate is removed to determine multiple candidate cropping frames, and the candidate cropping frames are used to observe whether the target panel is cut apart. If so, the candidate cropping frames are adjusted to obtain the target cropping frame to ensure the integrity of the target panel.
[0120] S106: Crop the image to be cropped according to the target cropping frame to obtain multiple target images.
[0121] As you can understand, the image to be cropped is cropped according to the target cropping frame to produce multiple target images. This step is the end of the cropping process and the ultimate goal of the entire process. Cropping cuts the original image according to the boundaries of the target cropping frame, generating multiple images that retain the target area. These target images can be used for subsequent tasks such as image analysis, text recognition, or content review to meet application requirements.
[0122] The image cropping method provided in the embodiment of the present application obtains an image to be cropped, pre-crops the image to be cropped according to a pre-cropping frame, and obtains multiple sub-images. The multiple sub-images are respectively identified and analyzed to obtain the block information of all blocks on the sub-images. The blocks in the multiple sub-images are clustered and merged according to the block information to obtain the target block. The candidate cropping frame is updated according to the target block to obtain the target cropping frame. The image to be cropped is cropped according to the target cropping frame to obtain multiple target images. The method crops the image according to the block position, retains the complete content in the image, improves the accuracy of subsequent algorithms such as text recognition and semantic analysis, and thus improves the quality of image review and the efficiency of image content review.
[0123] Figure 4 A schematic diagram of the process of an image cropping method provided in this application Figure 2 ,like Figure 4 As shown, this embodiment Figure 3 Based on the embodiment, the steps of determining the pre-cropping frame are described in detail. The method includes:
[0124] S201: Determine the aspect ratio of the image to be cropped according to the image to be cropped.
[0125] As you can understand, before cropping an image, you first need to obtain the width and height information of the image to be cropped. The aspect ratio refers to the ratio of the image's width to its height, reflecting the relationship between the image's horizontal and vertical dimensions. Determining the aspect ratio is fundamental to subsequent image cropping decisions, as different aspect ratios may indicate different image composition characteristics and cropping requirements. For example, if the aspect ratio indicates that the image is vertically oriented, then cropping along the horizontal direction is generally necessary.
[0126] S202: Determine whether the aspect ratio is greater than a preset value. If so, execute step S204; if not, execute step S203.
[0127] As will be appreciated, the system will determine whether the aspect ratio of the image to be cropped is too large or too small based on a preset aspect ratio threshold. The preset value is typically set based on experience or the needs of a specific application scenario. In this example, the preset value can be 3. If the aspect ratio is greater than the preset value, it indicates that the image may be excessively stretched horizontally or vertically, requiring a special cropping strategy to maintain the integrity of the image information. Therefore, the process jumps to step S204. If the aspect ratio is less than or equal to the preset value, the image is considered to have a moderate aspect ratio, and clear text information can be directly extracted without cropping.
[0128] S203: Output the image to be cropped.
[0129] It can be understood that if the aspect ratio is not greater than the preset value, the original image to be cropped is directly output as the final result of this case, which means that the aspect ratio of the image is moderate and does not need to be cropped.
[0130] S204: Determine the image overlap ratio and the pre-cropping size according to the width and height of the image to be cropped.
[0131] It is understandable that if the aspect ratio is greater than the preset value, a complex cropping strategy needs to be adopted for the image, and the image overlap rate and pre-cropping size are calculated based on the width and height of the image. The overlap rate refers to the degree of overlap between two adjacent sub-images after cropping, which helps to keep the key information of the image from being cropped. The pre-cropping size refers to the size of the cropping box, which needs to be determined based on the aspect ratio of the image and the final cropping target. For example, for images with a large aspect ratio, the overlap rate is usually in the range of 0.2~0.3, and the cropping size is .
[0132] Where w and h are the width and height of the image to be cropped, and ratio is the ratio of the width to height of the cropped sub-image. The value range of the ratio of the width to height of the cropped sub-image is 1.0~2.0. The specific value needs to be determined according to the image to be cropped.
[0133] S205: Determine a pre-cropping frame according to the pre-cropping size and the image overlap ratio.
[0134] As you can understand, the pre-cropping frame is the initial size value for the image to be cropped. Its size and position need to be accurately calculated based on the pre-cropping size and overlap ratio. Through this step, the system can generate a pre-cropping frame that meets the requirements and apply it to the image to be cropped, thus obtaining multiple sub-images.
[0135] The image cropping method provided in the embodiments of the present application determines the aspect ratio of the image to be cropped. If the aspect ratio is greater than a preset value, the image overlap ratio and pre-cropping size are determined based on the width and height of the image to be cropped. Furthermore, a pre-cropping frame is determined based on the pre-cropping size and the image overlap ratio. This method ensures that the subsequently cropped image meets the requirements of the image recognition algorithm, improving the algorithm's recognition accuracy.
[0136] Figure 5 A schematic diagram of the process of an image cropping method provided in this application Figure 3 ,like Figure 5 As shown, this embodiment Figure 3 Based on the embodiment, the steps for determining the target section are described in detail. The method includes:
[0137] S301: Add the first panel coordinates and the upper left corner coordinates of the pre-cropping frame to obtain the second panel coordinates.
[0138] Among them, the coordinates of the second section are in the same coordinate system.
[0139] As you can understand, using the layout analysis algorithm, we can obtain the type, rectangular frame coordinates (i.e., first-block coordinates), and confidence level of each block on the sub-image. The first-block coordinates include the coordinates of the block's upper left corner and lower right corner. These two coordinates can accurately describe the block's location. However, the first-block coordinates only identify the coordinate position of each block on the corresponding sub-image. The same block may be split multiple times on a sub-image, or the content of the same block may appear on multiple sub-images. Therefore, by summing the first-block coordinates, the upper left corner coordinates and lower right corner coordinates are added to the upper left corner coordinates of the corresponding pre-cropped frame, and the position of each block is expressed in the same coordinate system. In other words, the position coordinates of all blocks are restored to the image to be cropped.
[0140] S302: Sorting and classifying the unmerged sections according to the section confidence levels to obtain sections to be merged.
[0141] Among them, the section to be merged is the section with the highest confidence ranking.
[0142] As you can understand, the layout analysis algorithm calculates a confidence score for each section, which indicates the algorithm's confidence in the section's recognition result. A higher score indicates greater confidence in the section's recognition result, meaning the algorithm believes the section's type, location, and content are closer to reality. Therefore, all sections are sorted by confidence score, and the unmerged section with the highest confidence score is selected as the section to be merged, serving as the benchmark for merging.
[0143] S303: Determine a plurality of first intersection-over-union ratios according to the second block coordinates of the block to be merged and the unmerged block.
[0144] Understandably, Figure 6 This is a schematic diagram of the block merging of an image cropping method provided by this application, such as Figure 6 As shown, frame 11 is the determined block to be merged, and frames 12 to 16 are all unmerged blocks. The intersection-union ratio of frame 11 and frames 12 to 16 is calculated respectively. The intersection-union ratio refers to the ratio of the intersection area to the union area of the frames. The intersection area refers to the area of the overlapping part of the two bounding boxes, and the union area refers to the total area after the two bounding boxes are merged. The area is calculated based on the second plate coordinate of each block.
[0145] S304: determine in sequence whether the first intersection-over-union ratio is greater than a threshold; if not, execute step S305; if so, execute step S306.
[0146] It can be understood that the threshold refers to the preset size value of the intersection-union ratio. If the intersection-union ratio is greater than the threshold, it means that the overlapping area of the corresponding two blocks is large. At this time, it is considered that the two blocks are the same block on the image to be cropped. If the intersection-union ratio is not greater than the threshold, it means that the corresponding two blocks do not overlap, and the two blocks are not made of one block.
[0147] S305: releasing the unmerged blocks corresponding to the first intersection-union ratio, and performing confidence sorting on the unmerged blocks again until no unmerged blocks exist.
[0148] It can be understood that when the first intersection-over-union ratio is not greater than the threshold, such as Figure 6 As shown, that is, the intersection-and-union ratio of box 11 and box 15, and the intersection-and-union ratio of box 11 and box 16. In this case, it is determined that the two unmerged blocks 15 and 16 are not the same block as the block 11 to be merged, so the unmerged blocks 15 and 16 are released so that they can be sorted and calculated for confidence again to find out whether there are other blocks that need to be merged with them.
[0149] S306: Determine the two blocks corresponding to the first intersection-union ratio as first candidate blocks.
[0150] It can be understood that when the first intersection-over-union ratio is greater than the threshold, such as Figure 6As shown, that is, the intersection-union ratio of box 11 and box 12, the intersection-union ratio of box 11 and box 13, and the intersection-union ratio of box 11 and box 14. In this case, it is determined that the three unmerged blocks 12~14 and the block to be merged 11 belong to the same block, and blocks 11~14 are determined as the first candidate blocks.
[0151] S307: Take the union of the first candidate blocks to determine the second candidate block.
[0152] The block coordinates of the second candidate block include all the first candidate blocks.
[0153] It can be understood that after all first candidate blocks are determined, the union of all first candidate blocks is taken, that is, the second candidate block is determined based on the outermost coordinates of the first candidate blocks. Figure 6 As shown, box 17 is the second candidate block, which is obtained by taking the union of boxes 11 to 14.
[0154] S308: Input the second candidate section into the section list, and perform classification and storage processing to obtain multiple target sections.
[0155] It can be understood that a new section list is created, and after obtaining the second candidate section, the second candidate section is saved in the section list, and an intersection and union calculation is performed with all sections in the section list to ensure that there is no identical section between the second candidate sections.
[0156] The image cropping method provided in an embodiment of the present application obtains a second panel coordinate by summing the first panel coordinates and the coordinates of the upper left corner of the pre-cropped frame. The unmerged panels are sorted and classified according to panel confidence to obtain a panel to be merged, where the panel to be merged is the panel with the highest panel confidence. Multiple first intersection-over-union ratios are determined based on the second panel coordinates of the panel to be merged and the unmerged panels. The first intersection-over-union ratios are sequentially determined to determine whether they are greater than a threshold. If so, the two panels corresponding to the first intersection-over-union ratios are determined as first candidate panels.
[0157] The first candidate blocks are unioned to determine a second candidate block. The block coordinates of the second candidate block contain all the first candidate blocks. The second candidate block is then entered into the block list and sorted and stored to obtain multiple target blocks. This method determines the location of the target block by merging the blocks in multiple sub-images, laying the foundation for preserving the target block during subsequent image cropping and ensuring that the content of the block remains intact after cropping.
[0158] Figure 7 A schematic diagram of the process of an image cropping method provided in this application Figure 4 ,like Figure 7 As shown, this embodiment Figure 3Based on the embodiment, the step of determining the target section based on the second candidate section is described in detail. The method includes:
[0159] S401: Determine whether the forum list is empty, if so, execute step S402, if not, execute step S403.
[0160] It can be understood that the block list is used to store a collection of block coordinates. The second candidate block after the merge will be stored in the list, but when storing, the intersection and union ratio of the target blocks stored in the list needs to be calculated to prevent omissions in the block merge.
[0161] Figure 8 A schematic diagram of another image cropping method provided by this application, such as Figure 8 As shown in the figure, the intersection-and-union ratio of the to-be-merged block 11 and the unmerged blocks 12 to 14 is greater than the threshold. At this time, the intersection-and-union ratio of the to-be-merged block 11 and the unmerged block 25 is less than the threshold. The unmerged block 25 does not need to be merged with the to-be-merged block 11. Assuming that the intersection-and-union ratio of the unmerged block 25 with any other block is not greater than the threshold, the unmerged block 25 is stored as the target block in the block list. However, Figure 8 As can be seen in the figure, the intersection-and-union ratio (IoU) of the second candidate block 17 and the stored target block 25 is greater than the threshold, indicating that these two blocks 25 and 17 belong to the same block. If the IoU is not calculated with the blocks in the list when the second candidate block 17 is stored, the second candidate block 17 and the target block 25 will be stored separately. This may result in the same block being split during subsequent segmentation, resulting in unclear semantics. Therefore, it is necessary to determine the number of stored blocks in the list to prevent omissions in segment merging.
[0162] S402: The second candidate section is selected as the target section and stored in the section list.
[0163] It is understandable that if the section list is empty, then no target section has been stored yet, so there will be no section overlap that is not found, and the second candidate section can be directly stored as the target section.
[0164] S403: Determine a second intersection-over-union ratio between the second candidate block and the target block.
[0165] S404: Determine whether the second intersection-over-union ratio is less than a threshold value. If so, execute step S405; if not, execute step S406.
[0166] It can be understood that if the section list is not empty, it is necessary to calculate the second intersection-union ratio of the second candidate section and all target sections in the section list, and determine whether the second candidate section needs to be merged and stored with the sections in the section list based on the size of the second intersection-union ratio.
[0167] S405: Store the second candidate section as the target section in the section list.
[0168] It can be understood that when the second intersection-and-union ratio of the second candidate block and the target block is less than the threshold, it means that the second candidate block and the target block do not overlap, so the second candidate block is stored in the block list as the target block.
[0169] S406: Take the union of the second block corresponding to the second intersection-union ratio and the target block to obtain a new target block and store it.
[0170] It can be understood that when the second intersection-union ratio of the second candidate block and the target block is not less than the threshold, it means that the second candidate block and the target block overlap, and the second candidate block may belong to the same block as the target block, so the second candidate block may be taken as the target block and the block after the union is stored in the block list as the new target block.
[0171] The image cropping method provided in the embodiment of the present application determines whether the block list is empty; if the block list is empty, the second candidate block is used as the target block and stored in the block list; if the block list is not empty, the second intersection-and-union ratio of the second candidate block and the target block is determined; it is determined whether the second intersection-and-union ratio is less than a threshold; if so, the second candidate block is stored in the block list as the target block; if not, the second block corresponding to the second intersection-and-union ratio and the target block are combined to obtain a new target block and store it. This method re-judges the second candidate block to ensure the correctness of the target block and solves the problem of incomplete or redundant blocks caused by pre-cropping of the image.
[0172] Figure 9 A schematic diagram of the process of an image cropping method provided in this application Figure 5 ,like Figure 9 As shown, this embodiment Figure 3 Based on the embodiment, the steps of determining the target cropping frame are described in detail. The method includes:
[0173] S501: For any cropping frame of all candidate cropping frames, traverse the block coordinates of all target blocks according to the coordinates of the candidate cropping frame.
[0174] As you can understand, the candidate cropping frame is determined based on the pre-cropping frame, or in other words, the candidate cropping frame is determined based on the pre-cropping size. Unlike the pre-cropping frame, the candidate cropping frame does not need to consider the overlap ratio when determining the candidate cropping frame. After determining the candidate cropping frame, the coordinates of all target tiles in the tile list are traversed according to the coordinates of the candidate cropping frame to find whether the candidate cropping frame truncates the target tile.
[0175] S502: When the candidate cropping frame truncates the target block, determine the truncation edge of the candidate cropping frame.
[0176] It can be understood that if the candidate cropping frame truncates the target section, the truncation edge of the candidate cropping frame is determined. Figure 10 This is a schematic diagram of updating a candidate cropping frame in an image cropping method provided by this application, such as Figure 10 As shown, the candidate cropping frame truncates the target panel, that is, the coordinates of the candidate cropping frame are between the upper and lower boundaries of the target panel rectangle.
[0177] S503: Determine a first distance and a second distance between the truncation edge and the upper and lower edges of the target block respectively.
[0178] It can be understood that after the candidate cropping frame cuts off the target plate, the first distance from the cutoff edge to the upper edge of the target plate and the second distance from the cutoff edge to the lower edge of the target plate are calculated according to the coordinates of the cutoff edge and the coordinates of the target plate.
[0179] S504: Determine whether the first distance is smaller than the second distance. If so, execute step S504; if not, execute step S505.
[0180] S505: Determine the edge corresponding to the first distance as the cropping edge.
[0181] S506: Determine the edge corresponding to the second distance as the cropping edge.
[0182] It is understandable that after calculating the first distance and the second distance, the size of the first distance and the second distance is determined, and the smaller side is used as the new border value of the candidate cropping frame. Figure 10 As shown, the first distance is greater than the second distance, so the bottom edge of the target block is used as the new cropping edge.
[0183] S507: Determine a target cropping frame according to the candidate cropping frames and the cropping edges.
[0184] It can be understood that the coordinates of the candidate cropping frame are modified according to the new cropping edge, and it is judged again whether the candidate cropping frame truncates the target plate. If so, the candidate cropping frame is updated and modified according to the size of the distance until the candidate cropping frame does not truncate any target plate. At this time, the candidate cropping frame is used as the target cropping frame, so that the image to be cropped can be cropped according to the target cropping frame and the target image can be output.
[0185] The image cropping method provided by the embodiment of the present application traverses the panel coordinates of all target panels according to the coordinates of the candidate cropping frame for any cropping frame of all candidate cropping frames. In the case that the candidate cropping frame truncates the target panel, the truncation edge of the candidate cropping frame is determined; the first distance and the second distance between the truncation edge and the upper and lower edges of the target panel are determined respectively; if the first distance is less than the second distance, the edge corresponding to the first distance is determined as the cropping edge; if the first distance is not less than the second distance, the edge corresponding to the second distance is determined as the cropping edge; based on the candidate cropping frame and the cropping edge, the target cropping frame is determined. This method adaptively adjusts the candidate cropping frame coordinates by comparing the relative positions of the candidate cropping frame and the rectangular frames of each target panel to avoid the problem of semantic information destruction caused by the truncation of the target panel.
[0186] Figure 11 This is a structural diagram of an image cropping device provided by this application, such as Figure 11 As shown, the image cropping device 600 provided in this embodiment includes:
[0187] An acquisition module 601 is used to acquire an image to be cropped;
[0188] A processing module 602 is configured to perform pre-cropping on the image to be cropped according to a pre-cropping frame to obtain a plurality of sub-images, wherein the pre-cropping frame is determined according to a width and a height of the image to be cropped;
[0189] The processing module 602 is further configured to perform identification and analysis on the plurality of sub-images to obtain the block information of all blocks on the sub-images;
[0190] The processing module 602 is further configured to perform clustering and merging processing on the blocks in the plurality of sub-graphs according to the block information to obtain a target block;
[0191] The processing module 602 is further configured to update the candidate cropping frame according to the target section to obtain a target cropping frame, wherein the candidate cropping frame is determined according to the pre-cropping frame;
[0192] The processing module 602 is further configured to perform cropping processing on the image to be cropped according to the target cropping frame to obtain multiple target images.
[0193] Optionally, the device further includes: a determination module 603 and a judgment module 604;
[0194] The determining module 603 is configured to determine the aspect ratio of the image to be cropped based on the image to be cropped;
[0195] The judging module 604 is configured to judge whether the aspect ratio is greater than a preset value;
[0196] The determining module 603 is further configured to determine an image overlap ratio and a pre-cropping size according to a width value and a height value of the image to be cropped if the aspect ratio is greater than the preset value;
[0197] The determining module 603 is further configured to determine a pre-cropping frame according to the pre-cropping size and the image overlap ratio.
[0198] Optionally, the processing module 602 is further configured to add the first panel coordinates and the upper left corner coordinates of the pre-cropping frame to obtain second panel coordinates, wherein the second panel coordinates are in the same coordinate system;
[0199] The processing module 602 is further configured to merge the blocks according to the block confidence and the second block coordinates to obtain a target block.
[0200] Optionally, the processing module 602 is further configured to sort and classify the unmerged sections according to the section confidence to obtain sections to be merged, where the sections to be merged are sections with the highest section confidence.
[0201] The determining module 603 is further configured to determine a plurality of first intersection-over-union ratios based on the second block coordinates of the block to be merged and the unmerged block;
[0202] The determining module 603 is further configured to determine a first candidate block according to the first intersection-over-union ratio, where the first candidate block corresponds to one block to be merged and at least one unmerged block;
[0203] The determining module 603 is further configured to take a union of the first candidate blocks to determine a second candidate block, where the block coordinates of the second candidate block contain all the first candidate blocks;
[0204] The processing module 602 is further configured to input the second candidate section into a section list, and perform classification and storage processing to obtain a plurality of target sections.
[0205] Optionally, the judging module 604 is further configured to sequentially judge whether the first intersection-over-union ratio is greater than a threshold;
[0206] The determining module 603 is further configured to determine the two blocks corresponding to the first intersection-over-union ratio as first candidate blocks if the first intersection-over-union ratio is greater than the threshold;
[0207] The processing module 602 is further configured to release the unmerged blocks corresponding to the first intersection-over-union ratio if the first intersection-over-union ratio is not greater than the threshold, and to perform confidence sorting on the unmerged blocks again until no unmerged blocks exist.
[0208] Optionally, the judging module 604 is further configured to judge whether the forum list is empty;
[0209] The determining module 603 is further configured to, if the section list is empty, use the second candidate section as the target section and store it in the section list;
[0210] The determining module 603 is further configured to determine a second intersection-over-union ratio between the second candidate block and the target block if the block list is not empty;
[0211] The judging module 604 is further configured to judge whether the second intersection-over-union ratio is less than the threshold;
[0212] The determining module 603 is further configured to store the second candidate block as a target block in the block list if the second intersection-over-union ratio is less than the threshold;
[0213] The determining module 603 is further configured to obtain and store a new target block by taking a union of the second block corresponding to the second intersection-union ratio and the target block if the second intersection-union ratio is not less than the threshold.
[0214] Optionally, the processing module 602 is further configured to traverse the block coordinates of all target blocks according to the coordinates of any one of all candidate cropping frames;
[0215] The determining module 603 is further configured to determine a truncation edge of the candidate cropping frame when the candidate cropping frame truncates the target block;
[0216] The determining module 603 is further configured to respectively determine a first distance and a second distance between the truncated edge and the upper and lower edges of the target block;
[0217] The determining module 603 is further configured to determine the edge corresponding to the first distance as a cropping edge if the first distance is smaller than the second distance;
[0218] The determining module 603 is further configured to determine the edge corresponding to the second distance as the cropping edge if the first distance is not less than the second distance;
[0219] The determining module 603 is further configured to determine a target cropping frame according to the candidate cropping frames and the cropping edges.
[0220] The image cropping device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0221] Figure 12 This is a schematic diagram of the structure of an image cropping device provided by this application. Figure 12 As shown, the image cropping device 700 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the device 700 further includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus.
[0222] During the specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that the at least one processor 701 performs the above method.
[0223] The specific implementation process of the processor 701 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0224] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0225] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0226] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0227] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0228] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0229] The readable storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0230] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0231] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0232] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0233] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0234] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0235] Finally, it should be noted that those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The present invention is not limited to the precise structure described above and illustrated in the accompanying drawings, and various modifications and variations may be made without departing from the scope thereof. The scope of the present invention is limited solely by the appended claims.
Claims
1. An image cropping method, characterized in that: include: Get the image to be cropped; Pre-cropping the image to be cropped according to a pre-cropping frame to obtain a plurality of sub-images, wherein the pre-cropping frame is determined according to a width value and a height value of the image to be cropped; Performing identification and analysis on the plurality of sub-images respectively to obtain the section information of all sections on the sub-images; Clustering and merging the blocks in the multiple sub-graphs according to the block information to obtain a target block; updating the candidate cropping frame according to the target section to obtain a target cropping frame, wherein the candidate cropping frame is determined according to the pre-cropping frame; The image to be cropped is cropped according to the target cropping frame to obtain multiple target images.
2. The method according to claim 1, characterized in that Before performing pre-cropping processing on the image to be cropped according to the pre-cropping frame, the method further includes: Determining the aspect ratio of the image to be cropped according to the image to be cropped; Determining whether the aspect ratio is greater than a preset value; If the aspect ratio is greater than the preset value, determining the image overlap ratio and the pre-cropping size according to the width and height of the image to be cropped; A pre-cropping frame is determined according to the pre-cropping size and the image overlap ratio.
3. The method according to claim 1, characterized in that The block information includes: first block coordinates and block confidence. The clustering and merging of blocks in multiple sub-images according to the block information to obtain a target block includes: Adding the first panel coordinates and the upper left corner coordinates of the pre-cropping frame to obtain second panel coordinates, wherein the second panel coordinates are in the same coordinate system; The blocks are merged according to the block confidence and the second block coordinates to obtain a target block.
4. The method according to claim 3, characterized in that The merging of the blocks according to the block confidence and the second block coordinates to obtain a target block includes: Sorting and classifying the unmerged sections according to the section confidence to obtain sections to be merged, wherein the sections to be merged are sections with the highest section confidence ranking; Determining a plurality of first intersection-over-union ratios according to the second block coordinates of the block to be merged and the unmerged block; Determine a first candidate block according to the first intersection-over-union ratio, where the first candidate block corresponds to a block to be merged and at least one unmerged block; Taking a union of the first candidate blocks to determine a second candidate block, where the block coordinates of the second candidate block contain all the first candidate blocks; The second candidate section is input into the section list and classified and stored to obtain multiple target sections.
5. The method according to claim 4, characterized in that Determining a first candidate block according to the first intersection-over-union ratio includes: determining in sequence whether the first intersection-over-union ratio is greater than a threshold; If the first intersection-over-union ratio is greater than the threshold, determining the two blocks corresponding to the first intersection-over-union ratio as first candidate blocks; If the first intersection-in-union ratio is not greater than the threshold, the unmerged blocks corresponding to the first intersection-in-union ratio are released, and the unmerged blocks are sorted again based on confidence until no unmerged blocks exist.
6. The method according to claim 5, characterized in that The second candidate section is input into the section list and classified and stored to obtain multiple target sections, including: Determine whether the section list is empty; If the section list is empty, the second candidate section is used as the target section and stored in the section list; If the block list is not empty, determining a second intersection-over-union ratio between the second candidate block and the target block; Determining whether the second intersection-over-union ratio is less than the threshold; If the second intersection-over-union ratio is less than the threshold, storing the second candidate block as the target block in the block list; If the second intersection-over-union ratio is not less than the threshold, a union is taken between the second block corresponding to the second intersection-over-union ratio and the target block to obtain a new target block and store it.
7. The method according to claim 1, characterized in that The updating process of the candidate cropping frame according to the target section to obtain the target cropping frame includes: For any cropping frame of all candidate cropping frames, traverse the block coordinates of all target blocks according to the coordinates of the candidate cropping frame; In the case where the candidate cropping frame truncates the target block, determining a truncation edge of the candidate cropping frame; Determining a first distance and a second distance between the truncated edge and the upper and lower edges of the target block respectively; If the first distance is smaller than the second distance, determining the edge corresponding to the first distance as the cropping edge; If the first distance is not less than the second distance, determining the edge corresponding to the second distance as the cropping edge; A target cropping frame is determined according to the candidate cropping frames and the cropping edges.
8. An image cropping device, characterized in that: include: An acquisition module, used to acquire the image to be cropped; a processing module, configured to perform pre-cropping processing on the image to be cropped according to a pre-cropping frame to obtain a plurality of sub-images, wherein the pre-cropping frame is determined according to a width value and a height value of the image to be cropped; The processing module is further configured to perform identification and analysis on the plurality of sub-images to obtain the section information of all sections on the sub-images; The processing module is further configured to perform clustering and merging processing on the blocks in the plurality of sub-graphs according to the block information to obtain a target block; The processing module is further configured to update the candidate cropping frame according to the target section to obtain a target cropping frame, wherein the candidate cropping frame is determined according to the pre-cropping frame; The processing module is further configured to perform cropping processing on the image to be cropped according to the target cropping frame to obtain multiple target images.
9. An image cropping device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.