Intelligent control processing method and system for document scanning correction
Through edge detection, linear boundary detection, feature extraction and page change recognition, compensation parameters are generated to adjust the scanning equipment, solving the problems of limited applicability and low degree of automation in file scanning, and improving the quality and processing efficiency of scanning images.
Patent Information
- Application Number
- CN202411435653.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The prior art has problems such as limited applicability and low degree of automation in the file scanning process, resulting in poor quality of scanned images and increased difficulty in post-processing.
By obtaining file scan images, you can detect edges, extract the document outline, perform linear boundary detection and area segmentation, perform multi-level feature extraction and fusion, identify page changes and generate compensation parameters, and finally analyze compensation control parameters to adjust the tray position of the scanning device. and pressure.
Automatic adaptability correction for multi-type files is realized, and the quality and processing efficiency of scanned images are improved.
Smart Images

Figure CN118972501B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an intelligent control processing method and system for document scanning correction. Background Art
[0002] As an important means of digitizing paper documents, document scanning is widely used in various fields such as archive management, book digitization, and corporate document management. However, due to the wide variety of documents, uneven paper quality, and various binding methods, many problems are often encountered during the scanning process, such as page tilt, distortion, missing edges, shadow interference, etc. These problems not only affect the quality of the scanned image, but also increase the difficulty of subsequent image processing.
[0003] At present, the types of scanners available on the market mainly include flatbed scanners, sheet-fed scanners, handheld scanners, drum scanners, and wide-format scanners, etc. These scanners have certain advantages in their respective application scenarios, but when faced with complex and diverse document scanning needs, they have limited applicability and low automation. Summary of the invention
[0004] The present application provides an intelligent control processing method and system for document scanning correction, which is used to solve the technical problems of limited applicability and low degree of automation in the prior art when performing document scanning.
[0005] In view of the above problems, the present application provides an intelligent control processing method and system for document scanning correction.
[0006] In a first aspect of the present application, an intelligent control processing method for document scanning correction is provided, the method comprising:
[0007] Acquire a document scan image for edge detection, extract the outer contour of the document, and determine the document boundary; based on the document boundary, perform straight line boundary detection on the inside of the document scan image, and segment multiple types of document areas, wherein the multiple types of document areas include text, pictures, and tables; perform multi-level feature extraction and fusion based on the document boundary and multiple types of document areas to obtain recognition features; perform page change recognition based on the document boundary and recognition features, and generate page compensation parameters; parse compensation control parameters of the document scanning device based on the page compensation parameters, and the compensation control parameters are used to fix the tray position and adjust the pressure of the document scanning device.
[0008] In a second aspect of the present application, an intelligent control processing system for document scanning correction is provided, the system comprising:
[0009] A document boundary determination module, the document boundary determination module acquires a document scan image for edge detection, extracts the outer contour of the document, and determines the document boundary; a document region segmentation module, the document region segmentation module performs straight line boundary detection on the inside of the document scan image based on the document boundary, and segments multiple types of document regions, the multiple types of document regions including text, pictures, and tables; a feature extraction and fusion module, the feature extraction and fusion module performs multi-level feature extraction and fusion according to the document boundary and multiple types of document regions to obtain recognition features; a page change recognition module, the page change recognition module performs page change recognition according to the document boundary and recognition features, and generates page compensation parameters; a compensation control module, the compensation control module parses compensation control parameters of a document scanning device according to the page compensation parameters, and the compensation control parameters are used to fix the tray position and pressure adjustment of the document scanning device.
[0010] One or more technical solutions provided in this application have at least the following technical effects or advantages:
[0011] The present application obtains a document scan image for edge detection, extracts the outer contour of the document, and determines the document boundary; based on the document boundary, performs straight line boundary detection inside the document scan image, and segments multiple types of document areas, which include text, pictures, and tables; performs multi-level feature extraction and fusion according to the document boundary and multiple types of document areas to obtain recognition features; performs page change recognition according to the document boundary and recognition features, and generates page compensation parameters; and parses compensation control parameters of the document scanning device according to the page compensation parameters, which are used to fix the tray position and pressure adjustment of the document scanning device. The present invention solves the technical problems of the prior art in limited applicability and low degree of automation when performing document scanning, and realizes adaptability and automatic correction to multiple types of documents through edge detection and contour extraction, straight line boundary detection and area segmentation, multi-level feature extraction and fusion, page change recognition and compensation parameter generation, and compensation control parameter parsing and application, so as to achieve the technical effect of improving the quality of the scanned image and processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 A schematic diagram of the flow of an intelligent control processing method for document scanning correction provided in an embodiment of the present application;
[0014] Figure 2 A schematic diagram of the structure of an intelligent control processing system for document scanning correction provided in an embodiment of the present application.
[0015] Explanation of the reference numerals: document boundary determination module 11 , document region segmentation module 12 , feature extraction and fusion module 13 , page change identification module 14 , compensation control module 15 . DETAILED DESCRIPTION
[0016] The present application provides an intelligent control processing method and system for document scanning correction, aiming to solve the technical problems of limited applicability and low degree of automation in the prior art when performing document scanning. Through edge detection and contour extraction, straight line boundary detection and area segmentation, multi-level feature extraction and fusion, page change recognition and compensation parameter generation, and compensation control parameter analysis and application, adaptability and automatic correction of multiple types of files are achieved, thereby achieving the technical effect of improving the quality of scanned images and processing efficiency.
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0018] It should be noted that any variations of the terms "include" and "have" are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or modules that are not explicitly listed or inherent to these processes, methods, products or devices.
[0019] Embodiment 1, as Figure 1 As shown, the present application provides an intelligent control processing method for document scanning correction, the method comprising:
[0020] Step S100: Obtain a document scan image to perform edge detection, extract the outer contour of the document, and determine the document boundary.
[0021] In an embodiment of the present application, a scanned image of a document is first obtained by a scanning device, and then an edge detection algorithm, such as the Canny edge detection algorithm, is used to identify edge pixels by calculating the gradient of the image, and these edge pixels form continuous edge lines in the image. After completing edge detection, the outer contour of the document is extracted using the identified edge pixels. The outer contour refers to the outermost boundary of the document, and a closed contour line is formed by connecting these edge pixels. To ensure the integrity and continuity of the outer contour, a contour tracking algorithm is used to gradually track along the edge pixels to form a complete and continuous contour. Finally, the document boundary is determined based on the extracted outer contour. The document boundary includes four edges of the document, namely the top, bottom, left and right sides. By analyzing the shape and position of the outer contour, the four vertex positions of the document are determined. Through these vertices, the coordinate data and format parameters of the document are generated.
[0022] Through the above steps, the document boundary is determined.
[0023] Furthermore, in the method provided in the embodiment of the application, the step of acquiring the scanned image of the document for edge detection, extracting the outer contour of the document, and determining the document boundary also includes:
[0024] The document scanned image is binarized, edge pixels are identified based on the binarization, and the outer contour of the document is determined based on the connection of the edge pixels; based on the outer contour of the document, the four boundaries of the document are determined, document coordinate data and format parameters are generated, and the document boundary is determined.
[0025] In the embodiment of the present application, the document scanned image is first binarized, that is, the grayscale image is converted into a black and white image, and the pixels above the threshold are set to white (foreground) and the pixels below the threshold are set to black (background) through a pre-set threshold. Then, the Canny edge detection algorithm is applied to the binarized image for edge detection, and the edge pixels in the image are identified through multi-level filtering and non-maximum suppression technology. Then, the contour tracking algorithm is used to extract the outer contour of the document based on the identified edge pixels, that is, the shape of the document is outlined by connecting the closed contour lines formed by the edge pixels.
[0026] Based on the extracted document outline, the geometric analysis method is further used to determine the four boundaries of the document. These four boundaries include the top, bottom, left and right sides of the document. By identifying the vertex positions of the outer contour, the four vertices of the document are determined, and the coordinate data and format parameters of the document are generated. The coordinate data describes the specific position of the document in the image, while the format parameters describe the size and proportion of the document. Through the above process, the boundary position of the document is determined.
[0027] Furthermore, in the method provided in the embodiment of the application, according to the outer contour of the document, the four boundaries of the document are determined, and the document coordinate data and format parameters are generated, and the method also includes:
[0028] According to the outer contour of the document, the perimeter of the outer contour is calculated; using a preset approximation accuracy, according to the perimeter of the outer contour, the outer contour is simplified into a polygon, and the number of polygon vertices corresponds to the preset approximation accuracy; with the quadrilateral vertices as the target, the number of polygon vertices is verified to converge, and four vertices are determined; the four vertices are fitted to the scanned image of the original document to verify the approximation result, and the four vertices are confirmed when the quadrilateral covers the entire document; based on the determined four vertices, the document coordinate data and format parameters are obtained.
[0029] In an embodiment of the present application, a geometric algorithm is first used to calculate the perimeter of the document's outer contour. The perimeter refers to the total length of the outer contour line, which is obtained by calculating the distances between adjacent points on the outer contour point by point and accumulating them. Next, the outer contour is simplified into a polygon using a preset approximation accuracy. The approximation accuracy is 2% of the outer contour perimeter, which means that the number of vertices of the polygon is proportional to the outer contour perimeter. The specific method is to simplify the outer contour using the Douglas-Peucker algorithm, and finally obtain a simplified polygon by recursively removing points below the distance straight line threshold.
[0030] Then, with the quadrilateral vertices as the target, the number of simplified polygon vertices is verified and converged. The specific method is to iteratively reduce the number of polygon vertices and verify at each step whether the shape of the polygon is close to a quadrilateral. When the number of polygon vertices converges to four and the shape is close to a quadrilateral, the four vertices are determined.
[0031] Then, the determined four vertices are fitted to the original document scanned image to verify the approximation result. Specifically, the four vertices of the simplified polygon are mapped back to the original image by calculating the relative positions of the vertices in the simplified polygon and the original image. When performing the initial fitting, it is assumed that the relative positions of the vertices in the simplified polygon are , then the relative position in the original image is . By scaling, the specific position of the vertex in the original image is calculated. For example, let the width and height of the simplified polygon be and , the width and height of the original image are and , the position of the vertex in the simplified polygon is , then its position in the original image is , Based on the initial fitting results, adjust the positions of the vertices so that the boundary of the quadrilateral is as close as possible to the actual boundary of the document. This step uses an optimization algorithm, such as the least squares method, to adjust the vertex positions to minimize the error between the quadrilateral and the document boundary. Check whether the adjusted quadrilateral can cover the entire document. If the quadrilateral successfully covers the document, the four vertices are confirmed.
[0032] Finally, the coordinate data and format parameters of the document are generated based on the determined four vertices.
[0033] Furthermore, in the method provided in the embodiment of the application, obtaining the document coordinate data and format parameters according to the determined four vertices further includes:
[0034] Arrange the four vertices in order, record the coordinates of each vertex, and obtain the document coordinate data, wherein the arrangement order is upper left, upper right, lower left, and lower right; based on the coordinate data of the four vertices, determine two width edges and two height edges, the two width edges are two horizontal vertex connecting lines, and the two height edges are two vertical vertex connecting lines; calculate the average values of the two width edges and the two height edges respectively, to obtain the document width and document height; record the document width and document height as the format parameters.
[0035] In the embodiment of the present application, the four vertices of the simplified polygon are first arranged in order, and the coordinates of each vertex are recorded to obtain the coordinate data of the document. The arrangement order here is upper left, upper right, lower left, and lower right. At the same time, it is assumed that the vertex coordinates are , , , Next, based on the coordinate data of these four vertices, two width edges and two height edges are determined. The width edge refers to the horizontal vertex connection line, that is, the line segment connecting the upper left vertex and the upper right vertex, and the lower left vertex and the lower right vertex; the height edge refers to the vertical vertex connection line, that is, the line segment connecting the upper left vertex and the lower left vertex, and the upper right vertex and the lower right vertex. Specifically, the line segments of the width edge are and , the line segments of the height edges are and . Then the lengths of the two width sides and the two height sides are calculated and averaged to determine the width and height of the document. Specifically:
[0036] Length of the width side
[0037]
[0038] Length of the height side
[0039]
[0040] The width and height of the document are obtained by calculating the average value of the width side and the height side. Finally, the width and height of the document are recorded as the format parameters of the document.
[0041] Step S200: Based on the document boundary, straight line boundary detection is performed inside the document scanned image to segment multiple types of document areas, where the multiple types of document areas include text, pictures, and tables.
[0042] In the embodiment of the present application, based on the determined document boundary, the Hough transform is used to detect the straight line boundary of the internal area of the document scanned image. The Hough transform detects all the straight lines in the image by accumulating votes in the parameter space. For example, assuming that the detected straight line parameters are ,in is the vertical distance from the line to the origin of the image, is the angle of the line. Based on the detected line parameters, the internal area of the image is divided into multiple sub-regions. Each sub-region is surrounded by adjacent straight line boundaries. For example, suppose there are two horizontal lines and two vertical lines in the image, forming four rectangular regions. The goal of region segmentation is to divide the document content into smaller, manageable parts based on the detected lines.
[0043] Finally, the type of each segmented area is determined based on its content. Image analysis techniques such as optical character recognition are used to identify text areas, edge detection and shape analysis are used to identify table areas, and texture analysis is used to identify image areas. For example, OCR technology identifies areas containing text and marks them as text areas; shape analysis identifies areas containing regular lines and cells and marks them as table areas.
[0044] Through the above steps, different content areas within the document scan image are segmented and classified into types such as text, picture and table.
[0045] Step S300: performing multi-level feature extraction and fusion according to the document boundaries and multi-type document regions to obtain recognition features.
[0046] In an embodiment of the present application, when performing multi-level feature extraction and fusion, shallow feature extraction is first performed, and edge features are obtained by the Canny edge detection algorithm. Texture features are obtained using methods such as grayscale co-occurrence matrix, and shape features are obtained by methods such as Hough transform. When performing deep feature extraction, a deep learning model, such as a convolutional neural network, is used to extract semantic features, such as the semantics of text content, the theme of a picture, etc. Next, feature fusion is performed, and shallow features and deep features are standardized, and the feature values are converted to the same range. After that, the standardized shallow features and deep features are spliced to form a comprehensive feature vector. Finally, a classifier, such as a support vector machine, is used to classify and verify the comprehensive feature vector, and according to the distribution of the feature vector, it is classified into different document area types, such as text, pictures, and tables.
[0047] Through the above steps, the identification features of each document area are obtained.
[0048] Furthermore, in the method provided in the embodiment of the application, multi-level feature extraction and fusion are performed according to the document boundary and multi-type document regions, and further includes:
[0049] A shallow feature extraction submodel is constructed, and the shallow feature extraction submodel is used to identify and extract edge features, texture features, and shape features; a deep feature extraction submodel is constructed, and the deep feature extraction submodel is used to extract semantic features from images; a feature fusion layer is constructed, and the output results of the shallow feature extraction submodel and the deep feature extraction submodel are fused, and verified through a classifier, and the verified fusion features are output; wherein the recognition features include shallow features, deep features, and fusion features.
[0050] In an embodiment of the present application, a shallow feature extraction sub-model is first constructed, and the edges in the image are detected by using the Canny edge detection algorithm, and morphological operations such as dilation and erosion are applied to enhance the edge features. When performing texture feature extraction, the grayscale co-occurrence matrix is used to extract the texture features of the image. GLCM extracts texture features including contrast, homogeneity, energy, and entropy by counting the co-occurrence relationship of pixel grayscale values. When performing shape feature extraction, the Hu moment is used to extract the geometric shape features of the objects in the image, and the Fourier descriptor is used to analyze the frequency features of the shape to identify the shape changes of the objects in the image. The Fourier descriptor extracts the shape features of the object by analyzing the frequency components of the shape.
[0051] Next, we build a deep feature extraction sub-model. The deep feature extraction sub-model uses deep learning techniques, such as convolutional neural networks, to extract high-level semantic features from images. CNN extracts high-level semantic features from images, such as the content, subject, and category of objects in the image, through multiple layers of convolution and pooling operations. Specifically, we first select a pre-trained convolutional neural network model, such as VGG16, which has been trained on a large-scale image dataset and can extract rich semantic features. We use the convolution layer of the pre-trained model as the feature extraction layer. Through the convolution operation, the local features of the image are extracted, and the dimension is reduced through the pooling layer, such as max pooling or average pooling, to retain important feature information. The feature map output by the convolution layer is flattened and input into the fully connected layer. The feature vector is nonlinearly transformed through the ReLU activation function to enhance the expression ability of the model. Finally, we fine-tune the pre-trained model and continue to train it on the dataset of the specific task to meet the feature extraction requirements of the specific task. We use the document image dataset for training and fine-tuning so that the model can better understand and extract semantic features in the document. High-level semantic features such as image content, subject matter, and object categories are extracted from images through the constructed deep feature extraction sub-model.
[0052] Then, a feature fusion layer is constructed to fuse the output results of the shallow feature extraction sub-model and the deep feature extraction sub-model. Specifically, the shallow features and deep features are standardized, and the feature values are adjusted to the same scale by subtracting the mean and dividing by the standard deviation. The standardized shallow features and deep features are concatenated to form a comprehensive feature vector. Finally, a classifier, such as a support vector machine, is used to classify and verify the comprehensive feature vector, and the comprehensive feature vector is classified into different document area types, such as text, pictures, and tables. Finally, the verified fusion features are output.
[0053] Furthermore, in the method provided in the embodiment of the application, the output results of the shallow feature extraction sub-model and the deep feature extraction sub-model are fused, verified by a classifier, and the verified fusion features are output, which also includes:
[0054] The shallow features and deep features output by the shallow feature extraction sub-model and the deep feature extraction sub-model are standardized, and the feature values are converted to the same range; the shallow features and the deep features are concatenated to form a comprehensive feature vector; the comprehensive feature vector is classified and verified by a pre-trained support vector machine, and the comprehensive feature vector whose classification result meets the requirements is output to obtain the fusion feature.
[0055] In the embodiment of the present application, the shallow features and deep features are first normalized. Normalization is to convert the feature values to the same range to ensure that different types of features have the same importance when fused. Specifically, the feature values are adjusted to zero mean and unit variance by subtracting the mean and dividing by the standard deviation. Assume that the mean of the shallow features is , the standard deviation is , the mean of the deep features is , the standard deviation is , then the standardized eigenvalues are: , .
[0056] Next, the standardized shallow features and deep features are concatenated to combine multiple features into a high-dimensional vector. The comprehensive feature vector contains a variety of feature information. Assume that the standardized shallow features are , the standardized deep features are , then the comprehensive feature vector is .
[0057] The comprehensive feature vector is then classified and verified using a pre-trained support vector machine. Support vector machine is a supervised learning algorithm that uses a feature vector dataset containing labeled category labels for training to find the optimal hyperplane that maximizes the class spacing. Classification verification refers to inputting the comprehensive feature vector into a pre-trained SVM model and classifying it based on its output results. Assuming that the SVM model classifies the comprehensive feature vector into different document region types, such as text, image, and table, the comprehensive feature vector whose classification results meet the requirements is the verified fusion feature.
[0058] Finally, the comprehensive feature vector whose classification results meet the requirements is output to obtain the fusion feature.
[0059] Step S400: performing page change recognition based on the document boundary and recognition features, and generating page compensation parameters.
[0060] In an embodiment of the present application, the document boundary and identification features extracted previously are first used to identify the changes of the page. These changes include the tilt, distortion or other geometric deformation of the page. A standard coordinate system is constructed using the four vertex positions of the document boundary, and the current page is aligned with the standard coordinate system. By comparing the standard boundary and the current document boundary, the changes of the page are detected. Then, tilt detection is performed to calculate the tilt angle of the page. Using edge detection and Hough transform techniques, the straight lines in the page are detected, and the tilt angle of the page is determined by calculating the angle between these straight lines and the horizontal line. By analyzing the vertex positions of the document boundary, the overall tilt of the page is calculated. For example, if the positions of the upper left and upper right vertices are on the same horizontal line, but the positions of the lower left and lower right vertices are not on the same horizontal line, then the page may be tilted.
[0061] Distortion detection is then performed to detect the distortion of the page. By comparing the vertex positions of the document boundary with the standard coordinate system, the local distortion and deformation of the page are identified. The degree of distortion of the page is calculated using deformation analysis technology. For example, the geometric deformation of the page is analyzed using methods such as polynomial fitting or affine transformation. Then, according to the detected page changes, corresponding page compensation parameters are generated. The page compensation parameters include stretch coefficient, rotation angle, displacement vector, edge compensation direction and edge compensation amount.
[0062] Furthermore, in the method provided in the embodiment of the application, according to the document boundary and recognition features, page change recognition is performed to generate page compensation parameters, and the method also includes:
[0063] The pages are aligned according to the four vertices of the document boundary, a standard coordinate system is constructed, and the tilt and distortion information of the document page is identified; the standard boundary is used to fit and match the current document boundary, the page deformation area is detected, and the connection anomaly is identified based on the identification features to determine the abnormal features, which include texture changes, edge loss, shape anomalies, and semantic inconsistency; the anomaly is located according to the page deformation area and abnormal features to determine the abnormal position; feature compensation analysis is performed according to the abnormal features to obtain compensation parameters, and the abnormal position is integrated with the compensation parameters to generate the page compensation parameters.
[0064] In an embodiment of the present application, page alignment is first performed based on the four vertices of the document boundary, and a standard coordinate system is constructed by aligning the four vertices of the document with the corresponding points in the standard coordinate system to identify the tilt and distortion information of the document page. When identifying the tilt and distortion information of the document page, edge detection and Hough transform and other technologies are used to detect the straight lines in the page, and the tilt angle of the page is determined by calculating the angle between these straight lines and the horizontal line. If most of the horizontal straight lines in the page have a significant angle with the horizontal line of the standard coordinate system, the page may be tilted, and the average angle of these straight lines is calculated as the overall tilt angle of the page. By comparing the vertex position of the document boundary with the standard coordinate system, the local distortion and deformation of the page are identified. Geometric transformation techniques, such as polynomial fitting or affine transformation, are used to analyze the deformation of the page. Detect whether the straight lines in the page are bent or otherwise nonlinearly deformed, and whether the four vertices of the page form a regular rectangle.
[0065] Then, the standard boundary is used to fit and match the current document boundary. The fitting and matching process aligns the current document boundary with the standard boundary through geometric transformations, such as affine transformation or perspective transformation, so as to detect the deformed area of the page. By comparing the position and shape of the standard boundary and the current document boundary, the deformation of the page is identified. Then, the connection anomaly is identified based on the recognition features to determine the abnormal features. Abnormal features include texture change, edge loss, shape anomaly, and semantic inconsistency. Specifically, texture change detects the consistency of image texture by analyzing the texture features of the image, such as gray level co-occurrence matrix and local binary pattern; edge loss uses edge detection algorithms, such as Canny edge detection, to identify the missing edge parts in the image; shape anomaly uses shape feature extraction algorithms, such as Hu moment and Fourier descriptor, to detect shape inconsistency in the image; semantic inconsistency uses a pre-built convolutional neural network to identify semantic changes in image content.
[0066] After that, the abnormality is located according to the page deformation area and the abnormal features to determine the abnormal position. The abnormal position in the document is determined by analyzing the geometric deformation of the page deformation area and the position of the abnormal features. For example, the specific position of the deformation is determined by calculating the center and boundary of the deformation area; the position of the abnormal area is determined by analyzing the distribution of the abnormal features. Next, feature compensation analysis is performed based on the abnormal features to generate compensation parameters for correcting page deformation. The compensation parameters include stretching coefficient, rotation angle, displacement vector, edge compensation direction and edge compensation amount. The stretching coefficient is used to correct the proportional distortion of the page. By analyzing the length of the page boundary, the proportional factor that needs to be adjusted is calculated. Assuming that the page width should be W, but the detected width is W', the stretching coefficient is W / W'. The rotation angle is used to correct the tilt of the page. According to the detected tilt angle, the angle value that needs to be rotated is calculated. Assuming that the tilt angle of the page is θ, the rotation angle compensation parameter is -θ. The displacement vector is used to correct the position offset of the page. By comparing the position of the standard coordinate system and the current document boundary, the distance and direction required for translation are calculated. Assuming that the page should be at position , but the detected position is , then the displacement vector is Edge compensation is used to correct the missing or deformed edges of a page. Based on the edge detection results, the direction and amount of compensation required are calculated. Assuming that the length of the edge missing area is L, the edge compensation parameter is L.
[0067] Finally, the abnormal position and the compensation parameters are integrated to generate the page compensation parameters.
[0068] Step S500: parsing compensation control parameters of a document scanning device according to the page compensation parameters, wherein the compensation control parameters are used to fix a tray position and pressure adjustment of the document scanning device.
[0069] In an embodiment of the present application, the compensation control parameters of the document scanning device are parsed according to the page compensation parameters. The tray position of the scanning device is adjusted according to the parsed horizontal and vertical stretch ratios, rotation angles, and displacements. This includes controlling the movement, rotation, and stretching of the tray in the horizontal and vertical directions to ensure that the page maintains the correct position and angle during the scanning process. According to the parsed edge compensation amount, the pressure setting of the scanning device is adjusted to avoid scan image quality problems caused by edge loss or deformation.
[0070] Furthermore, in the method provided in the embodiment of the application, the compensation control parameter of the file scanning device is parsed according to the page compensation parameter, and further includes:
[0071] According to the page compensation parameters, the stretching coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount are analyzed, and the global compensation parameters and local compensation parameters are identified and separated; the control model of the tray position control parameters and the pressure control parameters are fitted using the historical test parameters, and the stretching coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount are calculated and converted through the control model to determine the control parameters; according to the global compensation parameters and the local compensation parameters, the adjustment area is located, and the control parameters are mapped and associated with the adjustment area to obtain the compensation control parameters.
[0072] In an embodiment of the present application, the generated page compensation parameters include a stretching coefficient, a rotation angle, a displacement vector, and an edge compensation amount for correcting page deformation. The stretching coefficient is used to correct the proportional distortion of the page. For example, a stretching coefficient of 1.05 indicates that the page needs to be stretched horizontally by 5%; the rotation angle is used to correct the tilt of the page. For example, a rotation angle of 2 degrees indicates that the page needs to be rotated 2 degrees clockwise; the displacement vector is used to correct the position offset of the page, for example, a horizontal displacement of 10 pixels and a vertical displacement of -5 pixels; the edge compensation direction and edge compensation amount are used to correct the missing or deformed edges of the page, for example, the left edge needs to be filled with 5 pixels; texture compensation is used to process local areas of the page, for example, local areas need to be smoothed. Next, identify and separate global compensation parameters and local compensation parameters. The global compensation parameters include the stretching coefficient, rotation angle, and global pressure adjustment of the entire page; the local compensation parameters include the displacement vector, edge compensation direction and edge compensation amount, and local pressure adjustment of the local area of the page.
[0073] Next, the control model is fitted using historical test parameters. The historical test data includes page compensation parameters and corresponding tray position adjustment and pressure adjustment parameters under different conditions. A linear regression or multivariate regression model is used to fit the tray position control parameters and pressure control parameters to obtain a control model. The control model is used to perform calculations and conversions on the stretch coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount to determine the control parameters.
[0074] Finally, the parsed compensation parameters are mapped to specific control parameters, including tray position control parameters and pressure control parameters. The tray position control parameters include horizontal and vertical position adjustment and rotation angle adjustment. For example, according to the global and local stretch coefficients and displacement vectors, the horizontal and vertical positions of the tray are adjusted; according to the rotation angle adjustment, the rotation angle of the tray is adjusted. The pressure control parameters include global pressure adjustment and local pressure adjustment. For example, according to the global pressure adjustment parameters, the pressure of the entire page is increased; according to the local pressure adjustment parameters, the pressure of a specific area of the page is increased.
[0075] The global compensation parameters and local compensation parameters are combined to generate comprehensive compensation control parameters.
[0076] In the embodiments of the present application, in summary, the embodiments of the present application have at least the following technical effects:
[0077] The present application obtains a document scan image for edge detection, extracts the outer contour of the document, and determines the document boundary; based on the document boundary, performs straight line boundary detection inside the document scan image, and segments multiple types of document areas, which include text, pictures, and tables; performs multi-level feature extraction and fusion according to the document boundary and multiple types of document areas to obtain recognition features; performs page change recognition according to the document boundary and recognition features, and generates page compensation parameters; and parses compensation control parameters of the document scanning device according to the page compensation parameters, which are used to fix the tray position and pressure adjustment of the document scanning device. The present invention solves the technical problems of the prior art in limited applicability and low degree of automation when performing document scanning, and realizes adaptability and automatic correction to multiple types of documents through edge detection and contour extraction, straight line boundary detection and area segmentation, multi-level feature extraction and fusion, page change recognition and compensation parameter generation, and compensation control parameter parsing and application, so as to achieve the technical effect of improving the quality of the scanned image and processing efficiency.
[0078] Embodiment 2 is based on the same inventive concept as the intelligent control processing method for document scanning correction in the previous embodiment. Figure 2 As shown, the present application provides an intelligent control processing system for document scanning correction, and the system and method embodiments in the present application are based on the same inventive concept. The system includes:
[0079] A document boundary determination module 11, wherein the document boundary determination module 11 obtains a document scan image for edge detection, extracts the outer contour of the document, and determines the document boundary; a document region segmentation module 12, wherein the document region segmentation module 12 performs straight line boundary detection on the inside of the document scan image based on the document boundary, and segments multiple types of document regions, wherein the multiple types of document regions include text, pictures, and tables; a feature extraction and fusion module 13, wherein the feature extraction and fusion module 13 performs multi-level feature extraction and fusion according to the document boundary and multiple types of document regions to obtain recognition features; a page change recognition module 14, wherein the page change recognition module 14 performs page change recognition according to the document boundary and recognition features, and generates page compensation parameters; a compensation control module 15, wherein the compensation control module 15 parses compensation control parameters of a document scanning device according to the page compensation parameters, wherein the compensation control parameters are used to fix the tray position and pressure adjustment of the document scanning device.
[0080] Furthermore, the system is also used to implement the following functions:
[0081] Binarizing the document scanned image, identifying edge pixels based on the binarization, and determining the outer contour of the document based on the connection of the edge pixels;
[0082] According to the outer contour of the document, the four boundaries of the document are determined, document coordinate data and format parameters are generated, and the document boundaries are determined.
[0083] Furthermore, the system is also used to implement the following functions:
[0084] According to the outer contour of the document, the perimeter of the outer contour is calculated; using a preset approximation accuracy, according to the perimeter of the outer contour, the outer contour is simplified into a polygon, and the number of polygon vertices corresponds to the preset approximation accuracy; with the quadrilateral vertices as the target, the number of polygon vertices is verified to converge, and four vertices are determined; the four vertices are fitted to the scanned image of the original document to verify the approximation result, and the four vertices are confirmed when the quadrilateral covers the entire document; based on the determined four vertices, the document coordinate data and format parameters are obtained.
[0085] Furthermore, the system is also used to implement the following functions:
[0086] Arrange the four vertices in order, record the coordinates of each vertex, and obtain the document coordinate data, wherein the arrangement order is upper left, upper right, lower left, and lower right; based on the coordinate data of the four vertices, determine two width edges and two height edges, the two width edges are two horizontal vertex connecting lines, and the two height edges are two vertical vertex connecting lines; calculate the average values of the two width edges and the two height edges respectively, to obtain the document width and document height; record the document width and document height as the format parameters.
[0087] Furthermore, the system is also used to implement the following functions:
[0088] A shallow feature extraction submodel is constructed, and the shallow feature extraction submodel is used to identify and extract edge features, texture features, and shape features; a deep feature extraction submodel is constructed, and the deep feature extraction submodel is used to extract semantic features from images; a feature fusion layer is constructed, and the output results of the shallow feature extraction submodel and the deep feature extraction submodel are fused, and verified through a classifier, and the verified fusion features are output; wherein the recognition features include shallow features, deep features, and fusion features.
[0089] Furthermore, the system is also used to implement the following functions:
[0090] The shallow features and deep features output by the shallow feature extraction sub-model and the deep feature extraction sub-model are standardized, and the feature values are converted to the same range; the shallow features and the deep features are concatenated to form a comprehensive feature vector; the comprehensive feature vector is classified and verified by a pre-trained support vector machine, and the comprehensive feature vector whose classification result meets the requirements is output to obtain the fusion feature.
[0091] Furthermore, the system is also used to implement the following functions:
[0092] The pages are aligned according to the four vertices of the document boundary, a standard coordinate system is constructed, and the tilt and distortion information of the document page is identified; the standard boundary is used to fit and match the current document boundary, the page deformation area is detected, and the connection anomaly is identified based on the identification features to determine the abnormal features, which include texture changes, edge loss, shape anomalies, and semantic inconsistency; the anomaly is located according to the page deformation area and abnormal features to determine the abnormal position; feature compensation analysis is performed according to the abnormal features to obtain compensation parameters, and the abnormal position is integrated with the compensation parameters to generate the page compensation parameters.
[0093] Furthermore, the system is also used to implement the following functions:
[0094] According to the page compensation parameters, the stretching coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount are analyzed, and the global compensation parameters and local compensation parameters are identified and separated; the control model of the tray position control parameters and the pressure control parameters are fitted using the historical test parameters, and the stretching coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount are calculated and converted through the control model to determine the control parameters; according to the global compensation parameters and the local compensation parameters, the adjustment area is located, and the control parameters are mapped and associated with the adjustment area to obtain the compensation control parameters.
[0095] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. And the above-mentioned specific embodiments of this specification are described. The processes depicted in the accompanying drawings do not necessarily require the specific order and continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0096] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
[0097] This specification and drawings are merely exemplary illustrations of the present application and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, a person skilled in the art may make various modifications and variations to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present application and its equivalents, the present application intends to include these modifications and variations.
Claims
1. An intelligent control processing method for document scanning correction, characterized in that: The intelligent control processing method for document scanning correction includes: Obtain the document scanned image for edge detection, extract the document's outer contour, and determine the document boundary; Based on the document boundary, straight line boundary detection is performed inside the document scanned image to segment multiple types of document areas, wherein the multiple types of document areas include text, pictures, and tables; According to the document boundaries and multi-type document regions, multi-level feature extraction and fusion are performed to obtain recognition features; According to the document boundary and recognition features, page change recognition is performed to generate page compensation parameters; parsing compensation control parameters of a document scanning device according to the page compensation parameters, wherein the compensation control parameters are used to adjust a fixed tray position and a page pressure of the document scanning device; Among them, according to the document boundary and multi-type document area, multi-level feature extraction and fusion are performed to obtain recognition features, including: Constructing a shallow feature extraction sub-model, wherein the shallow feature extraction sub-model is used to identify and extract edge features, texture features, and shape features; Constructing a deep feature extraction sub-model, wherein the deep feature extraction sub-model is used to extract semantic features from the image; Constructing a feature fusion layer, fusing the output results of the shallow feature extraction sub-model and the deep feature extraction sub-model, verifying them through a classifier, and outputting verified fusion features; The identification features include shallow features, deep features, and fusion features; Wherein, according to the document boundary and recognition features, page change recognition is performed to generate page compensation parameters, including: Performing page alignment according to the four vertices of the document boundary, constructing a standard coordinate system, and identifying the tilt and distortion information of the document page; Using the standard boundary to fit and match the current document boundary, detecting the page deformation area, and performing connection anomaly recognition based on the recognition features to determine the abnormal features, wherein the abnormal features include texture change, edge loss, shape abnormality, and semantic inconsistency; Perform abnormal location according to the page deformation area and abnormal features to determine the abnormal position; Feature compensation analysis is performed according to the abnormal feature to obtain compensation parameters, and the abnormal position and the compensation parameters are integrated to generate the page compensation parameters.
2. The intelligent control processing method for document scanning correction according to claim 1, characterized in that: The method of acquiring a document scanned image to perform edge detection, extracting the outer contour of the document, and determining the document boundary includes: Binarizing the document scanned image, identifying edge pixels based on the binarization, and determining the outer contour of the document based on the connection of the edge pixels; According to the outer contour of the document, the four boundaries of the document are determined, document coordinate data and format parameters are generated, and the document boundaries are determined.
3. The intelligent control processing method for document scanning correction according to claim 2, characterized in that: According to the outer contour of the document, four boundaries of the document are determined, and document coordinate data and format parameters are generated, including: Calculate the perimeter of the outer contour according to the outer contour of the document; Using a preset approximation precision, according to the perimeter of the outer contour, simplifying the outer contour into a polygon, wherein the number of vertices of the polygon corresponds to the preset approximation precision; Verifying the convergence of the number of polygon vertices with the quadrilateral vertices as the target, and determining four vertices; Fitting the four vertices to the original document scanned image, verifying the approximation result, and confirming the four vertices when the quadrilateral covers the entire document; The document coordinate data and format parameters are obtained according to the determined four vertices.
4. The intelligent control processing method for document scanning correction according to claim 3, characterized in that: The step of obtaining the document coordinate data and format parameters according to the determined four vertices includes: Arrange the four vertices in order, record the coordinates of each vertex, and obtain the document coordinate data, wherein the arrangement order is upper left, upper right, lower left, and lower right; Based on the coordinate data of the four vertices, two width edges and two height edges are determined, wherein the two width edges are two horizontal vertex connection lines, and the two height edges are two vertical vertex connection lines; Calculate the average values of the two width edges and the two height edges respectively to obtain the document width and document height; The document width and document height are recorded as the format parameters.
5. The intelligent control processing method for document scanning correction according to claim 1, characterized in that: The output results of the shallow feature extraction sub-model and the deep feature extraction sub-model are fused, verified by a classifier, and the verified fusion features are output, including: Standardizing the shallow features and deep features output by the shallow feature extraction sub-model and the deep feature extraction sub-model to convert feature values into the same range; Concatenate the shallow features and the deep features to form a comprehensive feature vector; The comprehensive feature vector is classified and verified by a pre-trained support vector machine, and the comprehensive feature vector whose classification result meets the requirements is output to obtain the fusion feature.
6. The intelligent control processing method for document scanning correction according to claim 4, characterized in that: Parsing compensation control parameters of a file scanning device according to the page compensation parameters includes: Analyze the stretching coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount according to the page compensation parameters, and identify and separate global compensation parameters and local compensation parameters; Using historical test parameters to fit a control model of a tray position control parameter and a pressure control parameter, and using the control model to perform calculation conversion on the stretch coefficient, rotation angle, displacement vector, edge compensation direction, and edge compensation amount to determine control parameters, wherein the control parameters include a tray position control parameter and a pressure control parameter; The adjustment area is located according to the global compensation parameter and the local compensation parameter, and the control parameter is mapped and associated with the adjustment area to obtain the compensation control parameter.
7. An intelligent control and processing system for document scanning and correction, characterized in that: The system comprises: A document boundary determination module, wherein the document boundary determination module obtains a document scan image to perform edge detection, extracts an outer contour of the document, and determines a document boundary; A document region segmentation module, wherein the document region segmentation module performs straight line boundary detection on the inside of the document scanned image based on the document boundary, and segments multiple types of document regions, wherein the multiple types of document regions include text, pictures, and tables; A feature extraction and fusion module, wherein the feature extraction and fusion module performs multi-level feature extraction and fusion according to the document boundary and multi-type document regions to obtain recognition features; A page change recognition module, wherein the page change recognition module performs page change recognition according to the document boundary and recognition features, and generates page compensation parameters; a compensation control module, wherein the compensation control module parses compensation control parameters of a document scanning device according to the page compensation parameters, wherein the compensation control parameters are used to adjust a fixed tray position and a page pressure of the document scanning device; Among them, according to the document boundary and multi-type document area, multi-level feature extraction and fusion are performed to obtain recognition features, including: Constructing a shallow feature extraction sub-model, wherein the shallow feature extraction sub-model is used to identify and extract edge features, texture features, and shape features; Constructing a deep feature extraction sub-model, wherein the deep feature extraction sub-model is used to extract semantic features from the image; Constructing a feature fusion layer, fusing the output results of the shallow feature extraction sub-model and the deep feature extraction sub-model, verifying them through a classifier, and outputting verified fusion features; The identification features include shallow features, deep features, and fusion features; Wherein, according to the document boundary and recognition features, page change recognition is performed to generate page compensation parameters, including: Performing page alignment according to the four vertices of the document boundary, constructing a standard coordinate system, and identifying the tilt and distortion information of the document page; Using the standard boundary to fit and match the current document boundary, detecting the page deformation area, and performing connection anomaly recognition based on the recognition features to determine the abnormal features, wherein the abnormal features include texture change, edge loss, shape abnormality, and semantic inconsistency; Perform abnormal location according to the page deformation area and abnormal features to determine the abnormal position; Feature compensation analysis is performed according to the abnormal feature to obtain compensation parameters, and the abnormal position and the compensation parameters are integrated to generate the page compensation parameters.