[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN117541546A - Method and device for determining image cropping effect, storage medium and electronic equipment - Google Patents

Method and device for determining image cropping effect, storage medium and electronic equipment Download PDF

Info

Publication number
CN117541546A
CN117541546A CN202311486650.7A CN202311486650A CN117541546A CN 117541546 A CN117541546 A CN 117541546A CN 202311486650 A CN202311486650 A CN 202311486650A CN 117541546 A CN117541546 A CN 117541546A
Authority
CN
China
Prior art keywords
text
target
determining
image
clipping
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311486650.7A
Other languages
Chinese (zh)
Inventor
刘晓滨
赵博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311486650.7A priority Critical patent/CN117541546A/en
Publication of CN117541546A publication Critical patent/CN117541546A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/155Segmentation; Edge detection involving morphological operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20036Morphological image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Multimedia (AREA)
  • Character Input (AREA)

Abstract

The application discloses a method and a device for determining image cropping effect, a storage medium and electronic equipment. Wherein the method comprises the following steps: obtaining an initial image to be cut, carrying out text detection on the initial image, determining a first text area, determining a second text area from the first text area according to a predetermined cutting line, carrying out target image processing on the second text area to obtain a group of text marks, and determining a target cutting result according to the cutting line and the group of text marks, wherein the target cutting result is used for indicating whether cutting of the initial image according to the cutting line causes text defects or not. The method and the device solve the technical problems that the cutting result is incomplete in characters and poor in cutting effect due to the fact that the cutting is performed from the middle of the image characters. The embodiment of the application can be applied to various scenes such as cloud technology, artificial intelligence and the like.

Description

Method and device for determining image cropping effect, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for determining an image cropping effect, a storage medium, and an electronic device.
Background
Currently, when editing an image, a content creator usually adopts a clipping mode, for example, a vertical image is obtained from a horizontal image, a small image is obtained by clipping in a large image, and an image edge is clipped to meet requirements of typesetting size and the like. In the cutting process, if the characters are cut from the middle of the characters, the characters remained in the cut images are incomplete, so that the character content is difficult to distinguish, the transmission expression of the character information in the images is blocked, and the aesthetic feeling of the images is reduced. The related text detection and recognition algorithm is mainly used for detecting the position of a text in an image and recognizing the content of the text, and cannot detect whether the text is incomplete or not, so that the recognition accuracy of the cutting effect is difficult to ensure.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a method and a device for determining an image clipping effect, a storage medium and electronic equipment, and aims to at least solve the technical problems that the clipping effect is incomplete and the clipping effect is poor due to clipping from the middle of image characters.
According to an aspect of the embodiments of the present application, there is provided a method for determining an image cropping effect, including: acquiring an initial image to be cut, performing text detection on the initial image, and determining a first text region, wherein the first text region comprises a region in the initial image, in which text information is identified; determining a second text region from the first text region according to a predetermined cutting line, wherein the second text region comprises a region, which is penetrated by the cutting line, in the first text region; performing target image processing on the second text region to obtain a group of text labels, wherein the target image processing is used for extracting edge information of the second text region, and the group of text labels are commonly used for indicating the positions of the text in the second text region; and determining a target cutting result according to the cutting line and the group of text marks, wherein the target cutting result is used for indicating whether the initial image is cut according to the cutting line to cause text defects or not.
According to another aspect of the embodiments of the present application, there is also provided a device for determining an image cropping effect, including: the device comprises an acquisition module, a text detection module and a text detection module, wherein the acquisition module is used for acquiring an initial image to be cut, performing text detection on the initial image and determining a first text area, wherein the first text area comprises an area in the initial image, in which text information is identified; the first determining module is used for determining a second text area from the first text area according to a predetermined cutting line, wherein the second text area comprises an area, which is penetrated by the cutting line, in the first text area; the processing module is used for carrying out target image processing on the second text region to obtain a group of text marks, wherein the target image processing is used for extracting edge information of the second text region, and the group of text marks are commonly used for indicating the positions of the text in the second text region; and the second determining module is used for determining a target cutting result according to the cutting line and the group of character marks, wherein the target cutting result is used for indicating whether cutting is performed on the initial image according to the cutting line to cause character incomplete.
Optionally, the device is configured to determine a target clipping result according to the clipping line and the set of text labels by: acquiring a predetermined edge quantity threshold, wherein the edge quantity threshold is used for determining whether the second text region corresponding to the group of text marks causes text defects or not; determining the number of contact points between the cutting line and the group of text marks; determining the target clipping result as that the initial image is clipped according to the clipping line under the condition that the number of the contact points is larger than or equal to the threshold value of the number of the edges, so that character incomplete is caused; and under the condition that the number of the contact points is smaller than the threshold value of the number of the edges, determining the target clipping result as that the initial image is clipped according to the clipping lines does not cause character defects.
Optionally, the device is configured to determine the second text area from the first text area according to a predetermined clipping line by: filtering the first text region, and determining a third text region meeting a preset size condition; determining a target clipping position according to the clipping line, wherein the target clipping position represents the position of the clipping line in the initial image; and determining the second text area according to the target cutting position, wherein the second text area represents the third text area with the target cutting position positioned inside.
Optionally, the device is configured to filter the first text area and determine a third text area that meets a preset size condition by: acquiring initial size information of the initial image and target size information of the first text region; determining a filtered text region according to the initial size information and the target size information, wherein the filtered text region represents the first text region of which the relation between the target size information and the initial size information does not meet the preset size condition; and deleting the filtered text region from the first text region to obtain the third text region.
Optionally, the device is configured to determine the filtered text region according to the initial size information and the target size information by at least one of: determining the first text area, of which the target height is greater than or equal to the initial height, as the filtered text area in the case where the initial size information includes an initial height and the target size information includes a target height; determining the first text area with the target width being greater than or equal to the initial width as the filtered text area in the case that the initial size information includes an initial width and the target size information includes a target width; determining the first text area, in which the ratio of the target height to the initial height is less than or equal to a height ratio threshold, as the filtered text area, in a case where the initial size information includes an initial height and the target size information includes a target height; and in the case that the initial size information includes an initial width and the target size information includes a target width, determining the first text area, in which a ratio of the target width to the initial width is less than or equal to a width ratio threshold, as the filtered text area.
Optionally, the device is configured to determine the second text area according to the target clipping position by: acquiring a cutting direction indicated by the cutting line; determining a first edge position and a second edge position of the initial image according to the clipping direction, wherein the first edge position and the second edge position represent edges of the initial image determined along the clipping direction; the third text area with the target clipping position between the first edge position and the second edge position is determined as the second text area.
Optionally, the means is configured to determine the third text area, where the target clipping position is located between the first edge position and the second edge position, as the second text area by: when the clipping direction represents vertical clipping, the first edge position represents a left edge position, and the second edge position represents a right edge position, determining the third text region, in which the abscissa corresponding to the target clipping position is greater than or equal to the sum of the abscissa corresponding to the left edge position and a first preset boundary threshold value, and the abscissa corresponding to the target clipping position is less than or equal to the difference between the abscissa corresponding to the right edge position and the first preset boundary threshold value, as the second text region; or when the clipping direction represents horizontal clipping, the first edge position represents a lower edge position, and the second edge position represents an upper edge position, determining the third text area, in which the ordinate corresponding to the target clipping position is greater than or equal to the sum of the ordinate corresponding to the lower edge position and a second preset boundary threshold value, and the ordinate corresponding to the target clipping position is less than or equal to the difference between the ordinate corresponding to the upper edge position and the second preset boundary threshold value, as the second text area.
Optionally, the means is configured to determine the third text area, where the target clipping position is located between the first edge position and the second edge position, as the second text area by: when the target clipping positions include a plurality of target clipping positions, determining a positional relationship between the first edge position and the second edge position of each target clipping position corresponding to the third text region in turn; and determining the corresponding third text area as the second text area when any one of the target clipping positions is located between the first edge position and the second edge position.
Optionally, the device is configured to perform target image processing on the second text area to obtain a set of text labels by: performing blurring processing on the second text region to obtain a blurred text region, wherein the blurring processing is used for blurring texture lines of background information in the second text region; performing edge detection on the fuzzy text region to obtain a group of initial edge lines, wherein the edge detection is used for extracting the edge information; and screening a group of target edge lines from the group of initial edge lines, and determining the group of target edge lines as the group of text marks, wherein the target edge lines are initial edge lines with line lengths meeting preset conditions.
Optionally, the device is configured to screen a set of target edge lines from the set of initial edge lines by: performing image corrosion operation on the group of initial edge lines to obtain a group of intermediate edge lines, wherein the image corrosion operation is used for shortening the line length of each initial edge line in the group of initial edge lines, and deleting the corresponding initial edge line when the line length is reduced to be smaller than or equal to a preset length threshold value; and performing image expansion operation on the group of intermediate edge lines to obtain a group of target edge lines, wherein the image expansion operation is used for increasing the line length of each intermediate edge line in the group of intermediate edge lines.
Optionally, the device is further configured to: determining the clipping line in response to a target clipping operation executed by a target client; or acquiring a cutting frame body configured for the initial image in advance, and determining the cutting lines according to the cutting frame body.
According to still another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described method of determining an image cropping effect when executed.
According to yet another aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the method of determining the effect of cropping an image as above.
According to still another aspect of the embodiments of the present application, there is also provided an electronic device including a memory, in which a computer program is stored, and a processor configured to execute the above-described method for determining an image cropping effect by the computer program.
In the embodiment of the application, an initial image to be cut is acquired, text detection is performed on the initial image, a first text area is determined, the first text area comprises an area where text information is identified in the initial image, a second text area is determined from the first text area according to a predetermined cutting line, the second text area comprises an area where the cutting line passes through in the first text area, target image processing is performed on the second text area, a set of text marks are obtained, the target image processing is used for extracting edge information of the second text area, the set of text marks are commonly used for indicating the position of a text in the second text area, a target cutting result is determined according to the cutting line and the set of text marks, the target cutting result is used for indicating whether the initial image is cut according to the cutting line to cause text incomplete, the image area with text is searched through text detection, then the text edge detection and other operations are utilized, the text edge line is reserved, whether text incomplete cutting exists in the cutting result is judged according to the text edge information of the cutting position, the text incomplete cutting result is obtained, the purpose of optimizing cutting is achieved, the cutting result is achieved, the problem that the text incomplete cutting exists is solved, the cutting result is poor in accuracy is solved, and the technical problem is solved due to the fact that the cutting result is poor in cutting effect is obtained.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a schematic illustration of an application environment of an alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 2 is a flow chart of an alternative method of determining image cropping effects according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 4 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 5 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 6 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 7 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 8 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 9 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 10 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 11 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 12 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 13 is a schematic diagram of a method of determining an alternative image cropping effect according to an embodiment of the application;
FIG. 14 is a schematic diagram of yet another alternative method of determining image cropping effects according to an embodiment of the application;
FIG. 15 is a schematic diagram of a method of determining an alternative image cropping effect according to an embodiment of the application;
FIG. 16 is a schematic structural view of an alternative image cropping effect determining device according to an embodiment of the present application;
FIG. 17 is a schematic diagram of the structure of an alternative image cropping effect determination product according to an embodiment of the present application;
fig. 18 is a schematic structural view of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, partial terms or terminology appearing in describing embodiments of the present application are applicable to the following explanation:
OpenCV: open Source Computer Vision Library, a cross-platform open-source computer vision processing code library.
Canny edge detection: an algorithm for detecting the edge position in an image based on the gradient change of the image, and an algorithm function interface is provided in an OpenCV code library.
Text detection: and detecting the position coordinates of the text in the image, and providing an algorithm function interface in an OpenCV code library.
Image dilation: and expanding the white area range with the value of 1 in the binary image according to the set parameters.
Image corrosion: and (5) reducing the white area range with the value of 1 in the binary image according to the set parameters.
The present application is described below with reference to examples:
according to an aspect of the embodiment of the present application, there is provided a method for determining an image clipping effect, and optionally, in the present embodiment, the method for determining an image clipping effect described above may be applied to a hardware environment configured by the server 101 and the terminal device 103 as shown in fig. 1. As shown in fig. 1, a server 101 is connected to a terminal 103 through a network, and may be used to provide services to a terminal device or an application installed on the terminal device, which may be a video application, an instant messaging application, a browser application, an educational application, a game application, or the like. The database 105 may be provided on or separate from the server for providing data storage services for the server 101, such as a game data storage server, which may include, but is not limited to: a wired network, a wireless network, wherein the wired network comprises: local area networks, metropolitan area networks, and wide area networks, the wireless network comprising: bluetooth, WIFI and other wireless communication networks, the terminal device 103 may be a terminal configured with an application program, and may include, but is not limited to, at least one of the following: mobile phones (such as Android mobile phones, iOS mobile phones, etc.), notebook computers, tablet computers, palm computers, MID (Mobile Internet Devices ), PAD, desktop computers, smart televisions, smart voice interaction devices, smart home appliances, vehicle terminals, aircrafts, virtual Reality (VR) terminals, augmented Reality (Augmented Reality, AR) terminals, mixed Reality (MR) terminals, and other computer devices, where the servers may be a single server, a server cluster composed of multiple servers, or a cloud server.
As shown in fig. 1, the method for determining the image cropping effect may be performed by an electronic device, which may be a terminal device or a server, and the method for determining the image cropping effect may be implemented by the terminal device or the server, respectively, or by both the terminal device and the server.
The above is merely an example, and the present embodiment is not particularly limited.
Optionally, as an optional implementation manner, as shown in fig. 2, the method for determining the image cropping effect includes:
s202, acquiring an initial image to be cut, performing text detection on the initial image, and determining a first text region, wherein the first text region comprises a region in the initial image, in which text information is identified;
alternatively, in the present embodiment, the method for determining the image clipping effect described above may be applied to various application scenarios requiring image clipping, including but not limited to:
advertisement design: in advertisement design, cropping images can help designers to highlight products or services, remove unnecessary background or interference factors, and improve the attractiveness and information transfer effect of advertisements.
E-commerce: on an e-commerce website, the clipping image can help merchants to show the details and characteristics of products, clear product images are provided, and trust and purchase willingness of purchasers are increased.
Social media: on a social media platform, the clipping image can help a user to adjust the size and proportion of the image so as to adapt to different platform requirements, and unnecessary elements can be removed, so that the image is more attractive and attractive.
Post-processing of shooting: in the post-photographic processing, the cut image can help a photographer to adjust the composition, highlight the theme or the key point, remove unnecessary background or interference factors, and improve the quality and the ornamental value of the photo.
Image recognition and computer vision: in the field of image recognition and computer vision, cropping images can help algorithms or models focus on the region of interest, improving the accuracy and efficiency of image recognition and understanding.
By way of example, image recognition and computer vision are used, and artificial intelligence (Artificial Intelligence, AI) is a theory, method, technique, and application system that simulates, extends, and extends human intelligence, senses environment, acquires knowledge, and uses knowledge to obtain optimal results using a digital computer or a machine controlled by a digital computer. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
Computer Vision (CV) is a science of studying how to "look" a machine, and more specifically, to replace a human eye with a camera and a Computer to perform machine Vision such as recognition and measurement on a target, and further perform graphic processing to make the Computer process an image more suitable for human eye observation or transmission to an instrument for detection. As a scientific discipline, computer vision research-related theory and technology has attempted to build artificial intelligence systems that can acquire information from images or multidimensional data. Computer vision techniques typically include image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content/behavior recognition, three-dimensional object reconstruction, 3D techniques, virtual reality, augmented reality, synchronous positioning, and map construction, among others, as well as common biometric recognition techniques such as face recognition, fingerprint recognition, and others.
Optionally, in this embodiment, the initial image to be cut may be an image uploaded by the user through the client, may be an image intercepted by the user through a screenshot tool, or may be an image indicated by the user by sending an HTTP request.
In an exemplary embodiment, the text detection of the initial image and the determination of the first text region may be performed according to the following steps:
s1, pretreatment: the initial image is preprocessed to improve the accuracy of text detection. Image enhancement techniques such as histogram equalization, contrast enhancement, etc. may be used to enhance text regions in an image.
S2, a text detection algorithm: text detection algorithms are applied to detect text regions in images, including but not limited to edge detection-based methods (e.g., canny edge detection), corner detection-based methods (e.g., harris corner detection), feature point detection-based methods (e.g., SIFT, SURF, etc.), and the like.
It should be noted that the number of the first text areas is not specifically limited, and may be one or more, and when there are a plurality of text areas, the first text areas may be further determined through a filtering operation.
Illustratively, an open source OCR engine named Tesseact may be used for text detection, including but not limited to: the initial image stored locally is first read using the OpenCV library and then converted into a grayscale image. Then, the image is converted into a black-and-white binary image through a binarization process so as to better recognize the text. Finally, the text region is extracted from the initial image and printed using some preset function. Fig. 3 is a schematic diagram of an alternative method for determining an image cropping effect according to an embodiment of the application, as shown in fig. 3, including an initial image, from which a text region 302 and a text region 304, where text may exist, may be identified using a text detection tool.
S204, determining a second text area from the first text area according to a predetermined cutting line, wherein the second text area comprises an area, in the first text area, through which the cutting line passes;
optionally, in this embodiment, the clipping line may be a clipping line manually input by a user, or may be a clipping frame set by a client. In other words, the user can set the clipping lines on the initial image through interactive operation, and can drag the clipping frame body on the initial image through interactive operation, and when the user stops operation, the overlapped part of the clipping frame body and the initial image is the area to be clipped.
Specifically, the image may be converted to a binary image using suitable image processing techniques (e.g., edge detection, binarization, etc.). Then, the contours of the first text region are found using image segmentation algorithms (e.g., connected region analysis, contour detection, etc.). And marking the outline or the position of the cutting line in the first text area according to the position of the cutting line which is determined in advance. A second text area is determined by analyzing whether the crop line is located inside the first text area. For example, geometric calculations or image segmentation algorithms may be used to determine the region through which the crop line passes.
It should be noted that the second text area may be understood as an area through which the cut line passes in the first text area, that is, when there are a plurality of first text areas, it is determined whether each of the first text areas is sequentially passed by the cut line, and the first text area through which the cut line passes is determined as the second text area.
For example, fig. 4 is a schematic diagram of another alternative method for determining an image clipping effect according to an embodiment of the present application, as shown in fig. 4, including an initial image, a text area 402 and a text area 404 where text may exist may be identified from the initial image by using a text detection tool, where a clipping line 406 and a clipping line 408 input by a user are acquired, and it may be understood that a user desires to intercept an area between the clipping line 406 and the clipping line 408 in the initial image, and the text area 402 is considered to be the second text area because the text area 402 is penetrated by the clipping line 406 and the text area 404 is not penetrated by the clipping line 406 and is not penetrated by the clipping line 408.
S206, performing target image processing on the second text region to obtain a group of text labels, wherein the target image processing is used for extracting edge information of the second text region, and the group of text labels are commonly used for indicating the positions of the text in the second text region;
alternatively, in this embodiment, the target image processing may include, but is not limited to, image graying, binarizing, edge detecting, gaussian noise filtering, image eroding, image expanding, and the like, to extract edge information corresponding to text in the second text region, and then determine the edge information as the set of text labels.
Illustratively, the following operations may be performed on the second text region to obtain the set of text labels: importing required libraries and modules; for example, image processing operations may be performed using the OpenCV library; reading a corresponding image of the second text region and converting the corresponding image into a gray image; threshold processing is carried out on the gray level image, the text area is changed into white, and the background area is changed into black; the appropriate threshold may be selected according to the specific circumstances; performing image erosion operation on the threshold image; selecting proper corrosion kernel size and iteration times; performing image expansion operation on the corroded image; and selecting the proper expansion kernel size and iteration times to take each edge in the gray level image after the final image expansion operation as the set of character marks.
It should be noted that, the above-mentioned group of text labels are used together to indicate the location of the text in the second text region, which may be understood as the edge information of the text in the second text region, where the text in the second text region is located may be represented by the edge information.
In an exemplary embodiment, fig. 5 is a schematic diagram of a further alternative method for determining an image cropping effect according to an embodiment of the application, as shown in fig. 5, including a region 502 and a region 504, where the region 502 represents a second text region, and the region 504 represents a region having the same size as the second text region and labeled with the set of text labels, that is, the set of text labels label the positions of the characters in the second text region in the region 504.
S208, determining a target cutting result according to the cutting lines and a group of text marks, wherein the target cutting result is used for indicating whether the initial image is cut according to the cutting lines to cause text defects or not.
Optionally, in this embodiment, the target clipping result is used to indicate whether clipping the initial image according to the clipping line will cause text defects, that is, the target clipping result will indicate the clipping result associated with the clipping line or the initial image.
It should be noted that, the target clipping result may be presented by means of a prompt message, or may be presented by means of a clipping image after correction.
Illustratively, determining the target clipping result from the clipping line and the set of text labels may be performed as follows:
acquiring an initial image and clipping lines: firstly, an initial image to be cut and a corresponding cutting line are obtained. An image processing library or computer vision tool may be used to process the images and extract lines.
Extracting a text region: and extracting the text region in the initial image by using a text recognition algorithm or an image segmentation technology. This can be achieved by region segmentation based on pixel color, texture, shape, etc. characteristics.
Marking a text area: the extracted text region is marked, and a rectangular frame or a polygon can be used for marking the text region.
Judging a cutting result: judging whether the cutting line is intersected with the character marks according to the cutting line and a group of character marks in the character area, if the cutting line is intersected with the character marks, and if the intersecting character marks reach a certain degree, the cutting can be considered to cause character incomplete, otherwise, the cutting can be considered to not cause character incomplete.
Outputting a target clipping result: and outputting a target cutting result according to the judging result. Boolean values may be used to indicate that clipping causes text defects, for example True indicates that clipping does not cause text defects.
In an exemplary embodiment, fig. 6 is a schematic diagram of a method for determining an image clipping effect according to an embodiment of the present application, including a clipping line, an area 602, and an area 604, as shown in fig. 6, in which, since the clipping line has 3 contact points with a set of text labels in the area 604, if the predetermined contact point threshold is 2, it is determined that clipping an initial image with the clipping line may result in a "sheet" word defect, and at this time, a related target clipping result may be output to indicate that the current clipping result is not qualified.
It should be noted that, the target clipping result may be actively pushed to the client, or the modified clipping image may be generated according to the target clipping result and pushed to the client.
In an exemplary embodiment, fig. 7 is a schematic diagram of a method for determining an image clipping effect according to another embodiment of the present application, as shown in fig. 7, obtaining clipping operation data sent by a user, generating clipping line 702 according to the clipping operation data, determining clipping results of clipping the initial image according to the clipping line in the above manner, and pushing related prompt information 704 to the user after the clipping results indicate that text is incomplete, so as to prompt the user whether to re-clip.
In another exemplary embodiment, fig. 8 is a schematic diagram of a method for determining an image clipping effect according to another embodiment of the present application, as shown in fig. 8, where clipping operation data sent by a user is acquired, clipping lines 802 are generated according to the clipping operation data, clipping results of clipping the initial image according to the clipping lines are determined in the above manner, after the clipping results indicate that text is incomplete, a corrected clipping image is generated, and the corrected clipping image is clipped according to clipping lines 804.
According to the method, an initial image to be cut is obtained, text detection is conducted on the initial image, a first text area is determined, the first text area comprises an area where text information is recognized in the initial image, a second text area is determined from the first text area according to predetermined cutting lines, the second text area comprises an area where the cutting lines pass through in the first text area, target image processing is conducted on the second text area, a group of text marks are obtained, the target image processing is used for extracting edge information of the second text area, the group of text marks are jointly used for indicating the position of characters in the second text area, a target cutting result is determined according to the cutting lines and the group of text marks, the target cutting result is used for representing whether the initial image is cut into characters in incomplete mode according to the cutting lines, the image area with text is found through text detection, then the edge detection operation of the image is utilized, the text edge lines are reserved, whether the characters in incomplete in the cutting process can be caused in the cutting process or not is judged according to the text edge information of the cutting positions, the purpose of optimizing whether the characters in the cutting result is incomplete is achieved, accordingly, cutting effect is improved, the problem that the cutting effect is poor in the cutting recognition effect is achieved is solved, and the existing in the cutting effect is poor, and the technical problem is solved.
As an alternative, determining the target clipping result according to the clipping line and a set of text labels includes:
acquiring a predetermined edge quantity threshold, wherein the edge quantity threshold is used for determining whether a second text region corresponding to a group of text marks causes text defects or not;
determining the number of contact points between the cutting line and a group of text marks;
under the condition that the number of contact points is larger than or equal to the threshold value of the number of edges, determining a target cutting result as that cutting is performed on the initial image according to cutting lines so as to cause character incomplete;
and under the condition that the number of contact points is smaller than the threshold value of the number of edges, determining the target clipping result as that the initial image is clipped according to clipping lines, wherein the initial image is not subject to character incomplete.
Alternatively, in this embodiment, the above-mentioned threshold value for the number of edges may be flexibly set according to a priori knowledge, specifically, may be flexibly set according to one or more factors such as an image size of the initial image, the number of text labels of a set of text labels, and the like.
The threshold value of the number of edges may include, but is not limited to, the maximum number of edges of the clipping position, and the number of edges of the clipping position (corresponding to the number of contact points) is calculated to determine whether to clip the text. Specifically, if the number of clipping location edges is greater than cut_margin (e.g., set to 2), then this clipping location is considered to be passed through the middle of a single word, resulting in word breaks. Otherwise, the cutting position is considered to pass through the text gap (or is only slightly cut to the edge of the text, so that the text is not damaged).
In one exemplary embodiment, a predetermined edge number threshold is obtained, for example, the edge number threshold is set to 10. This threshold is used to determine whether a second text region corresponding to a set of text labels has caused text defects. For example, assuming an image with a set of text labels representing text positions, the number of edges between the crop line and the set of text labels is determined to be 8. Since 8 is less than 10, this set of text labels does not cause text defects. The contact point is the point where the clipping line intersects the text mark. The purpose of this step is to determine if the crop line has sufficient contact with the text mark to determine if text imperfection will result. When the number of contact points is greater than or equal to the threshold value of the number of edges, determining the target clipping result as clipping the initial image according to clipping lines causes character defects. For example, assume that the number of contact points is 12, which is equal to or greater than the threshold number of edges 10. According to the judgment, it can be confirmed that the cutting line cuts the initial image to cause character defect. And under the condition that the number of contact points is smaller than the threshold value of the number of edges, determining the target clipping result as that the initial image is clipped according to clipping lines, wherein the initial image is not subject to character incomplete. For example, assume that the number of contact points is 6, which is less than the threshold number of edges 10. This means that the clipping of the initial image by the clipping lines does not cause text defects.
According to the embodiment, whether the cutting result can cause character incomplete or not can be judged according to the predetermined edge quantity threshold value and the quantity of contact points of the cutting lines and the character marks. Such an analysis method can be applied to fields such as image processing and character recognition.
As an alternative, determining the second text region from the first text region according to the predetermined clipping line includes: filtering the first text region, and determining a third text region meeting the preset size condition; determining a target cutting position according to the cutting line, wherein the target cutting position represents the position of the cutting line in the initial image; and determining a second text area according to the target cutting position, wherein the second text area represents a third text area of which the target cutting position is positioned inside.
Alternatively, in this embodiment, the filtering may be understood as removing a portion of the first text region where no subsequent processing is necessary, for example, a first text region that is oversized or undersized. Assuming that there are a plurality of text regions in one image, a text region having a preset size of more than 200 pixels in width may be set, and it is necessary to find a first text region satisfying this condition as the above-described third text region.
After the third text area satisfying the preset size condition is determined, the target clipping position needs to be determined according to the clipping line. The clipping line refers to a line marked in the original image, which may be any shape and location. The target clipping position represents the specific position where the clipping line is located in the initial image. For example, a dashed box is used in an image to mark the target clipping location, and the area enclosed by the dashed box is the target location to be clipped.
As an alternative, filtering the first text area to determine a third text area meeting a preset size condition includes:
acquiring initial size information of an initial image and target size information of a first text region;
determining a filtered text region according to the initial size information and the target size information, wherein the filtered text region represents a first text region of which the relation between the target size information and the initial size information does not meet a preset size condition;
and deleting the filtered text region from the first text region to obtain a third text region.
Alternatively, in the present embodiment, the above-described initial size information may include, but is not limited to, information indicating the size of the initial image, such as the height and width of the initial image. The above-described target size information may include, but is not limited to, information indicating the size of a certain first text area, such as the height and width of the first text area.
In an exemplary embodiment, fig. 9 is a schematic diagram of a method for determining an image clipping effect according to another embodiment of the present application, where, as shown in fig. 9, taking an example in which an initial image is a rectangular image, a top left corner vertex of the rectangle is taken as an origin, a lateral direction is taken as an X axis, and a longitudinal direction is taken as a Y axis, that is, an X coordinate is used to represent a column where a pixel is located in the image, and a Y coordinate is used to represent a row where the pixel is located.
Alternatively, in this embodiment, determining the filtered text region according to the initial size information and the target size information may be understood as determining whether the first text region corresponding to the target size information needs to be filtered according to the comparison relationship between the values of the initial size information and the target size information.
It should be noted that, deleting the filtered text region from the first text region to obtain the third text region may be understood as determining, when the first text region includes a plurality of text regions, the first text region satisfying the preset size condition as the third text region, and deleting the first text region not satisfying the preset size condition. Here, deletion means that subsequent processing is not performed as the third text area, and does not limit whether deletion from the database storing the first text area is necessary.
As an alternative, determining the filtered text region according to the initial size information and the target size information includes at least one of:
determining a first text area with a target height greater than or equal to the initial height as a filtered text area in the case that the initial size information includes the initial height and the target size information includes the target height;
determining a first text area with a target width greater than or equal to the initial width as a filtered text area in the case where the initial size information includes the initial width and the target size information includes the target width;
determining a first text area, in which the ratio of the target height to the initial height is less than or equal to a height ratio threshold, as a filtered text area, in the case where the initial size information includes an initial height and the target size information includes a target height;
in the case where the initial size information includes an initial width and the target size information includes a target width, a first text region in which a ratio of the target width to the initial width is less than or equal to a width ratio threshold is determined as a filtered text region.
Alternatively, in this embodiment, the target height being greater than or equal to the initial height may be understood as determining the first text area having a height less than the initial height as the filtered text area, and the target width being greater than or equal to the initial width may be understood as determining the first text area having a width less than the initial width as the filtered text area.
In an exemplary embodiment, p= (x 1, y1, x2, y 2) may be used to represent the coordinates of a rectangular area, x1, y1 represent the position of the upper left corner of a rectangle in the lateral and longitudinal directions on the coordinate system, i.e. the serial numbers of the columns and rows in which the upper left corner is located, and x2, y2 represent the position of the lower right corner of the rectangle in the lateral and longitudinal directions on the coordinate system, respectively.
Thus, the first text region may be represented as S p = { P1, P2, P3, … … }; since the text detection result in the image generally contains noise, the accuracy of the text detection result can be improved by filtering the text region (corresponding to the text box described below) with too small or too large a portion:
in one exemplary embodiment, smaller text boxes mean smaller font text content, typically the background in an image, that is cut out so as not to normally affect the aesthetics of the image and the communication of valid information, so that such text boxes can be filtered. The text box width may be calculated as: width=x2-x 1 and height=y2-y1. To filter smaller text boxes, a minimum HEIGHT scaling factor min_height_ratio (corresponding to the HEIGHT scaling threshold described above) and a minimum WIDTH scaling factor min_width_ratio (corresponding to the WIDTH scaling threshold described above) may be introduced. These two coefficients represent the ratio of the height and width of the smallest text box to be detected to the height and width of the image, respectively. For example, the image HEIGHT is 1000 pixels, and min_high_ratio is set to 0.01, the minimum text box HEIGHT to be detected is 10 pixels. The width of the marked image is W, the height of the marked image is H, and the filtering condition is as follows: WIDTH < w_min_width_ratio or HEIGHT < h_min_height_ratio, the text box is filtered out, W represents the initial WIDTH and H represents the initial HEIGHT.
In another exemplary embodiment, text boxes whose text ranges are beyond the image are filtered: some text detection methods return text boxes that are out of range of the image, which means that the text may be incomplete in the original image, and therefore the method does not detect these text boxes. The filtering conditions are as follows: x2> W or y2> H or x1<0 or y1<0, the text box is filtered out.
As an alternative, determining the second text area according to the target clipping position includes:
acquiring a cutting direction indicated by a cutting line;
determining a first edge position and a second edge position of the initial image according to the clipping direction, wherein the first edge position and the second edge position represent edges of the initial image determined along the clipping direction;
a third text area with the target clipping position between the first edge position and the second edge position is determined as a second text area.
Alternatively, in this embodiment, the cutting direction may include, but is not limited to, a cutting direction of horizontal cutting, vertical cutting, circular cutting, irregular cutting, and the like, and the circular cutting and the irregular cutting may be considered to be composed of a plurality of horizontal cutting and vertical cutting, which are not described herein.
The first edge position is used to indicate one edge of the original image in the cropping direction, and the first edge position is used to indicate the other edge of the original image in the cropping direction.
Alternatively, in this embodiment, the above-mentioned clipping direction for acquiring the clipping line indication may be understood as being determined by a specific marker in the image or input of the user in the image clipping algorithm.
Illustratively, taking the example of a marker indication, assuming that a map image is to be cropped, the cropped line may be indicated by a road or river line on the map. The indicated direction of the clipping line can be determined by calculating the direction of the road or river. Taking the user input indication as an example, the user can indicate the direction of the clipping line by dragging the mouse over the image. By capturing the track dragged by the mouse, the input indication of the user can be obtained, so that the indication direction of the clipping line is determined.
Alternatively, in the present embodiment, the above determination of the edge position of the initial image according to the clipping direction may be understood as requiring determination of the edge position of the initial image according to the direction after determining the indication direction of the clipping line. Generally, two edges in the cropping direction are taken as the edges of the initial image.
For example, taking a horizontal clipping direction as an example, if the indication direction of the clipping line is horizontal, the first edge position of the image may be the upper edge of the image and the second edge position may be the lower edge of the image. Taking the vertical clipping direction as an example, if the indication direction of the clipping line is vertical, the first edge position of the image may be the left edge of the image and the second edge position may be the right edge of the image.
Alternatively, in the present embodiment, after determining the edge position of the initial image, a third text area where the target clipping position is located between the first edge position and the second edge position may be determined as the second text area. Specifically, it is assumed that a sheet of an image containing a book name is cut out, and the position of the book name is located in the upper half of the image. By determining the upper and lower edges of the image, the area where the book name is located can be determined as the second text area. It is assumed that an image containing a billboard logo is to be cropped and the position of the billboard logo is in the left half of the image. By determining the left and right edges of the image, the area where the billboard tagline is located can be determined as the second text area.
As an alternative, determining the third text area with the target clipping position located between the first edge position and the second edge position as the second text area includes:
when the cutting direction represents vertical cutting, the first edge position represents left edge position, the second edge position represents right edge position, the abscissa corresponding to the target cutting position is larger than or equal to the sum of the abscissa corresponding to the left edge position and the first preset boundary threshold value, and determining a third text area, of which the abscissa corresponding to the target cutting position is smaller than or equal to the difference between the abscissa corresponding to the right edge position and the first preset boundary threshold value, as a second text area; or alternatively
And determining a third text area, which is larger than or equal to the sum of the ordinate corresponding to the target cutting position and the second preset boundary threshold value and smaller than or equal to the difference between the ordinate corresponding to the upper edge position and the second preset boundary threshold value, as the second text area when the cutting direction represents horizontal cutting, the first edge position represents lower edge position and the second edge position represents upper edge position.
Alternatively, in the present embodiment, when the target clipping is performed, sometimes the target clipping position may involve a plurality of cases. Assuming that the target clipping position includes 3 cases (A, B, C), the first edge position of the third text region is X and the second edge position is Y. The positional relationship between each target clipping position and X and Y is determined separately. The target clipping position a is located between the first edge position X and the second edge position Y, and the corresponding third text region (i.e., the text region associated with the target clipping position a) is determined as the second text region. The target clipping position B is located between the first edge position X and the second edge position Y, and the corresponding third text region (i.e., the text region associated with the target clipping position B) is determined as the second text region. The target clipping position C is located between the first edge position X and the second edge position Y, and the corresponding third text region (i.e., the text region associated with the target clipping position C) is determined as the second text region.
In an exemplary embodiment, taking vertical cropping (cropping from a certain column of the image) as an example, the cropping position is noted as x_cut (i.e., the image is cropped from the x-th column, corresponding to the aforementioned target cropping position), the condition for determining whether the cropping position passes through the text region is:
x_cut > = x1+border_margin and x_cut < = x2-border_margin
Where x1 and x2 represent the left and right positions of the text region, respectively, and the boundary threshold is the boundary threshold, i.e., the clipping position is not considered to have passed through the text region if it is within a range of the boundary of the text region from the boundary of the text region. This is because the text is detected to have a region that is typically larger than the actual region of text, and is typically outside the actual region of text if the cut location is between the distances of detected text boxes from Border_Margin.
As an alternative, determining the third text area with the target clipping position located between the first edge position and the second edge position as the second text area includes:
when the target cutting positions comprise a plurality of target cutting positions, determining the position relation between the first edge position and the second edge position of each target cutting position corresponding to the third text region in sequence;
In the case where any one of the target clipping positions is located between the first edge position and the second edge position, the corresponding third text region is determined as the second text region.
Alternatively, in this embodiment, the target clipping positions may include a plurality of, for example, two, and one clipping line may be disposed in the left half of the initial image and one clipping line may be disposed in the right half of the initial image, where the target clipping position of the clipping line with respect to the initial image is one in each of the left half and the right half of the initial image, and where each of the target clipping positions is used for each of the third text regions to determine, and when any one of the target clipping positions is located within the first edge position and the second edge position of one of the third text regions, the text region is considered to be the second text region. That is, when there are a plurality of third text areas, it can be understood that there are one or more of the above-described second text areas.
In an exemplary embodiment, if there are multiple target clipping locations, each target clipping location is identical to S described above p Is determined. If any clipping position does not pass through any text box, judging that the clipping line does not cause character incomplete and exiting the algorithm.
As an alternative, the target image processing is performed on the second text area to obtain a set of text labels, including:
performing blurring processing on the second text region to obtain a blurred text region, wherein the blurring processing is used for blurring texture lines of background information in the second text region;
performing edge detection on the fuzzy text region to obtain a group of initial edge lines, wherein the edge detection is used for extracting edge information;
and screening a group of target edge lines from the group of initial edge lines, and determining the group of target edge lines as a group of text marks, wherein the target edge lines are initial edge lines with line lengths meeting preset conditions.
Alternatively, in this embodiment, the blurring process may include, but is not limited to, filtering the second text region using a gaussian filter to obtain a blurred text region with texture lines blurred with background information. The blurring process is to blur the texture lines of the background information in the second text area. For example, if the second text region is where a piece of text is placed on an image, the blurring process may reduce the interference by blurring the background texture lines of the image, making the text more prominent.
Alternatively, in the present embodiment, the purpose of the above edge detection is to extract edge information of a text region for subsequent processing. For example, if there is a piece of text in the blurred text region, edge detection may extract the outline of the text to form a set of initial edge lines.
Optionally, in this embodiment, the target edge line refers to an initial edge line whose line length meets a preset condition. For example, if the length of the preset text mark should be within a certain range, the line meeting the length requirement is selected from the initial edge lines, and the target edge line and the text mark can be determined.
As an alternative, selecting a set of target edge lines from a set of initial edge lines and determining the set of target edge lines as a set of text labels, comprising:
performing image corrosion operation on a group of initial edge lines to obtain a group of intermediate edge lines, wherein the image corrosion operation is used for shortening the line length of each initial edge line in the group of initial edge lines, and deleting the corresponding initial edge line when the line length is reduced to be smaller than or equal to a preset length threshold value;
And performing image expansion operation on the group of intermediate edge lines to obtain a group of target edge lines, wherein the image expansion operation is used for increasing the line length of each intermediate edge line in the group of intermediate edge lines.
Alternatively, in the present embodiment, the above-described image erosion and image dilation are operations in digital image processing for changing the form and length of image edge lines. The initial edge line refers to an original edge line extracted from the image, the middle edge line is a group of edge lines obtained after the image erosion operation, and finally, the target edge line is a line obtained after the image expansion operation.
It should be noted that the image etching operation changes the morphology of the lines by shortening the length of the initial edge lines. The method comprises the following specific steps:
s1, a preset length threshold (generally set to 0) is set for judging whether the line needs to be deleted or not.
S2, calculating the line length of each initial edge line, and reducing the line length of each initial edge line.
S3, deleting the line if the line length of a certain initial edge line is smaller than or equal to a preset length threshold value after the line length is reduced.
S4, repeating the steps S2 and S3 until all the initial edge lines are processed.
In one exemplary embodiment, assuming a set of initial edge lines, a preset length threshold is set to 1 pixel. The lines are now processed one by one:
for the first initial edge line, the length of the first initial edge line is 8 pixels, and the first initial edge line is smaller than a preset length threshold value after being reduced by 8 pixels, so that the first initial edge line is deleted.
For the second initial edge line, the length of the second initial edge line is 12 pixels, and the second initial edge line is reduced by 8 pixels and then is larger than a preset length threshold value, and the second initial edge line is kept unchanged.
For the third initial edge line, the length of the third initial edge line is 5 pixels, and the third initial edge line is smaller than the preset length threshold after being reduced by 8 pixels, so that the third initial edge line is deleted.
Repeating the steps until all the initial edge lines are processed.
The image expansion operation changes the form of the line by increasing the length of the line at the middle edge. The method comprises the following specific steps:
s1, calculating the length of each middle edge line.
S2, increasing the length of the line.
In one exemplary embodiment, a set of intermediate edge lines is assumed, each having a length of 6, 8, and 10 pixels. The lines are now processed one by one:
for the first middle edge line, which is 6 pixels in length, the added line length is 5 pixels, thus becoming 11 pixels.
For the first middle edge line, which is 3 pixels in length, the added line length is 5 pixels, thus becoming 8 pixels.
For the first middle edge line, which is 9 pixels in length, the added line length is 5 pixels, thus becoming 14 pixels.
As an alternative, the method further includes: determining a clipping line in response to a target clipping operation executed by a target client; or acquiring a cutting frame body configured for the initial image in advance, and determining cutting lines according to the cutting frame body.
Optionally, in this embodiment, determining the clipping line in response to the target clipping operation performed by the target client may include, but is not limited to, the following exemplary description:
illustratively, assume that an online image editing software is being developed that includes a cropping function. When a user selects an image on the client side for clipping, clipping lines are determined according to the operation of the user.
For example, the user opens an image of 1000 pixels in width and 800 pixels in height on the software and selects the cropping function. The user selects a rectangular area on the image as a cutting frame by dragging the mouse. The upper left corner of the cutting frame is 200,150, and the lower right corner is 700,600. In response to a target clipping operation performed by the target client, a clipping line is determined according to a clipping frame selected by a user. According to the clipping frame body selected by the user, the starting point coordinate of the clipping line is 200,150, and the end point coordinate is 700,150; the starting point coordinates are (700,150) and the ending point coordinates are (700,600); starting point coordinates (700,600) and ending point coordinates (200, 600); the start point coordinates are (200, 600) and the end point coordinates are (200,150).
Alternatively, in the present embodiment, the above-described acquisition of the clipping frame configured in advance for the initial image, and determination of the clipping line according to the clipping frame may include, but is not limited to, the following exemplary description:
illustratively, it is assumed that after the initial image is uploaded, a crop frame is automatically configured for the image, and a suitable crop frame is calculated based on the size and characteristics of the image.
For example, the user uploaded an image having a width of 1200 pixels and a height of 900 pixels. A crop frame is automatically configured for the image with an upper left corner (300, 200) and a lower right corner (900,700). Obtaining starting point coordinates (300, 200) and end point coordinates (900,200) of the cutting lines according to a pre-configured cutting frame; the starting point coordinates are (900,200) and the ending point coordinates are (900,700); the starting point coordinates are (900,700) and the ending point coordinates are (300,700); the starting point coordinates are (300,700) and the ending point coordinates are (300, 200).
The present application is further explained below in conjunction with specific examples:
the text clipping method and device can analyze the text condition of the clipping position and judge whether the clipping is incomplete by clipping the text from the middle of a single text. The method and the device can be applied to auditing of the uploaded image of the creator and auxiliary detection in the image editing process. For example, in the image auditing, the uploaded cut image is detected, and the creator is specifically prompted to modify the condition of text defect caused by cutting, so that the uploaded image is more attractive, the text transmission information efficiency in the image is higher, and the image content quality in a related platform is improved. In the image editing assistance, whether the cutting action causes character defect or not can be checked according to the cutting action of the user in real time, and the user is prompted to re-edit in a targeted manner.
The method and the device mainly realize detection of whether the characters are incomplete during image cutting. The method mainly comprises the steps of text detection, text region Gaussian filtering, expansion corrosion operation, image edge detection and the like, and finally whether single characters are cut or not is judged according to the text edge condition at the cutting position. Fig. 10 is a schematic diagram of a further alternative method of determining an image cropping effect according to an embodiment of the application, as shown in fig. 10.
S1, text box detection and filtration: the text region in the image is detected, the detection return result is usually a series of coordinates, and the position of the circumscribed rectangle of the text region appearing in the image is marked. The coordinate system in the image is: the upper left corner of the image is taken as the origin, the transverse direction is taken as the X axis, and the longitudinal direction is taken as the Y axis, namely the row where the pixels in the X coordinate mark image are located and the row where the Y coordinate mark pixels are located are shown in fig. 9.
For example, using p= (x 1, y1, x2, y 2) to represent the coordinates of a rectangular region, x1, y1 represent the positions of the upper left corner of the rectangle in the image in the lateral and longitudinal directions, i.e., the serial numbers of the columns and rows in which the upper left corner of the rectangle is located, and x2, y2 represent the positions of the lower right corner of the rectangle in the image in the lateral and longitudinal directions. Representing the output result of text detection in an image as S p = { P1, P2, P3, … … }, text detection results in images usually contain noise, and the application adopts a series of filtering rules to improve the accuracy of the text detection results:
s1-1, filtering small text boxes: smaller text boxes mean smaller font text content, typically the background in an image, which text is cut out so as not to normally affect the aesthetics of the image and the communication of valid information, and so such text boxes should be filtered.
The text box width may be calculated as: width=x2-x 1 and height=y2-y1. To filter smaller text boxes, the present application refers to a minimum HEIGHT scaling factor MIN_HEIGHT_Ratio and a minimum WIDTH scaling factor MIN_WIDTH_Ratio. These two coefficients represent the ratio of the height and width of the smallest text box to be detected to the height and width of the image, respectively. For example, the image HEIGHT is 1000 pixels, and min_high_ratio is set to 0.01, the minimum text box HEIGHT to be detected is 10 pixels. The width of the marked image is W, the height of the marked image is H, and the filtering condition is as follows:
WIDTH < w_min_width_ratio or HEIGHT < h_min_height_ratio, the text box is filtered out.
S1-2, filtering text boxes with text ranges beyond the image: some text detection methods return text boxes that are out of range of the image, which means that the text may be incomplete in the original image, and therefore the method does not detect these text boxes. The filtering conditions are as follows:
x2> W or y2> H or x1<0 or y1<0, the text box is filtered out.
After detection and filtration of the text box, S is removed p And obtaining a series of text boxes meeting the condition. If after filtration S p If not empty, then a determination is made as to whether the crop passed through these text boxes. Fig. 11 is a schematic diagram of yet another alternative method for determining an image cropping effect according to an embodiment of the application, with a text box conforming to the conditions shown in the box line of fig. 11.
S2, judging whether cutting passes through a text region or not: taking vertical cropping (cropping from a certain column of the image) as an example, and recording the cropping position as x_cut (i.e. cropping the image from the x-th column), the condition for judging whether the cropping position passes through the text region is:
x_cut > = x1+border_margin and x_cut < = x2-border_margin
Where x1 and x2 are the left and right positions of the text region, respectively, and the boundary threshold is the boundary threshold, i.e., if the clipping position is within a range of the boundary of the text region from the boundary of the text region, the clipping position is not considered to pass through the text region. This is because the text is detected to have a region that is typically larger than the actual region of text, and is typically outside the actual region of text if the cut location is between the distances of detected text boxes from Border_Margin. If there are multiple clipping positions in the image, each clipping position is equal to S p Is determined by the text box. If all the clipping positions do not pass through any text box, judging that the clipping does not cause character incomplete and exiting the algorithm.
In an exemplary embodiment, fig. 12 is a schematic diagram of a further alternative method of determining an image cropping effect according to an embodiment of the application, as shown in fig. 12, in which two lines of green and red represent two cropping positions, which are not considered to have passed through a text region because they are less than border_margin from the text frame. The green clipping locations are farther from the border and are considered to have passed through the text region. It can be seen that the red clipping locations do not actually clip to the text itself, but rather the area between text boxes and text, after step S2, a set of text boxes can be obtained through which each clipping location passes. Then, for each text box passed through the cutting position, it is judged whether or not the text defect is caused.
S3: judging whether the cutting position causes character incomplete in the text box or not: the clipping position is in the text box, but it is possible to clip from a gap in the middle of the text. S3, judging whether the clipping is above a single word or in a gap between words. First, the text region of the image is fetched, noise is filtered using a gaussian filter, the text edge contour is emphasized (for enhancing the difference between text and background, removing the texture lines in the background information), fig. 13 is a schematic diagram of a further alternative method for determining the clipping effect of the image according to an embodiment of the present application, and the text region is fetched and gaussian filtered as shown in fig. 13.
Subsequently, edge information in the text region is detected using Canny edge detection. Because the edge information comprises the transverse direction and the vertical direction, in order to be convenient for judging the edge position of the cutting position, the application firstly uses image corrosion, and the window size of an operator is (1, 9), namely, a window with 1 row and 9 columns (the window size can be adjusted according to practical application). Image erosion may remove the shorter lateral and vertical edges, leaving only the longer lateral edges. (according to a certain strategy, the lines meeting the strategy are blackened and the transverse is reduced by a certain amount) then the edge image is subjected to image expansion by using a window with the same size, and the shortened long transverse edge in image erosion is restored to the original length. Fig. 14 is a schematic diagram of a further alternative method of determining an image cropping effect according to an embodiment of the application, as shown in fig. 14.
After image processing, the text region only retains the lateral edges of the text. According to the method and the device, whether the text is cut from the middle is judged by calculating the number of edges of the cutting position. Specifically, if the number of clipping location edges is greater than cut_margin (which may be set to 2 in the practice of the present application), then this clipping location is considered to be passed through the middle of a single word, resulting in word breaks. Otherwise, the cutting position is considered to pass through the text gap (or is only slightly cut to the edge of the text, so that the text is not damaged). As shown in fig. 6. The cutting lines pass through 3 edges and pass through the middle of the word, so that the incomplete condition of the word is caused.
In an exemplary embodiment, if a plurality of text regions overlap with the clipping position, each text region executes a judgment process, and if it is judged that text defects occur in one region, it is judged that text defects occur in the image clipping process.
Fig. 15 is a schematic diagram of yet another alternative method for determining an image cropping effect according to an embodiment of the application, where the effect applied in detecting text cropping in an image is as shown in fig. 15, and the accuracy reaches 94.3%.
It should be noted that, the present application focuses on determining whether the clipping position will pass through a single text to cause text defect based on the text detection result. In the implementation example of the application, a text detector in OpenCV is adopted, and other text detection methods, such as a text detection method based on deep learning, can be adopted in use.
It will be appreciated that in the specific embodiments of the present application, related data such as user information is referred to, and when the above embodiments of the present application are applied to specific products or technologies, user permissions or consents need to be obtained, and the collection, use and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
According to another aspect of the embodiments of the present application, there is also provided an image clipping effect determining apparatus for implementing the above-described image clipping effect determining method. As shown in fig. 16, the apparatus includes:
the obtaining module 1602 is configured to obtain an initial image to be cut, perform text detection on the initial image, and determine a first text region, where the first text region includes a region in the initial image in which text information is identified;
a first determining module 1604, configured to determine a second text area from the first text area according to a predetermined clipping line, where the second text area includes an area of the first text area through which the clipping line passes;
A processing module 1606, configured to perform target image processing on the second text region to obtain a set of text labels, where the target image processing is configured to extract edge information of the second text region, and the set of text labels are used together to indicate a location of a text in the second text region;
a second determining module 1608, configured to determine a target clipping result according to the clipping line and a set of text labels, where the target clipping result is used to indicate whether clipping the initial image according to the clipping line causes text defects.
As an alternative, the device is configured to determine the target clipping result from the clipping line and the set of text labels by: acquiring a predetermined edge quantity threshold, wherein the edge quantity threshold is used for determining whether a second text region corresponding to a group of text marks causes text defects or not; determining the number of contact points between the cutting line and a group of text marks; under the condition that the number of contact points is larger than or equal to the threshold value of the number of edges, determining a target cutting result as that cutting is performed on the initial image according to cutting lines so as to cause character incomplete; and under the condition that the number of contact points is smaller than the threshold value of the number of edges, determining the target clipping result as that the initial image is clipped according to clipping lines, wherein the initial image is not subject to character incomplete.
As an alternative, the device is configured to determine the second text region from the first text region according to a predetermined clipping line by: filtering the first text region, and determining a third text region meeting the preset size condition; determining a target cutting position according to the cutting line, wherein the target cutting position represents the position of the cutting line in the initial image; and determining a second text area according to the target cutting position, wherein the second text area represents a third text area of which the target cutting position is positioned inside.
As an alternative, the device is configured to filter the first text area and determine a third text area that meets a preset size condition by: acquiring initial size information of an initial image and target size information of a first text region; determining a filtered text region according to the initial size information and the target size information, wherein the filtered text region represents a first text region of which the relation between the target size information and the initial size information does not meet a preset size condition; and deleting the filtered text region from the first text region to obtain a third text region.
As an alternative, the apparatus is configured to determine the filtered text region based on the initial size information and the target size information by at least one of: determining a first text area with a target height greater than or equal to the initial height as a filtered text area in the case that the initial size information includes the initial height and the target size information includes the target height; determining a first text area with a target width greater than or equal to the initial width as a filtered text area in the case where the initial size information includes the initial width and the target size information includes the target width; determining a first text area, in which the ratio of the target height to the initial height is less than or equal to a height ratio threshold, as a filtered text area, in the case where the initial size information includes an initial height and the target size information includes a target height; in the case where the initial size information includes an initial width and the target size information includes a target width, a first text region in which a ratio of the target width to the initial width is less than or equal to a width ratio threshold is determined as a filtered text region.
As an alternative, the device is configured to determine the second text area according to the target clipping position by: acquiring a cutting direction indicated by a cutting line; determining a first edge position and a second edge position of the initial image according to the clipping direction, wherein the first edge position and the second edge position represent edges of the initial image determined along the clipping direction; a third text area with the target clipping position between the first edge position and the second edge position is determined as a second text area.
As an alternative, the means is configured to determine the third text area with the target clipping position located between the first edge position and the second edge position as the second text area by: when the cutting direction represents vertical cutting, the first edge position represents left edge position, the second edge position represents right edge position, the abscissa corresponding to the target cutting position is larger than or equal to the sum of the abscissa corresponding to the left edge position and the first preset boundary threshold value, and determining a third text area, of which the abscissa corresponding to the target cutting position is smaller than or equal to the difference between the abscissa corresponding to the right edge position and the first preset boundary threshold value, as a second text area; or when the cutting direction represents horizontal cutting, the first edge position represents the lower edge position, and the second edge position represents the upper edge position, determining a third text region, in which the ordinate corresponding to the target cutting position is greater than or equal to the sum of the ordinate corresponding to the lower edge position and the second preset boundary threshold value, and the ordinate corresponding to the target cutting position is less than or equal to the difference between the ordinate corresponding to the upper edge position and the second preset boundary threshold value, as the second text region.
As an alternative, the means is configured to determine the third text area with the target clipping position located between the first edge position and the second edge position as the second text area by: when the target cutting positions comprise a plurality of target cutting positions, determining the position relation between the first edge position and the second edge position of each target cutting position corresponding to the third text region in sequence; in the case where any one of the target clipping positions is located between the first edge position and the second edge position, the corresponding third text region is determined as the second text region.
As an alternative, the device is configured to perform target image processing on the second text area to obtain a set of text labels by: performing blurring processing on the second text region to obtain a blurred text region, wherein the blurring processing is used for blurring texture lines of background information in the second text region; performing edge detection on the fuzzy text region to obtain a group of initial edge lines, wherein the edge detection is used for extracting edge information; and screening a group of target edge lines from the group of initial edge lines, and determining the group of target edge lines as a group of text marks, wherein the target edge lines are initial edge lines with line lengths meeting preset conditions.
As an alternative, the apparatus is configured to screen a set of target edge lines from a set of initial edge lines by: performing image corrosion operation on a group of initial edge lines to obtain a group of intermediate edge lines, wherein the image corrosion operation is used for shortening the line length of each initial edge line in the group of initial edge lines, and deleting the corresponding initial edge line when the line length is reduced to be smaller than or equal to a preset length threshold value; and performing image expansion operation on the group of intermediate edge lines to obtain a group of target edge lines, wherein the image expansion operation is used for increasing the line length of each intermediate edge line in the group of intermediate edge lines.
As an alternative, the device is further configured to: determining a clipping line in response to a target clipping operation executed by a target client; or acquiring a cutting frame body configured for the initial image in advance, and determining cutting lines according to the cutting frame body.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
Fig. 17 schematically shows a block diagram of a computer system for implementing an electronic device according to an embodiment of the present application.
It should be noted that, the computer system 1700 of the electronic device shown in fig. 17 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 17, the computer system 1700 includes a central processing unit 1701 (Central Processing Unit, CPU) that can execute various appropriate actions and processes according to a program stored in a Read-Only Memory 1702 (ROM) or a program loaded from a storage portion 1708 into a random access Memory 1703 (Random Access Memory, RAM). In the random access memory 1703, various programs and data necessary for the system operation are also stored. The cpu 1701, the rom 1702, and the ram 1703 are connected to each other via a bus 1704. An Input/Output interface 1705 (i.e., an I/O interface) is also connected to the bus 1704.
The following components are connected to the input/output interface 1705: an input section 1706 including a keyboard, a mouse, and the like; an output portion 1707 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and a speaker, etc.; a storage portion 1708 including a hard disk or the like; and a communication section 1709 including a network interface card such as a local area network card, a modem, or the like. The communication section 1709 performs communication processing via a network such as the internet. The driver 1710 is also connected to the input/output interface 1705 as needed. A removable medium 1711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 1710, so that a computer program read therefrom is installed into the storage portion 1708 as needed.
In particular, according to embodiments of the present application, the processes described in the various method flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1709, and/or installed from the removable media 1711. The computer programs, when executed by the central processor 1701, perform the various functions defined in the system of the present application.
In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1709, and/or installed from the removable media 1711. When executed by the central processor 1701, performs the various functions provided by the embodiments of the present application.
According to still another aspect of the embodiments of the present application, there is further provided an electronic device for implementing the method for determining an image cropping effect described above, where the electronic device may be a terminal device or a server as shown in fig. 1. The present embodiment is described taking the electronic device as a terminal device as an example. As shown in fig. 18, the electronic device comprises a memory 1802 and a processor 1804, the memory 1802 having stored therein a computer program, the processor 1804 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the method in the embodiments of the present application by a computer program.
Alternatively, it will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 18 is merely illustrative, and that fig. 18 is not intended to limit the configuration of the electronic device described above. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 18, or have a different configuration than shown in FIG. 18.
The memory 1802 may be used for storing software programs and modules, such as program instructions/modules corresponding to the method and apparatus for determining an image cropping effect in the embodiments of the present application, and the processor 1804 executes the software programs and modules stored in the memory 1802, thereby performing various functional applications and data processing, that is, implementing the method for determining an image cropping effect described above. The memory 1802 may include high-speed random access memory, but may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1802 may further include memory that is remotely located relative to the processor 1804, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1802 may be used for storing information such as image data, in particular, but not limited to. As an example, as shown in fig. 18, the memory 1802 may include, but is not limited to, an acquisition module 1602, a first determination module 1604, a processing module 1606, and a second determination module 1608 in the determination apparatus including the image clipping effect. In addition, other module units in the above-mentioned image clipping effect determining device may be included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 1806 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 1806 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 1806 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In addition, the electronic device further includes: a display 1808 for displaying the initial image; and a connection bus 1810 for connecting the various module components in the electronic device described above.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the plurality of nodes through a network communication. The nodes may form a peer-to-peer network, and any type of computing device, such as a server, a terminal, etc., may become a node in the blockchain system by joining the peer-to-peer network.
According to one aspect of the present application, there is provided a computer-readable storage medium, from which a processor of an electronic device reads the computer instructions, which the processor executes, so that the electronic device performs a method of determining an image cropping effect provided in various alternative implementations of the above-described determination aspect of an image cropping effect.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a program for executing the method in the embodiments of the present application.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or part of the technical solution that contributes to the prior art, in the form of a software product, which is stored in a storage medium, comprising several instructions for causing one or more electronic devices to perform all or part of the steps of the methods described in the various embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed application may be implemented in other ways. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.

Claims (15)

1. A method for determining an image cropping effect, comprising:
acquiring an initial image to be cut, performing text detection on the initial image, and determining a first text region, wherein the first text region comprises a region in the initial image, in which text information is identified;
determining a second text region from the first text region according to a predetermined cutting line, wherein the second text region comprises a region, which is penetrated by the cutting line, in the first text region;
Performing target image processing on the second text region to obtain a group of text labels, wherein the target image processing is used for extracting edge information of the second text region, and the group of text labels are commonly used for indicating the positions of the text in the second text region;
and determining a target cutting result according to the cutting line and the group of text marks, wherein the target cutting result is used for indicating whether the initial image is cut according to the cutting line to cause text defects or not.
2. The method of claim 1, wherein the determining a target crop result from the crop line and the set of text labels comprises:
acquiring a predetermined edge quantity threshold, wherein the edge quantity threshold is used for determining whether the second text region corresponding to the group of text marks causes text defects or not;
determining the number of contact points between the cutting line and the group of text marks;
determining the target clipping result as that the initial image is clipped according to the clipping line under the condition that the number of the contact points is larger than or equal to the threshold value of the number of the edges, so that character incomplete is caused;
And under the condition that the number of the contact points is smaller than the threshold value of the number of the edges, determining the target clipping result as that the initial image is clipped according to the clipping lines does not cause character defects.
3. The method of claim 1, wherein the determining a second text region from the first text region according to a predetermined clipping line comprises:
filtering the first text region, and determining a third text region meeting a preset size condition;
determining a target clipping position according to the clipping line, wherein the target clipping position represents the position of the clipping line in the initial image;
and determining the second text area according to the target cutting position, wherein the second text area represents the third text area with the target cutting position positioned inside.
4. The method of claim 3, wherein the filtering the first text region to determine a third text region that meets a preset size condition comprises:
acquiring initial size information of the initial image and target size information of the first text region;
Determining a filtered text region according to the initial size information and the target size information, wherein the filtered text region represents the first text region of which the relation between the target size information and the initial size information does not meet the preset size condition;
and deleting the filtered text region from the first text region to obtain the third text region.
5. The method of claim 4, wherein said determining a filtered text region based on said initial size information and said target size information comprises at least one of:
determining the first text area, of which the target height is greater than or equal to the initial height, as the filtered text area in the case where the initial size information includes an initial height and the target size information includes a target height;
determining the first text area with the target width being greater than or equal to the initial width as the filtered text area in the case that the initial size information includes an initial width and the target size information includes a target width;
determining the first text area, in which the ratio of the target height to the initial height is less than or equal to a height ratio threshold, as the filtered text area, in a case where the initial size information includes an initial height and the target size information includes a target height;
And in the case that the initial size information includes an initial width and the target size information includes a target width, determining the first text area, in which a ratio of the target width to the initial width is less than or equal to a width ratio threshold, as the filtered text area.
6. The method of claim 3, wherein the determining the second text region from the target clipping location comprises:
acquiring a cutting direction indicated by the cutting line;
determining a first edge position and a second edge position of the initial image according to the clipping direction, wherein the first edge position and the second edge position represent edges of the initial image determined along the clipping direction;
the third text area with the target clipping position between the first edge position and the second edge position is determined as the second text area.
7. The method of claim 6, wherein the determining the third text area with the target clipping position between the first edge position and the second edge position as the second text area comprises:
When the clipping direction represents vertical clipping, the first edge position represents a left edge position, and the second edge position represents a right edge position, determining the third text region, in which the abscissa corresponding to the target clipping position is greater than or equal to the sum of the abscissa corresponding to the left edge position and a first preset boundary threshold value, and the abscissa corresponding to the target clipping position is less than or equal to the difference between the abscissa corresponding to the right edge position and the first preset boundary threshold value, as the second text region; or alternatively
And determining the third text area, which is larger than or equal to the sum of the ordinate corresponding to the target cutting position and a second preset boundary threshold value and smaller than or equal to the difference between the ordinate corresponding to the upper edge position and the second preset boundary threshold value, as the second text area when the cutting direction represents horizontal cutting and the first edge position represents lower edge position and the second edge position represents upper edge position.
8. The method of claim 6, wherein the determining the third text area with the target clipping position between the first edge position and the second edge position as the second text area comprises:
When the target clipping positions include a plurality of target clipping positions, determining a positional relationship between the first edge position and the second edge position of each target clipping position corresponding to the third text region in turn;
and determining the corresponding third text area as the second text area when any one of the target clipping positions is located between the first edge position and the second edge position.
9. The method of claim 1, wherein said performing a target image process on said second text region results in a set of text labels, comprising:
performing blurring processing on the second text region to obtain a blurred text region, wherein the blurring processing is used for blurring texture lines of background information in the second text region;
performing edge detection on the fuzzy text region to obtain a group of initial edge lines, wherein the edge detection is used for extracting the edge information;
and screening a group of target edge lines from the group of initial edge lines, and determining the group of target edge lines as the group of text marks, wherein the target edge lines are initial edge lines with line lengths meeting preset conditions.
10. The method of claim 9, wherein the screening a set of target edge lines from the set of initial edge lines and determining the set of target edge lines as the set of text labels comprises:
performing image corrosion operation on the group of initial edge lines to obtain a group of intermediate edge lines, wherein the image corrosion operation is used for shortening the line length of each initial edge line in the group of initial edge lines, and deleting the corresponding initial edge line when the line length is reduced to be smaller than or equal to a preset length threshold value;
and performing image expansion operation on the group of intermediate edge lines to obtain a group of target edge lines, wherein the image expansion operation is used for increasing the line length of each intermediate edge line in the group of intermediate edge lines.
11. The method according to any one of claims 1 to 10, further comprising:
determining the clipping line in response to a target clipping operation executed by a target client; or alternatively
And acquiring a cutting frame body configured for the initial image in advance, and determining the cutting lines according to the cutting frame body.
12. A device for determining an image cropping effect, comprising:
the device comprises an acquisition module, a text detection module and a text detection module, wherein the acquisition module is used for acquiring an initial image to be cut, performing text detection on the initial image and determining a first text area, wherein the first text area comprises an area in the initial image, in which text information is identified;
the first determining module is used for determining a second text area from the first text area according to a predetermined cutting line, wherein the second text area comprises an area, which is penetrated by the cutting line, in the first text area;
the processing module is used for carrying out target image processing on the second text region to obtain a group of text marks, wherein the target image processing is used for extracting edge information of the second text region, and the group of text marks are commonly used for indicating the positions of the text in the second text region;
and the second determining module is used for determining a target cutting result according to the cutting line and the group of character marks, wherein the target cutting result is used for indicating whether cutting is performed on the initial image according to the cutting line to cause character incomplete.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored computer program, wherein the computer program is executable by an electronic device to perform the method of any one of claims 1 to 11.
14. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method as claimed in any one of claims 1 to 11.
15. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 11 by means of the computer program.
CN202311486650.7A 2023-11-08 2023-11-08 Method and device for determining image cropping effect, storage medium and electronic equipment Pending CN117541546A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311486650.7A CN117541546A (en) 2023-11-08 2023-11-08 Method and device for determining image cropping effect, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311486650.7A CN117541546A (en) 2023-11-08 2023-11-08 Method and device for determining image cropping effect, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117541546A true CN117541546A (en) 2024-02-09

Family

ID=89785362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311486650.7A Pending CN117541546A (en) 2023-11-08 2023-11-08 Method and device for determining image cropping effect, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117541546A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117892698A (en) * 2024-03-14 2024-04-16 成都数之联科技股份有限公司 Text gradual change rendering method, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117892698A (en) * 2024-03-14 2024-04-16 成都数之联科技股份有限公司 Text gradual change rendering method, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110163198B (en) Table identification reconstruction method and device and storage medium
CN111709420B (en) Text detection method, electronic device and computer readable medium
CN111652218A (en) Text detection method, electronic device and computer readable medium
CN112101386B (en) Text detection method, device, computer equipment and storage medium
CN112749696B (en) Text detection method and device
CN112990205B (en) Method and device for generating handwritten character sample, electronic equipment and storage medium
CN111681198A (en) Morphological attribute filtering multimode fusion imaging method, system and medium
CN112749606A (en) Text positioning method and device
CN112507876A (en) Wired table picture analysis method and device based on semantic segmentation
CN113591746B (en) Document table structure detection method and device
CN112883926B (en) Identification method and device for form medical images
CN110889374A (en) Seal image processing method and device, computer and storage medium
CN111563505A (en) Character detection method and device based on pixel segmentation and merging
CN113505702A (en) Pavement disease identification method and system based on double neural network optimization
CN117541546A (en) Method and device for determining image cropping effect, storage medium and electronic equipment
Zheng et al. A new artistic information extraction method with multi channels and guided filters for calligraphy works
CN112669204B (en) Image processing method, training method and device of image processing model
CN113537187A (en) Text recognition method and device, electronic equipment and readable storage medium
CN112418220A (en) Single word detection method, device, equipment and medium
CN118115932A (en) Image regressor training method, related method, device, equipment and medium
CN116798041A (en) Image recognition method and device and electronic equipment
US11468658B2 (en) Systems and methods for generating typographical images or videos
CN114387315A (en) Image processing model training method, image processing device, image processing equipment and image processing medium
CN114648751A (en) Method, device, terminal and storage medium for processing video subtitles
CN113888758B (en) Curved character recognition method and system based on complex scene

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication