Image cutting method, system and related equipment

By determining the probability distribution information of the category to which the image belongs based on the target characteristics, selecting the applicable cropping algorithm and generating the crop line group, the problems of low image cropping accuracy and narrow application range in the prior art are solved, and image cropping with high precision and diversity requirements are achieved.

CN119477949BActive Publication Date: 2025-05-13BEIJING STARSHINE DIGITAL SYST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510079750.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-18
Publication Date
2025-05-13
Estimated Expiration
2045-01-18

AI Technical Summary

Technical Problem

The prior art cannot be applied to multiple requirements at the same time during the cropping process of electronic scanning images, and the cropping accuracy is low.

Method used

By determining the probability distribution information of the category to which the image belongs based on the target characteristics, selecting the applicable cropping algorithm, generating a crop line group, and performing cropping operations based on confidence to achieve high-precision image cropping.

Benefits of technology

It achieves meeting the cropping needs of multiple electronic scan images at the same time, improves the cropping accuracy, and can automatically adjust the cropping algorithm and line groups according to different image features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477949B_ABST
    Figure CN119477949B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide an image cropping method, system and related equipment, which relate to the field of image processing technology, wherein the method includes: determining the probability distribution information of the category to which the target image belongs according to the target features, wherein the target features include: line segment features, and / or color difference features; determining the target cropping algorithm according to the probability distribution information of the category to which it belongs; determining the target cropping line group according to the target cropping algorithm; determining the confidence of the pre-cropping result according to the category probability distribution information, the target cropping algorithm, and / or the target cropping line group; performing the target operation to generate the target image cropping result according to the confidence. In this way, the present application can simultaneously meet the cropping requirements of multiple electronically scanned images and improve the cropping accuracy of electronically scanned images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to an image cropping method, system and related equipment. Background Art

[0002] With the gradual advancement of the digitalization process, all kinds of manuscript archives, especially book archives, need to be converted from physical form to electronic form based on various needs or purposes. Cropping of electronic images is mainly used to remove irrelevant content such as the scanned background and retain the key content of the original scanned document.

[0003] In the related art, most of them perform cropping operations on the electronic images generated during the scanning process based on a single algorithm. The above method has the problems of not being able to simultaneously meet various electronic scan image cropping requirements and having poor electronic scan image cropping accuracy.

[0004] Therefore, a new technical solution is urgently needed to solve the above technical problems. Summary of the invention

[0005] According to an embodiment of the present application, an image cropping method, system and related equipment are provided, which can simultaneously meet the cropping requirements of multiple electronic scanned images and improve the cropping accuracy of electronic scanned images.

[0006] In a first aspect of the present application, there is provided an image cropping method, comprising:

[0007] Determine the probability distribution information of the category to which the target image belongs according to the target feature, wherein the target feature includes: line segment feature and / or color difference feature;

[0008] Determine the target cutting algorithm based on the probability distribution information of the category to which it belongs;

[0009] According to the target cutting algorithm, determine the target cutting line group;

[0010] Determine the confidence of the pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group;

[0011] Based on the confidence level, a target operation is performed to generate a target image cropping result.

[0012] In some feasible implementations, the above-mentioned performing the target operation according to the confidence level to generate the target image cropping result includes:

[0013] When the confidence level is less than a preset confidence threshold, performing a target correction operation on the target cutting line group so that the confidence level is greater than or equal to the preset confidence threshold;

[0014] When the confidence is greater than a preset confidence threshold, a target cropping operation is performed on the target cropping image according to the target cropping line group to generate a target image cropping result.

[0015] In some feasible implementations, the above method further includes:

[0016] Determine target correction information according to the target cutting line group and the original line group of the target image;

[0017] According to the target correction information, a target correction operation is performed on the target cutting line group, wherein the target correction information includes: a target correction angle and / or a target correction direction. In some feasible implementations, the method further includes:

[0018] When it is determined that the length of the first target line segment is less than or equal to the first preset length, and the coordinate difference between the first target line segments greater than or equal to the preset number is less than or equal to the preset coordinate difference,

[0019] According to the plurality of first target line segments, a target line segment is generated by fusing;

[0020] Generate a target cutting line group based on the target line segment.

[0021] In some feasible implementations, the above method further includes:

[0022] Determine the second target line segment distribution information according to the pre-cutting result, wherein the second target line segment distribution information includes: the distribution position and / or the distribution quantity of the second target line segment;

[0023] A first score is determined according to the second target line segment distribution information and a preset scoring mechanism, wherein the first score is used to evaluate the target cutting algorithm, the length of the second target line segment is greater than or equal to a second preset length, and the second preset length is greater than the first preset length.

[0024] In some feasible implementations, the target cutting line group includes: a first cutting line and a second cutting line, the first cutting line being perpendicular to the second cutting line;

[0025] The above method further includes:

[0026] Determine a length ratio and / or an area ratio according to the first cutting line and the second cutting line;

[0027] Determining a first evaluation factor according to the length ratio and a first preset ratio;

[0028] Determining a second evaluation factor according to the area ratio and a second preset ratio;

[0029] A second score is determined according to the first evaluation factor and / or the second evaluation factor, wherein the second score is used to evaluate the target cutting line group.

[0030] In some feasible implementations, the above method further includes:

[0031] The confidence level is determined according to the color difference of the pre-cropped result, the maximum probability of the category to which the target image belongs, the first score, and / or the second score.

[0032] In a second aspect of the present application, an image cropping system is provided, comprising:

[0033] A first determining unit is used to determine the probability distribution information of the category to which the target image belongs according to the target feature, wherein the target feature includes: a line segment feature and / or a color difference feature;

[0034] A second determination unit, used to determine a target cutting algorithm according to the probability distribution information of the category to which it belongs;

[0035] A third determining unit, configured to determine a target cutting line group according to a target cutting algorithm;

[0036] A fourth determination unit, configured to determine the confidence of the pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group;

[0037] The execution unit is used to perform a target operation to generate a target image cropping result according to the confidence level.

[0038] In a third aspect of the present application, an electronic device is provided, comprising: a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used to execute the image cropping method as described in any one of the above items when the processor is executed.

[0039] In a fourth aspect of the present application, a computer storage medium is provided, on which program instructions are stored, and the program instructions are used to execute the image cropping method as described in any one of the above items when running.

[0040] The embodiment of the present application provides an image cropping method, system and related equipment, wherein the method includes: determining the probability distribution information of the category to which the target image belongs according to the target features, wherein the target features include: line segment features, and / or color difference features; determining the target cropping algorithm according to the probability distribution information of the category to which it belongs; determining the target cropping line group according to the target cropping algorithm; determining the confidence of the pre-cropping result according to the category probability distribution information, the target cropping algorithm, and / or the target cropping line group; performing the target operation to generate the target image cropping result according to the confidence. The present application can meet the cropping requirements of multiple electronically scanned images at the same time and improve the cropping accuracy of electronically scanned images.

[0041] It should be understood that the contents described in the Summary of the Invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0043] Figure 1 A schematic diagram of the process of an image cropping method provided in an embodiment of the present application;

[0044] Figure 2 A structural schematic diagram of a target cutting line group provided in an embodiment of the present application;

[0045] Figure 3 A structural schematic diagram of an image cropping system provided in an embodiment of the present application;

[0046] Figure 4 A structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0048] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0049] According to a first aspect of the embodiments of the present application, an image cropping method is provided. Figure 1 A schematic diagram of the process of an image cropping method 100 provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the method 100 includes:

[0050] Step S110: Determine the probability distribution information of the category to which the target image belongs based on the target features, wherein the target features include: line segment features, and / or color difference features.

[0051] Exemplarily, the above-mentioned target features may also include: size features, texture features, contour features, and / or shape features, etc.

[0052] In some feasible implementations, the probability distribution information of the category to which the target image belongs can be determined based on the target features and the preset image classification model. The preset image classification model can be generated based on deep learning algorithms, preset image databases, feature databases corresponding to preset images, and databases of categories corresponding to preset images. Specifically, the preset model classification model can include: VGG16 model, RENET50 model, etc.

[0053] Specifically, the target image can be subjected to feature recognition based on the target convolution operation and / or the target pooling operation to determine the target feature vector and / or the target feature vector matrix corresponding to the target feature, and the target feature vector and / or the target feature vector matrix are input into the preset image classification model to determine the probability distribution information of the category according to the target feature. The target feature vector matrix can include: a line segment feature matrix, a color difference feature matrix, a size feature matrix, a texture feature matrix, a contour feature matrix, and / or a shape feature matrix, etc.

[0054] Exemplarily, the categories may include: manuscripts, documents, receipts, and / or artworks, etc. It should be noted that the above categories may be expanded and defined according to actual needs of users.

[0055] Exemplarily, the above-mentioned preset image classification model can determine the probability distribution information of the category to which the target image belongs based on the similarity between the target features of the target image and the corresponding features of manuscript images, document images, receipt images, and / or artwork images.

[0056] Specifically, when the similarity between the target features of the target image and the corresponding features of the manuscript image is 0.3, the similarity with the corresponding features of the document image is 0.6, and the similarity with the corresponding features of the artwork image is 0.1, the probability distribution information of the category to which the target image belongs is determined as follows: the probability that the target image belongs to the manuscript class is 0.3, the probability that it belongs to the document class is 0.6, and the probability that it belongs to the artwork class is 0.1.

[0057] It should be noted that the preset image classification model can be corrected according to the actual category distribution information of the target image and the category probability distribution information output by the preset image classification model.

[0058] Exemplarily, when the target image actually belongs to a document image category, the vector corresponding to the actual category probability distribution information of the target image is (0, 1, 0), and the corresponding vector of the category probability distribution information output by the preset image classification model is (0.3, 0.6, 0.1). Based on the vector difference between the vector (0, 1, 0) corresponding to the actual category probability distribution information of the target image and the vector (0.3, 0.6, 0.1) corresponding to the category probability distribution information output by the preset image classification model, the parameters of the preset image classification model are adjusted to improve the output accuracy of the preset image classification model for the category probability distribution information of the target image.

[0059] Step S120: Determine the target cutting algorithm according to the probability distribution information of the category.

[0060] For example, the corresponding target clipping algorithm may be determined according to the maximum probability in the probability distribution information of the above-mentioned category, wherein the above-mentioned target clipping algorithm may include: a minimum significant difference clipping algorithm, a color difference clipping algorithm, and the like.

[0061] Specifically, when the probability that the target image belongs to the manuscript class is the largest, it can be determined that the target cropping algorithm is the minimum significant difference cropping algorithm.

[0062] Specifically, when the probability that the target image belongs to the artwork class is the largest, it can be determined that the target cropping algorithm is the color difference cropping algorithm.

[0063] Step S130: Determine a target cutting line group according to a target cutting algorithm.

[0064] Exemplarily, when it is determined that the target cropping algorithm is the least significant difference cropping algorithm, a target straight line segment group in the target image is determined based on the least significant difference cropping algorithm to determine the target cropping line group.

[0065] Exemplarily, the target cutting line group may include: a line segment along the first direction whose length is greater than a preset multiple of the longest line segment in the first direction, and / or a line segment along the second direction whose length is greater than a preset multiple of the longest line segment in the second direction.

[0066] Specifically, the first direction may be a vertical direction, the second direction may be a horizontal direction, and the preset multiple may be 0.7. The target cutting line group may include a line segment along the vertical direction whose length is greater than 0.7 times the longest line segment in the vertical direction, and / or a line segment along the horizontal direction whose length is greater than 0.7 times the longest line segment in the horizontal direction.

[0067] Specifically, Figure 2 A structural schematic diagram of a target cutting line group provided in an embodiment of the present application. Figure 2 As shown, the target cutting line group 10 may include: a target contour line 11 , and / or a target gap line 12 .

[0068] Exemplarily, when the target cropping algorithm is determined to be a color difference cropping algorithm, the color difference boundary between the noise image and the target image can be determined based on the hue difference between the noise pixels and the target pixels, the contour boundary between the noise image and the target image can be determined based on the color difference boundary, and the target cropping line group can be determined based on the contour boundary group. It should be noted that the noise image can include: a scanned background image in the target image. The target image can include: a paper image, a text image, and / or a substantial content image such as a graphic image corresponding to the original scanned document.

[0069] Step S140: Determine the confidence of the pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group.

[0070] Exemplarily, the confidence of the pre-cutting result may be determined based on the category probability distribution information, the score of the target cutting algorithm, and / or the score of the target cutting line group.

[0071] Specifically, according to the actual needs of the user, a corresponding weight can be assigned to the probability distribution information of the category to which the above-mentioned target image belongs, a corresponding weight can be assigned to the score of the above-mentioned target cropping algorithm, and a corresponding weight can be assigned to the score of the above-mentioned target cropping line group, so as to determine the confidence of the above-mentioned pre-cutting result based on the category probability distribution information and the corresponding weight, the score and corresponding weight of the target cropping algorithm, and / or the score and corresponding weight of the target cropping line group.

[0072] Step S150: Execute a target operation to generate a target image cropping result according to the confidence level.

[0073] Exemplarily, the above target operation may include: a correction operation, a cropping operation, etc.

[0074] In some feasible embodiments, the above-mentioned performing a target operation based on the confidence to generate a target image cropping result includes: when the confidence is less than a preset confidence threshold, performing a target correction operation on the target cropping line group to make the confidence greater than or equal to the preset confidence threshold; when the confidence is greater than the preset confidence threshold, performing a target cropping operation on the target cropping image according to the target cropping line group to generate a target image cropping result.

[0075] It should be noted that the above-mentioned preset confidence threshold is positively correlated with the user's requirement for the cropping accuracy of the target image, that is, the higher the requirement for the cropping accuracy of the target image, the larger the above-mentioned preset confidence threshold. Among them, the above-mentioned preset confidence threshold can be set differently corresponding to the target category to which the target image belongs, so as to further improve the cropping accuracy of the target image.

[0076] Exemplarily, when the confidence of the above-mentioned pre-cropping result determined based on the above-mentioned category probability distribution information, the score of the target cropping algorithm, and / or the score of the target cropping line group is less than or equal to a preset confidence threshold corresponding to the category to which the target image belongs, a target correction operation is performed on the target cropping line group so that the confidence is greater than or equal to the above-mentioned preset confidence threshold, and then a cropping operation is performed on the target cropping image based on the corrected target cropping line group to generate a target image cropping result.

[0077] It should be noted that, when all correction operations on the target cutting line group have been completed and the above confidence is still less than the preset confidence threshold corresponding to the category to which the target image belongs, a correction operation is performed in the cutting process to improve the cutting accuracy of the target image. Among them, the correction operation of the cutting process can be implemented manually. It should be noted that the relevant data generated by the manual correction process can be stored as training samples to further improve the determination accuracy of the target cutting line group.

[0078] Exemplarily, when the confidence of the above-mentioned pre-cropping result determined by the above-mentioned category probability distribution information, the score of the target cropping algorithm, and / or the score of the target cropping line group is greater than the preset confidence threshold corresponding to the category to which the target image belongs, the cropping operation is performed directly on the target cropping image based on the above-mentioned target cropping line group to generate the target image cropping result.

[0079] Therefore, the above method can realize the precise execution of the corresponding target operation to generate the target image cropping result according to the comparison result between the confidence and the preset confidence threshold. When the confidence is less than the preset confidence threshold, the target correction operation is precisely performed on the target cropping line group. When the confidence is greater than or equal to the preset confidence threshold, the cropping operation is performed on the target cropping image based on the target cropping line group, which is beneficial to improve the output accuracy of the target image cropping result.

[0080] Based on this, the image cropping method proposed in the embodiment of the present application includes: determining the probability distribution information of the category to which the target image belongs according to the target features, wherein the target features include: line segment features, and / or color difference features; determining the target cropping algorithm according to the probability distribution information of the category to which it belongs; determining the target cropping line group according to the target cropping algorithm; determining the confidence of the pre-cropping result according to the category probability distribution information, the target cropping algorithm, and / or the target cropping line group; performing the target operation to generate the target image cropping result according to the confidence. The present application can accurately determine the probability distribution information of the category to which the target image belongs according to the line segment features and / or color difference features of the target image; accurately select the applicable target cropping algorithm according to the probability distribution information of the category to which it belongs; accurately generate the target cropping line group according to the target cropping algorithm; objectively and quantitatively determine the confidence of the pre-cropping result in multiple dimensions according to the category probability distribution information, the target cropping algorithm, and / or the target cropping line group; thereby improving the execution accuracy of the target operation to improve the output accuracy of the target image cropping result.

[0081] In some feasible implementations, the above method further includes: determining target correction information based on the target cutting line group and the original line group of the target image; performing a target correction operation on the target cutting line group based on the target correction information, wherein the above target correction information includes: a target correction angle, and / or a target correction direction.

[0082] Exemplarily, the above-mentioned original line group may include: original contour lines of the target image, and / or gap lines.

[0083] It should be noted that the target cutting line group may constitute a cutting interface. The original line group may constitute an original interface to be cut. The target correction information may be determined by comparing the constituent lines of the target cutting interface with the constituent lines of the corresponding original interface to be cut.

[0084] Exemplarily, the deviation angles of the four sides of the target rectangular cutting interface and the four sides of the original cutting interface can be determined by comparing the target rectangular cutting interface and the original cutting interface, and the target correction angle and / or the target correction direction can be determined based on the deviation angles. The deviation angle information can include: a first deviation angle, a second deviation angle, a third deviation angle, and a fourth deviation angle.

[0085] Exemplarily, when the fourth deviation angle is the largest, the target correction angle is determined according to an average value of the first deviation angle, the second deviation angle and the third deviation angle.

[0086] Exemplarily, based on the target correction angle and / or the target correction direction, a target correction operation can be performed on the target cutting line group so that the difference between the deviation angles of the four sides of the target rectangular cutting interface and the four sides of the original to-be-cut interface and the target correction angle is less than or equal to a preset difference, wherein the preset difference is determined according to the preset confidence threshold.

[0087] Based on this, the above method can accurately determine the target correction information by comparing the target cutting line group and the original line group, and accurately perform the target correction operation on the target cutting line group based on the above target correction information, so that the confidence is greater than or equal to the preset confidence threshold, thereby further improving the output accuracy of the target image cutting result.

[0088] In some feasible implementations, the above method further includes: when it is determined that the length of the first target line segment is less than or equal to the first preset length, and there are greater than or equal to a preset number of first target line segments whose coordinate difference is less than or equal to the preset coordinate difference, based on multiple first target line segments, fusing and generating a target line segment; based on the target line segment, generating a target cutting line group.

[0089] Exemplarily, the first preset length, the preset number, and / or the preset coordinate difference can be set differently according to the target category to which the target image belongs. The preset coordinate difference may include: the coordinate difference corresponding to the first direction, for example, the y-axis coordinate difference, and / or the coordinate difference corresponding to the second direction, for example, the x-axis coordinate difference.

[0090] Exemplarily, when it is determined that the length of the first target line segment of the target image is less than or equal to the first preset length, and there are greater than or equal to the preset number of first target line segments whose first direction coordinate difference is less than or equal to the preset coordinate difference corresponding to the first direction, and / or there are greater than or equal to the preset number of first target line segments whose second direction coordinate difference is less than or equal to the preset coordinate difference corresponding to the second direction, then based on the coordinate information of the plurality of first target line segments, a fusion operation and / or a pixel compensation operation are performed on the plurality of first target line segments to generate the target line segment, and based on the target line segment, a target cutting line group is generated. Wherein, the length of the target line segment is greater than the first direction, and / or the length of the longest line segment in the second direction corresponds to a preset multiple.

[0091] Specifically, the value of the preset coordinate difference corresponding to the first direction may be 0.0014 times the length of the longest line segment along the first direction. The value of the preset coordinate difference corresponding to the second direction may be 0.0014 times the length of the longest line segment along the second direction.

[0092] Exemplarily, a fusion operation and / or a pixel compensation operation may be performed on the two first target line segments with the largest coordinate difference in the first direction to generate the target line segment. For example: based on the corresponding coordinate information of the two first target line segments with the largest coordinate difference in the y-axis, a fusion operation and / or a pixel compensation operation may be performed to generate the target line segment. And / or, a fusion operation and / or a pixel compensation operation may be performed on the corresponding coordinate information of the two first target line segments with the largest coordinate difference in the second direction to generate the target line segment. For example: based on the corresponding coordinate information of the two first target line segments with the largest coordinate difference in the x-axis, a fusion operation and / or a pixel compensation operation may be performed to generate the target line segment.

[0093] Based on this, the above method can be implemented to achieve the situation that when it is determined that the length of the first target line segment is less than or equal to the first preset length, and there are greater than or equal to a preset number of the first target line segments whose coordinate difference is less than or equal to the preset coordinate difference, based on the above multiple first target line segments, the target line segment is accurately fused and generated, and based on the above target line segments, the target cutting line group is accurately generated, which is conducive to avoiding the breakage of the original contour line and / or the original seam line of the target image due to abnormalities in the scanning process of the original scanned document, resulting in the loss of the target cutting line group, thereby ensuring the integrity of the target cutting line group and improving the output accuracy of the target image cutting result.

[0094] In some feasible implementations, the above method further includes: determining second target line segment distribution information based on the pre-cutting result, wherein the second target line segment distribution information includes: the distribution position of the second target line segment, and / or the distribution quantity; determining a first score based on the second target line segment distribution information and a preset scoring mechanism, wherein the first score is used to evaluate the target cutting algorithm, and the length of the second target line segment is greater than or equal to the second preset length, and the second preset length is greater than the first preset length.

[0095] Exemplarily, the distribution number of the second target line segments in the first preset part and / or the distribution number of the second target line segments in the second preset part may be determined according to the second target line segment distribution information.

[0096] Specifically, the first preset position may include: a position whose distance from the target contour line is less than or equal to a first preset multiple of the target contour line length. And / or, a position whose distance from the target gap line is less than or equal to a first preset multiple of the target gap line length. The first preset multiple may be: two thirds.

[0097] Specifically, the second preset position may include: a position whose distance from the target contour line is greater than a first preset multiple of the target contour line length and less than or equal to a second preset multiple of the target contour line length. And / or, a position whose distance from the target gap line is greater than a first preset multiple of the target gap line length and less than or equal to a second preset multiple of the target gap line length. The second preset multiple may be: one-half.

[0098] Exemplarily, the preset scoring mechanism may include: a first scoring mechanism, and / or a second scoring mechanism, wherein the first scoring mechanism is used to determine a basic score based on the distribution number of the second target line segment in the first preset part; the second scoring mechanism is used to determine the first score based on the distribution number of the second target line segment in the second preset part and the basic score. It should be noted that the preset scoring mechanism may also be set differently according to the target category to which the target image belongs.

[0099] Specifically, the first scoring mechanism may include: setting the initial score to 0, and implementing a corresponding scoring mechanism when the second target line segment exists at a position whose distance from the target contour line is less than or equal to a first preset multiple of the target contour line length. And / or, implementing a corresponding scoring mechanism when the second target line segment exists at a position whose distance from the target gap line is less than or equal to a first preset multiple of the target gap line length.

[0100] For example, the first preset part can be divided twice based on the four sides of the target rectangular cutting interface to generate the first part, the second part, the third part and the fourth part. If the second target line segment exists in any of the above parts, 0.25 points will be added accordingly. It should be noted that if the second target line segment exists in the first part, the second part, the third part and the fourth part, the basic score is 1 point.

[0101] Specifically, the second scoring mechanism may include: if the second target line segment exists at a position whose distance from the target contour line is greater than a first preset multiple of the target contour line length and less than or equal to a second preset multiple of the target contour line length, a corresponding deduction mechanism is implemented. And / or, if the second target line segment exists at a position whose distance from the target gap line is greater than a second preset multiple of the target gap line length and less than or equal to a second preset multiple of the target contour line length, a corresponding deduction mechanism is implemented.

[0102] For example, the second preset part can be divided twice based on the four sides of the target rectangular cutting interface to generate the fifth part, the sixth part, the seventh part and the eighth part. If the second target line segment exists in any of the above parts, the basic score is reduced by 0.05 points accordingly.

[0103] Based on this, the above method can accurately determine the distribution position and / or distribution number of the second target line segment of the target image according to the above pre-cutting results, and based on a preset scoring mechanism, accurately determine the score of the target cutting algorithm according to the distribution position and / or distribution number of the above second target line segment, thereby achieving a quantitative and objective evaluation of the target cutting algorithm and providing accurate data support for determining the confidence of the pre-cutting results.

[0104] In some feasible implementations, the target cutting line group includes: a first cutting line and a second cutting line, and the first cutting line is perpendicular to the second cutting line.

[0105] Exemplarily, the first cutting line may be a cutting line corresponding to a first direction. The second cutting line may be a cutting line corresponding to a second direction. Specifically, the first direction may be a vertical direction, and the second direction may be a horizontal direction.

[0106] The above method also includes: determining a length ratio and / or an area ratio based on the first cutting line and the second cutting line; determining a first evaluation factor based on the length ratio and a first preset ratio; determining a second evaluation factor based on the area ratio and the second preset ratio; and determining a second score based on the first evaluation factor and / or the second evaluation factor, wherein the second score is used to evaluate the target cutting line group.

[0107] Exemplarily, the length ratio may be a ratio of the first cutting line length to the second cutting line length, that is, a ratio of the vertical cutting line length to the horizontal cutting line length.

[0108] Exemplarily, the area ratio may be: a ratio of an area formed by the target cutting line group to an area formed by the original line group.

[0109] It should be noted that the first preset ratio and the second preset ratio may be set differently according to the target category to which the target image belongs.

[0110] For example, the first evaluation factor can be determined based on the following formula (1):

[0111] (1)

[0112] in, is the first evaluation factor, is the first scaling factor, is the length of the first cutting line, is the length of the second cutting line, is the length ratio, is a first preset ratio. Specifically, the first scaling factor Can be set to 2.

[0113] For example, the second evaluation factor can be determined based on the following formula (2):

[0114] (2)

[0115] in, is the second evaluation factor, is the area formed by the target cutting line group, is the area formed by the original line group, is the area ratio, is the second preset ratio.

[0116] Specifically, the first preset ratio Can be set to: 1.41:1, the second preset above The ratio can be set to 0.65.

[0117] For example, the second score may be determined based on the following formula (3):

[0118] (3)

[0119] in, For the second rating, is the first evaluation factor, is the second evaluation factor, is the second scaling factor. Specifically, the second scaling factor Can be set to 2.

[0120] Based on this, the above method can accurately determine the first evaluation factor based on the length ratio and the first preset ratio, and accurately determine the second evaluation factor based on the area ratio and the second preset ratio, so as to accurately determine the second score of the target cutting line group according to the first evaluation factor and the second evaluation factor, so as to provide accurate data support for determining the confidence of the pre-cutting results.

[0121] In some feasible implementations, the method further includes: determining a confidence level based on the color difference of the pre-cropped result, the maximum probability of the category to which the target image belongs, the first score, and / or the second score.

[0122] It should be noted that the color difference can be determined according to the brightness difference, saturation difference, hue angle difference and rotation factor of the pre-cropping result.

[0123] For example, the color difference can be determined based on the following formula (4) according to the brightness difference, saturation difference, hue angle difference and rotation factor:

[0124] (4)

[0125] in, is the color difference, For brightness difference, is the saturation difference, is the hue angle difference, is the rotation factor.

[0126] Exemplarily, according to the color difference, the maximum probability of the category to which the target image belongs, the first score, and / or the second score, the confidence level may be determined based on the following formula (5):

[0127] (5)

[0128] Among them, the above is the confidence level, is the weight corresponding to the color difference, is the color difference, is the weight corresponding to the first score, For the first rating, is the weight corresponding to the second score, For the second rating, is the weight corresponding to the maximum probability of the classification to which the target image belongs, is the maximum probability of the category to which the target image belongs.

[0129] It should be noted that the above color difference corresponds to the weight 、The weight corresponding to the first score , the weight corresponding to the second score And the maximum probability corresponding weight of the classification to which the above target image belongs The color difference can be set differently according to the target category to which the target image belongs. 、The weight corresponding to the first score , the weight corresponding to the second score And the maximum probability corresponding weight of the classification to which the above target image belongs One or more of them can be set to 0 according to the target category to which the target image belongs.

[0130] Based on this, the above method can realize multi-dimensional precise determination of the confidence of the pre-cutting result based on the color difference dimension, the probability dimension of the category to which the target image belongs, the scoring dimension of the target cropping algorithm, and / or the scoring dimension of the target cropping line group, thereby improving the execution accuracy of the above target operation and further improving the output accuracy of the target image cropping result.

[0131] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0132] The above is an introduction to the method embodiment. The following is a further explanation of the scheme described in this application through an apparatus embodiment.

[0133] According to a second aspect of the embodiments of the present application, an image cropping system is provided. Figure 3 FIG. 2 is a structural diagram of an image cropping system 200 provided in an embodiment of the present application. Figure 3 The system 200 shown includes: a first determining unit 210 , a second determining unit 220 , a third determining unit 230 , a fourth determining unit 240 and an executing unit 250 .

[0134] A first determining unit 210 is used to determine the probability distribution information of the category to which the target image belongs according to the target feature, wherein the target feature includes: a line segment feature and / or a color difference feature;

[0135] A second determination unit 220, configured to determine a target cutting algorithm according to the probability distribution information of the category to which it belongs;

[0136] A third determining unit 230 is used to determine a target cutting line group according to a target cutting algorithm;

[0137] The fourth determining unit 240 is used to determine the confidence of the pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group;

[0138] The execution unit 250 is used to execute a target operation to generate a target image cropping result according to the confidence level.

[0139] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described method can refer to the corresponding process in the aforementioned system embodiment, and will not be repeated here.

[0140] Figure 4 Schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present application. Figure 4As shown, the electronic device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 into the random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the terminal device or the server are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0141] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.

[0142] In particular, according to an embodiment of the present application, the above method flow steps can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program includes a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above-mentioned functions defined in the system of the present application are executed.

[0143] It should be noted that the computer-readable medium described in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0144] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of the code, and the aforementioned module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0145] The units or modules involved in the embodiments described in the present application may be implemented by software or hardware. The units or modules described may also be arranged in a processor. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.

[0146] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.

Claims

1. An image cropping method, characterized in that: Applicable to scanning documents, the method comprises: Determine the probability distribution information of the category to which the target image belongs according to the target feature, wherein the target feature includes: line segment feature and / or color difference feature; Determining a target cutting algorithm according to the probability distribution information of the category; Determine a target cutting line group according to the target cutting algorithm; Wherein, the target cutting line group includes: a target contour line, and / or a target gap line; Determine the confidence of the pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group; According to the confidence level, a target operation is performed to generate a target image cropping result.

2. The image cropping method according to claim 1, characterized in that: The performing a target operation to generate a target image cropping result according to the confidence level includes: When the confidence level is less than a preset confidence threshold, performing a target correction operation on the target cutting line group so that the confidence level is greater than or equal to the preset confidence threshold; In a case where the confidence is greater than or equal to the preset confidence threshold, a target cropping operation is performed on the target cropping image according to the target cropping line group to generate the target image cropping result.

3. The image cropping method according to claim 2, characterized in that: Also includes: Determining target correction information according to the target cutting line group and the original line group of the target image; The target correction operation is performed on the target cutting line group according to the target correction information, wherein the target correction information includes: a target correction angle and / or a target correction direction.

4. The image cropping method according to claim 1, characterized in that: Also includes: When it is determined that the length of the first target line segment is less than or equal to the first preset length, and there are greater than or equal to a preset number of the first target line segments whose coordinate differences are less than or equal to the preset coordinate difference, According to the plurality of first target line segments, a target line segment is generated by fusing; The target cutting line group is generated according to the target line segment.

5. The image cropping method according to claim 4, characterized in that: Also includes: Determine the second target line segment distribution information according to the pre-cutting result, wherein the second target line segment distribution information includes: the distribution position and / or the distribution quantity of the second target line segment; A first score is determined based on the second target line segment distribution information and a preset scoring mechanism, wherein the first score is used to evaluate the target cutting algorithm, the length of the second target line segment is greater than or equal to a second preset length, and the second preset length is greater than the first preset length.

6. The image cropping method according to claim 5, characterized in that: The target cutting line group includes: a first cutting line and a second cutting line, wherein the first cutting line is perpendicular to the second cutting line; The method further comprises: Determine a length ratio and / or an area ratio according to the first cutting line and the second cutting line; Determining a first evaluation factor according to the length ratio and a first preset ratio; Determining a second evaluation factor according to the area ratio and a second preset ratio; A second score is determined according to the first evaluation factor and / or the second evaluation factor, wherein the second score is used to evaluate the target cutting line group.

7. The image cropping method according to claim 6, characterized in that: Also includes: The confidence level is determined according to the color difference of the pre-cropping result, the maximum probability of the category to which the target image belongs, the first score, and / or the second score.

8. An image cropping system, characterized in that: Suitable for scanning documents, the system comprises: A first determining unit is used to determine the probability distribution information of the category to which the target image belongs according to the target feature, wherein the target feature includes: a line segment feature and / or a color difference feature; A second determining unit, configured to determine a target cutting algorithm according to the probability distribution information of the category to which the target belongs; A third determining unit, configured to determine a target cutting line group according to the target cutting algorithm; Wherein, the target cutting line group includes: a target contour line, and / or a target gap line; a fourth determining unit, configured to determine a confidence level of a pre-cutting result according to the category probability distribution information, the target cutting algorithm, and / or the target cutting line group; An execution unit is used to execute a target operation to generate a target image cropping result according to the confidence level.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used to execute the image cropping method according to any one of claims 1 to 7 when the processor is running.

10. A computer storage medium, characterized in that: Program instructions are stored on the computer storage medium, and the program instructions are used to execute the image cropping method according to any one of claims 1 to 7 when running.

Citation Information

Patent Citations

  • Automatic scanning and printing method and system, computer and storage medium

    CN116820357A

  • Scanning detection method and device, electronic equipment and storage medium

    CN117349646A