Disclosure of Invention
The invention aims to solve the technical problem that the invention provides a novel paper grain recognition method by combining a paper grain acquisition scheme and a paper grain recognition algorithm aiming at the defects of the prior art.
The technical scheme adopted for solving the technical problems is as follows: a paper grain identification method is constructed, which comprises the following steps:
s1, shooting an internal fiber micrometer precision microscopic image of a reference paper document and a paper document to be identified under the condition of a transmission light source, and respectively serving as a reference paper pattern image and a paper pattern image to be identified;
s2, extracting characteristic points of the reference paper grain image and the paper grain image to be identified for matching, and generating characteristic point matching pairs;
s3, estimating a transformation matrix between the reference paper grain image and the paper grain image to be identified according to the characteristic point matching pair, and respectively acquiring the interested areas of the reference paper grain image and the paper grain image to be identified;
s4, respectively enhancing fiber textures of the region of interest;
s5, measuring similarity according to the enhanced texture structure, and outputting a recognition result.
Preferably, in the paper grain recognition method according to the present invention, in step S1,
when the reference paper pattern image is acquired, simultaneously recording the coordinate position of the corresponding point of the central point of the acquired reference paper pattern image on the reference paper document relative to the central point of the reference paper document;
and when the paper grain image to be identified is acquired, acquiring the paper grain image to be identified of the corresponding area according to the recorded coordinate position.
Preferably, in the paper grain identification method of the present invention, when the paper grain image to be identified is acquired, the recorded coordinate position is within a field of view of microscopic photographing.
Preferably, in the paper grain recognition method of the present invention, microscopic images of the reference paper file and the paper file to be recognized are taken with accurate focusing.
Preferably, in the paper grain recognition method of the present invention, the step S2 includes:
s2-1, performing image preprocessing on the reference paper grain image and the paper grain image to be identified;
s2-2, extracting texture feature points of the preprocessed reference paper grain image and the paper grain image to be identified, calculating feature vectors of the feature points, and generating feature point matching pairs according to feature vector matching feature points.
Preferably, in the paper grain recognition method of the present invention, the matching feature points according to feature vectors includes:
and matching the feature points according to the similarity of the feature vectors corresponding to the extracted feature points.
Preferably, in the paper grain recognition method of the present invention, the matching feature points according to the similarity of the feature vectors corresponding to the extracted feature points includes:
and respectively extracting characteristic points of the reference paper grain image and the paper grain image to be identified, respectively calculating the similarity of characteristic vectors corresponding to the characteristic points of the reference paper grain image and the paper grain image to be identified, selecting a threshold value, and generating a characteristic point matching pair when the calculated similarity is larger than the threshold value.
Preferably, in the paper grain recognition method of the present invention, the feature points are SURF or SIFT feature points.
Preferably, in the paper grain recognition method according to the present invention, the step S3 includes:
s3-1, eliminating error feature point matching pairs in the feature point matching pairs obtained in the step S2, and estimating a transformation matrix between the reference paper grain image and the paper grain image to be identified according to the rest effective feature point matching pairs;
s3-2, transforming the paper grain image to be identified by using the transformation matrix;
s3-3, stacking the transformed paper grain image to be identified and the reference paper grain image, and respectively cutting inscribed rectangles of the overlapped parts from the two paper grain images to be used as the region of interest.
Preferably, in the paper grain recognition method according to the present invention,
the step S3-1 comprises the following steps: removing the error characteristic point matching pairs in the characteristic point matching pairs obtained in the step S2 by adopting an MSAC algorithm, and estimating an affine transformation matrix from the paper pattern image to be identified to the reference paper pattern image according to the rest effective characteristic point matching pairs by taking the reference paper pattern image as a standard;
the step S3-2 comprises the following steps: carrying out affine transformation on the paper grain image to be identified by utilizing the affine transformation matrix;
the step S3-3 comprises the following steps: and stacking the transformed paper grain images, selecting a threshold S, and intercepting the largest inscribed rectangle of the overlapping part of the transformed paper grain images as an interested region if the ratio of the area of the overlapping part to the total area of the reference paper grain image or the paper grain image to be identified is greater than S.
Preferably, in the paper grain recognition method of the present invention, the step S3 further includes:
if the number of effective feature point matching pairs in the step S3-1 is too small, and is not enough to estimate the transformation matrix, or if the area of the region of interest is too small, the reference paper pattern image and the paper pattern image to be identified which are preprocessed in the step S2-1 are used as the region of interest.
Preferably, in the paper grain recognition method according to the present invention, the step S4 includes:
and respectively enhancing fiber textures of the two regions of interest by adopting Gabor filters with a plurality of angles, generating an amplitude response matrix and a phase angle response matrix by the Gabor filters with each angle, superposing the amplitude response matrix and the phase angle response matrix under the plurality of angles, and finally generating a corresponding amplitude response matrix and phase angle response matrix.
Preferably, in the paper grain recognition method according to the present invention, the step S4 includes:
and adjusting the interested areas of the reference paper grain image and the paper grain image to be identified to be the same size according to the preset image size parameters.
Preferably, in the paper grain recognition method according to the present invention, the step S5 includes:
and mapping the texture structures of the paper grain images to be identified and the reference paper grain images after the interested areas are enhanced to a 01 digital space, generating a similarity index by utilizing the Hamming distance, and measuring the similarity of bit streams correspondingly generated by the reference paper grain images and the paper grain images to be identified.
Preferably, in the paper grain recognition method of the present invention, mapping the enhanced texture structure to a 01 digital space, generating a similarity index by using a hamming distance, and measuring the similarity of the reference paper grain image and the bit stream generated by the paper grain image to be recognized includes:
calculating the average value of the final amplitude response matrix and the final phase angle response matrix of the region of interest of the reference paper grain image and the region of interest of the paper grain image to be identified respectively, carrying out size ratio on each number in the response matrix and the average value, taking 1 larger than the average value and taking 0 smaller than the average value, expanding the two number matrixes according to rows or columns, and splicing the obtained bit streams together to respectively serve as the number paper grains of the reference paper grain image and the digital paper grain of the paper grain image to be identified;
calculating the Hamming distance between the reference paper grain image and the digital paper grain of the paper grain image to be identified, and taking the proportion of the Hamming distance to the total length of the digital paper grain as a similarity index between the reference paper grain and the paper grain to be identified;
and selecting a threshold t, if the similarity index is larger than the threshold t, failing to identify, and if the similarity index is smaller than the threshold t, successful identification.
The invention provides a paper grain recognition method based on a fiber micron precision microstructure in paper, which mainly utilizes a random microfiber interweaved texture structure in the paper to recognize paper grains. Compared with the prior art, the paper grain identification method provided by the invention has at least the following beneficial effects: (1) The paper grain collection scheme of microscopic transmission illumination is adopted, so that micron-precision fiber structure texture images ranging from the surface of the paper to below 50 microns can be directly collected, fiber textures are stable, and illumination changes and paper surface dirt are insensitive; (2) The paper grain identification is carried out by adopting the fiber texture characteristics with paper micron precision, so that the stability of the paper grain calibration method based on the characteristic point estimated paper grain transformation matrix provided by the invention is ensured, and the translation, rotation and scaling of paper grain images caused by illumination change or manual and equipment operation deviation in the paper grain acquisition process can be resisted; (3) As the fiber texture features with micron precision are not easy to lose when dirt appears on the surface of the paper, the paper grain recognition algorithm provided by the invention can still realize paper grain calibration and recognition work under the condition of dirt, so that the paper grain recognition method provided by the invention can resist adverse situations such as dirt on the surface of the paper.
Detailed Description
For a clearer understanding of technical features, objects and effects of the present invention, a detailed description of embodiments of the present invention will be made with reference to the accompanying drawings.
As shown in fig. 1, the present invention constructs a paper grain recognition method based on a fiber micro-texture structure inside paper, which is easy to implement, does not need to introduce additional printing operations, can resist translation, rotation, and image scaling during collection of paper, and can ensure accuracy of results of the paper grain recognition method when different contaminants appear on the surface of paper, the method comprising the steps of:
step S1: and under the condition of a transmission light source, shooting microscopic images with micron precision of internal fibers of the reference paper file and the paper file to be identified, and respectively taking the microscopic images as the reference paper image and the paper image to be identified.
Specifically, in step S1, the reference paper grain image needs to be acquired and stored in advance for the next paper grain recognition. The paper grain image to be identified is used for being identified and matched with the reference paper grain image, and when the paper grain image to be identified and the reference paper grain image are acquired from the same area of the same piece of paper, the paper grain matching is successful; when the paper grain image to be identified and the reference paper grain image are acquired from different areas of the same paper sheet or different paper sheets, the paper grain matching fails.
The same area of the same piece of paper refers to that the acquired reference paper image and the paper image to be identified contain a common area on the same paper document, but the corresponding areas of the two acquired images are not required to be identical, namely translation and rotation caused by manual acquisition are allowed when the paper images are acquired.
The step S1 specifically includes: when the reference paper pattern image is acquired, simultaneously recording the coordinate position of the corresponding point of the central point of the acquired reference paper pattern image on the reference paper document relative to the central point of the reference paper document; and when the paper grain image to be identified is acquired, acquiring the paper grain image to be identified of the corresponding area according to the recorded coordinate position.
And when the paper grain image to be identified is acquired, the recorded coordinate position relative to the center point of the reference paper file is only required to be ensured to be within the range of the microscopic shooting visual field.
In addition, when the microscopic images of the reference paper file and the paper file to be identified are acquired, focusing accuracy is only required to be ensured when the microscopic images are acquired each time, and the high consistency of the magnification when the images are acquired is not required, namely the inconsistent magnification when the reference paper image and the paper image to be identified are acquired can be allowed. Thus, in the present embodiment, microscopic images of the reference paper document and the paper document to be identified are taken with accurate focusing.
The collection scheme of microscopic transmission illumination in the step S1 can collect fiber images with micron precision of fibers in paper, has stable texture characteristics and is insensitive to abnormal conditions such as illumination change, paper surface dirt and the like.
Step S2: and extracting characteristic points of the reference paper grain image and the paper grain image to be identified for matching, and generating characteristic point matching pairs.
Specifically, step S2 includes:
step S2-1: carrying out image preprocessing on the reference paper grain image and the paper grain image to be identified;
the purpose of image preprocessing is to simplify the reference paper image and the paper image data to be identified, and enable the reference paper image and the paper image data to have the same size and data format, so that identification errors caused by inconsistent image data formats can be effectively avoided, and if the acquired image has a plurality of channels, one channel of data is selected for processing. Specifically, the reference paper grain image and the paper grain image to be identified are grayed and adjusted to the same size, and in this embodiment, the reference paper grain image and the paper grain image to be identified are grayed and adjusted to 640×640 size.
Step S2-2: and extracting texture feature points of the preprocessed reference paper grain image and the paper grain image to be identified, calculating feature vectors of the feature points, and generating feature point matching pairs according to feature vector matching feature points.
The feature points generally refer to points with invariance of rotation or translation or affine transformation, and the feature matching method can effectively resist translation, rotation and miscut of the acquired image, is insensitive to illumination change, noise, viewpoint transformation and the like, and improves algorithm robustness.
In this embodiment, the matching feature points according to the feature vectors includes: and matching the feature points according to the similarity of the feature vectors corresponding to the extracted feature points. Specifically, feature points of a reference paper grain image and a paper grain image to be identified are respectively extracted, similarity of feature vectors corresponding to the feature points of the reference paper grain image and the paper grain image to be identified is respectively calculated, a threshold value is selected, and when the calculated similarity is larger than the threshold value, feature point matching pairs are generated. Wherein in some embodiments the feature points are SURF or SIFT feature points. In this embodiment, the characteristic points are SURF characteristic points, which can effectively resist translation, rotation, scaling and illumination changes when the paper image is acquired.
Compared with the prior art, the step of matching the feature points in the step S2 is to estimate the transformation matrix in the step S3, and to obtain the reference paper pattern image and the region of interest of the paper pattern image to be identified for preparation, instead of directly identifying the paper pattern according to the feature vectors of the feature points.
Step S3: according to the feature point matching pair, estimating a transformation matrix between the reference paper grain image and the paper grain image to be identified, and respectively obtaining interested areas of the reference paper grain image and the paper grain image to be identified;
specifically, step S3 includes:
step S3-1: removing the error feature point matching pairs in the feature point matching pairs obtained in the step S2, and estimating a transformation matrix between the reference paper pattern image and the paper pattern image to be identified according to the rest of the effective feature point matching pairs, so that the effective feature point matching pairs corresponding to the reference paper pattern image and the paper pattern image to be identified after transformation are consistent as much as possible in space position;
step S3-2: transforming the paper grain image to be identified by using the transformation matrix;
step S3-3: and overlapping the transformed paper grain image to be identified with the reference paper grain image, and respectively intercepting inscribed rectangles of the overlapped parts from the two paper grain images to serve as an interested area so as to realize paper grain calibration. The regions of interest here are two, one of the reference paper images and one of the paper images to be identified.
The purpose of eliminating the feature point matching pairs in the step S3-1 is to effectively reduce the influence of noise on feature point selection, eliminate the feature point error matching pairs generated by noise interference, and ensure the accuracy of the transformation matrix between the estimated paper grain image to be identified and the reference paper grain image in the step S3-1.
The transformation matrix in step S3-1 can automatically adjust the translation, rotation and scaling of the position of the paper grain to be identified relative to the reference paper grain when the reference paper grain image and the paper grain image to be identified are acquired from the same area of the same piece of paper.
And when the reference paper grain image and the paper grain image to be identified are acquired from the same area of the same piece of paper, the acquired region of interest in the step S3-1 is a public region acquired twice.
In the present embodiment, preferably, step S3-1 includes: removing the error feature point matching pairs in the feature point matching pairs obtained in the step S2 by adopting an MSAC algorithm, taking the reference paper pattern image as a standard, and estimating an affine transformation matrix from the paper pattern image to be identified to the reference paper pattern image according to the rest effective feature point matching pairs;
step S3-2 includes: carrying out affine transformation on the paper grain image to be identified by utilizing an affine transformation matrix, so that the corresponding effective feature point matching pairs between the two after transformation are consistent as far as possible in space position;
the step S3-3 comprises the following steps: and overlapping the transformed paper grain image to be identified with the reference paper grain image to enable the reference paper grain image and the paper grain image to be identified to have larger similar areas, selecting a threshold S, and intercepting the largest inscribed rectangle of the overlapping part of the reference paper grain image and the paper grain image to be identified as an interested area if the area of the overlapping part after transformation is larger than the total area of the reference paper grain image or the paper grain image to be identified. In this embodiment, s=20%.
In some embodiments, step S3 further comprises: if the number of effective feature point matching pairs in the step S3-1 is too small, the transformation matrix is not estimated sufficiently, or the area of the region of interest is too small, the reference paper pattern image and the paper pattern image to be identified which are preprocessed in the step S2-1 are used as the region of interest.
Specifically, in this embodiment, since three pairs of feature points are required for estimating one affine transformation matrix, if the number of valid feature point matches remaining in step S3-1 is less than 3, it is insufficient to estimate the affine transformation matrix or the ratio of the area of the overlapping portion of the reference paper grain and the paper grain to be identified after transformation is less than 20%, the reference paper grain image and the paper grain image to be identified which are preprocessed in step S2-1 are taken as the region of interest.
Compared with the prior art, the method for intercepting the region of interest can realize registration between the acquired paper grain images without additional operations such as rectangle printing, watermark printing and the like.
Compared with the prior art, the method for intercepting the region of interest ensures that the paper grain recognition does not depend on the extraction of global feature points, and can ensure the accuracy of the paper grain recognition without decontamination in advance when local graffiti, water stains and printed characters appear on the surface of the paper.
The step S3 utilizes the characteristic point matching pairs extracted in the step S2 to acquire the region of interest, so that translation and rotation of paper, illumination change of environment, relative position change between the paper and image acquisition equipment and image acquisition optical magnification change can be effectively resisted when the paper is acquired, and compared with the existing method for directly carrying out paper identification by means of characteristic vectors of global characteristic points, the method provided by the invention can be used for effectively resisting differences caused by inconsistent manual operation when the image is acquired.
The flow of obtaining the regions of interest of the reference paper grain image and the paper grain image to be identified in step S3 is shown in fig. 2, and the schematic diagram of the regions of interest of the reference paper grain image and the paper grain image to be identified (the same region where the reference paper grain and the paper grain to be identified are collected from the same piece of paper) is shown in fig. 3;
the stability of the paper grain calibration method based on the paper fiber microscopic image characteristic point estimation image transformation in the steps S2 and S3 is ensured by the stability of the microscopic image texture characteristics of the paper internal fiber micrometer precision acquired in the step S1, so that the calibration algorithm can resist the translation, rotation and scaling of the paper grain image caused by illumination change or manual and equipment operation deviation in the paper grain acquisition process.
Step S4: respectively enhance the fiber texture of the region of interest.
Specifically, step S4 includes:
and respectively enhancing fiber textures of two regions of interest by adopting Gabor filters with a plurality of angles, generating an amplitude response matrix and a phase angle response matrix by the Gabor filters with each angle, then superposing the amplitude response matrix and the phase angle response matrix under the plurality of angles, and generating a corresponding amplitude response matrix and phase angle response matrix by the final paper texture image.
In the existing paper grain anti-counterfeiting technology, paper grain enhancement is mostly carried out by utilizing unidirectional Gabor filtering, and then final paper grain recognition is carried out by utilizing eigenvectors or singular values of a generated matrix, so that details of the paper grain are lost, and recognition accuracy is affected.
The multi-angle Gabor filtering is enhanced, and paper grain information can be reserved to a greater extent by considering randomness of the arrangement and the direction of micro-fiber textures on the surface and in the paper, so that the recognition accuracy is improved.
Specifically, the multi-angle Gabor filter is adopted to enhance the fiber textures of the interested areas of the reference paper grain image and the paper grain image to be identified, and the Gabor filter has the characteristic of simultaneously obtaining optimal localization in the space domain and the frequency domain, so that local structure information corresponding to the spatial frequency, the spatial position and the direction selectivity can be well described. In this embodiment, the Gabor filters in four directions are applied to one paper grain at the same time, the spatial frequencies of the four Gabor filters are set to 0.1, and then the direction parameters are set to 0 °, 30 °, 60 °, and 90 °, so that each paper grain can obtain four amplitude responses and four phase angle responses corresponding to the four Gabor filters, and the four amplitude responses and the four phase angle responses are respectively superimposed to obtain a combined amplitude response and phase angle response as a final response result of one paper grain. It should be noted that, the magnitude response and the phase angle response matrix are the same as the size of the input region of interest, so in order to ensure that the different paper grain recognition results are comparable, the reference paper grain image and the region of interest of the paper grain image to be recognized need to be adjusted to the same size according to the preset image size parameters before the paper grain is enhanced, and the size of the intercepted region of interest may be different because the overlapped region of the different paper grain images is different. In this embodiment, the regions of interest are each adjusted to a 32 x 32 size image prior to enhancing the texture. An example of enhancing the fiber texture of a region of interest using a multi-angle Gabor filter is shown in fig. 4.
The micro-precision micro-texture features of the fibers in the paper acquired by the method are stable, and can still be kept stable under the conditions of illumination change and dirt on the surface of the paper, so that the recognition algorithm based on the paper fiber texture image in the step S4 can resist abnormal situations such as illumination change and paper dirt.
Step S5: and measuring similarity according to the enhanced texture structure, and outputting an identification result.
Specifically, the method for measuring similarity according to the enhanced texture structure in step S5 is as follows:
and mapping the texture structures of the paper grain images to be identified and the reference paper grain images after the interested areas are enhanced to a 01 digital space, generating similarity indexes by utilizing Hamming distances, and measuring the similarity of bit streams correspondingly generated by the reference paper grain images and the paper grain images to be identified.
Preferably, mapping the enhanced texture structure to a 01 digital space, generating a similarity index by using a hamming distance, and measuring the similarity of a bit stream generated by the reference paper texture image and the paper texture image to be identified correspondingly comprises:
calculating the average value of the final amplitude response matrix and the final phase angle response matrix of the interested areas of the reference paper grain image and the paper grain image to be identified respectively, carrying out size ratio on each number in the response matrix and the average value, taking 1 larger than the average value and 0 smaller than the average value, expanding the two number matrixes according to rows or columns, and splicing the obtained bit streams together to respectively serve as the number paper grains of the reference paper grain image and the paper grain image to be identified;
calculating the Hamming distance between the reference paper grain image and the digital paper grain of the paper grain image to be identified, and taking the proportion of the Hamming distance to the total length of the digital paper grain as a similarity index between the reference paper grain and the paper grain to be identified;
and selecting a threshold t, if the similarity index is larger than the threshold t, failing to identify, and if the similarity index is smaller than the threshold t, successful identification.
Specifically, calculating the average value of the final amplitude response and the phase angle response matrix of the region of interest respectively, and then comparing each number in the response matrix with the average value, taking 1 larger than the average value and taking 0 smaller than the average value; in this embodiment, for a region of interest of 32×32 of a paper grain, two 01 digital matrices corresponding to 32×32 of amplitude response and phase angle response respectively can be obtained finally, and after the two digital matrices are expanded in rows or columns, the obtained bit streams are spliced together, so that a bit stream with a size of 32×32×2=2048 can be obtained, and the bit streams are respectively used as digital paper grain of a reference paper grain image and a paper grain image to be identified.
In information coding, the bit numbers coded on the corresponding bits of two legal codes are called Hamming distance; in this embodiment, the hamming distance between the obtained reference paper grain image and the digital paper grain of the paper grain image to be identified in the above step is calculated, and then the ratio of the hamming distance to the total length 2048 of the digital paper grain is taken as the similarity index between the reference paper grain and the paper grain to be identified, for example, when the number of different bits in the corresponding positions of the digital paper grain generated by the reference paper grain image and the paper grain image to be identified is 80, that is, when the hamming distance is 80, the corresponding similarity index is 0.039; it should be noted that, if the reference paper grain image and the paper grain image to be identified are collected from the same area of the same paper, the similarity index between the reference paper grain image and the digital paper grain corresponding to the paper grain image to be identified is close to 0; if the reference paper grain image and the paper grain image to be identified are acquired from different papers or different areas of the same paper, the similarity index between the reference paper grain image and the digital paper grain corresponding to the paper grain image to be identified is close to 0.5 by randomness. In this embodiment, a threshold t=0.25 is selected, and when the similarity index is greater than 0.25, the recognition fails, and when the similarity index is less than 0.25, the recognition succeeds. Moreover, it should be noted that the selection of the threshold value may be finally given according to a large number of experimental results.
The invention provides a paper grain recognition method based on a micro-precision fiber microstructure in paper, which mainly utilizes a random micro-fiber interweaved texture structure in the paper to recognize paper grains. Compared with the prior art, the paper grain identification method provided by the invention has at least the following beneficial effects: (1) The paper grain collection scheme of microscopic transmission illumination is adopted, so that micron-precision fiber structure texture images ranging from the surface of the paper to below 50 microns can be directly collected, fiber textures are stable, and illumination changes and paper surface dirt are insensitive; (2) The paper grain identification is carried out by adopting the fiber texture characteristics with paper micron precision, so that the stability of the paper grain calibration method based on the characteristic point estimated paper grain transformation matrix provided by the invention is ensured, and translation, rotation and scaling of paper grain images caused by manual and equipment operation deviation in the paper grain acquisition process can be resisted; (3) As the fiber texture features with micron precision are not easy to lose when dirt appears on the surface of the paper, the paper grain recognition algorithm provided by the invention can still realize paper grain calibration and recognition work under the condition of dirt, so that the paper grain recognition method provided by the invention can resist adverse situations such as dirt on the surface of the paper.
While the invention has been described with reference to the specific embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted without departing from the scope of the invention. In addition, many modifications may be made to adapt a particular situation or material to the teachings of the invention without departing from its scope. Therefore, it is intended that the invention not be limited to the particular embodiment disclosed, but that the invention will include all embodiments falling within the scope of the appended claims.