Intelligent correction method and device for answer sheet image from global to local

By obtaining the answer sheet template image and the target answer sheet image, using marking point matching and template frame offset for global and local correction, the problem of poor local deformation correction effect of answer sheets in the existing technology is solved, and more efficient correction is achieved Effect.

CN119478955AInactive Publication Date: 2025-02-18BEIJING HEQIJULI EDUCATION TECH CO LTD

Patent Information

Application Number
CN202510038768.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-02-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When correcting the perspective deformation of the answer sheet, the prior art cannot effectively solve the poor correction effect of the position far away from the marking point, and cannot solve the problem of local deformation caused by the answer sheet.

Method used

By obtaining the question or title template box in the target answer sheet image and the answer sheet template image, the marking point matching is used for global correction, and the moving distance is determined based on the offsets of the target line and template frame, and the black pixel points in the image are moved to Complete local correction.

Benefits of technology

The image correction of the answer sheet from global to local is achieved, the correction effect is improved, and the local deformation problem of the answer sheet can be effectively handled.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478955A_ABST
    Figure CN119478955A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a global-to-local answer sheet image intelligent correction method and device. The method comprises the following steps: correcting a to-be-corrected answer sheet image to obtain a target answer sheet image based on first mark point position information with the highest matching degree with a mark point image in an answer sheet template image and corresponding second mark point position information in the to-be-corrected answer sheet image; determining a target straight line corresponding to each edge of the question template frame in the target answer sheet image as an edge of a question target frame; matching a title target frame corresponding to the title template frame in the target answer sheet image; determining a moving distance corresponding to the target answer sheet image based on a first offset of the target straight line relative to the corresponding edge and / or a second offset of the title target frame relative to the title template frame; and moving the black pixel points in the question target frame and / or the title target frame according to the moving distance. According to the invention, the deformation problem of the answer sheet image can be corrected from global to local, and the correction effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for intelligent correction of answer sheet images from global to local. Background Art

[0002] The answer sheet will be deformed in perspective during scanning or shooting, which brings challenges to the correction and recognition of the answer sheet. Some studies use fixed markers to generate a perspective transformation matrix to perform perspective correction on the answer sheet.

[0003] However, the above method has poor correction effect for positions far away from the marking point and cannot solve the problem of local deformation of the answer sheet. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a method and device for intelligent correction of answer sheet images from global to local, which can correct the deformation problem of answer sheet images from global to local, thereby improving the correction effect.

[0005] In a first aspect, an embodiment of the present application provides a method for intelligent correction of answer sheet images from global to local, the method comprising: Obtain a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; Determine the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or match the title target frame corresponding to the title template frame in the target answer sheet image; Determine the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding side of the question template frame and / or the second offset of the title target frame relative to the title template frame; The black pixels in the target answer sheet image and the question target frame and / or the title target frame are moved according to the moving distance to complete the local correction of the target answer sheet image.

[0006] In a possible implementation, obtaining a target answer sheet image includes: Match each mark point image in each corner area of ​​the answer sheet template image to obtain the first mark point position information with the highest matching degree in each corner area; the mark point image refers to the image of the mark point within the preset angle range and within the first preset size range; the distribution information of the black pixel points and the white pixel points in the minimum enclosing rectangular box corresponding to the mark point conforms to the preset distribution information; Matching is performed with each mark point target image in a local area corresponding to each first mark point position information in the answer sheet image to be corrected; the mark point position information with the highest matching degree in the local area corresponding to each first mark point position information is determined as the second mark point position information corresponding to each first mark point position information; the size range of the mark point in the mark point target image is determined based on the first preset size range, the size of the answer sheet template image and the size of the target answer sheet image; A perspective transformation matrix is ​​generated according to the second marking point position information corresponding to all the first marking point position information in the answer sheet template image and all the first marking point position information in the answer sheet image to be corrected; and perspective correction is performed on the answer sheet image to be corrected based on the perspective transformation matrix to obtain a target answer sheet image.

[0007] In a possible implementation, the question template frame corresponding to the question area in the answer sheet template image is obtained through the following steps: Increasing the size of the annular rectangular frame according to the preset size step and the second preset size range; counting the number of black pixels in the border of the annular rectangular frame of each size containing the question area in the answer sheet template image; the initial size of the annular rectangular frame is greater than or equal to the preset size of the question area; the second preset size range is determined based on the preset size of the question area and the width of the answer sheet template image; The position of the circular rectangular frame with the largest number of black pixels is determined as the position of the question template frame.

[0008] In a possible implementation, the title template frame corresponding to the question area in the answer sheet template image is obtained through the following steps: Convert the black pixels in the question area of ​​the answer sheet template image into white pixels; Convert the pixels in the handwriting area of ​​the answer sheet template image into white pixels; Perform a closing operation on the answer sheet template image to obtain a target answer sheet template image; In the target area including the question area in the target answer sheet template image, a connected domain analysis is performed on the black pixels; the shape of the connected domain is a rectangle; The position of the connected domain with the largest area is determined as the position of the title template frame.

[0009] In a possible implementation, the following steps are performed to detect a straight line corresponding to each edge in the question template frame in the target answer sheet image, including: An initial straight line satisfying a preset straight line condition is detected in the first extension area corresponding to the edge in the target answer sheet image; the distance from the pixel point in the first extension area corresponding to the edge to the edge is less than the preset extension distance; According to the direction of the edge in the question template frame, the target straight line corresponding to the edge is determined from all corresponding initial straight lines.

[0010] In a possible implementation, matching a title target frame corresponding to a title template frame in a target answer sheet image includes: According to a preset expansion size, the area corresponding to the title template frame in the target answer sheet image is expanded to obtain a second expansion area; A title target frame corresponding to the title template frame is matched in the second extended area.

[0011] In a possible implementation, the first offset of each target straight line relative to the corresponding side of the question template frame is determined by the following steps, including: Calculate the first difference between the abscissa of the endpoint of the target straight line corresponding to the left side of the question template frame and the abscissa of the endpoint of the left side; calculate the second difference between the abscissa of the endpoint of the target straight line corresponding to the right side of the question template frame and the abscissa of the endpoint of the right side; Determine an average value of the first difference and the second difference as a lateral offset in the first offset; Calculate the third difference between the ordinate of the endpoint of the target straight line corresponding to the upper side of the question template frame and the ordinate of the endpoint of the upper side; calculate the fourth difference between the ordinate of the endpoint of the target straight line corresponding to the lower side of the question template frame and the ordinate of the endpoint of the lower side; An average value of the third difference and the fourth difference is determined as the longitudinal offset in the first offset.

[0012] In a second aspect, the embodiment of the present application further provides a device for intelligently correcting answer sheet images from global to local, the device comprising: An acquisition module is used to acquire a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; A matching module is determined, which is used to determine the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or to match the title target frame corresponding to the title template frame in the target answer sheet image; A determination matching module is used to determine the moving distance corresponding to the target answer sheet image based on a first offset of each target straight line relative to a corresponding side of the question template frame and / or a second offset of the title target frame relative to the title template frame; The moving module is used to move the black pixels in the target answer sheet image and the question target frame and / or the title target frame according to the moving distance to complete the local correction of the target answer sheet image.

[0013] In the third aspect, an embodiment of the present application also provides an electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, when the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for intelligent correction of answer sheet images from global to local as described in any one of the items of the first aspect.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for intelligent correction of answer sheet images from global to local as described in any one of the items in the first aspect are executed.

[0015] The embodiment of the present application provides a method and device for intelligent correction of answer sheet images from global to local, the method comprising: obtaining a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image after global correction of the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; determining the target straight lines corresponding to the edges of the question template frame detected in the target answer sheet image as the edges of the question target frame; and / or matching the title target frame corresponding to the title template frame in the target answer sheet image; determining the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding edge of the question template frame and / or the second offset of the title target frame relative to the title template frame; and moving the black pixels in the question target frame and / or the title target frame in the target answer sheet image according to the moving distance to complete the local correction of the target answer sheet image. This application can correct the deformation problem of the answer sheet image from the global to the local, thereby improving the correction effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 A flowchart of a method for intelligent correction of answer sheet images from global to local provided in an embodiment of the present application is shown; Figure 2 A schematic diagram of a marker point image provided by an embodiment of the present application is shown; Figure 3 A schematic diagram of a topic template frame and a title template frame provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of the structure of a device for intelligently correcting answer sheet images from global to local aspects provided in an embodiment of the present application is shown; Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0018] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0019] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0020] In order to enable those skilled in the art to use the contents of this application, the following implementation is provided in conjunction with a specific application scenario, the "field of image processing technology". For those skilled in the art, the general principles defined herein may be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is mainly described around the "field of image processing technology", it should be understood that this is only an exemplary embodiment.

[0021] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0022] The following is a detailed description of a method for intelligent correction of answer sheet images from global to local aspects provided in an embodiment of the present application.

[0023] Reference Figure 1 As shown, it is a flowchart of a method for intelligent correction of answer sheet images from global to local provided in an embodiment of the present application. The exemplary steps of the embodiment of the present application are described below: S101, obtaining a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image.

[0024] In the embodiment of the present application, the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected. The mark point image refers to the image of the answer sheet image to be corrected within a preset angle range (such as 0 ) and within the first preset size range (such as , in pixels). The angle of the marker in the marker image It refers to the corresponding value of the angle between the marker point in the marker template image of the marker point and the marker point in the marker image. The size of the marker in the marker image, including the height of the marker and width .

[0025] In addition, the distribution information of black pixels and white pixels in the minimum enclosing rectangle corresponding to the marker point conforms to the preset distribution information; the distribution information refers to the ratio between the number of black pixels and the number of white pixels in the minimum enclosing rectangle corresponding to the preset marker point, the distribution position of the black pixels and the distribution position of the white pixels. Figure 2 , which is a schematic diagram of a marker point image provided in an embodiment of the present application.

[0026] The answer sheet template image includes at least one question area. Obtain a question template frame and / or a title template frame corresponding to each question area. Figure 3 Shown is a schematic diagram of a topic template frame and a title template frame provided in an embodiment of the present application.

[0027] Specifically, obtaining the target answer sheet image includes: Step 1: Match each corner area in the answer sheet template image with each marker point image to obtain the first marker point position information with the highest matching degree in each corner area.

[0028] In the implementation manner of the present application, a marking point is set in each corner area of ​​the answer sheet template image.

[0029] Step 2: Match each marking point target image within the local area corresponding to each first marking point position information in the answer sheet image to be corrected; determine the marking point position information with the highest matching degree in the local area corresponding to each first marking point position information as the second marking point position information corresponding to each first marking point position information; the size range of the marking point in the marking point target image is determined based on the first preset size range, the size of the answer sheet template image and the size of the target answer card image.

[0030] In the implementation mode of the present application, it is assumed that the size of the answer sheet template image is , the size of the target answer sheet image is , the first marking point position information is (X, Y), the horizontal coordinate of the pixel point in the local area x The range is ; The vertical coordinate of the pixel point in the local area y The range is .

[0031] In addition, the size range of the marker points in the marker target image is , ;in, is the minimum width in the first preset size range, is the minimum height value in the first preset size range, is the maximum width in the first preset size range, is the maximum height in the first preset size range, is the size of the marker point in the target image The width of is the size of the marker point in the target image The angle range of the marker point in the marker target image is the preset angle range.

[0032] Step three, generate a perspective transformation matrix based on the second marking point position information corresponding to all the first marking point position information in the answer sheet template image and all the first marking point position information in the answer sheet image to be corrected; perform perspective correction on the answer sheet image to be corrected based on the perspective transformation matrix to obtain the target answer sheet image.

[0033] In an implementation manner of the present application, the second mark point position information corresponding to all the first mark point position information in the answer sheet template image and all the first mark point position information in the answer sheet image to be corrected is used as parameters of the getPerspectiveTransform method in OpenCV to generate a perspective transformation matrix; the answer sheet image to be corrected is perspective corrected based on the perspective transformation matrix to align the answer sheet image to be corrected with the answer card template image to obtain a target answer sheet image.

[0034] Furthermore, the question template frame corresponding to the question area in the answer sheet template image is obtained through the following steps: Step 1: Increase the size of the annular rectangular frame according to the preset size step and the second preset size range; count the number of black pixels in the border of the annular rectangular frame of each size that includes the question area in the answer sheet template image; the initial size of the annular rectangular frame is determined based on the preset size of the question area; the second preset size range is determined based on the preset size of the question area and the width of the answer sheet template image.

[0035] In an embodiment of the present application, the position of the annular rectangular frame can be determined by setting the center point of the question area in the answer sheet template image and the center point of the annular rectangular frame to be at the same position. The annular rectangular frame refers to a frame composed of two concentric rectangles. The area where the border of the annular rectangular frame is located refers to the area between the boundaries of the two rectangles. The width of the border can be 1 pixel. The above-mentioned preset size step can be 1 pixel, which means that the width and height of the annular rectangular frame are increased by 1 pixel. The width in the initial size of the annular rectangular frame is greater than or equal to the width in the preset size of the question area. The height in the initial size of the annular rectangular frame is greater than or equal to the height in the preset size of the question area.

[0036] Here, the paper size standard of the answer sheet corresponding to the answer sheet template image is different, and the formula for determining the second preset size range is also different. Specifically, if the paper size standard of the answer sheet is A4, then the maximum width in the second preset size range is ; If the standard paper size of the answer sheet is A3, the maximum width in the second preset size range ; The width of the initial size of the circular rectangular frame. The maximum height in the second preset size range ;in, The height of the title area in the default size. The width of the title area in the default size.

[0037] Step 2: Determine the position of the circular rectangular frame with the largest number of black pixels as the position of the question template frame.

[0038] Furthermore, the title template frame corresponding to the question area in the answer sheet template image is obtained through the following steps: Step 1: Convert the black pixels in the question area of ​​the answer sheet template image into white pixels.

[0039] In an embodiment of the present application, the pixel values ​​of black pixels in the question area in the answer sheet template image are set to white pixel values ​​to convert the black pixels in the question area in the answer sheet template image into white pixels.

[0040] Step 2: Convert the pixels in the handwritten area of ​​the answer sheet template image into white pixels.

[0041] In an implementation manner of the present application, a handwriting area recognition model trained with a U-Net network is used to identify the handwriting area in the answer sheet template image, and the pixel values ​​of all pixels in the handwriting area are set to white pixel values.

[0042] Step 3: Perform a closing operation on the answer sheet template image to obtain the target answer sheet template image.

[0043] In the implementation mode of this application, use The window is closed, and the closing operation is the process of image dilation and corrosion in sequence.

[0044] Step 4: Perform a connected domain analysis on black pixels in the target area including the question area in the target answer sheet template image; the shape of the connected domain is a rectangle.

[0045] In the embodiment of the present application, the size of the target area is a preset multiple (such as 1.1) of the preset size of the question area. The position of the target area can be determined by setting the center point of the question area in the answer sheet template image to be the same as the center point of the target area.

[0046] Step 5: Determine the position of the connected domain with the largest area as the position of the title template frame.

[0047] S102, determining the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or matching the title target frame corresponding to the title template frame in the target answer sheet image.

[0048] Specifically, the straight lines corresponding to each edge in the question template frame are detected in the target answer sheet image through the following steps, including: Step 1: Detect an initial straight line that meets a preset straight line condition in a first extended area corresponding to the edge in the target answer sheet image; the distance from the pixel point in the first extended area corresponding to the edge to the edge is less than a preset extended distance.

[0049] In the implementation manner of the present application, the preset straight line condition may be that the initial straight line is a horizontal or vertical straight line, the length is greater than the preset length, etc. For example, the initial straight line is detected by the Hough (parameters are cv::HoughLinesP(img, lines, 1, CV_PI / 180,img.cols / 2, img.cols / 12, img.cols / 16);) transformation algorithm. Wherein, img: input image, which should be the grayscale image corresponding to the target answer sheet image, and edge detection (such as Canny edge detection) has been applied. lines: output straight line segment array, each element is a Vec4i type, containing the starting and ending coordinates of the straight line (x1, y1, x2, y2). 1: resolution of rho, that is, the accuracy of rho. rho is the radial distance in polar coordinates, which represents the distance from the origin (center of the image) to the straight line. CV_PI / 180: resolution of theta, that is, the accuracy of theta. theta is the angle in polar coordinates, which represents the angle between the straight line and the x-axis. img.cols / 2: Threshold, used to decide whether a line is significant enough to be detected. This value is the number of votes in the accumulator, and lines exceeding this value will be detected. img.cols / 12: Minimum length of a line, lines shorter than this length will be ignored. img.cols / 16: Minimum gap between lines, that is, the minimum distance between two lines. If the distance between two lines is less than this value, they will be considered the same line. cols is the width of the target answer sheet image.

[0050] Furthermore, matching a title target frame corresponding to the title template frame in the target answer sheet image includes: expanding an area corresponding to the title template frame in the target answer sheet image according to a preset expansion size to obtain a second expansion area; and matching a title target frame corresponding to the title template frame in the second expansion area.

[0051] In the implementation manner of the present application, the second extension area is the same as the center point of the title template frame.

[0052] For example, if the preset expansion size is 50 pixels×50 pixels, the width of the second expansion area is the width of the title template frame plus 50 pixels, and the height of the second expansion area is the width of the title template frame plus 50 pixels.

[0053] Step 2: Determine the target straight line corresponding to the edge from all corresponding initial straight lines according to the direction of the edge in the question template frame.

[0054] In an implementation manner of the present application, if the edge is a left edge, the rightmost initial straight line corresponding to the edge is used to determine the target straight line corresponding to the edge; if the edge is a right edge, the leftmost initial straight line corresponding to the edge is used to determine the target straight line corresponding to the edge; if the edge is an upper edge, the lowermost initial straight line corresponding to the edge is used to determine the target straight line corresponding to the edge; if the edge is a lower edge, the uppermost initial straight line corresponding to the edge is used to determine the target straight line corresponding to the edge.

[0055] S103, determining the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding side of the question template frame and / or the second offset of the title target frame relative to the title template frame.

[0056] In the implementation manner of the present application, if based on the first offset of each target straight line relative to the corresponding side of the title template frame and the second offset of the title target frame relative to the title template frame, the average value of the lateral offset of the first offset and the lateral offset of the second offset is determined as the lateral moving distance in the moving distance; the average value of the longitudinal offset of the first offset and the longitudinal offset of the second offset is determined as the longitudinal moving distance in the moving distance. If based on the first offset of each target straight line relative to the corresponding side of the title template frame or the second offset of the title target frame relative to the title template frame, the average value of the lateral offset of the first offset or the lateral offset of the second offset is determined as the lateral moving distance in the moving distance. The average value of the longitudinal offset of the first offset or the longitudinal offset of the second offset is determined as the longitudinal moving distance in the moving distance.

[0057] Furthermore, the first offset of each target straight line relative to the corresponding side of the question template frame is determined by the following steps, including: Step 1: Calculate the first difference between the horizontal coordinate of the endpoint of the target straight line corresponding to the left side of the question template frame and the horizontal coordinate of the endpoint of the left side; calculate the second difference between the horizontal coordinate of the endpoint of the target straight line corresponding to the right side of the question template frame and the horizontal coordinate of the endpoint of the right side.

[0058] In the embodiment of the present application, the average value of the difference between the horizontal coordinate of the upper endpoint of the target straight line corresponding to the left side of the topic template frame and the horizontal coordinate of the upper endpoint of the left side, and the average value of the difference between the horizontal coordinate of the lower endpoint of the target straight line corresponding to the left side of the topic template frame and the horizontal coordinate of the lower endpoint of the left side, is determined as the first difference. The average value of the difference between the horizontal coordinate of the upper endpoint of the target straight line corresponding to the right side of the topic template frame and the horizontal coordinate of the upper endpoint of the right side, and the average value of the difference between the horizontal coordinate of the lower endpoint of the target straight line corresponding to the right side of the topic template frame and the horizontal coordinate of the lower endpoint of the right side, is determined as the second difference.

[0059] Step 2: Determine the average value of the first difference and the second difference as the lateral offset in the first offset.

[0060] Step 3: Calculate the third difference between the ordinate of the endpoint of the target straight line corresponding to the upper side of the question template frame and the ordinate of the endpoint of the upper side; calculate the fourth difference between the ordinate of the endpoint of the target straight line corresponding to the lower side of the question template frame and the ordinate of the endpoint of the lower side.

[0061] In the embodiment of the present application, the difference between the ordinate of the left end point of the target straight line corresponding to the upper side of the topic template frame and the ordinate of the right end point of the upper side, and the average value of the difference between the ordinate of the left end point of the target straight line corresponding to the upper side of the topic template frame and the ordinate of the right end point of the upper side, are determined as the third difference. The difference between the ordinate of the left end point of the target straight line corresponding to the lower side of the topic template frame and the ordinate of the right end point of the lower side, and the average value of the difference between the ordinate of the left end point of the target straight line corresponding to the lower side of the topic template frame and the ordinate of the right end point of the lower side, are determined as the fourth difference.

[0062] Step 4: Determine the average value of the third difference and the fourth difference as the longitudinal offset in the first offset.

[0063] Furthermore, the second offset of the title target frame relative to the title template frame is determined by the following steps: the difference between the horizontal coordinate of the vertex at the upper left corner of the title target frame and the horizontal coordinate of the vertex at the upper left corner of the title template frame is determined as the horizontal offset in the second offset; the difference between the vertical coordinate of the vertex at the upper left corner of the title target frame and the vertical coordinate of the vertex at the upper left corner of the title template frame is determined as the vertical offset in the second offset.

[0064] In addition, similar to the process of calculating the second offset using the vertex of the upper left corner of the title target frame, the second offset can also be calculated using the vertex of the upper right corner of the title target frame, the center point, etc.

[0065] S104, moving the black pixels in the target answer sheet image and the question target frame and / or the title target frame according to the moving distance to complete the local correction of the target answer sheet image.

[0066] In addition, when a question area does not have a question target box and / or a title target box, the moving distance corresponding to the question area will not be obtained. At this time, the black pixel points in the question area in the target answer sheet image can be moved according to the moving distances corresponding to other question areas closest to the question area.

[0067] The embodiment of the present application provides a method for intelligent correction of answer sheet images from global to local, the method comprising: obtaining a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; determining the target straight lines corresponding to the edges of the question template frame detected in the target answer sheet image as the edges of the question target frame; and / or matching the title target frame corresponding to the title template frame in the target answer sheet image; determining the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding edge of the question template frame and / or the second offset of the title target frame relative to the title template frame; and moving the black pixels in the question target frame and / or the title target frame in the target answer sheet image according to the moving distance to complete the local correction of the target answer sheet image. This application can correct the deformation problem of the answer sheet image from the global to the local, thereby improving the correction effect.

[0068] Based on the same inventive concept, an embodiment of the present application also provides an intelligent correction device for answer sheet images from global to local corresponding to the intelligent correction method for answer sheet images from global to local. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned intelligent correction method for answer sheet images from global to local in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0069] Reference Figure 4 FIG. 1 is a schematic diagram of a device for intelligently correcting answer sheet images from global to local provided in an embodiment of the present application. The device for intelligently correcting answer sheet images from global to local includes: An acquisition module 401 is used to acquire a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on the first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and the second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; A determination matching module 402 is used to determine the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or to match the title target frame corresponding to the title template frame in the target answer sheet image; A determination matching module 402 is used to determine the moving distance corresponding to the target answer sheet image based on a first offset of each target straight line relative to a corresponding side of the question template frame and / or a second offset of the title target frame relative to the title template frame; The moving module 403 is used to move the black pixels in the target answer sheet image and the question target frame and / or the title target frame according to the moving distance to complete the local correction of the target answer sheet image.

[0070] The embodiment of the present application provides a device for intelligently correcting answer sheet images from global to local aspects, which can correct the deformation problem of answer sheet images from global to local aspects, thereby improving the correction effect.

[0071] like Figure 5 As shown, an electronic device 500 provided in an embodiment of the present application includes: a processor 501, a memory 502 and a bus, the memory 502 stores machine-readable instructions executable by the processor 501, when the electronic device is running, the processor 501 and the memory 502 communicate through the bus, and the processor 501 executes the machine-readable instructions to perform the steps of the above-mentioned method for intelligent correction of answer sheet images from global to local.

[0072] Specifically, the above-mentioned memory 502 and processor 501 can be general-purpose memory and processor, which are not specifically limited here. When the processor 501 runs the computer program stored in the memory 502, it can execute the above-mentioned global to local intelligent correction method for answer sheet images.

[0073] Corresponding to the above-mentioned method for intelligent correction of answer sheet images from global to local, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for intelligent correction of answer sheet images from global to local are executed.

[0074] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0075] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0076] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0077] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the information processing method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0078] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A global to local intelligent correction method for answer sheet images, characterized in that: The method comprises: Acquire a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; Determine the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or match the title target frame corresponding to the title template frame in the target answer sheet image; Determine the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding side of the question template frame and / or the second offset of the title target frame relative to the title template frame; The black pixels in the target answer sheet image and in the question target frame and / or the title target frame are moved according to the moving distance to complete the local correction of the target answer sheet image.

2. The method for intelligent correction of answer sheet images from global to local according to claim 1, characterized in that: The step of obtaining the target answer sheet image comprises: Matching each mark point image in each corner area of ​​the answer sheet template image to obtain the first mark point position information with the highest matching degree in each corner area; the mark point image refers to the image of the mark point within a preset angle range and within a first preset size range; the distribution information of the black pixel points and the white pixel points in the minimum enclosing rectangular box corresponding to the mark point conforms to the preset distribution information; Matching is performed with each marked point target image in a local area corresponding to each first marked point position information in the answer sheet image to be corrected; the marked point position information with the highest matching degree in the local area corresponding to each first marked point position information is determined as the second marked point position information corresponding to each first marked point position information; the size range of the marked point in the marked point target image is determined based on the first preset size range, the size of the answer sheet template image and the size of the target answer sheet image; Generate a perspective transformation matrix based on the second marking point position information corresponding to all the first marking point position information in the answer sheet template image and all the first marking point position information in the answer sheet image to be corrected; perform perspective correction on the answer sheet image to be corrected based on the perspective transformation matrix to obtain a target answer sheet image.

3. The method for intelligent correction of answer sheet images from global to local according to claim 1 or 2, characterized in that: Get the question template frame corresponding to the question area in the answer sheet template image through the following steps: Increasing the size of the annular rectangular frame according to the preset size step and the second preset size range; counting the number of black pixels within the border of the annular rectangular frame of each size containing the question area in the answer sheet template image; The initial size of the annular rectangular frame is greater than or equal to the preset size of the question area; the second preset size range is determined based on the preset size of the question area and the width of the answer sheet template image; The position of the circular rectangular frame with the largest number of black pixels is determined as the position of the question template frame.

4. The method for intelligent correction of answer sheet images from global to local according to claim 1 or 2, characterized in that: Get the title template frame corresponding to the question area in the answer sheet template image through the following steps: Converting black pixels in the question area of ​​the answer sheet template image into white pixels; Converting the pixels in the handwriting area of ​​the answer sheet template image into white pixels; Performing a closing operation on the answer sheet template image to obtain a target answer sheet template image; In the target area including the question area in the target answer sheet template image, a connected domain analysis is performed on black pixels; the shape of the connected domain is a rectangle; The position of the connected domain with the largest area is determined as the position of the title template frame.

5. The method for intelligent correction of answer sheet images from global to local according to claim 1, characterized in that: The steps of detecting a straight line corresponding to each edge of the question template frame in the target answer sheet image include: An initial straight line satisfying a preset straight line condition is detected in the first extended area corresponding to the edge in the target answer sheet image; the distance from the pixel point in the first extended area corresponding to the edge to the edge is less than a preset extended distance; According to the direction of the edge in the question template frame, a target straight line corresponding to the edge is determined from all corresponding initial straight lines.

6. The method for intelligent correction of answer sheet images from global to local according to claim 1, characterized in that: The step of matching a title target frame corresponding to the title template frame in the target answer sheet image includes: According to a preset expansion size, the area corresponding to the title template frame in the target answer sheet image is expanded to obtain a second expansion area; A title target frame corresponding to the title template frame is matched in the second extended area.

7. The method for intelligent correction of answer sheet images from global to local according to claim 1, characterized in that: The first offset of each target straight line relative to the corresponding side of the question template frame is determined by the following steps, including: Calculate a first difference between the abscissa of the endpoint of the target straight line corresponding to the left side of the question template frame and the abscissa of the endpoint of the left side; calculate a second difference between the abscissa of the endpoint of the target straight line corresponding to the right side of the question template frame and the abscissa of the endpoint of the right side; Determine an average value of the first difference and the second difference as a lateral offset in the first offset; Calculate the third difference between the ordinate of the endpoint of the target straight line corresponding to the upper side of the question template frame and the ordinate of the endpoint of the upper side; calculate the fourth difference between the ordinate of the endpoint of the target straight line corresponding to the lower side of the question template frame and the ordinate of the endpoint of the lower side; An average value of the third difference and the fourth difference is determined as the longitudinal offset in the first offset.

8. An intelligent correction device for answer sheet images from global to local, characterized in that: The device comprises: An acquisition module, used for acquiring a target answer sheet image and a question template frame and / or a title template frame corresponding to the question area in the answer sheet template image; the target answer sheet image is an image obtained by globally correcting the answer sheet image to be corrected based on first mark point position information with the highest matching degree with the mark point image in each corner area of ​​the answer sheet template image and second mark point position information corresponding to the first mark point position information in the answer sheet image to be corrected; A determination matching module is used to determine the target straight lines detected in the target answer sheet image and corresponding to the edges of the question template frame as the edges of the question target frame; and / or to match the title target frame corresponding to the title template frame in the target answer sheet image; A determination matching module is used to match the moving distance corresponding to the target answer sheet image based on the first offset of each target straight line relative to the corresponding side of the question template frame and / or the second offset of the title target frame relative to the title template frame; A moving module is used to move the black pixels in the target answer sheet image and the question target frame and / or the title target frame according to the moving distance to complete the local correction of the target answer sheet image.

9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the method for intelligent correction of answer sheet images from global to local as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for intelligent correction of answer sheet images from global to local as described in any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • A method for cutting answer regions of the same batch of test papers based on a combination

    CN109409374A

  • Image processing method and device

    CN111279389A

  • Image processing method, image processing device, electronic equipment and storage medium

    CN111753832A

  • Answer sheet correction method and device, electronic equipment and storage medium

    CN112348019A

  • Answer sheet identification method and system, computer equipment and readable storage medium

    CN117765560A

Cited By

  • Method, system and equipment for correcting OCR (Optical Character Recognition) result in answer sheet consistency verification and medium

    CN120260060A