OMR recognition method and system based on spatial relative position feature sorting
Through the OMR identification method based on spatial relative position feature sorting, the problems of high consumption and low accuracy of computing resources in the prior art are solved, and efficient and accurate OMR identification is achieved, which is suitable for processing large amounts of test paper data.
Patent Information
- Application Number
- CN202410654517.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-05-24
AI Technical Summary
The existing OMR identification technology consumes a large amount of computing resources and has limited accuracy, making it difficult to effectively identify and process a large amount of test paper data.
Using the OMR recognition method based on spatial relative position feature sorting, by constructing a test paper template, extracting image feature points and descriptors, performing feature matching and single-map matrix mapping, positioning the OMR code position and calculating the grayscale value to determine the filling position.
It improves the accuracy of OMR recognition, reduces the consumption of computing resources, enhances the system's tolerance for interference factors such as scanning offset and image distortion, and improves processing speed and system stability.
Smart Images

Figure CN118609135B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of OMR recognition technology, and in particular to an OMR recognition method and system based on spatial relative position feature sorting. Background Art
[0002] With the rapid development of information technology, the demand for data processing and automation is growing. As an important means of information collection and processing, OMR (Optical Mark Recognition) technology plays a key role in many fields. The OMR recognition method uses an optical scanning device to scan documents containing specific marks, and identifies information by analyzing the mark features in the scanned image. In order to improve the accuracy of OMR recognition, existing technologies often use deep learning models for OMR recognition, such as convolutional neural networks, to extract and classify images. While using deep learning models to improve recognition accuracy, they also require a large amount of accurately labeled data for training. The data labeling process is relatively cumbersome, and the training and operation of deep learning models usually require higher computing resources. Image processing technology that does not use deep learning algorithms often has low scanning accuracy and limited recognition accuracy of marks. At this stage, an OMR recognition method and system based on spatial relative position feature sorting is needed. Summary of the invention
[0003] In order to solve the problem of large consumption of computing resources and limited accuracy in the prior art of OMR recognition, the present invention provides an OMR recognition method and system based on spatial relative position feature sorting, which can reduce the consumption of computing resources while improving accuracy.
[0004] In a first aspect, the present invention provides an OMR recognition method based on spatial relative position feature sorting, which adopts the following technical solution:
[0005] An OMR recognition method based on spatial relative position feature sorting, comprising:
[0006] Construct the test paper template and save the location frame coordinates of the corresponding OMR code in each template image;
[0007] Extract image feature points and feature descriptors from the template image;
[0008] Collect the test paper images to be processed, and pre-process the collected test paper images;
[0009] Perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result;
[0010] Locating the OMR code position in the test paper image based on feature matching between the test paper image and the template image, including respectively calculating the spatial relative position features of the feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single mapping matrix;
[0011] Calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
[0012] Furthermore, the extraction of image feature points and feature descriptors in the template image includes detecting image feature points from the template image using a SIFT detection algorithm, defining a circular area of a fixed size with the image feature points as the center, calculating gradient information of pixels in the area around the image feature points, determining the scale and dominant direction of the image feature points through a scale space and a direction histogram, and constructing a feature descriptor based on the scale, dominant direction and gradient information of the image feature points.
[0013] Furthermore, the collected test paper images are preprocessed, including adjusting the brightness of the test paper images using a histogram estimation method, binarizing the test paper images with completed brightness adjustment through error diffusion, extracting edge information from the binarized test paper images, and converting the edge information into curves in the Hough space using Hough transform, screening the curves whose accumulated values are higher than a set threshold for parameter transformation, calculating the inclination angle of the straight line in the test paper images from the curve parameters according to the results of the Hough transform, and using the inclination angle of the straight line to perform image correction.
[0014] Furthermore, the feature matching of the preprocessed test paper image and the template image includes matching the feature points of the test paper image and the template image based on a nearest neighbor matching algorithm, selecting the template image with the largest number of feature point matches as the matching template, drawing a horizontal median line for the test paper image as a dividing line, and counting the number of feature point matches above and below the dividing line between the matching template and the test paper image.
[0015] Furthermore, the spatial relative position features of feature points of the test paper image and the template image are calculated respectively according to the feature matching results, including obtaining feature point pairs composed of feature points of the template image and the test paper image according to the feature matching results, taking any feature point constituting the feature point pair as the center of the circle, and any R greater than the minimum feature point spacing as the radius, obtaining feature points within the radius, calculating the angle values and Euclidean distances of all feature points within the radius, and obtaining the spatial relative position features of the feature points in the test paper image and the template image.
[0016] Furthermore, the method of using a single projection matrix to map the OMR position in the template image to the test paper image includes using the cosine similarity of the spatial relative position feature as the similarity of the feature point pairs, and sorting the feature point pairs in order of similarity from large to small, taking the first U feature point pairs greater than the minimum number of samples as high-quality matching point pairs, and further sampling and calculating the single projection matrix from the test paper image to the corresponding template image through the RANSAC method based on the high-quality U feature point pairs, and using the single projection matrix to map the OMR position of the template image to the test paper image to obtain the OMR position of the test paper image.
[0017] Furthermore, the filling position of the OMR code in the test paper image is determined according to the grayscale value, including determining the position area of each OMR code based on the OMR position of the test paper image, traversing each OMR code position area to obtain its corresponding image coordinate range, traversing the pixel points in each OMR code position area, calculating its grayscale value and obtaining the average value, and determining the filling position of the OMR code according to the size of the average value and the set threshold.
[0018] In a second aspect, an OMR recognition system based on spatial relative position feature sorting includes:
[0019] The template construction module is configured to: construct a test paper template and save the position frame coordinates of the corresponding OMR code in each template image;
[0020] The feature extraction module is configured to: extract image feature points and feature descriptors from the template image;
[0021] The data acquisition module is configured to: acquire the test paper images to be processed, and pre-process the acquired test paper images;
[0022] The feature matching module is configured to: perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result;
[0023] The position positioning module is configured to: locate the OMR code position in the test paper image based on feature matching between the test paper image and the template image, including respectively calculating the spatial relative position features of feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single mapping matrix;
[0024] The checking module is configured to calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
[0025] In a third aspect, the present invention provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor of a terminal device and executing the OMR recognition method based on spatial relative position feature sorting.
[0026] In a fourth aspect, the present invention provides a terminal device, including a processor and a computer-readable storage medium, the processor being used to implement various instructions; the computer-readable storage medium being used to store multiple instructions, the instructions being suitable for being loaded by the processor and executing the OMR recognition method based on spatial relative position feature sorting.
[0027] In summary, the present invention has the following beneficial technical effects:
[0028] 1. The present invention analyzes the position and arrangement order of the OMR code and uses Hough transform to detect the tilt of the test paper image to reduce erroneous recognition and analysis. In addition, the position and arrangement order of the OMR code may be interfered by some factors, such as scanning offset, image distortion or irregular filling. The method based on spatial relative position feature sorting can improve the system's fault tolerance to these interference factors and reduce the possibility of misjudgment.
[0029] 2. The present invention can optimize the processing flow of the algorithm by sorting the spatial relative positions of the OMR codes, reduce unnecessary calculations and comparison operations, and effectively improve the processing speed of the OMR recognition system. Especially when processing a large number of test papers, the present invention maps the OMR position of the template image to the test paper image through a single mapping matrix, simplifies the design and implementation of the OMR recognition algorithm, and transforms the complex recognition problem into a relatively simple local recognition task by sorting the OMR code positions. There is no need to use a large amount of data to train the model, thereby simplifying the complexity of the algorithm and the difficulty of implementation. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic diagram of the overall process of an OMR recognition method based on spatial relative position feature sorting according to an embodiment of the present invention.
[0031] Figure 2 It is a schematic diagram of image preprocessing in an OMR recognition method based on spatial relative position feature sorting in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0033] Example 1
[0034] Reference Figure 1 , an OMR recognition method based on spatial relative position feature sorting of this embodiment includes:
[0035] Construct the test paper template and save the location frame coordinates of the corresponding OMR code in each template image;
[0036] Extract image feature points and feature descriptors from the template image;
[0037] Collect the test paper images to be processed, and pre-process the collected test paper images;
[0038] Perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result;
[0039] Locating the OMR code position in the test paper image based on feature matching between the test paper image and the template image, including respectively calculating the spatial relative position features of the feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single mapping matrix;
[0040] Calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
[0041] Specifically, an OMR recognition method based on spatial relative position feature sorting in this embodiment includes the following steps:
[0042] like Figure 1 As shown, S1. construct a test paper template and save the position frame coordinates of the corresponding OMR code in each template image;
[0043] Construct a test paper template. First, select the template test paper image T = {T1, T2, ...T n}, where T n It is represented as the nth template test paper image, and all template images are scaled to the same size. First, the target image size is defined through the formula code target_size = (width, height), where width and height represent the target width and height respectively. Secondly, the template image with the defined size is scaled. The scaling code is expressed as: resized_template = template_image.resize (target_size). Finally, through resized_template.save ("resized_template.jpg"), each template image scaled to the same size is saved. The position of the OMR code in the template image is located through edge detection. The coordinate information of the upper left corner and the lower right corner of the OMR code position box is saved according to the located OMR code, and the coordinates of the position box corresponding to the OMR code in each template image are saved. Among them, n represents the number of template images, represents the coordinates of all OMR code position boxes in the i-th template image, b j =(x1, y1, x2, y2) represents the coordinates of the upper left corner and the lower right corner of the jth OMR box in the i-th template picture, and m represents the number of OMR codes in the i-th template picture.
[0044] S2. Extract image feature points and feature descriptors from the template image;
[0045] For each template image T i Extract image feature points With feature descriptors Where l represents the number of feature points and feature descriptors, k p =(x,y) represents the coordinates of the pth feature point, d p ∈R Q Represents feature point k p The feature descriptor is a Q-dimensional vector, where R Q It is represented as a set of Q-dimensional real vectors. In the image feature point and feature descriptor extraction part, the SIFT detection algorithm is used to detect image feature points from the template image. The specific steps are shown in the following code: / / Read template image
[0046] template_image = cv2.imread('template.jpg',0) / / Read as grayscale image
[0047] / / Create SIFT object
[0048] sift = cv2.SIFT_create()
[0049] / / Detect and calculate feature points
[0050] keypoints,descriptors=sift.detectAndCompute(template_image,None)
[0051] / / Draw feature points
[0052] template_with_keypoints=cv2.drawKeypoints(template_image,keypoints,None)
[0053] / / Display the results
[0054] cv2.imshow('Template with Keypoints',template_with_keypoints)
[0055] cv2.waitKey(0)
[0056] cv2.destroyAllWindows()
[0057] Among them, when using the SIFT detection algorithm to detect image feature points from a template image, first use the `cv2.imread()` function to read the template image, set the parameter `0` to read the image as a grayscale image, and then create a SIFT object `sift=cv2.SIFT_create()`. After creating the SIFT object, use the `detectAndCompute()` method to detect and calculate the feature points. This method accepts two parameters: the input image and the mask (in the above code, it is set to `None`). The returned `keypoints` is a list of feature points, and `descriptors` is the descriptor of each feature point. The feature points are drawn on the template image using the `drawKeypoints()` function to obtain an image with feature points. Finally, the results are displayed using the `imshow()` and `waitKey()` functions, and the window is closed using `destroyAllWindows()`. After obtaining the feature points, a circular area of fixed size is defined with the image feature points as the center. In the area around the image feature points, the gradient information of the pixels is calculated using the second-order difference operator, including using the `imread()` function in the OpenCV library to read the template image, and using the grayscale mode (`cv2.IMREAD_GRAYSCALE`) to read the image, and then using the Laplacian operator (`cv2.Laplacian()` function) to calculate the second-order gradient of the image. This function takes the input image as a parameter and returns an image representing the gradient. The scale and dominant direction of the image feature points are determined by the scale space and the directional histogram, and a feature descriptor is constructed based on the scale, dominant direction and gradient information of the image feature points. In order to further obtain the gradient amplitude and direction information of the pixel, the present invention also uses a first-order difference operator (Sobel operator) to calculate the first-order gradient of the image in the horizontal and vertical directions, uses the `cv2.Sobel()` function to calculate the gradient, and saves the result in the `gradient_x` and `gradient_y` variables. The gradient image and the gradient information image are displayed by the `cv2.imshow()` function. Finally, the scale and dominant direction of the image feature points are determined by the scale space and the directional histogram, and a feature descriptor is constructed based on the scale, dominant direction and gradient information of the image feature points.
[0058] like Figure 2As shown, S3. Collect the test paper pictures to be processed, and pre-process the collected test paper pictures;
[0059] Use the histogram estimation method to adjust the brightness of the image. First, get the histogram of the image, and obtain the lowest gray level and the gray level with the highest probability in the image. The gray level with the highest probability is actually the background color of the image. The specific method is as follows:
[0060] Assume that the image histogram is P, the gray level corresponding to the first non-zero element in P is x1, and the gray level corresponding to the maximum value in P is x2. Through the linear mapping relationship, x1 is adjusted to y1, and x2 is adjusted to y2. The calculation formula is expressed as:
[0061]
[0062] The two parameters of the straight line, slope k and constant b, are obtained through the above formula, thereby completing the automatic adjustment of the brightness of the image.
[0063] The brightness of the test paper image is adjusted by using the histogram estimation method, and the test paper image with completed brightness adjustment is binarized by error diffusion. The edge information is extracted from the binarized test paper image, and the edge information is converted into a curve in the Hough space using the Hough transform. The inclination angle of the straight line is detected using the Hough transform. The Hough transform itself has many excellent characteristics, such as insensitivity to noise and no requirements for the continuity of the straight line. Considering that the image itself will not have too much inclination, the actual application is to use the hough transform with a limited angle, which can greatly improve the speed of image processing. In addition, the image is binarized and refined before the Hough transform to eliminate the influence of the smear points on the transformation, so that the inclination angle of the straight line obtained by the Hough transform is more accurate.
[0064] According to the size of the image, all the lines that meet the conditions can be detected, and then the line parameters are recorded as (ρ, θ). The line parameters (ρ, θ) respectively represent the representation of the line in the polar coordinate space, where ρ represents the vertical distance from the origin to the line, that is, the shortest distance from the line to the origin, and θ represents the angle from the x-axis counterclockwise to the line, that is, the line inclination angle. Then the set of lines L can be expressed as:
[0065] L = {(ρ i ,θ i )},=1,2,…m,ρ1>ρ2>…ρ m ,
[0066] The tilt angle of the image is defined as the average of the straight line tilt angles θ corresponding to the first n largest ρ. The choice of n depends on how many ρ values need to be considered to calculate the image tilt angle. The application of the average value makes the detection of the tilt angle very stable.
[0067] The image is corrected according to the detected straight line inclination angle. The image correction adopts the bilinear interpolation algorithm. For each pixel coordinate (x, y) to be corrected, the corresponding coordinate (x', y') in the original image is calculated according to the inverse transformation of the correction transformation, and (x', y') is decomposed into the integer part (x0, y0) and the decimal part (dx, dy). The pixel values are obtained at the four nearest neighboring pixel points (x0, y0), (x0+1, y0), (x0, y0+1), and (x0+1, y0+1) of the original image. According to the decimal part (dx, dy), the new pixel value is calculated by weighted averaging the pixel values of the four nearest neighboring pixel points. The weight is interpolated according to the distance (dx, dy), and the calculated new pixel value is assigned to the coordinate (x, y) corresponding to the corrected image. The above method makes the image correction have a higher time complexity.
[0068] S4. Perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result;
[0069] First, the preprocessed test paper image is used to extract image feature points and feature descriptors using the method described in S2, and the feature points of the test paper image and the template image are matched using the nearest neighbor matching algorithm, including traversing each feature point in the test paper image, for each feature point, calculating the distance between it and all feature points in the template image, and selecting the feature point with the closest distance as the matching point. After the feature points are matched, the template image with the largest number of feature matches is selected as the matching template of I. The matching template formula is expressed as:
[0070]
[0071] Among them, |match(a,b)| represents the number of matches between feature point sets a and b, K I Represented as the feature points of the test paper image, K T Represents the feature points in the template image.
[0072] After confirming the matching template image, determine whether the image I is rotated. In the marking system, after image preprocessing, the test paper image can only be rotated by 180°. Therefore, a horizontal line is drawn at half the image width as the dividing line, and the feature points of the template image above the dividing line are determined. Feature points above and below the boundary line of the predicted image I The number of matches, if and The number of matches is greater than and If the number of matches is greater than , it is considered that rotation has occurred, and the image is rotated 180° to complete the correction. Otherwise, it is considered that no rotation has occurred. The rotation judgment formula is:
[0073]
[0074] in, Indicates the feature points of the template image above the dividing line. and They respectively represent the feature points above and below the boundary line of the predicted image I.
[0075] S5. Locate the OMR code position in the test paper image based on the feature matching between the test paper image and the template image, including calculating the spatial relative position features of the feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single projection matrix;
[0076] After completing the image rotation judgment, if the image is rotated and corrected, it is necessary to re-detect the feature points and feature descriptors of the image I and re-match them with the feature points of the corresponding template. Since there are a large number of repeated texture features in the test paper, it is easy to have a large number of wrongly matched feature point pairs if only relying on the current mainstream feature matching method, and then calculate the wrong single projection matrix, and finally map the wrong OMR position on the image I. Therefore, the present invention proposes a feature point matching proofreading method based on spatial relative position feature sorting to filter out wrong matching point pairs.
[0077] Specifically, the feature point pair is obtained by matching the feature matching method described in S4 above. in, Represented as the feature point h in the test paper image, It is represented by the feature point h in the template image, where h represents the number of matched feature point pairs. For each point pair Respectively and As the center of the circle, take any R greater than the minimum feature point spacing as the radius, and obtain the feature points within the radius and in, Indicates the feature points of the test paper image within the radius. Indicates the feature points of the template image within the radius, and sorts these feature points from top to bottom and from left to right, where z and v represent and The number of feature points, |a,b| represents the Euclidean distance between points a and b. Since the number of z and v is usually different, for a set with more feature points, the first min(z,v) feature points are selected, and then the feature points are calculated separately. and The spatial relative position characteristics.
[0078] Specifically, For example, calculate and The angle values and Euclidean distances of all feature points in The angle value and Euclidean distance from the upper left corner (0,0) of the image. The angle value and Euclidean distance are calculated as shown in formulas (1) and (2):
[0079]
[0080]
[0081] Among them, x i Represents the horizontal coordinate of the i-th feature point, y i Indicates the ordinate of the i-th feature point, x j Indicates the horizontal coordinate of the jth feature point, y j Represents the ordinate of the jth feature point, and finally gets The spatial relative position characteristics and The relative position in space Among them, R represents the dimension of the spatial relative position feature. At this time, the calculation and The cosine similarity of The similarity of and Normalize the vector and calculate the normalized eigenvector and The inner product between them is used to calculate the cosine similarity by the inner product result and the product of the norms of the two vectors. In this way, the similarities of all point pairs are calculated and sorted in order from large to small. Finally, the first U point pairs greater than the minimum number of samples are taken as high-quality matching point pairs. The high-quality U point pairs are further sampled and calculated from the predicted image I to the corresponding template T through the RANSAC method. match Finally, the OMR position of the template is converted using the single-image matrix Mapped to I, get the OMR position B on image I I .
[0082] S6. Calculate the grayscale value of the image in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value;
[0083] Based on the OMR position of the test paper image, the position area of each OMR code is determined, and each OMR code position area is traversed to obtain its corresponding image coordinate range. By traversing the pixel points in each OMR code position area, the grayscale value of each pixel point is accumulated to calculate its grayscale value and the average value is obtained. The filling position of the OMR code is determined according to the average value and the size of the set threshold. The establishment of the threshold is an iterative process. According to the observed sample data, an initial threshold is selected and tested. According to the test results, the size of the threshold is gradually adjusted, and the detection effect of the filling position is observed. If the average value is less than the threshold, it is considered that the area is filled by the examinee, and vice versa. Finally, the examinee's filling answer is confirmed.
[0084] Example 2
[0085] The difference between this embodiment and embodiment 1 is that this embodiment provides an OMR recognition system based on spatial relative position feature sorting, including:
[0086] The template construction module is configured to: construct a test paper template and save the position frame coordinates of the corresponding OMR code in each template image;
[0087] The feature extraction module is configured to: extract image feature points and feature descriptors from the template image;
[0088] The data acquisition module is configured to: acquire the test paper images to be processed, and pre-process the acquired test paper images;
[0089] The feature matching module is configured to: perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result;
[0090] The position positioning module is configured to: locate the OMR code position in the test paper image based on feature matching between the test paper image and the template image, including respectively calculating the spatial relative position features of feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single mapping matrix;
[0091] The checking module is configured to calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
[0092] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device, for example, an OMR recognition method based on spatial relative position feature sorting.
[0093] A terminal device includes a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; and the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing the OMR recognition method based on spatial relative position feature sorting.
[0094] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An OMR recognition method based on spatial relative position feature sorting, characterized in that: include: Construct the test paper template and save the location frame coordinates of the corresponding OMR code in each template image; Extract image feature points and feature descriptors from the template image; Collect the test paper images to be processed, and pre-process the collected test paper images; Perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result; The OMR code position in the test paper image is located based on the feature matching between the test paper image and the template image, including calculating the spatial relative position features of the feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single projection matrix. The calculation of the spatial relative position features of the feature points of the test paper image and the template image according to the feature matching results includes obtaining a feature point pair composed of feature points of the template image and the test paper image according to the feature matching results, taking any feature point constituting the feature point pair as the center of the circle, taking any R greater than the minimum feature point spacing as the radius, obtaining feature points within the radius, and calculating all feature points within the radius. The angle value and the Euclidean distance are used to obtain the spatial relative position features of the feature points in the test paper image and the template image, and the OMR code position in the template image is mapped to the test paper image using a single projection matrix, including using the cosine similarity of the spatial relative position feature as the similarity of the feature point pair, and sorting the feature point pairs in descending order according to the similarity, taking the first U feature point pairs greater than the minimum number of samples as high-quality matching point pairs, and further sampling and calculating the single projection matrix from the test paper image to the corresponding template image based on the high-quality U feature point pairs through the RANSAC method, and using the single projection matrix to map the OMR position of the template image to the test paper image to obtain the OMR position of the test paper image; Calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
2. The OMR recognition method based on spatial relative position feature sorting according to claim 1, characterized in that: The method for extracting image feature points and feature descriptors from a template image includes detecting image feature points from the template image using a SIFT detection algorithm, defining a circular area of a fixed size with the image feature points as the center, calculating gradient information of pixels in the area around the image feature points, determining the scale and dominant direction of the image feature points through a scale space and a direction histogram, and constructing a feature descriptor according to the scale, dominant direction and gradient information of the image feature points.
3. The OMR recognition method based on spatial relative position feature sorting according to claim 2, characterized in that: The method pre-processes the collected test paper images, including adjusting the brightness of the test paper images by using a histogram estimation method, binarizing the test paper images after the brightness adjustment by error diffusion, extracting edge information from the binarized test paper images, and converting the edge information into curves in the Hough space by using Hough transformation, screening the curves whose accumulated values are higher than a set threshold for parameter transformation, calculating the inclination angle of the straight line in the test paper images by using the curve parameters according to the results of the Hough transformation, and performing image correction using the inclination angle of the straight line.
4. The OMR recognition method based on spatial relative position feature sorting according to claim 3, characterized in that: The method of performing feature matching between the preprocessed test paper image and the template image includes matching feature points of the test paper image and the template image based on a nearest neighbor matching algorithm, selecting the template image with the largest number of feature point matches as a matching template, drawing a horizontal median line on the test paper image as a dividing line, and counting the number of feature point matches above and below the dividing line between the matching template and the test paper image.
5. The OMR recognition method based on spatial relative position feature sorting according to claim 4, characterized in that: The method of determining the filling position of the OMR code in the test paper image according to the grayscale value includes determining the position area of each OMR code based on the OMR position of the test paper image, traversing each OMR code position area to obtain its corresponding image coordinate range, traversing the pixel points in each OMR code position area, calculating its grayscale value and obtaining the average value, and determining the filling position of the OMR code according to the size of the average value and a set threshold.
6. An OMR recognition system based on spatial relative position feature sorting, executing the method as claimed in claim 1, characterized in that: include: The template construction module is configured to: construct a test paper template and save the position frame coordinates of the corresponding OMR code in each template image; The feature extraction module is configured to: extract image feature points and feature descriptors from the template image; The data acquisition module is configured to: acquire the test paper images to be processed, and pre-process the acquired test paper images; The feature matching module is configured to: perform feature matching on the preprocessed test paper image and the template image, and determine the rotation of the test paper image according to the feature matching result; The position positioning module is configured to: locate the OMR code position in the test paper image based on feature matching between the test paper image and the template image, including respectively calculating the spatial relative position features of feature points of the test paper image and the template image according to the feature matching results, and mapping the OMR code position in the template image to the test paper image using a single mapping matrix; The checking module is configured to calculate the image grayscale value in each OMR code position area in the test paper image, and determine the filling position of the OMR code in the test paper image according to the grayscale value.
7. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instruction is suitable for being loaded by a processor of a terminal device and executing an OMR recognition method based on spatial relative position feature sorting as described in any one of claims 1 to 5.
8. A terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement each instruction; and the computer-readable storage medium is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing an OMR recognition method based on spatial relative position feature sorting as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Test paper correction method based on image feature matching and alignment
CN113095187A
Automatic detection method and device and computer readable storage medium
CN115631358A