CN108345881B - Document quality detection method based on computer vision - Google Patents

Document quality detection method based on computer vision Download PDF

Info

Publication number
CN108345881B
CN108345881B CN201810101325.7A CN201810101325A CN108345881B CN 108345881 B CN108345881 B CN 108345881B CN 201810101325 A CN201810101325 A CN 201810101325A CN 108345881 B CN108345881 B CN 108345881B
Authority
CN
China
Prior art keywords
image
document
point
detected
edge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810101325.7A
Other languages
Chinese (zh)
Other versions
CN108345881A (en
Inventor
郭文忠
张融
柯逍
陈羽中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou University
Original Assignee
Fuzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuzhou University filed Critical Fuzhou University
Priority to CN201810101325.7A priority Critical patent/CN108345881B/en
Publication of CN108345881A publication Critical patent/CN108345881A/en
Application granted granted Critical
Publication of CN108345881B publication Critical patent/CN108345881B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/243Aligning, centring, orientation detection or correction of the image by compensating for image skew or non-uniform image deformations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/34Smoothing or thinning of the pattern; Morphological operations; Skeletonisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/48Extraction of image or video features by mapping characteristic values of the pattern into a parameter space, e.g. Hough transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/98Detection or correction of errors, e.g. by rescanning the pattern or by human intervention; Evaluation of the quality of the acquired patterns
    • G06V10/993Evaluation of the quality of the acquired pattern

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a document quality detection method based on computer vision. The document quality detection method based on computer vision is provided for solving the problems that the traditional manual naked eye detection is difficult, the efficiency is low, the reliability is poor, and the subjectivity influence is large. In order to accurately detect the quality of a document, the method firstly extracts a static frame of a high-speed document printing video by a reasonable method; secondly, carrying out proper image preprocessing on the document image based on a computer vision preprocessing method; thirdly, carrying out accurate contour detection and extraction on the preprocessed document image; then, carrying out inclination correction on the extracted document outline image to enable the malformed image to become a normally tiled document image to be detected; and finally, PSNR and MSE quality evaluation is carried out on the image to be detected, and the image to be detected is compared with the template to obtain a detection result of the document quality. The method has the characteristics of high efficiency, reliability, continuity, flexibility and the like, and has strong practical applicability.

Description

Document quality detection method based on computer vision
Technical Field
The invention relates to the field of computer vision and digital images, and applies the method to the document quality detection, in particular to a document quality detection method based on the computer vision.
Background
With the rapid development of the society in the twenty-first century, the rapid development and progress of the industry and the service industry, the modern printing industry has performed highly automated production, and in the service industry, as the competition among enterprises is more and more intense, the requirement for the appearance printing quality of documents is higher and higher, the demand for documents is more and more, and the problem that the sorting and arrangement of a huge number of documents are required is also troublesome. Under the pressure of time and cost of modern printing enterprises, traditional visual observation can only qualitatively describe the printing quality, but cannot quantitatively describe the printing quality in a large quantity and fast manner, and cannot classify documents quickly and accurately according to certain characteristic classifications. Under these circumstances, intelligent systems for detecting and classifying documents with high efficiency and accuracy are urgently sought.
In recent years, computer vision technology has been developed rapidly, and various detection technologies based on computer vision have been widely used and developed in many practical application systems. The computer vision is to replace human with industrial camera and computer, and to identify, track and detect the target through computer without human intervention. In general, machines are used to process and analyze images instead of the human eye. The method has the characteristics of high efficiency, reliability, continuity, flexibility and the like. In the printing of documents in batches in modern and service industries, it is possible to use printing machines with less precision, less material to be printed, and complicated processes in printing technology, as well as environmental factors. Printed documents may suffer from a wide variety of quality defects, such as insurance policies, for example, ink smearing, pinholes, wrinkling, text blurring, text missing, blemishes, scratches, ghosting, scratches, misalignment, misregistration, color misregistration, and the like. These quality defects can become the development bottleneck of industrial enterprises, and can cause the situation that people cannot compete for the service industry. Meanwhile, because the manual quality detection efficiency is far lower than that of a machine computer, the situations force the rapid detection and classification of the documents to be a necessary development trend.
Disclosure of Invention
The invention aims to provide a computer vision-based document quality detection method, which overcomes the defects of the existing manual detection and solves the problem of the computer vision-based document quality detection method.
In order to achieve the purpose, the technical scheme of the invention is as follows: a document quality detection method based on computer vision is realized according to the following steps:
step S1: extracting a static frame from an input high-speed image video sequence to obtain a document image needing to be detected and processed;
step S2: preprocessing the extracted static frame, performing noise reduction and edge reinforcement, and eliminating environmental interference items;
step S3: carrying out document contour detection on the image preprocessed in the step S2, and extracting a document image part according to the contour;
step S4: performing tilt correction on the document image on spatial transformation to enable the document image to be a tiled vertical overlook document image;
step S5: comparing the document image identified and located in the step S4 with the template through a quality evaluation algorithm to detect the quality level of the document.
In an embodiment of the present invention, in the step S1, the document image to be detected is extracted by:
step S11: taking frame number I for an input high-speed video under a printer, extracting images at intervals of the frame number I, selecting preset interval frame numbers, and converting the input video into an image stream;
step S12: performing still frame processing on the image stream, and performing image algorithm subtraction on the front image and the rear image in the image stream to make the same part be a pixel 255 and the different part be 0;
step S13: and (4) counting the number N of 0 pixel points of the image after the subtraction operation, wherein if N is smaller than a preset threshold value Y, the current frame is a static frame, otherwise, the frame is discarded, and the step S12 is continued.
In an embodiment of the present invention, in the step S2, the still frame is preprocessed by the following steps:
step S21: carrying out image smoothing treatment on an image to be detected through a Mean Shift algorithm, wherein the Mean Shift algorithm comprises the following steps:
s211: firstly, randomly selecting a pixel point in a picture as a central point;
s212: calculating the mean value M (x) of the shift of the center point,
Figure BDA0001566177760000021
wherein x represents the center point abscissa y represents the center point ordinate, ShIs a high dimensional sphere region with radius h: k denotes that k fall into the ball S among the n sample pointshPerforming the following steps;
s213: moving the point to its offset mean, Xt+1=Mt+xt,MtIs an offset mean value obtained in a t state; x is the number oftIs the center in the t state, Xt+1Is xtCenter in the next state; then, taking the initial point as a new initial point, and continuing moving until a certain condition is met;
step S22: performing morphological operation on an image to be detected, namely performing the process of firstly corroding and then expanding the image, wherein the mathematical expression of the process is as follows:
dst=open(src,element)=dilate(erode(src,element))
where src is the input image, element is the defined kernel, enode is the erosion operation, and dilate is the dilation operation;
step S23: and carrying out binarization processing on the image to be detected, and selecting a threshold value to convert the image into a gray image.
In an embodiment of the present invention, in the step S3, the specific implementation steps of performing the document contour detection on the image preprocessed in the step S2 are as follows:
step S31: contour detection is carried out on an image to be detected by adopting a Canny operator, and a convolution operator for Canny is
Figure BDA0001566177760000031
X and Y being variables of the axes X and Y, SxIs its x-direction partial derivative calculation template, SyThe partial derivative in the y direction is calculated for the template, the x-axis direction and the y-axis directionThe mathematical expressions of the first partial derivative matrix, the gradient magnitude and the gradient direction are as follows:
P[i,j]=(f[i,j+1]-f[i,j]+f[i+1,j+1]-f[i+1,j])/2
Q[i,j]=(f[i,j]-f[i+1,j]+f[i,j+1]-f[i+1,j+1])/2
Figure BDA0001566177760000032
θ[i:j]=arCtan(Q[i:j]P[i:j])
wherein i and j are array subscripts, wherein f is an image gray value, P represents an X-axis direction gradient amplitude, Q represents a Y-axis direction gradient amplitude, M is the point amplitude, and theta is a gradient direction, namely an angle;
then, according to the calculated gradient amplitude, non-maximum value inhibition is carried out, and then a double-threshold algorithm is used for detecting and connecting edges;
step S32: extracting all contour edges from the binary image through a contour search function, and writing a deletion algorithm: calculating the areas of all connected domains, and then deleting the connected domains with the areas smaller than a preset threshold value, and only leaving the outline graph of the document;
step S33: detecting straight line segments in the contour map, and adopting cumulative probability Hough transform, wherein the steps are as follows:
s331: mapping the image coordinates to image polar coordinates, the linear expression is
Figure BDA0001566177760000033
Where r is the distance from the origin to the line,
Figure BDA0001566177760000034
is the X-axis coordinate, beta is the Y-axis coordinate, and lambda is the inclination angle of the straight line and the X-axis;
s332: randomly extracting a feature point, namely an edge point, in the image, if the feature point is marked as a point on a certain straight line, continuously randomly extracting an edge point from the rest edge points until all the edge points are extracted;
s333: carrying out Hough transform on the point, and carrying out accumulation and calculation;
s334: selecting a point with the maximum value in the Hough space, if the point is larger than a threshold value, performing step S335, otherwise returning to step S332;
s335: according to the maximum value obtained by Hough transform, sending out the point, and displacing along the direction of a straight line, thereby finding two end points of the straight line;
s336: and calculating the length of the straight line, and if the length is greater than a certain threshold value, recording the edge line segment which is considered to be good, placing the edge line segment in a Lines array, and returning to the step S332.
In an embodiment of the present invention, in the step S4, the specific implementation steps of performing the tilt correction on the document image in the spatial transformation are as follows:
step S51: the edge of the document image is a quadrangle which is divided into an upper edge, a lower edge, a left edge and a right edge which are A, B, C, D respectively; a straight line is determined by two end points; classifying all straight line segments in the Lines array according to A, B, C, D four edges approximately through the two point coordinates, taking a point a at the upper left corner of the document image, and taking a point closest to the upper left corner from the left end point of A and the upper end point of C; b, taking a point which is closest to the upper right corner from the right endpoint of A and the upper endpoint of D; c, taking the point at the lower left corner of the document image, and taking the point closest to the lower left corner in the lower end point of C and the left end point of B; taking a point D at the lower right corner of the document image, taking a point closest to the lower right corner from the lower end point of D and the right end point of B, and taking four corner points of the document images a, B, c and D;
step S52: then, perspective space transformation is used for performing tilt correction on the malformed image of the document image, a perspective transformation matrix for transforming the malformed image into a rectangle is obtained through a perspective transformation matrix algorithm function according to the four corner points found in step S51, and then space transformation is performed through the perspective space transformation algorithm function to complete tilt correction.
In an embodiment of the present invention, the specific implementation steps of step S5 are as follows:
step S61: measuring the quality level of the document image by using the PSNR peak signal-to-noise ratio; PSNR is applied to a document image to be detected and a template image, and the larger the PSNR value among 2 images is, the more similar the PSNR value is; presetting a threshold value ps as a measuring reference; PSNR equation is as follows:
Figure BDA0001566177760000041
where MAX represents the maximum value of the image color and the 8-bit sample points are represented as 255, MAX is therefore2=255*255;
MSE represents the current picture P1And a reference picture P2The MSE equation is:
Figure BDA0001566177760000042
where m and n represent the height and width of the image frame, I represents the current image in line I, J represents the current image in column J, and K (I, J) represents the current image P1L (I, J) denotes the reference image P2Row I and column J;
step S62: substituting an image array to be detected as K (I, J) and substituting a template image array as L (I, J); and calculating to obtain the PSNR value pr of the document image to be detected, wherein if the pr is larger than a threshold value ps, the quality level of the document to be detected accords with the condition, and otherwise, the quality level of the document to be detected is unqualified.
Compared with the prior art, the invention has the following beneficial effects: the method comprehensively considers the interference caused by environmental factors, and improves the accuracy and reliability of document positioning by preprocessing noise reduction and deleting the connected domain with small area by the algorithm. And simultaneously, detecting and extracting the document contour through a Canny operator and a contour search function. And thirdly, extracting straight line segments through cumulative probability Hough transformation, and positioning coordinates of four corner points of the document through a designed algorithm. Subsequently, the deformed document image is stretched into a normal document image through perspective space transformation tilt correction. And finally, detecting the document quality by using a PSNR and MSE evaluation method. The patent applies and optimizes an algorithm in computer vision, and can accurately position and identify the document and carry out quality detection on the document. The method is simple, flexible to implement and high in practicability.
Drawings
FIG. 1 is a flow chart of a computer vision-based document quality detection method according to the present invention.
Detailed Description
The technical scheme of the invention is specifically explained below with reference to the accompanying drawings.
As shown in FIG. 1, the present invention provides a document quality detection method based on computer vision. The document quality detection method based on computer vision is provided for the problems that the traditional manual naked eye detection is difficult, the efficiency is low, the reliability is poor, and the subjectivity influence is large. In order to accurately detect the quality of a document, the method firstly extracts a static frame of a high-speed document printing video by a reasonable method; secondly, carrying out proper image preprocessing on the document image based on a computer vision preprocessing method; thirdly, carrying out accurate contour detection and extraction on the preprocessed document image; then, carrying out inclination correction on the extracted document outline image to enable the malformed image to become a normally tiled document image to be detected; and finally, PSNR and MSE quality evaluation is carried out on the image to be detected, and the image to be detected is compared with the template to obtain a detection result of the document quality. The method comprises the following specific steps:
step S1: extracting a static frame from an input high-speed image video sequence to obtain a document image needing to be detected and processed;
step S2: preprocessing the extracted static frame, performing noise reduction and edge reinforcement, and eliminating environmental interference items;
step S3: carrying out document contour detection on the image preprocessed in the step S2, and extracting a document image part according to the contour;
step S4: performing tilt correction on the document image on spatial transformation to enable the document image to be a tiled vertical overlook document image;
step S5: comparing the document image identified and located in the step S4 with the template through a quality evaluation algorithm to detect the quality level of the document.
In the step S1, a document image to be detected is extracted by:
step S11: adopting proper frame number I for an input high-speed video under a printer, extracting images at intervals of the frame number I, selecting preset interval frame numbers, and converting the input video into an image stream;
step S12: performing still frame processing on the image stream, and performing image algorithm subtraction on the front image and the rear image in the image stream to make the same part be a pixel 255 (white pixel) and the different part be 0 (black pixel);
step S13: and (4) counting the number N of 0 (black) pixel points of the image after the subtraction operation, wherein if N is smaller than a preset threshold value Y, the current frame is a static frame, otherwise, the frame is discarded, and the step S12 is continued.
In the step S2, the still frame is preprocessed by:
step S21: carrying out image smoothing treatment on an image to be detected through a Mean Shift algorithm, wherein the Mean Shift algorithm comprises the following steps:
s211: firstly, randomly selecting a pixel point in a picture as a central point;
s212: calculating the mean value M (x) of the shift of the center point,
Figure BDA0001566177760000061
wherein x represents the abscissa of the center point, y represents the ordinate of the center point, ShIs a high dimensional sphere region with radius h: k denotes that k fall into the ball S among the n sample pointshPerforming the following steps;
s213: moving the point to its offset mean, Xt+1=Mt+xt,MtIs an offset mean value obtained in a t state; x is the number oftIs the center in the t state, Xt+1Is xtCenter in the next state; then, taking the initial point as a new initial point, and continuing moving until a certain condition is met;
step S22: performing morphological operation on an image to be detected, namely performing the process of firstly corroding and then expanding the image, wherein the mathematical expression of the process is as follows:
dst=open(src,element)=dilate(erode(src,element))
where src is the input image, element is the defined kernel, enode is the erosion operation, and dilate is the dilation operation;
step S23: and carrying out binarization processing on the image to be detected, and selecting a threshold value to convert the image into a gray image.
In step S3, the specific implementation steps of detecting the document contour of the image preprocessed in step S2 are as follows:
step S31: contour detection is carried out on an image to be detected by adopting a Canny operator, and a convolution operator for Canny is
Figure BDA0001566177760000062
X and Y being variables of the axes X and Y, SxIs its x-direction partial derivative calculation template, SyThe calculation template of the partial derivatives in the y direction is characterized in that the mathematical expressions of a first-order partial derivative matrix, a gradient amplitude and a gradient direction of the calculation template in the x-axis direction and the y-axis direction are as follows:
P[i,j]=(f[i,j+1]-f[i,j]+f[i+1,j+1]-f[i+1,j])/2
Q[i,j]=(f[i,j]-f[i+1,j]+f[i,j+1]-f[i+1,j+1])/2
Figure BDA0001566177760000063
θ[i,j]=arctan(Q[i,j]P[i:j])
wherein i and j are array subscripts, wherein f is an image gray value, P represents an X-axis direction gradient amplitude, Q represents a Y-axis direction gradient amplitude, M is the point amplitude, and theta is a gradient direction, namely an angle;
then, according to the calculated gradient amplitude, non-maximum value inhibition is carried out, and then a double-threshold algorithm is used for detecting and connecting edges;
step S32: extracting all contour edges from the binary image through a contour search function, and writing a deletion algorithm: calculating the areas of all connected domains, and then deleting the connected domains with the areas smaller than a preset threshold value, and only leaving the outline graph of the document;
step S33: detecting straight line segments in the contour map, and adopting cumulative probability Hough transform, wherein the steps are as follows:
s331: mapping the image coordinates to image polar coordinates, the linear expression is
Figure BDA0001566177760000071
Where r is the distance from the origin to the line,
Figure BDA0001566177760000072
is the X-axis coordinate, beta is the Y-axis coordinate, and lambda is the inclination angle of the straight line and the X-axis;
s332: randomly extracting a feature point, namely an edge point, in the image, if the feature point is marked as a point on a certain straight line, continuously randomly extracting an edge point from the rest edge points until all the edge points are extracted;
s333: carrying out Hough transform on the point, and carrying out accumulation and calculation;
s334: selecting a point with the maximum value in the Hough space, if the point is larger than a threshold value, performing step S335, otherwise returning to step S332;
s335: according to the maximum value obtained by Hough transform, sending out the point, and displacing along the direction of a straight line, thereby finding two end points of the straight line;
s336: and calculating the length of the straight line, and if the length is greater than a certain threshold value, recording the edge line segment which is considered to be good, placing the edge line segment in a Lines array, and returning to the step S332.
In step S4, the specific implementation steps of performing the tilt correction on the document image in the spatial transformation are as follows:
step S51: the edge of the document image is a quadrangle which is divided into an upper edge, a lower edge, a left edge and a right edge which are A, B, C, D respectively; a straight line is determined by two end points; classifying all straight line segments in the Lines array according to A, B, C, D four edges approximately through the two point coordinates, taking a point a at the upper left corner of the document image, and taking a point closest to the upper left corner from the left end point of A and the upper end point of C; b, taking a point which is closest to the upper right corner from the right endpoint of A and the upper endpoint of D; c, taking the point at the lower left corner of the document image, and taking the point closest to the lower left corner in the lower end point of C and the left end point of B; taking a point D at the lower right corner of the document image, taking a point closest to the lower right corner from the lower end point of D and the right end point of B, and taking four corner points of the document images a, B, c and D;
step S52: then, perspective space transformation is used for performing tilt correction on the malformed image of the document image, a perspective transformation matrix for transforming the malformed image into a rectangle is obtained through a perspective transformation matrix algorithm function according to the four corner points found in step S51, and then space transformation is performed through the perspective space transformation algorithm function to complete tilt correction.
The specific implementation steps of step S5 are as follows:
step S61: measuring the quality level of the document image by using the PSNR peak signal-to-noise ratio; PSNR is applied to a document image to be detected and a template image, and the larger the PSNR value among 2 images is, the more similar the PSNR value is; presetting a threshold value ps as a measuring reference; PSNR equation is as follows:
Figure BDA0001566177760000073
where MAX represents the maximum value of the image color and the 8-bit sample points are represented as 255, MAX is therefore2=255*255;
MSE represents the current picture P1And a reference picture P2The MSE equation is:
Figure BDA0001566177760000081
where m and n represent the height and width of the image frame, I represents the current image in line I, J represents the current image in column J, and K (I, J) represents the current image P1L (I, J) denotes the reference image P2Row I and column J;
step S62: substituting an image array to be detected as K (I, J) and substituting a template image array as L (I, J); and calculating to obtain the PSNR value pr of the document image to be detected, wherein if the pr is larger than a threshold value ps, the quality level of the document to be detected accords with the condition, and otherwise, the quality level of the document to be detected is unqualified.
The above are preferred embodiments of the present invention, and all changes made according to the technical scheme of the present invention that produce functional effects do not exceed the scope of the technical scheme of the present invention belong to the protection scope of the present invention.

Claims (3)

1. A document quality detection method based on computer vision is characterized by comprising the following steps:
step S1: extracting a static frame from an input high-speed image video sequence under a printer to obtain a document image needing detection processing;
step S2: preprocessing the extracted static frame, performing noise reduction and edge reinforcement, and eliminating environmental interference items;
step S3: carrying out document contour detection on the image preprocessed in the step S2, and extracting a document image part according to the contour;
step S4: performing tilt correction on the document image on spatial transformation to enable the document image to be a tiled vertical overlook document image;
step S5: comparing the document image identified and positioned in the step S4 with the template through a quality evaluation algorithm to detect the quality level of the document;
in the step S2, the still frame is preprocessed by:
step S21: carrying out image smoothing treatment on an image to be detected through a Mean Shift algorithm, wherein the Mean Shift algorithm comprises the following steps:
s211: firstly, randomly selecting a pixel point in a picture as a central point;
s212: calculating the mean value M (x) of the shift of the center point0),
Figure FDA0003338539630000011
Wherein x is0Representing the abscissa of the center point, ShIs a high dimensional sphere region with radius h: k is represented by n0In one sample point havek drop balls ShPerforming the following steps;
s213: moving the point to its offset mean, Xt+1=Mt+xt,MtIs an offset mean value obtained in a t state; x is the number oftIs the center in the t state, Xt+1Is xtCenter in the next state; then, taking the initial point as a new initial point, and continuing moving until a certain condition is met;
step S22: performing morphological operation on an image to be detected, namely performing the process of firstly corroding and then expanding the image, wherein the mathematical expression of the process is as follows:
dst=open(src,element)=dilate(erode(src,element))
where src is the input image, element is the defined kernel, enode is the erosion operation, and dilate is the dilation operation;
step S23: carrying out binarization processing on an image to be detected, and selecting a threshold value to convert the image into a gray image;
in step S3, the specific implementation steps of detecting the document contour of the image preprocessed in step S2 are as follows:
step S31: contour detection is carried out on an image to be detected by adopting a Canny operator, and a convolution operator for Canny is
Figure FDA0003338539630000012
X and Y being variables of the axes X and Y, SxIs a template for calculating partial derivatives in the x direction, SyThe calculation template of the partial derivatives in the y direction is a first-order partial derivative matrix in the x-axis direction and the y-axis direction, and the mathematical expressions of the gradient amplitude and the gradient direction are as follows:
P[i,j]=(f[i,j+1]-f[i,j]+f[i+1,j+1]-f[i+1,j])/2
Q[i,j]=(f[i,j]-f[i+1,j]+f[i,j+1]-f[i+1,j+1])/2
Figure 1
θ[i,j]=arctan(Q[i,j]/P[i,j])
wherein i and j are array subscripts, wherein f is an image gray value, P represents an X-axis direction gradient amplitude, Q represents a Y-axis direction gradient amplitude, M is the point amplitude, and theta is a gradient direction, namely an angle;
then, according to the calculated gradient amplitude, non-maximum value inhibition is carried out, and then a double-threshold algorithm is used for detecting and connecting edges;
step S32: extracting all contour edges from the binary image through a contour search function, and writing a deletion algorithm: calculating the areas of all connected domains, and then deleting the connected domains with the areas smaller than a preset threshold value, and only leaving the outline graph of the document;
step S33: detecting straight line segments in the contour map, and adopting cumulative probability Hough transform, wherein the steps are as follows:
s331: mapping the image coordinates to image polar coordinates, the linear expression is
Figure FDA0003338539630000022
Where r is the distance from the origin to the line,
Figure FDA0003338539630000023
is the X-axis coordinate, beta is the Y-axis coordinate, and lambda is the inclination angle of the straight line and the X-axis;
s332: randomly extracting a feature point, namely an edge point, in the image, if the feature point is marked as a point on a certain straight line, continuously randomly extracting an edge point from the rest edge points until all the edge points are extracted;
s333: carrying out Hough transform on the point, and carrying out accumulation and calculation;
s334: selecting a point with the maximum value in the Hough space, if the point is larger than a threshold value, performing step S335, otherwise returning to step S332;
s335: according to the maximum value obtained by Hough transform, sending out the point, and displacing along the direction of a straight line, thereby finding two end points of the straight line;
s336: calculating the length of the straight line, if the length is greater than a certain threshold value, recording the edge line segment which is considered to be good, placing the edge line segment in a Lines array, and returning to the step S332;
in step S4, the specific implementation steps of performing the tilt correction on the document image in the spatial transformation are as follows:
step S51: the edge of the document image is a quadrangle which is divided into an upper edge, a lower edge, a left edge and a right edge which are A, B, C, D respectively; a straight line is determined by two end points; classifying all straight line segments in the Lines array according to A, B, C, D four edges approximately through the coordinates of the two end points, taking a point a at the upper left corner of the document image, and taking a point closest to the upper left corner in the left end point of A and the upper end point of C; b, taking a point which is closest to the upper right corner from the right endpoint of A and the upper endpoint of D; c, taking the point at the lower left corner of the document image, and taking the point closest to the lower left corner in the lower end point of C and the left end point of B; taking a point D at the lower right corner of the document image, taking a point closest to the lower right corner from the lower end point of D and the right end point of B, and taking four corner points of the document images a, B, c and D;
step S52: then, perspective space transformation is used for performing tilt correction on the malformed image of the document image, a perspective transformation matrix for transforming the malformed image into a rectangle is obtained through a perspective transformation matrix algorithm function according to the four corner points found in step S51, and then space transformation is performed through the perspective space transformation algorithm function to complete tilt correction.
2. A computer vision-based document quality detection method according to claim 1, wherein in said step S1, the document image to be detected is extracted by:
step S11: taking frame number I for an input high-speed video under a printer, extracting images at intervals of the frame number I, selecting preset interval frame numbers, and converting the input video into an image stream;
step S12: performing still frame processing on the image stream, and performing image algorithm subtraction on the front image and the rear image in the image stream to make the same part be a pixel 255 and the different part be 0;
step S13: counting the number N of 0 pixel points of the image subjected to the subtraction operation, and if N is smaller than a preset threshold value Y0If the current frame is a still frame,otherwise, the frame is discarded and the process continues to step S12.
3. The method for detecting document quality based on computer vision of claim 1, wherein the step S5 is implemented by the following steps:
step S61: measuring the quality level of the document image by using the PSNR peak signal-to-noise ratio; PSNR is applied to a document image to be detected and a template image, and the larger the PSNR value among 2 images is, the more similar the PSNR value is; presetting a threshold value ps as a measuring reference; PSNR equation is as follows:
Figure FDA0003338539630000031
where MAX represents the maximum value of the image color and the 8-bit sample points are represented as 255, MAX is therefore2=255*255;
MSE represents the current picture P1And a reference picture P2The MSE equation is:
Figure FDA0003338539630000032
where m and n represent the height and width of the image frame, I represents the current image in line I, J represents the current image in column J, and K (I, J) represents the current image P1L (I, J) denotes the reference image P2Row I and column J;
step S62: substituting an image array to be detected as K (I, J) and substituting a template image array as L (I, J); and calculating to obtain the PSNR value pr of the document image to be detected, wherein if the pr is larger than a threshold value ps, the quality level of the document to be detected accords with the condition, and otherwise, the quality level of the document to be detected is unqualified.
CN201810101325.7A 2018-02-01 2018-02-01 Document quality detection method based on computer vision Active CN108345881B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810101325.7A CN108345881B (en) 2018-02-01 2018-02-01 Document quality detection method based on computer vision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810101325.7A CN108345881B (en) 2018-02-01 2018-02-01 Document quality detection method based on computer vision

Publications (2)

Publication Number Publication Date
CN108345881A CN108345881A (en) 2018-07-31
CN108345881B true CN108345881B (en) 2021-12-21

Family

ID=62958831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810101325.7A Active CN108345881B (en) 2018-02-01 2018-02-01 Document quality detection method based on computer vision

Country Status (1)

Country Link
CN (1) CN108345881B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109242787A (en) * 2018-08-15 2019-01-18 南京光辉互动网络科技股份有限公司 It paints in a kind of assessment of middle and primary schools' art input method
CN109389121B (en) * 2018-10-30 2021-11-09 金现代信息产业股份有限公司 Nameplate identification method and system based on deep learning
CN111435531B (en) * 2018-12-25 2023-08-08 Tcl科技集团股份有限公司 Image deflection angle detection method, intelligent device and storage medium
CN109871844A (en) * 2019-01-09 2019-06-11 东南大学 A kind of correction of shooting receipt image text and extracting method
CN109785367B (en) * 2019-01-21 2019-12-20 视辰信息科技(上海)有限公司 Method and device for filtering foreign points in three-dimensional model tracking
CN110033471B (en) * 2019-04-19 2022-09-13 福州大学 Frame line detection method based on connected domain analysis and morphological operation
CN110032989B (en) * 2019-04-23 2022-07-08 福州大学 Table document image classification method based on frame line characteristics and pixel distribution
US11145064B2 (en) 2019-11-27 2021-10-12 Cimpress Schweiz Gmbh Technologies for detecting crop marks in electronic documents
CN111108515B (en) * 2019-12-27 2021-11-12 威创集团股份有限公司 Picture target point correcting method, device and equipment and storage medium
CN111488931B (en) * 2020-04-10 2023-04-07 腾讯科技(深圳)有限公司 Article quality evaluation method, article recommendation method and corresponding devices
CN112131841A (en) * 2020-08-27 2020-12-25 北京云动智效网络科技有限公司 Document quality evaluation method and system
CN112200789B (en) * 2020-10-16 2023-11-21 中国铁道科学研究院集团有限公司 Image recognition method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004109586A1 (en) * 2003-06-05 2004-12-16 Aware, Inc. Image quality control techniques
JP2011239066A (en) * 2010-05-07 2011-11-24 Sony Corp Device and method of processing image
CN102496018A (en) * 2011-12-08 2012-06-13 方正国际软件有限公司 Document skew detection method and system
CN103839058A (en) * 2012-11-21 2014-06-04 方正国际软件(北京)有限公司 Information locating method for document image based on standard template

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004109586A1 (en) * 2003-06-05 2004-12-16 Aware, Inc. Image quality control techniques
JP2011239066A (en) * 2010-05-07 2011-11-24 Sony Corp Device and method of processing image
CN102496018A (en) * 2011-12-08 2012-06-13 方正国际软件有限公司 Document skew detection method and system
CN103839058A (en) * 2012-11-21 2014-06-04 方正国际软件(北京)有限公司 Information locating method for document image based on standard template

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
Mean Squared Error: Love It or Leave It?;Zhou Wang et al.;《IEEE SIGNAL PROCESSING MAGAZINE》;20090131;第99页 *
Vehicle detection method based on mean shift clustering;Linhui Li et al.;《Journal of Intelligent & Fuzzy Systems》;20161231;第1359—1360页 *
基于智能检测车位信息的车辆识别算法;王景丹等;《计算机科学与应用》;20131231;第97-99页 *
基于边缘检测的OMR图像倾斜矫正;高晓波等;《长春理工大学学报(自然科学版)》;20110331;第34卷(第1期);第101—103页 *
运动物体相对位置的视觉检测算法的研究;商萌萌;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170515(第05期);第9—11、22-25页 *

Also Published As

Publication number Publication date
CN108345881A (en) 2018-07-31

Similar Documents

Publication Publication Date Title
CN108345881B (en) Document quality detection method based on computer vision
CN112508826B (en) Printed matter defect detection method
CN111986190B (en) Printed matter defect detection method and device based on artifact elimination
CN107543828B (en) Workpiece surface defect detection method and system
CN111062940B (en) Screw positioning and identifying method based on machine vision
CN111489337B (en) Automatic optical detection pseudo defect removal method and system
CN111127417B (en) Printing defect detection method based on SIFT feature matching and SSD algorithm improvement
CN112991305A (en) Visual inspection method for surface defects of paint spraying panel
CN111667475B (en) Machine vision-based Chinese date grading detection method
CN110648330B (en) Defect detection method for camera glass
CN104331695A (en) Robust round identifier shape quality detection method
CN113516619B (en) Product surface flaw identification method based on image processing technology
CN111487192A (en) Machine vision surface defect detection device and method based on artificial intelligence
CN113034488A (en) Visual detection method of ink-jet printed matter
CN117541588A (en) Printing defect detection method for paper product
CN112419260A (en) PCB character area defect detection method
CN116012292A (en) Wafer appearance defect detection method based on machine vision
CN116128873A (en) Bearing retainer detection method, device and medium based on image recognition
Wankhede et al. A low cost surface strain measurement system using image processing for sheet metal forming applications
CN117333467B (en) Image processing-based glass bottle body flaw identification and detection method and system
CN112069974B (en) Image recognition method and system for recognizing defects of components
CN111862178B (en) Improved LBP feature extraction method
CN113916893A (en) Method for detecting die-cutting product defects
CN107609482B (en) Chinese text image inversion discrimination method based on Chinese character stroke characteristics
CN111028215A (en) Method for detecting end surface defects of steel coil based on machine vision

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant