Image detection region determination method and device, electronic equipment and storage medium

By dividing the image into sub-images and using a sharpness scoring algorithm to determine the target detection box, the shortcomings of manually drawing the image detection region in the existing technology are solved, and automated and efficient image detection region determination is achieved.

CN116168192BActive Publication Date: 2026-05-15CHENGDU INTELLIFUSION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHENGDU INTELLIFUSION TECH CO LTD
Filing Date
2022-12-30
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing image acquisition equipment or image detection technology cannot automatically determine the image detection area and must be determined by manual drawing.

Method used

The image to be detected is divided into multiple sub-images of the same size. The sharpness of each sub-image is evaluated by a sharpness scoring algorithm such as the Tenengrad gradient function. The target detection box is determined based on the sharpness score set, and the image detection region is automatically determined.

Benefits of technology

It enables automatic determination of image detection areas, improving the efficiency and accuracy of image detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168192B_ABST
    Figure CN116168192B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method and device for determining an image detection region, electronic equipment and a storage medium. The method comprises: dividing a to-be-detected image into a plurality of sub-images of the same size to obtain a sub-image set, so as to subsequently determine a sub-image region in which part of the sub-images are located as the image detection region; determining a definition score of each sub-image in the sub-image set to obtain a definition score set, so as to determine a clear region in the to-be-detected image as the image detection region according to the definition score; and determining a target detection frame of the to-be-detected image according to the definition score set, and taking a sub-image region corresponding to position information of the target detection frame as the image detection region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image detection technology, specifically to a method, apparatus, electronic device, and storage medium for determining an image detection region. Background Technology

[0002] Existing image acquisition equipment or image detection technology mainly relies on manual drawing to determine the area to be detected based on real-world images. However, it cannot automatically determine the image detection area. Summary of the Invention

[0003] This application provides a method, apparatus, electronic device, and storage medium for determining an image detection region, which can automatically determine a clear region in an image to be detected as the image detection region.

[0004] A first aspect of this application provides a method for determining an image detection region, the method comprising:

[0005] The image to be detected is divided into multiple sub-images of the same size to obtain a set of sub-images;

[0006] Determine the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set;

[0007] The target detection box of the image to be detected is determined based on the sharpness score set, and the sub-image region corresponding to the position information of the target detection box is taken as the image detection region.

[0008] A second aspect of this application provides an apparatus for determining an image detection region, the apparatus comprising:

[0009] A segmentation unit is used to divide the image to be detected into multiple sub-images of the same size, resulting in a set of sub-images;

[0010] A determining unit is used to determine the sharpness score of each sub-image in the sub-image set, thereby obtaining a sharpness score set;

[0011] The determining unit is further configured to determine the target detection box of the image to be detected based on the sharpness score set, and take the sub-image region corresponding to the position information of the target detection box as the image detection region.

[0012] A third aspect of this application provides an electronic device including: a processor and a memory; and one or more programs stored in the memory and configured to be executed by the processor, the programs including instructions for some or all of the steps as described in the first aspect.

[0013] Fourthly, embodiments of this application provide a computer-readable storage medium for storing a computer program that causes a computer to execute instructions for some or all of the steps described in the first aspect of embodiments of this application.

[0014] Fifthly, embodiments of this application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the first aspect of embodiments of this application. The computer program product may be a software installation package.

[0015] Implementing the embodiments of this application has the following beneficial effects:

[0016] As can be seen, the image detection region determination method, apparatus, electronic device, and storage medium described in the embodiments of this application divide the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, so as to subsequently determine the sub-image regions where some of the sub-images are located as image detection regions; determine the sharpness score of each sub-image in the sub-image set to obtain a set of sharpness scores, so as to determine the sharp regions in the image to be detected as image detection regions based on the sharpness scores; determine the target detection box of the image to be detected based on the set of sharpness scores, and take the sub-image region corresponding to the position information of the target detection box as the image detection region. In this way, the sharp regions in the image to be detected can be automatically determined as image detection regions. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic flowchart of an embodiment of a method for determining an image detection region provided in this application.

[0019] Figure 2 This is a schematic diagram illustrating how an image to be detected is divided into multiple sub-images of the same size, according to an embodiment of this application.

[0020] Figure 3 This is a schematic diagram illustrating how to determine the maximum sharpness score sum corresponding to a combination of sub-image quantities, as provided in an embodiment of this application.

[0021] Figure 4This is a schematic diagram illustrating how to determine the range of the detection box position corresponding to the maximum sharpness score sum corresponding to a combination of sub-images, as provided in an embodiment of this application.

[0022] Figure 5 This is a schematic diagram illustrating how to determine the maximum sharpness score sum corresponding to another combination of sub-image quantities, as provided in an embodiment of this application.

[0023] Figure 6 This is a schematic diagram illustrating how to determine the range of the detection box position corresponding to the maximum sharpness score sum corresponding to another combination of sub-image quantities, as provided in an embodiment of this application.

[0024] Figure 7 This is a schematic flowchart of an embodiment of another method for determining an image detection region provided in this application;

[0025] Figure 8 This is a schematic flowchart of an embodiment of another method for determining an image detection region provided in this application;

[0026] Figure 9 This is a schematic diagram of an embodiment of an electronic device provided in this application;

[0027] Figure 10 This is a schematic diagram of an embodiment of an image detection region determination device provided in this application. Detailed Implementation

[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0030] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0031] Please see Figure 1 This is a flowchart illustrating an embodiment of a method for determining an image detection region provided in this application. The method for determining an image detection region described in this embodiment includes the following steps:

[0032] 101. Divide the image to be detected into multiple sub-images of the same size to obtain a set of sub-images.

[0033] One approach is to first construct a coordinate system, and then divide the image to be detected into multiple sub-images of the same size based on the position of each pixel in the coordinate system.

[0034] Specifically, the origin of the coordinate system can be on the plane where the image to be detected is located. For example, the origin of the coordinate system can be the upper left corner of the image to be detected, or it can be any pixel point on the image to be detected. This application does not impose any restrictions.

[0035] By constructing a coordinate system, the positional information of each sub-image can be represented using coordinate information. During the process of determining the image detection region, the coordinate information can be used to retrieve each sub-image and other relevant information, such as sharpness scores. Figure 2 As shown, each sub-image can be represented by a coordinate information, x1y1, x2y2, ..., x20y20, which can be used to represent the position information of each sub-image.

[0036] Optionally, in step 101 above, dividing the image to be detected into multiple sub-images of the same size to obtain a set of sub-images may include the following steps:

[0037] 11. Divide the image to be detected into multiple sub-images with equal width and height, and each sub-image corresponds to a location information;

[0038] 12. Save the location information of the plurality of sub-images and the plurality of sub-images to a sub-image set, wherein each element of the sub-image set is the location information of the sub-image and a key-value pair of the sub-image.

[0039] In this embodiment of the application, considering that the shape of the image to be detected is usually rectangular, it is possible to first determine how many sub-images the image to be detected needs to be divided into, and obtain the total number of sub-images P. Then, the image to be detected is divided according to the total number of sub-images, the total height and the total width of the image to be detected, to obtain multiple sub-images. The multiple sub-images have the same height and the same width.

[0040] Specifically, such as Figure 2 As shown, the image to be detected is divided into multiple sub-images with equal width and height, with the top left corner as the origin. x S represents the number of blocks used to divide the X-axis. y The number of blocks along the Y-axis, and the total number of sub-images, P = S. x *S y For example, S x The value of S is 20. y With a value of 20 and P = 400, the image to be detected can be divided into 400 parts. Assuming the original pixel of the image to be detected is 1920*1080, the size of each sub-image after division is 96*54.

[0041] In this application, the location information of each sub-image and the sub-image itself can be saved as key-value pairs to obtain a sub-image set C. p <k,v> Sub-image set C p Each element in the table represents the location information of the sub-image and a key-value pair of the sub-image, where k is the location information of the sub-image, such as x1y1, x100y100, and v is the sub-image.

[0042] 102. Determine the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set.

[0043] For each sub-image, a sharpness scoring algorithm can be used. For example, the Tenengrad gradient function can be used. The Tenengrad gradient function is a gradient-based image sharpness evaluation function. The Tenengrad gradient function uses the Sobel operator to extract the gradient values ​​in the horizontal and vertical directions. After processing by the Sobel operator, the average gray value of the sub-image is obtained. The larger the average gray value, the sharper the image. The Sobel operator is a discrete differential operator mainly used for edge detection to calculate the approximate gradient of the image gray function.

[0044] Optionally, in step 102 above, determining the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set may include the following steps:

[0045] 21. Traverse each element in the set of sub-images and determine the sharpness score for each sub-image;

[0046] 22. Save the location information and sharpness score of each of the sub-images to a sharpness score set, wherein each element of the sharpness score set is a key-value pair of the location information of the sub-image and the sharpness score of the sub-image corresponding to the location information.

[0047] After obtaining the sharpness score set, each element in the sub-image set can be traversed to determine the sharpness score of each sub-image. Then, the location information and sharpness score of the sub-images are saved as key-value pairs to obtain the sharpness score set C. t <k,v> Clarity rating set C t Each element in the table is a key-value pair of sub-image location information and sharpness score. k is the sub-image location information, such as x1y1, x20y20, and v is the sharpness score corresponding to the sub-image. The higher the sharpness score, the sharper the sub-image.

[0048] Optionally, in step 21 above, determining the sharpness score for each sub-image may include the following steps:

[0049] Extract the gradient values ​​of all pixels in the horizontal and vertical directions for each sub-image;

[0050] The average grayscale value of the sub-image is determined based on the gradient values ​​of all pixels in the horizontal and vertical directions, and the sharpness score of the corresponding sub-image is obtained.

[0051] The Tenengrad gradient function uses the Sobel operator to extract the gradient values ​​of all pixels in the sub-image in the horizontal and vertical directions. The convolution kernel of the Sobel operator is G. x G y Then the gradient value of subimage I at point (x, y) is:

[0052] The sharpness score Ten of a sub-image can be calculated using the following formula:

[0053]

[0054] Where n is the total number of pixels in the sub-image.

[0055] 103. Determine the target detection box of the image to be detected based on the sharpness score set, and take the sub-image region corresponding to the position information of the target detection box as the image detection region.

[0056] The image detection region is a coordinate frame used to define the detection range area. The image detection region is a sub-image region composed of some sub-images. In order to determine the clear region as the image detection region, the clarity of the sub-images contained in the sub-image region needs to be greater than that of other regions. Specifically, the number Q of sub-images that make up the image detection region can be determined, as well as the position information of the Q sub-images. Based on the position information of the Q sub-images, the position range of the detection box and the target detection box within the position range of the detection box can be determined, so that the overall clarity of multiple sub-images within the position range of the detection box is greater than the overall clarity of other combined sub-image regions.

[0057] Optionally, in step 103 above, determining the target detection box of the image to be detected based on the sharpness score set may include the following steps:

[0058] 31. Estimate the number of sub-images contained in the image detection region based on the total number P of the multiple sub-images and the set detection region ratio F, and obtain the estimated number of sub-images Q;

[0059] 32. Determine the number of different single-row sub-images Q based on the estimated number of sub-images Q. W and the number of single-column sub-images Q H The set of detection boxes, wherein each element of the set of detection boxes includes a single row of sub-images Q. W And the number of single-column sub-images Q H The number of sub-images is composed of a combination of sub-images, each combination of sub-images corresponding to a detection box and a number of clear region sub-images, wherein the number of clear region sub-images is Q, which is the number of single-row sub-images. W With the number of single-column sub-images Q H The product;

[0060] 33. Based on each element in the detection box set, determine the sum of the sharpness scores of the sub-images of each combination of sub-image quantities when the detection box corresponding to each combination of sub-image quantities is located in different positions in the image to be detected;

[0061] 34. Determine the detection box location range corresponding to the maximum sharpness score sum of each sub-image combination, and obtain multiple detection box location ranges;

[0062] 35. Determine the maximum value of the sum of the maximum sharpness scores within the range of the multiple detection boxes, and determine the range of the detection boxes corresponding to the maximum value of the sum of the maximum sharpness scores as the target detection box.

[0063] The detection area ratio F can be preset. When the total number of multiple sub-images P = 400, the estimated number of sub-images Q can be calculated based on the total number of multiple sub-images P and the set detection area ratio F, where Q = P * F. For example, when F is 0.4, Q = 400 * 0.4 = 160.

[0064] Optionally, the number of sub-images in each row of the image to be detected is 'a', and the number of sub-images in each column is 'b'. In step 32 above, the number of different single-row sub-images Q is determined based on the estimated number of sub-images Q. W and the number of single-column sub-images Q H The set of detection boxes may include the following steps:

[0065] The number of single-row sub-images Q is determined based on the estimated number of sub-images Q. W The first set is obtained by taking values ​​from 1 to a, corresponding to the number of single-row sub-images, and each element of the first set includes a single-row sub-image count Q. W And the number of single-column sub-images Q H The number of sub-image combinations;

[0066] The number of single-column sub-images Q is determined based on the estimated number of sub-images Q. H The values ​​from 1 to b represent the number of single-row sub-images, respectively, to obtain a second set. Each element of the second set includes a single-row image count Q. W And the number of single-column sub-images Q H The number of sub-image combinations;

[0067] The detection box set is obtained by taking the union of the first set and the second set. Assuming the image to be detected is divided into 400 sub-images, with 20 sub-images in each row and 20 sub-images in each column, then a = 20 and b = 20.

[0068] The number of single-row sub-images Q is determined based on the estimated number of sub-images Q. W The first set is obtained by taking values ​​from 1 to a, corresponding to the number of single-column sub-images, and may include the following steps:

[0069] The number of single-row sub-images Q W Given values ​​from 1 to a, determine the estimated number of sub-images Q divided by the number of single-row sub-images Q. W The quotient is taken and rounded to obtain the corresponding number of single-column sub-images, Q. H .

[0070] Similarly, in the number Q of single-column sub-images H Given values ​​from 1 to b, determine the estimated number of sub-images Q divided by the number of single-column sub-images Q. HThe quotient is taken and rounded to obtain the corresponding number of single-row sub-images, Q. W .

[0071] For example, calculating Q w Q takes values ​​from 1 to 20 H Q H =Q / Q w (Round to the nearest integer) Calculate Q H Q takes values ​​from 1 to 20 W Q W =Q / Q H (Rounded to the nearest integer), as shown in Table 1 below:

[0072] <![CDATA[Number Q of single-line sub-images W > <![CDATA[Single-column sub-image quantity Q H > Number of clear region sub-images 20 8 160 19 8 152 18 9 162 17 9 153 16 10 160 15 11 165 14 11 154 13 12 156 12 13 156 11 14 154 11 15 165 10 16 160 9 17 153 9 18 162 8 19 152 8 20 160

[0073] Table 1

[0074] When taking the union of the first set and the second set, if there is a duplicate single-row sub-image Q W Or the number of single-column sub-images Q H Then compare the number of repeated single-row sub-images Q. W Or the number of single-column sub-images Q H The number of sharp region sub-images corresponding to different combinations of sub-image numbers is determined by retaining only the combination of sub-image numbers that is closer to the estimated number of sub-images Q.

[0075] For example, there exist combinations of sub-image counts {11, 14} and {11, 15}, and the number of sub-images in a single row is Q. W Since the sub-images overlap, and 11*14 = 154 and 11*15 = 165, 165 is closer to the estimated number of sub-images, 160. Therefore, only the combination of sub-image numbers {11, 15} is retained. Thus, the detection box set C can be obtained. r = [{20, 8}, {18, 9}, {16, 10}, {15, 11}, {13, 12}, {12, 13}, {11, 15}, {10, 16}, {9, 18}, {8, 20}], as shown in Table 2 below:

[0076] <![CDATA[Number Q of single-line sub-images W > <![CDATA[Single-column sub-image quantity Q H > Number of clear region sub-images 20 8 160 18 9 162 16 10 160 15 11 165 13 12 156 12 13 156 11 15 165 10 16 160 9 18 162 8 20 160

[0077] Table 2

[0078] Each combination of sub-image counts corresponds to a detection box and a number of sharp region sub-images. For example, {20, 8} corresponds to a detection box with 20 sub-images in a single row and 8 sub-images in a single column. The number of sharp region sub-images corresponding to this detection box is 160. Since the sub-images contained in the corresponding sub-image regions vary depending on the location of the detection box in the image to be detected, and thus the sharpness also varies, it is possible to determine the sharpness rating of the sub-images of each combination of sub-image counts when the detection box is located in different positions in the image to be detected. Summarizing the results, for example, when the detection box {20, 8} is in the first position, the sum of the sharpness scores of the 160 sub-images within the detection box can be determined. When the detection box {20, 8} is in the second position, the sum of the sharpness scores of the 160 sub-images within the detection box can be determined. Thus, assuming the detection box is in m different positions, m sharpness score sums can be obtained. Furthermore, the maximum sharpness score sum among the m sharpness score sums can be determined, and the location information of the maximum sharpness score sum can be obtained. Following this method, assuming the detection box set C... r If the data includes e combinations of sub-image counts, then the sum of e maximum sharpness scores corresponding to these e combinations of sub-image counts and the corresponding bounding box location range can be determined, such as... Figure 3 and Figure 4 As shown, Figure 3 The value in each square represents the sharpness score of the sub-image. The darker the square color, the higher the sharpness score of the sub-image. In practice, different square colors can also be used to represent different sharpness scores. For example, the greener the square color, the higher the sharpness score of the sub-image, and the redder the square color, the lower the sharpness score of the sub-image. Figure 4 Each square in the diagram is labeled with the location information of the sub-images. When the location information of the detection box with the combination of sub-images {20, 8} is (x1y7, x20y14), the maximum sharpness score corresponding to this combination of sub-images is obtained as 1287. That is, the maximum sharpness score corresponding to the detection box {20, 8} is 1287, and the location range of the detection box is (x1y7, x20y14).

[0079] like Figure 5 and Figure 6 As shown, when the location information of the detection box with the sub-image number combination {18, 9} is (x2y6, x19y14), the maximum sharpness score corresponding to this sub-image number combination is obtained as 1320. That is, the maximum sharpness score corresponding to the detection box {18, 9} is 1320, and the location range of the detection box is (x2y6, x19y14).

[0080] Similarly, it can be determined that the maximum sharpness score sum corresponding to the detection box {16, 10} is 1305, and the detection box position range is (x3y6, x18y15).

[0081] The maximum sharpness score for the detection box {15, 11} is 1318, and the detection box position range is (x3y5, x17y15).

[0082] The maximum sharpness score for the detection box {13, 12} is 1219, and the detection box position range is (x4y5, x16y16).

[0083] The maximum sharpness score for the detection box {12, 13} is 1184, and the detection box position range is (x6y5, x17y17).

[0084] The maximum sharpness score for the detection box {11, 15} is 1185, and the detection box position range is (x6y4, x16y18).

[0085] The maximum sharpness score for the detection box {10, 16} is 1118, and the detection box position range is (x7y3, x16y18).

[0086] The maximum sharpness score for the detection box {9, 18} is 1066, and the detection box position range is (x8y2, x16y19).

[0087] The maximum sharpness score for the detection box {8, 20} is 976, and the detection box location range is (x8y1, x15y20).

[0088] Finally, the maximum sum of the maximum sharpness scores across multiple detection box locations is determined, and the detection box location range corresponding to the maximum sum of the maximum sharpness scores is identified as the target detection box, as follows:

[0089] As shown in Table 3:

[0090]

[0091] Table 3

[0092] As can be seen, the image detection region determination method provided in this application divides the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, so that the sub-image regions where some of the sub-images are located can be determined as image detection regions. The sharpness score of each sub-image in the sub-image set is determined to obtain a set of sharpness scores, so that the sharp regions in the image to be detected can be determined as image detection regions based on the sharpness scores. The target detection box of the image to be detected is determined according to the set of sharpness scores, and the sub-image regions corresponding to the position information of the target detection box are taken as image detection regions. In this way, the sharp regions in the image to be detected can be automatically determined as image detection regions.

[0093] Consistent with the above, please refer to Figure 7 This is a schematic flowchart illustrating an embodiment of a method for determining an image detection region provided in this application. The method for determining an image detection region described in this embodiment includes the following steps:

[0094] 201. Divide the image to be detected into multiple sub-images with equal width and height, and each sub-image corresponds to a location information.

[0095] 202. Save the location information of the plurality of sub-images and the plurality of sub-images to a sub-image set. Each element of the sub-image set consists of the location information of the sub-image and a key-value pair of the sub-image.

[0096] 203. Traverse each element in the set of sub-images and determine the sharpness score for each sub-image.

[0097] 204. Save the position information and sharpness score of each of the sub-images to a sharpness score set.

[0098] Each element of the sharpness score set is a key-value pair consisting of the location information of the sub-image and the sharpness score of the corresponding sub-image.

[0099] 205. Estimate the number of sub-images contained in the image detection region based on the total number of the multiple sub-images and the set detection region ratio, and obtain the estimated number of sub-images.

[0100] 206. Determine a set of detection boxes consisting of different numbers of single-row sub-images and single-column sub-images based on the estimated number of sub-images.

[0101] Each element of the detection box set includes a combination of sub-image counts consisting of a single row of sub-images and a single column of sub-images. Each combination of sub-image counts corresponds to a detection box and a number of clear region sub-images. The number of clear region sub-images is the product of the number of single row of sub-images and the number of single column of sub-images.

[0102] 207. Based on each element in the detection box set, determine the sum of the sharpness scores of the sub-images of each combination of sub-image quantities when the detection box corresponding to each combination of sub-image quantities is located in different positions in the image to be detected.

[0103] 208. Determine the range of detection box positions corresponding to the maximum sharpness score sum of each combination of sub-images, and obtain multiple detection box position ranges.

[0104] 209. Determine the maximum value of the sum of the maximum sharpness scores corresponding to the multiple detection box position ranges, and determine the detection box position range corresponding to the maximum value of the sum of the maximum sharpness scores as the target detection box.

[0105] 210. The sub-image region corresponding to the position information of the target detection box is taken as the image detection region.

[0106] For a detailed description of steps 201-210 above, please refer to Figure 1 The corresponding steps 101-103 of the method for determining the image detection region described herein will not be repeated here.

[0107] As can be seen, the image detection region determination method provided in this application divides the image to be detected into multiple sub-images with equal width and height, saves the position information of the multiple sub-images and the multiple sub-images to a sub-image set, traverses each element in the sub-image set, and determines the sharpness score of each sub-image; saves the position information and sharpness score of each sub-image to a sharpness score set, estimates the number of sub-images contained in the image detection region based on the total number of the multiple sub-images and the set detection region ratio, and obtains the estimated number of sub-images; and determines a detection box set composed of different numbers of single-row sub-images and single-column sub-images based on the estimated number of sub-images. Based on each element in the detection box set, the sum of the sharpness scores of the sub-images corresponding to each combination of sub-image quantities is determined when the detection boxes are located at different positions in the image to be detected. The detection box position range corresponding to the maximum sum of sharpness scores for each combination of sub-image quantities is determined, resulting in multiple detection box position ranges. The maximum value of the maximum sum of sharpness scores among the multiple detection box position ranges is determined, and the detection box position range corresponding to the maximum value of the maximum sum of sharpness scores is determined as the target detection box. This accurately identifies the sub-image region with the highest overall sharpness, thereby automatically determining the sharp region in the image to be detected as the image detection region.

[0108] Consistent with the above, please refer to Figure 8This is a schematic flowchart illustrating an embodiment of a method for determining an image detection region provided in this application. The method for determining an image detection region described in this embodiment includes the following steps:

[0109] 301. Divide the image to be detected into multiple sub-images with equal width and height, and each sub-image corresponds to a location information.

[0110] 302. Save the location information of the plurality of sub-images and the plurality of sub-images to a sub-image set. Each element of the sub-image set consists of the location information of the sub-image and a key-value pair of the sub-image.

[0111] 303. Traverse each element in the sub-image set and extract the gradient values ​​of all pixels in the horizontal and vertical directions of each sub-image.

[0112] 304. Determine the average gray value of the sub-image based on the gradient values ​​of all pixels in the horizontal and vertical directions, and obtain the sharpness score of the corresponding sub-image.

[0113] 305. Save the position information and sharpness score of each of the sub-images to a sharpness score set.

[0114] Each element of the sharpness score set is a key-value pair consisting of the location information of the sub-image and the sharpness score of the corresponding sub-image.

[0115] 306. Estimate the number of sub-images contained in the image detection region based on the total number of the multiple sub-images and the set detection region ratio, and obtain the estimated number of sub-images.

[0116] 307. Based on the estimated number of sub-images, determine the number of single-row sub-images corresponding to values ​​from 1 to a, and obtain the first set.

[0117] Each element of the first set includes a combination of a single row of sub-images and a single column of sub-images.

[0118] 308. Based on the estimated number of sub-images, determine the number of single-row sub-images corresponding to the values ​​of 1 to b for the number of single-column sub-images, and obtain the second set.

[0119] Each element of the second set includes a combination of the number of sub-images in a single row and the number of sub-images in a single column.

[0120] 309. Take the union of the first set and the second set to obtain a set of detection boxes composed of different numbers of single-row sub-images and single-column sub-images.

[0121] Each element of the detection box set includes a combination of sub-image counts consisting of a single row of sub-images and a single column of sub-images. Each combination of sub-image counts corresponds to a detection box and a number of clear region sub-images. The number of clear region sub-images is the product of the number of single row of sub-images and the number of single column of sub-images.

[0122] 310. Based on each element in the detection box set, determine the sum of the sharpness scores of the sub-images of each combination of sub-image quantities when the detection box corresponding to each combination of sub-image quantities is located in different positions in the image to be detected.

[0123] 311. Determine the detection box position range corresponding to the maximum sharpness score sum of each sub-image combination, and obtain multiple detection box position ranges.

[0124] 312. Determine the maximum value of the sum of the maximum sharpness scores corresponding to the multiple detection box position ranges, and determine the detection box position range corresponding to the maximum value of the sum of the maximum sharpness scores as the target detection box.

[0125] 313. The sub-image region corresponding to the position information of the target detection box is taken as the image detection region.

[0126] For a detailed description of steps 301-306 above, please refer to Figure 1 The corresponding steps 101-104 of the method for determining the image detection region described herein will not be repeated here.

[0127] As can be seen, the image detection region determination method provided in this application extracts the gradient values ​​of all pixels in each sub-image in the horizontal and vertical directions; determines the average grayscale value of the sub-image based on the gradient values ​​of all pixels in the horizontal and vertical directions, obtains the sharpness score of the corresponding sub-image, and determines the number of single-row sub-images corresponding to values ​​from 1 to a based on the estimated number of sub-images, thus obtaining a first set. Each element of the first set includes a combination of the number of sub-images in a single row and the number of sub-images in a single column; the method determines the number of sub-images in a single column based on the estimated number of sub-images. The number of sub-images in a single column ranges from 1 to b, corresponding to the number of sub-images in a single row, to obtain a second set. Each element of the second set includes a combination of the number of sub-images in a single row and the number of sub-images in a single column. The union of the first set and the second set is taken to obtain the detection box set. In this way, the sharpness score of each sub-image can be accurately determined, and the detection box set composed of different numbers of sub-images in a single row and the number of sub-images in a single column can be determined based on the estimated number of sub-images. This allows for the accurate identification of the sub-image region with the highest overall sharpness, and the automatic identification of the sharp region in the image to be detected as the image detection region.

[0128] Consistent with the above, the following is an apparatus for implementing the above-described method for determining the image detection region:

[0129] Please see Figure 9 This is a schematic diagram illustrating the structure of an electronic device according to an embodiment of this application. The electronic device 400 described in this embodiment includes: at least one input device 1000; at least one output device 2000; at least one processor 3000, such as a CPU; and a memory 4000, wherein the input device 1000, output device 2000, processor 3000, and memory 4000 are connected via a bus 5000.

[0130] Specifically, the input device 1000 can be a touch panel, a physical button, or a mouse.

[0131] The aforementioned output device 2000 can specifically be a display screen.

[0132] The aforementioned memory 4000 can be high-speed RAM or non-volatile memory, such as disk storage. The memory 4000 is used to store a set of program code. The input device 1000, output device 2000, and processor 3000 are used to call the program code stored in the memory 4000 to perform the following operations:

[0133] The aforementioned processor 3000 is used for:

[0134] The image to be detected is divided into multiple sub-images of the same size to obtain a set of sub-images;

[0135] Determine the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set;

[0136] The target detection box of the image to be detected is determined based on the sharpness score set, and the sub-image region corresponding to the position information of the target detection box is taken as the image detection region.

[0137] Optionally, in dividing the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, the processor 3000 is specifically used for:

[0138] The image to be detected is divided into multiple sub-images with equal width and height, and each sub-image corresponds to a location information;

[0139] The location information of the plurality of sub-images and the plurality of sub-images are saved to a sub-image set, wherein each element of the sub-image set is the location information of the sub-image and a key-value pair of the sub-image.

[0140] Optionally, in determining the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set, the processor 3000 is specifically used for:

[0141] Iterate through each element in the set of sub-images and determine the sharpness score for each sub-image;

[0142] The location information and sharpness score of each of the sub-images are saved to a sharpness score set, where each element of the sharpness score set is a key-value pair of the location information of the sub-image and the sharpness score of the sub-image corresponding to the location information.

[0143] Optionally, in determining the sharpness score for each sub-image, the aforementioned processor 3000 is specifically used for:

[0144] Extract the gradient values ​​of all pixels in the horizontal and vertical directions for each sub-image;

[0145] The average grayscale value of the sub-image is determined based on the gradient values ​​of all pixels in the horizontal and vertical directions, and the sharpness score of the corresponding sub-image is obtained.

[0146] Optionally, in determining the target detection box of the image to be detected based on the sharpness score set, the processor 3000 is specifically configured to:

[0147] The number of sub-images contained in the image detection region is estimated based on the total number of the multiple sub-images and the set detection region ratio F, thus obtaining the estimated number of sub-images;

[0148] Based on the estimated number of sub-images, a set of detection boxes is determined, consisting of different numbers of single-row sub-images and single-column sub-images. Each element of the set of detection boxes includes a combination of a number of sub-images consisting of a number of single-row sub-images and a number of single-column sub-images. Each combination of sub-images corresponds to a detection box and a number of clear region sub-images. The number of clear region sub-images is the product of the number of single-row sub-images and the number of single-column sub-images.

[0149] Based on each element in the detection box set, determine the sum of the sharpness scores of the sub-images of each combination of sub-image quantities when the detection box corresponding to each combination of sub-image quantities is located in different positions in the image to be detected;

[0150] Determine the range of detection box positions corresponding to the maximum sharpness score sum for each combination of sub-image quantities to obtain multiple detection box position ranges;

[0151] The maximum value of the sum of the maximum sharpness scores within the range of the multiple detection boxes is determined, and the range of detection boxes corresponding to the maximum value of the sum of the maximum sharpness scores is determined as the target detection box.

[0152] Optionally, the number of sub-images in each row of the image to be detected is 'a', and the number of sub-images in each column is 'b'. In determining the set of detection boxes composed of different numbers of sub-images per row and per column based on the estimated number of sub-images, the processor 3000 is specifically used for:

[0153] Based on the estimated number of sub-images, the number of single-row sub-images from 1 to a is determined to correspond to the number of single-column sub-images respectively, resulting in a first set. Each element of the first set includes a combination of the number of sub-images of a single-row sub-image and a number of single-column sub-images.

[0154] Based on the estimated number of sub-images, the number of single-row sub-images corresponding to the values ​​of the single-column sub-images from 1 to b is determined, resulting in a second set. Each element of the second set includes a combination of the number of sub-images of a single-row sub-image and a single-column sub-image.

[0155] The detection box set is obtained by taking the union of the first set and the second set.

[0156] Optionally, in determining the number of single-column sub-images corresponding to the values ​​of 1 to a for each row of sub-images based on the estimated number of sub-images, and obtaining the first set, the processor 3000 is specifically used for:

[0157] Given that the number of sub-images in a single row ranges from 1 to a, determine the quotient of the estimated number of sub-images divided by the number of sub-images in a single row, and round it down to obtain the corresponding number of sub-images in a single column.

[0158] The aforementioned processor 3000 is also used for:

[0159] When taking the union of the first set and the second set, if there are duplicate single-row sub-image counts or single-column sub-image counts, the number of clear region sub-images corresponding to different combinations of the number of sub-images corresponding to the duplicate single-row sub-image counts or single-column sub-image counts is compared, and only the combination of the number of clear region sub-images that is closer to the estimated number of sub-images is retained.

[0160] As can be seen, the electronic device described in this application divides the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, so as to subsequently determine the sub-image regions where some of the sub-images are located as image detection regions; determines the sharpness score of each sub-image in the set of sub-images to obtain a set of sharpness scores, so as to determine the sharp regions in the image to be detected as image detection regions based on the sharpness scores; determines the target detection box of the image to be detected based on the set of sharpness scores, and takes the sub-image region corresponding to the position information of the target detection box as the image detection region. In this way, the sharp regions in the image to be detected can be automatically determined as image detection regions.

[0161] Please see Figure 10 This is a schematic diagram of an embodiment of an image detection region determination device provided in this application. The image detection region determination device 500 described in this embodiment includes: a division unit 501 and a determination unit 502, as detailed below:

[0162] The segmentation unit 501 is used to divide the image to be detected into multiple sub-images of the same size to obtain a set of sub-images;

[0163] The determining unit 502 is used to determine the sharpness score of each sub-image in the sub-image set, thereby obtaining a sharpness score set;

[0164] The determining unit 502 is further configured to determine the target detection box of the image to be detected based on the sharpness score set, and take the sub-image region corresponding to the position information of the target detection box as the image detection region.

[0165] Optionally, in dividing the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, the division unit 501 is specifically used for:

[0166] The image to be detected is divided into multiple sub-images with equal width and height, and each sub-image corresponds to a location information;

[0167] The location information of the plurality of sub-images and the plurality of sub-images are saved to a sub-image set, wherein each element of the sub-image set is the location information of the sub-image and a key-value pair of the sub-image.

[0168] Optionally, in determining the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set, the determining unit 502 is specifically used for:

[0169] Iterate through each element in the set of sub-images and determine the sharpness score for each sub-image;

[0170] The location information and sharpness score of each of the sub-images are saved to a sharpness score set, where each element of the sharpness score set is a key-value pair of the location information of the sub-image and the sharpness score of the sub-image corresponding to the location information.

[0171] Optionally, in determining the sharpness score of each sub-image, the determining unit 502 is specifically used for:

[0172] Extract the gradient values ​​of all pixels in the horizontal and vertical directions for each sub-image;

[0173] The average grayscale value of the sub-image is determined based on the gradient values ​​of all pixels in the horizontal and vertical directions, and the sharpness score of the corresponding sub-image is obtained.

[0174] Optionally, in determining the target detection box of the image to be detected based on the sharpness score set, the determining unit 502 is specifically used for:

[0175] The number of sub-images contained in the image detection region is estimated based on the total number of the multiple sub-images and the set detection region ratio F, thus obtaining the estimated number of sub-images;

[0176] Based on the estimated number of sub-images, a set of detection boxes is determined, consisting of different numbers of single-row sub-images and single-column sub-images. Each element of the set of detection boxes includes a combination of a number of sub-images consisting of a number of single-row sub-images and a number of single-column sub-images. Each combination of sub-images corresponds to a detection box and a number of clear region sub-images. The number of clear region sub-images is the product of the number of single-row sub-images and the number of single-column sub-images.

[0177] Based on each element in the detection box set, determine the sum of the sharpness scores of the sub-images of each combination of sub-image quantities when the detection box corresponding to each combination of sub-image quantities is located in different positions in the image to be detected;

[0178] Determine the range of detection box positions corresponding to the maximum sharpness score sum for each combination of sub-image quantities to obtain multiple detection box position ranges;

[0179] The maximum value of the sum of the maximum sharpness scores within the range of the multiple detection boxes is determined, and the range of detection boxes corresponding to the maximum value of the sum of the maximum sharpness scores is determined as the target detection box.

[0180] Optionally, the number of sub-images in each row of the image to be detected is 'a', and the number of sub-images in each column is 'b'. In determining the set of detection boxes composed of different numbers of sub-images per row and per column based on the estimated number of sub-images, the determining unit 502 is specifically used for:

[0181] Based on the estimated number of sub-images, the number of single-row sub-images from 1 to a is determined to correspond to the number of single-column sub-images respectively, resulting in a first set. Each element of the first set includes a combination of the number of sub-images of a single-row sub-image and a number of single-column sub-images.

[0182] Based on the estimated number of sub-images, the number of single-row sub-images corresponding to the values ​​of the single-column sub-images from 1 to b is determined, resulting in a second set. Each element of the second set includes a combination of the number of sub-images of a single-row sub-image and a single-column sub-image.

[0183] The detection box set is obtained by taking the union of the first set and the second set.

[0184] Optionally, in determining the number of single-column sub-images corresponding to the values ​​of 1 to a for each row of sub-images based on the estimated number of sub-images, and obtaining the first set, the determining unit 502 is specifically used for:

[0185] Given that the number of sub-images in a single row ranges from 1 to a, determine the quotient of the estimated number of sub-images divided by the number of sub-images in a single row, and round it down to obtain the corresponding number of sub-images in a single column.

[0186] The aforementioned determining unit 502 is also used for:

[0187] When taking the union of the first set and the second set, if there are duplicate single-row sub-image counts or single-column sub-image counts, the number of clear region sub-images corresponding to different combinations of the number of sub-images corresponding to the duplicate single-row sub-image counts or single-column sub-image counts is compared, and only the combination of the number of clear region sub-images that is closer to the estimated number of sub-images is retained.

[0188] As can be seen, the image detection region determination device described in the embodiments of this application divides the image to be detected into multiple sub-images of the same size to obtain a set of sub-images, so as to subsequently determine the sub-image regions where some of the sub-images are located as image detection regions; determines the sharpness score of each sub-image in the set of sub-images to obtain a set of sharpness scores, so as to determine the sharp regions in the image to be detected as image detection regions based on the sharpness scores; determines the target detection box of the image to be detected based on the set of sharpness scores, and takes the sub-image region corresponding to the position information of the target detection box as the image detection region. In this way, the sharp regions in the image to be detected can be automatically determined as image detection regions.

[0189] It is understood that the functions of each program module of the image detection region determination device in this embodiment can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above method embodiments, and will not be repeated here.

[0190] This application also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, includes some or all of the steps of any of the image detection region determination methods described in the above method embodiments.

[0191] This application provides a computer program product, comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in any of the image detection region determination methods recounted in this application. The computer program product may be a software installation package.

[0192] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.

[0193] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus (devices), or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The computer program may be stored / distributed in a suitable medium, provided with or as part of other hardware, or may take other distribution forms, such as via the Internet or other wired or wireless telecommunications systems.

[0194] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable human and vehicle trajectory analysis device to produce a machine, such that the instructions, which execute via a processor of a computer or other programmable device for counting entry and exit, generate instructions for implementing the process... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0195] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable human and vehicle trajectory analysis device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0196] These computer program instructions can also be loaded onto a computer or other programmable human and vehicle trajectory analysis device, causing a series of operational steps to be executed on the computer or other programmable device to produce computer-implemented processing, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0197] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.

Claims

1. A method for determining an image detection region, characterized in that, The method includes: The image to be detected is divided into multiple sub-images of the same size to obtain a set of sub-images; Determine the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set; The target detection box of the image to be detected is determined based on the sharpness score set. The sub-image region corresponding to the position information of the target detection box is taken as the image detection region. Specifically, the number of sub-images contained in the image detection region is estimated based on the total number of the multiple sub-images and the set detection region ratio to obtain the estimated number of sub-images. Based on the estimated number of sub-images, a set of detection boxes composed of different numbers of single-row sub-images and single-column sub-images is determined. Each element of the detection box set includes a combination of a number of sub-images consisting of a number of single-row sub-images and a number of single-column sub-images. Each combination of sub-images corresponds to a detection box and a sharp region sub-image. The number of clear region sub-images is the product of the number of single-row sub-images and the number of single-column sub-images. Based on each element in the detection box set, the sum of the sharpness scores of the sub-images corresponding to each combination of sub-image counts is determined when the detection box is located at different positions in the image to be detected. The detection box position range corresponding to the maximum sum of sharpness scores for each combination of sub-image counts is determined, resulting in multiple detection box position ranges. The maximum value of the maximum sum of sharpness scores among the multiple detection box position ranges is determined, and the detection box position range corresponding to the maximum value of the maximum sum of sharpness scores is determined as the target detection box.

2. The method according to claim 1, characterized in that, The step of dividing the image to be detected into multiple sub-images of the same size to obtain a set of sub-images includes: The image to be detected is divided into multiple sub-images with equal width and height, and each sub-image corresponds to a location information; The location information of the plurality of sub-images and the plurality of sub-images are saved to a sub-image set, wherein each element of the sub-image set is the location information of the sub-image and a key-value pair of the sub-image.

3. The method according to claim 2, characterized in that, The process of determining the sharpness score of each sub-image in the sub-image set to obtain a sharpness score set includes: Iterate through each element in the set of sub-images and determine the sharpness score for each sub-image; The location information and sharpness score of each of the sub-images are saved to a sharpness score set, where each element of the sharpness score set is a key-value pair of the location information of the sub-image and the sharpness score of the sub-image corresponding to the location information.

4. The method according to claim 3, characterized in that, The determination of the sharpness score for each sub-image includes: Extract the gradient values ​​of all pixels in the horizontal and vertical directions for each sub-image; The average grayscale value of the sub-image is determined based on the gradient values ​​of all pixels in the horizontal and vertical directions, and the sharpness score of the corresponding sub-image is obtained.

5. The method according to claim 1, characterized in that, The number of sub-images in each row of the image to be detected is 'a', and the number of sub-images in each column is 'b'. The step of determining a set of detection boxes composed of different numbers of sub-images per row and per column based on the estimated number of sub-images includes: Based on the estimated number of sub-images, the number of single-row sub-images from 1 to a is determined to correspond to the number of single-column sub-images respectively, resulting in a first set. Each element of the first set includes a combination of the number of sub-images of a single-row sub-image and a number of single-column sub-images. Based on the estimated number of sub-images, the number of single-row sub-images corresponding to the values ​​of the single-column sub-images from 1 to b is determined, resulting in a second set. Each element of the second set includes a combination of the number of sub-images of a single-row sub-image and a single-column sub-image. The detection box set is obtained by taking the union of the first set and the second set.

6. The method according to claim 5, characterized in that, The step of determining the number of single-row sub-images corresponding to values ​​from 1 to a based on the estimated number of sub-images yields a first set, including: Given that the number of sub-images in a single row ranges from 1 to a, determine the quotient of the estimated number of sub-images divided by the number of sub-images in a single row, and round it down to obtain the corresponding number of sub-images in a single column. The method further includes: When taking the union of the first set and the second set, if there are duplicate single-row sub-image counts or single-column sub-image counts, the number of clear region sub-images corresponding to different combinations of the number of sub-images corresponding to the duplicate single-row sub-image counts or single-column sub-image counts is compared, and only the combination of the number of clear region sub-images that is closer to the estimated number of sub-images is retained.

7. An image detection region determination device, characterized in that, The device includes: A segmentation unit is used to divide the image to be detected into multiple sub-images of the same size, resulting in a set of sub-images; A determining unit is used to determine the sharpness score of each sub-image in the sub-image set, thereby obtaining a sharpness score set; The determining unit is further configured to determine the target detection box of the image to be detected based on the sharpness score set, and take the sub-image region corresponding to the position information of the target detection box as the image detection region. Specifically, it estimates the number of sub-images contained in the image detection region based on the total number of the multiple sub-images and the set detection region ratio to obtain an estimated number of sub-images; and determines a set of detection boxes composed of different numbers of single-row sub-images and single-column sub-images based on the estimated number of sub-images. Each element of the detection box set includes a combination of a number of sub-images consisting of a number of single-row sub-images and a number of single-column sub-images. Each combination of sub-images corresponds to a detection box and a sharpness score. The number of clear region sub-images is the product of the number of single-row sub-images and the number of single-column sub-images. Based on each element in the detection box set, the sum of the sharpness scores of the sub-images corresponding to each combination of sub-image counts is determined when the detection box is located at different positions in the image to be detected. The detection box position range corresponding to the maximum sum of sharpness scores for each combination of sub-image counts is determined, resulting in multiple detection box position ranges. The maximum value of the maximum sum of sharpness scores among the multiple detection box position ranges is determined, and the detection box position range corresponding to the maximum value of the maximum sum of sharpness scores is determined as the target detection box.

8. An electronic device, characterized in that, It includes a processor and a memory, the memory being used to store one or more programs and configured to be executed by the processor, the programs including instructions for performing the steps of the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer program for storing electronic data interchange is provided, wherein the computer program causes a computer to perform the method as described in any one of claims 1-6.