An objective question positioning method, device, equipment and storage medium
By acquiring test paper images in the objective question grading system, identifying and clustering image moments of question numbers and option areas, the cumbersome option location process is solved, and grading efficiency is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2023-02-02
- Publication Date
- 2026-07-24
AI Technical Summary
In existing objective question grading systems, the algorithm for locating and identifying the distribution of answer choices is cumbersome, resulting in low grading efficiency.
By acquiring the test paper image, the question number and option regions in the target image are determined, the image moments of each region are calculated, and clustering is performed to identify the question number and option image blocks.
It enables quick and accurate location of options and question numbers in objective questions, improving grading efficiency.
Smart Images

Figure CN116137076B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an objective problem location method, apparatus, device, and storage medium. Background Technology
[0002] Currently, examinations are an important means of assessing students' learning progress over a period of time, and correspondingly, grading exam papers is a demanding task. To alleviate the burden on manual labor, many schools have adopted grading systems to grade objective questions, while teachers grade subjective questions.
[0003] When grading objective questions, the test paper images are usually obtained by scanning and compared with standard template test papers. However, the algorithms for locating and identifying the distribution of answer choices for customer questions are cumbersome, which greatly reduces the grading efficiency of the system. Summary of the Invention
[0004] In view of the above problems, the present invention is proposed to provide an objective problem-solving method, apparatus, device, and storage medium that overcomes or at least partially solves the above problems.
[0005] Based on a first aspect of the present invention, a method for locating objective questions is provided, the method comprising:
[0006] Acquire an image of the test paper and determine the target image corresponding to the objective question area, wherein the target image includes multiple question numbers and multiple options;
[0007] Determine the region contours corresponding to multiple question numbers and multiple options in the target image;
[0008] Calculate the target image moments corresponding to the contours of each region;
[0009] Clustering is performed on multiple target image moments to determine the image block corresponding to each question number and the image block corresponding to each option.
[0010] Based on a second aspect of the present invention, an apparatus for locating objective questions is also provided, the apparatus comprising:
[0011] The image acquisition module is used to acquire test paper images and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options.
[0012] The contour determination module is used to determine the region contours corresponding to multiple question numbers and multiple options in the target image;
[0013] The image moment calculation module is used to calculate the target image moments corresponding to the contours of each region;
[0014] The image moment clustering module is used to cluster multiple target image moments to determine the image block corresponding to each question number and the image block corresponding to each option.
[0015] Based on a third aspect of the present invention, an electronic device is also provided, comprising:
[0016] One or more processors;
[0017] Memory;
[0018] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform any of the methods described above.
[0019] Based on a fourth aspect of the invention, a computer-readable storage medium is also provided for storing a computer program for use in conjunction with an electronic device, the computer program being executable by a processor to perform any of the methods described above.
[0020] Compared with existing technologies, this invention involves first acquiring an image of the exam paper and determining the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options. Then, the contours of the regions corresponding to the multiple question numbers and multiple options in the target image are determined. Next, the target image moments corresponding to each region contour are calculated, and the multiple target image moments are clustered to determine the question number image block corresponding to each question number and the option image block corresponding to each option. This allows for quick and accurate location of the options and question numbers in the objective questions, improving the efficiency of grading the objective questions on the exam paper.
[0021] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0022] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings.
[0023] In the attached diagram:
[0024] Figure 1 This is a flowchart illustrating the steps of an objective question location method provided in an embodiment of the present invention;
[0025] Figure 2This is a flowchart illustrating the steps of another objective question location method provided in this embodiment of the invention;
[0026] Figure 3 This is a schematic diagram of a target image provided in an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of a morphological image provided in an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of the area outline of question numbers and options provided in an embodiment of the present invention;
[0029] Figure 6 This is a schematic diagram of a minimum enclosing rectangle provided in an embodiment of the present invention;
[0030] Figure 7 This is a schematic diagram illustrating the distribution of a target image after moment clustering, provided in an embodiment of the present invention.
[0031] Figure 8 This is a schematic diagram of the detection of an option image block provided in an embodiment of the present invention;
[0032] Figure 9 This is a schematic diagram of the detection of a title image block provided in an embodiment of the present invention;
[0033] Figure 10 This is a schematic diagram illustrating the distribution of answers to objective questions according to an embodiment of the present invention;
[0034] Figure 11 This is a schematic diagram of the structure of an objective question positioning device provided in an embodiment of the present invention. Detailed Implementation
[0035] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0036] Reference Figure 1 This illustrates an objective question location method provided by an embodiment of the present invention, the method including:
[0037] S101. Obtain the test paper image and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options.
[0038] In this embodiment of the invention, the test paper image can be obtained by scanning the answer sheet with a scanner. The answer sheet typically includes an objective question area and a subjective question area. A blank answer sheet can be scanned beforehand to determine the objective question area, and the image within that area can be designated as the target image. Therefore, the target image can include multiple question numbers and multiple options.
[0039] S102. Determine the region contours corresponding to multiple question numbers and multiple options in the target image.
[0040] In this embodiment of the invention, contour lookup can be performed in the target image to determine the region contour corresponding to each question number and the region contour corresponding to each option, wherein the region contour corresponding to the question number and the option can be a rectangle.
[0041] S103. Calculate the target image moments corresponding to the contours of each region.
[0042] S104. Cluster the multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
[0043] In this embodiment of the invention, image moments refer to image features that are invariant to translation, rotation, and scale. They are convenient for describing the shape of objects and have strong noise resistance, allowing for the identification and location of options and question numbers even when there is significant noise in the target image. Therefore, the target image moments of the regions formed by the contours of each area can be calculated. These target image moments can include multiple orders, such as zero-order, first-order, and second-order image moments. Based on clustering operations on the target image moments, the image blocks corresponding to each question number and the image blocks corresponding to each option can be determined. This allows for the rapid and accurate location of options and question numbers in objective questions, improving the efficiency of grading objective questions on exam papers.
[0044] Reference Figure 2 This illustrates another objective question location method provided by an embodiment of the present invention, the method including:
[0045] S201. Obtain the test paper image and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options.
[0046] In this embodiment of the invention, the description of step S201 can be referred to the description of step S101.
[0047] In another example, after acquiring the exam paper image, it can be binarized. Binarization can be understood as refilling the exam paper image with two different pixel values. Considering that exam papers typically use a white background, when detecting a white pixel during image detection, no filling operation is performed. When a pixel is detected to be a color other than white, the target color is used to fill the pixel. For example, refer to... Figure 3 As shown, this is the binarized target image of a blank answer sheet, where the target color can be black. Therefore, the binarized answer sheet image contains only white and the target color.
[0048] The objective question region bounding box can be preset and used to select the objective question area. In one example, the objective question region bounding box can be obtained by scanning a blank answer sheet image and then selecting it. Based on the preset objective question region bounding box, the binarized answer sheet image is cropped to obtain the target image corresponding to the objective question area. The target image may include multiple question numbers and multiple options.
[0049] S202. Perform morphological operations on the target image to obtain a morphological image.
[0050] S203. Perform contour search on the morphological image to determine the contours of the regions corresponding to multiple question numbers and multiple options in the morphological image.
[0051] In this embodiment of the invention, morphological operations are used to fill small pixel blocks (which can be understood as isolated pixel noise) distributed between different pixels in a target image. These morphological operations may include erosion, dilation, opening, and closing operations, thereby dilating the target image and filling the background pixels in the target image that are in contact with pixels corresponding to each target color with the target color. This can also be understood as eliminating some isolated pixel noise and connectivity breaks in the target image. (See reference...) Figure 4 As shown, each question number or option is transformed into a rectangle after morphological operations, thus obtaining the morphological image corresponding to the target image.
[0052] In one example, contour searching can be performed on the morphological image, for example, edge detection can be performed on the regions corresponding to each question number and each option (e.g., determining edges by the boundary between white and black pixels), referring to... Figure 5 As shown, the region contours corresponding to multiple question numbers and multiple options in the morphological image are thus determined.
[0053] S204. Determine the minimum enclosing rectangle corresponding to the outline of each region.
[0054] In this embodiment of the invention, the shape of the region contour may often be irregular and not a standard rectangle. Therefore, after determining the region contours corresponding to each question number and each option, the minimum bounding rectangle corresponding to each region contour can be determined. For example, pixel detection can be performed sequentially from the outside to the inside of the region contour to correct the region contour in both the vertical and horizontal directions, making it a straight line in both directions, and the straight line is within the area enclosed by the region contour. Thus, the minimum bounding rectangle corresponding to each region contour can be determined. (Refer to...) Figure 6 As shown, Figure 6 The area defined by the dashed box in the diagram is the smallest bounding rectangle of the corresponding area outline.
[0055] S205. Calculate the zero-order image moment, first-order image moment, and second-order image moment of each smallest bounding rectangle.
[0056] In this embodiment of the invention, the target image moments include at least zero-order image moments, first-order image moments, and second-order image moments. The zero-order image moment is used to determine the area of the minimum bounding rectangle; the first-order image moment is used to determine the centroid corresponding to the area of the minimum bounding rectangle; and the second-order image moment is used to determine the rotation radius corresponding to the area of the minimum bounding rectangle.
[0057] In one example, the zero-order image moment m00 can be calculated using the following formula (1):
[0058] m00=∫∫f(x,y)dxdy Formula (1)
[0059] In the above formula (1), f(x,y) is used to represent the pixel value of the corresponding minimum bounding rectangle; x and y are the coordinates of the corresponding minimum bounding rectangle in the Cartesian coordinate axis.
[0060] In another example, the first-order image moments can be calculated using the following formulas (2) and (3):
[0061]
[0062]
[0063] In formulas (2) and (3) above, m01 refers to the first moment of the corresponding minimum enclosing rectangle about the x-axis, and m10 refers to the first moment of the corresponding minimum enclosing rectangle about the y-axis.
[0064] In another example, the second-order image moments can be calculated using the following formulas (4), (5) and (6):
[0065]
[0066]
[0067]
[0068] In the above formulas (4), (5) and (6), m20 refers to the horizontal extension of the corresponding minimum enclosing rectangle; m02 refers to the vertical extension of the corresponding minimum enclosing rectangle; and m11 refers to the tilt of the corresponding minimum enclosing rectangle.
[0069] For example, when m20 is greater than 0, it means that the horizontal extension of the lower part of the corresponding minimum enclosing rectangle is greater than that of the upper part; if it is less than 0, it means that the horizontal extension of the lower part of the corresponding minimum enclosing rectangle is less than that of the upper part. When m02 is greater than 0, it means that the vertical extension of the right side of the minimum enclosing rectangle is greater than that of the left side; if it is less than 0, it means that the vertical extension of the right side of the minimum enclosing rectangle is less than that of the left side. When m11 is greater than 0, it means that the minimum enclosing rectangle is tilted to the upper left; if it is less than 0, it means that the minimum enclosing rectangle is tilted to the upper right.
[0070] S206. Cluster the zero-order, first-order, and second-order image moments of each smallest bounding rectangle to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
[0071] In this embodiment of the invention, during the clustering process, the target image moments (i.e., zero-order image moments, first-order image moments, and second-order image moments) corresponding to each minimum bounding rectangle can be converted into corresponding feature distribution vectors. These feature distribution vectors characterize the distribution of image features within the corresponding minimum bounding rectangles. Therefore, based on the feature distribution vectors (which are three-dimensional vectors) corresponding to each minimum bounding rectangle, three-dimensional coordinates can be established. Furthermore, based on the feature distances between the feature distribution vectors corresponding to each minimum bounding rectangle, the image blocks corresponding to the question numbers and the image blocks corresponding to each option can be distinguished according to their target distances.
[0072] In another optional embodiment of the invention, during the clustering process, two target image moments can be selected from the plurality of target image moments as cluster centers for two preset categories. The feature distance between the two cluster centers must meet a second clustering condition. For example, the second clustering condition can be that the feature distance is greater than a second clustering threshold. Since the corresponding minimum bounding rectangle area needs to be determined as the option area or question number area, the number of preset categories is fixed at two. The feature distances from the other target image moments (excluding the two cluster centers) to each cluster center are calculated. The first clustering condition can be that the feature distance is less than a first clustering threshold. Therefore, the target image moments whose feature distances meet the first clustering condition can be assigned to the preset category to which the corresponding cluster center belongs, until all target image moments have been divided into the preset categories.
[0073] For objective questions, one question number corresponds to N options, where N is typically 3 or 4. (See reference...) Figure 7 As shown, after clustering, a preset category containing the most target image moments is selected and designated as the option category. Based on multiple target image moments within the option category, the corresponding option image block is obtained. Further, a preset category containing the fewest target image moment feature information is selected and designated as the question number category. Based on multiple target image moment information within the question number category, the corresponding question number image block is obtained. This allows for quick and accurate location of the options and question numbers in objective questions, and rapid image detection of the image blocks, improving the efficiency of grading objective questions on exam papers.
[0074] Furthermore, this invention does not require pre-setting relevant parameters of the objective question distribution characteristics. Compared with target detection and localization methods, its algorithm has a smaller computational requirement and can improve the localization efficiency of objective questions.
[0075] In an optional embodiment of the invention, considering the possibility of misclassification in the above clustering results, the method may further include:
[0076] Based on the classification and filtering criteria, the image blocks corresponding to each option are filtered.
[0077] In this embodiment of the invention, the classification filtering condition can be that the area and / or aspect ratio of the minimum bounding rectangle meets the filtering rule. The filtering rule can be: the area of the minimum bounding rectangle is greater than or equal to a preset area threshold. Specifically, the area of the minimum bounding rectangle corresponding to the question number is less than the area of the minimum bounding rectangle corresponding to the option. In another example, the filtering rule can also be: the aspect ratio is within a target range. Here, the target range is preset, and the aspect ratios of the minimum bounding rectangles corresponding to the question number and the options differ significantly. Therefore, based on the above classification filtering condition, image blocks belonging to the option category can be further filtered, thereby improving the accuracy of option image block recognition.
[0078] In an optional embodiment of the invention, to further improve the recognition accuracy of each option image patch, the method may further include:
[0079] The image blocks corresponding to each option are clustered by location to identify multiple image regions with different location distribution characteristics.
[0080] In this embodiment of the invention, the image blocks corresponding to each option can also be clustered by location. This location clustering refers to grouping image blocks with correlated location distributions together, thereby obtaining a region image formed by combining multiple image blocks. Consequently, the location distribution characteristics of the multiple region images are different.
[0081] In the process of location clustering, the coordinates of each option image patch in the target image can be used for clustering. Furthermore, a preset distance threshold and a sample number threshold are set for location clustering. The sample number threshold can be understood as the number of option image patches corresponding to each location category after location clustering. Therefore, based on the preset distance threshold and sample number threshold, location clustering can be performed on the option image patches corresponding to each option, resulting in multiple location categories. For example, based on the distribution pattern of options in the target image, such as grouping N options horizontally and keeping options of different question numbers aligned vertically, each region image can include N option image patches horizontally, or M option image patches vertically. Therefore, multiple region images with different location distribution characteristics can be generated based on the multiple option image patches in each location category.
[0082] In one example, M is determined based on the question number, and the preset distance threshold and sample number threshold can be dynamically adjusted based on the different directional distribution of option image blocks on the regional image. Next, after determining multiple regional images, the distribution of multiple option image blocks within the regional images in the horizontal and / or vertical directions can be further detected. Based on the distribution patterns of the option image blocks, multiple option image blocks in each regional image are detected in different directions, thereby determining whether any option image blocks have been missed based on the detection results. This allows for adjustment of the position of the option image blocks and improves the accuracy of reviewing objective questions through self-checking.
[0083] In this embodiment of the invention, after completing the missed detection of the option image blocks, pixel detection of each option image block can be performed, referring to... Figure 8 As shown, after a student selects a corresponding option, the pixels of the option image block for that question number are all black, thus allowing pixel detection to determine the option content for that question number. After recognizing the option image blocks, these blocks can be removed, as shown in the diagram. Figure 9 As shown, Figure 9 The selected area is the question number image block, allowing us to obtain the specific question number based on pixel detection of this block. Therefore, the option content and question number are combined, referring to... Figure 10 As shown, the distribution of answers to objective questions can be obtained.
[0084] In summary, this invention discloses a method for locating objective questions. The method may include first acquiring an image of the exam paper and determining the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options. Then, the contours of the regions corresponding to the multiple question numbers and multiple options in the target image are determined. Next, the target image moments corresponding to each region contour are calculated, and the multiple target image moments are clustered to determine the question number image block corresponding to each question number and the option image block corresponding to each option. This allows for quick and accurate location of the options and question numbers in objective questions, improving the efficiency of grading objective questions on the exam paper.
[0085] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0086] Reference Figure 11This illustration shows an objective question location device provided by an embodiment of the present invention, the device may include:
[0087] The image acquisition module 1101 is used to acquire the test paper image and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options.
[0088] The contour determination module 1102 is used to determine the contours of the regions corresponding to multiple question numbers and multiple options in the target image.
[0089] The image moment calculation module 1103 is used to calculate the target image moments corresponding to the contours of each region.
[0090] The image moment clustering module 1104 is used to cluster multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
[0091] In an optional embodiment of the invention, the image moment calculation module 1103 can also be used for:
[0092] Calculate the zero-order image moment, first-order image moment, and second-order image moment corresponding to the contour of each region.
[0093] In an optional embodiment of the invention, the image moment calculation module 1103 may include:
[0094] The rectangle determination submodule is used to determine the minimum enclosing rectangle corresponding to the outline of each region.
[0095] The image moment calculation submodule is used to calculate the zero-order image moment, first-order image moment, and second-order image moment of each minimum bounding rectangle.
[0096] In an optional embodiment of the invention, the image moment clustering module 1104 can also be used for:
[0097] Cluster the zero-order, first-order, and second-order image moments of each smallest bounding rectangle to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
[0098] In an optional embodiment of the invention, the image moment clustering module 1104 may include:
[0099] The image moment selection submodule is used to select two target image moments from the plurality of target image moments, and use them as cluster centers for two preset categories, respectively.
[0100] The image moment clustering submodule is used to cluster multiple target image moments based on two cluster centers to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
[0101] In an optional embodiment of the invention, the image moment clustering submodule may include:
[0102] The distance calculation unit is used to calculate the feature distances from each cluster center to the other target image moments (excluding the two cluster centers) among multiple target image moments.
[0103] The category division unit is used to classify the target image moments whose feature distances meet the first clustering conditions into the preset categories to which the corresponding cluster centers belong, until all target image moments have been divided into the preset categories.
[0104] The first filtering unit is used to filter out the preset category containing the most target image moments as the option category, and obtain the option image block corresponding to each option based on the multiple target image moments in the option category.
[0105] The second filtering unit is used to filter out the preset category with the fewest information containing target image moment feature information, determine it as the question number category, and obtain the question number image block corresponding to each question number based on the multiple target image moment information in the question number category.
[0106] In an optional embodiment of the invention, the apparatus may further include a filtering module, the filtering module being used for:
[0107] Based on the classification and filtering criteria, the image blocks corresponding to each option are filtered.
[0108] In an optional embodiment of the invention, the apparatus may further include:
[0109] The location clustering module is used to perform location clustering on the image blocks corresponding to each option, and to determine multiple region images with different location distribution characteristics.
[0110] The image patch detection module is used to determine whether the selected image patch has been missed based on multiple region images with different location distribution characteristics.
[0111] In one optional embodiment of the invention, the location clustering module may include:
[0112] The location category determination submodule is used to perform location clustering on the option image blocks corresponding to each option based on preset distance thresholds and sample number thresholds to obtain multiple location categories.
[0113] The region image generation submodule is used to generate multiple region images with different location distribution characteristics based on multiple option image patches in each location category.
[0114] In an optional embodiment of the invention, the image patch detection module can also be used for:
[0115] Based on multiple region images with different location distribution characteristics, the distribution of multiple option image blocks located within the region images in the horizontal and / or vertical directions is detected.
[0116] Based on the detection results, determine whether the selected image block was missed.
[0117] In an optional embodiment of the invention, the image acquisition module 1101 may include:
[0118] The binarization submodule is used to acquire the test paper image and binarize the test paper image.
[0119] The target image acquisition submodule is used to extract the target image corresponding to the objective question region from the binarized test paper image based on the objective question region bounding box.
[0120] In an optional embodiment of the invention, the contour determination module 1102 may include:
[0121] The morphological image determination submodule is used to perform morphological operations on the target image to obtain a morphological image.
[0122] The contour determination submodule is used to perform contour search on the morphological image and determine the contours of the regions corresponding to multiple question numbers and multiple options in the morphological image.
[0123] In summary, this invention discloses an objective question location device. The device may first acquire a test paper image and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options. Then, it determines the region contours corresponding to the multiple question numbers and multiple options in the target image. Next, it calculates the target image moments corresponding to each region contour and clusters the multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option. This allows for quick and accurate location of the options and question numbers in objective questions, improving the efficiency of grading objective questions on test papers.
[0124] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0125] It will be readily apparent to those skilled in the art that any combination of the above embodiments is feasible, and therefore any combination of the above embodiments is an implementation scheme of the present invention. However, due to space limitations, this specification will not describe them in detail here.
[0126] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0127] Similarly, it should be understood that, in order to simplify the invention and aid in understanding one or more of the various inventive aspects, features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in fewer than all features of the single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.
[0128] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0129] An electronic device, comprising:
[0130] One or more processors;
[0131] Memory;
[0132] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the methods described in the above embodiments.
[0133] A computer-readable storage medium stores a computer program for use in conjunction with an electronic device, the computer program being executable by a processor to perform the methods described in the embodiments above.
[0134] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products 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.
[0135] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. 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 data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0136] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal 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.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment 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.
[0138] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.
[0139] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0140] The objective question location method and objective question location device provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for locating objective questions, the method comprising: Acquire an image of the test paper and determine the target image corresponding to the objective question area, wherein the target image includes multiple question numbers and multiple options; Determine the region contours corresponding to multiple question numbers and multiple options in the target image; Calculate the target image moments corresponding to the contours of each region; Clustering is performed on multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option; The calculation of the target image moments corresponding to the contours of each region includes: Calculate the zeroth-order image moment, first-order image moment, and second-order image moment corresponding to the contour of each region respectively; The step of clustering multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option includes: From the plurality of target image moments, two target image moments are selected as cluster centers for two preset categories, respectively; Based on two cluster centers, multiple target image moments are clustered to determine the image block corresponding to each question number and the image block corresponding to each option.
2. The objective question location method according to claim 1, characterized in that, The calculation of the zero-order image moment, first-order image moment, and second-order image moment corresponding to the contour of each region includes: Determine the minimum enclosing rectangle corresponding to the outline of each region; Calculate the zero-order image moment, first-order image moment, and second-order image moment for each smallest bounding rectangle.
3. The objective question location method according to claim 2, characterized in that, The step of clustering multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option includes: Cluster the zero-order, first-order, and second-order image moments of each smallest bounding rectangle to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
4. The objective question location method according to claim 1, characterized in that, The process of clustering multiple target image moments based on two cluster centers to determine the question number image block corresponding to each question number and the option image block corresponding to each option includes: Calculate the feature distances from each cluster center to the other target image moments (excluding the two cluster centers) among multiple target image moments; The target image moments whose feature distances meet the first clustering conditions are assigned to the preset categories to which the corresponding cluster centers belong, until all target image moments have been assigned to the preset categories; The preset category containing the most target image moments is selected as the option category, and the option image block corresponding to each option is obtained based on the multiple target image moments in the option category. The preset category with the fewest information containing target image moment feature information is selected and determined as the question number category. Based on the multiple target image moment information in the question number category, the question number image block corresponding to each question number is obtained.
5. The objective question location method according to claim 3 or 4, characterized in that, The method further includes: Based on the classification and filtering criteria, the image blocks corresponding to each option are filtered.
6. The objective question location method according to claim 1, characterized in that, The method further includes: The image patches corresponding to each option are clustered by location to identify multiple image regions with different location distribution characteristics; Based on multiple region images with different location distribution characteristics, determine whether the selected image block was missed.
7. The objective question location method according to claim 6, characterized in that, The step of clustering the image blocks corresponding to each option to determine multiple region images with different location distribution characteristics includes: Based on preset distance thresholds and sample number thresholds, the image patches corresponding to each option are clustered at their locations to obtain multiple location categories; Based on multiple option image patches in each location category, generate multiple region images with different location distribution characteristics.
8. The objective question location method according to claim 7, characterized in that, The step of determining whether the selected image patch was missed based on multiple region images with different location distribution characteristics includes: Based on multiple region images with different location distribution characteristics, detect the distribution of multiple option image blocks located within the region images in the horizontal and / or vertical directions; Based on the detection results, determine whether the selected image block was missed.
9. The objective question location method according to claim 1, characterized in that, The step of acquiring the test paper image and determining the target image corresponding to the objective question area includes: Acquire the test paper image and binarize the test paper image; Based on the objective question region bounding box, the binarized test paper image is cropped to obtain the target image corresponding to the objective question region.
10. The objective question location method according to claim 9, characterized in that, The process of determining the region contours corresponding to multiple question numbers and multiple options in the target image includes: Perform morphological operations on the target image to obtain a morphological image; The contour search is performed on the morphological image to determine the contours of the regions corresponding to multiple question numbers and multiple options in the morphological image.
11. An objective question positioning device, characterized in that, The device includes: The image acquisition module is used to acquire test paper images and determine the target image corresponding to the objective question area. The target image includes multiple question numbers and multiple options. The contour determination module is used to determine the region contours corresponding to multiple question numbers and multiple options in the target image; The image moment calculation module is used to calculate the target image moments corresponding to the contours of each region; The image moment clustering module is used to cluster multiple target image moments to determine the question number image block corresponding to each question number and the option image block corresponding to each option. The image moment calculation module is also used for: Calculate the zeroth-order image moment, first-order image moment, and second-order image moment corresponding to the contour of each region respectively; The image moment clustering module includes: The image moment selection submodule is used to select two target image moments from the plurality of target image moments, and use them as cluster centers for two preset categories respectively; The image moment clustering submodule is used to cluster multiple target image moments based on two cluster centers to determine the question number image block corresponding to each question number and the option image block corresponding to each option.
12. An electronic device, comprising: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method of any one of claims 1-10.
13. A computer-readable storage medium storing a computer program for use in conjunction with an electronic device, said computer program being executable by a processor to perform the method of any one of claims 1-10.