CN111461030A - Affine iterative transformation-based template matching alignment method - Google Patents

Affine iterative transformation-based template matching alignment method Download PDF

Info

Publication number
CN111461030A
CN111461030A CN202010260124.9A CN202010260124A CN111461030A CN 111461030 A CN111461030 A CN 111461030A CN 202010260124 A CN202010260124 A CN 202010260124A CN 111461030 A CN111461030 A CN 111461030A
Authority
CN
China
Prior art keywords
affine
image
transformation
paper
sub
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.)
Granted
Application number
CN202010260124.9A
Other languages
Chinese (zh)
Other versions
CN111461030B (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.)
Nanjing Hongsong Information Technology Co ltd
Original Assignee
Nanjing Hongsong Information Technology Co ltd
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 Nanjing Hongsong Information Technology Co ltd filed Critical Nanjing Hongsong Information Technology Co ltd
Priority to CN202010260124.9A priority Critical patent/CN111461030B/en
Publication of CN111461030A publication Critical patent/CN111461030A/en
Application granted granted Critical
Publication of CN111461030B publication Critical patent/CN111461030B/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
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4084Scaling of whole images or parts thereof, e.g. expanding or contracting in the transform domain, e.g. fast Fourier transform [FFT] domain scaling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • 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
    • G06V30/43Editing text-bitmaps, e.g. alignment, spacing; Semantic analysis of bitmaps of text without OCR
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to a template matching and aligning method based on affine iterative transformation, which comprises the following steps: s1, setting a scanning test paper of the test paper to comprise a mother paper and a sub paper, respectively positioning character coordinates of a mother paper image and a sub paper image, and moving the sub paper to enable the character coordinates of the mother paper and the character coordinates of the sub paper to be aligned; s2, positioning coordinates of the sub-roll characters which are approximately aligned, acquiring an X axis and a Y axis, acquiring coordinates of first characters at the upper left corner, taking the coordinates of the first characters as a starting point, and cutting to obtain an image to be corrected; s3, performing affine iterative transformation on the image to be corrected to the corrected image matrix to obtain a corrected image; s4, performing template matching on the local correction image after affine transformation and the local template image once every iteration of affine iteration, and continuously iterating until the affine iteration is stopped when the matching is successful to obtain an affine transformation matrix; s5, applying the affine transformation matrix to the transformation in the sub-volume to complete the alignment of the mother volume and the sub-volume; the alignment efficiency and accuracy are improved.

Description

Affine iterative transformation-based template matching alignment method
Technical Field
The invention relates to the technical field of text image processing, in particular to a template matching alignment method based on affine iterative transformation.
Background
Machine vision is an important branch of artificial intelligence, has been developed rapidly in recent years, has been widely applied in various industries, greatly improves human productivity and production modes, reduces labor of people, relieves workload of people, and brings great convenience and improvement to life styles of people.
In the field of education, computer vision technology has been applied to automated review systems in a comprehensive manner, which can help teachers perform automated review of test papers. The time for the teacher to manually correct the test paper is greatly shortened, and the working efficiency of the teacher is improved. Today, computer vision technology has gained brilliant achievements, and accompanying image processing technology is becoming mature. In the technical field of text OCR recognition, various automatic reading and amending products apply a computer vision technology, and an image preprocessing technology is an indispensable technical link and is widely applied to early processing of various images.
In the actual use process of the automatic reading and amending product, due to the influence of a plurality of reasons such as printing, scanning and the like, the image has certain phenomena such as deflection, deformation, scaling and the like. In order to solve such practical problems of images, image preprocessing is urgently needed, simple translation and scaling cannot meet the requirements of common image alignment processing, and although affine transformation is used as an effective image correction and transformation method, the affine transformation cannot meet the requirements when processing an image alignment task.
Therefore, the method for matching and aligning the template based on the affine iterative transformation mainly achieves the aim of completely aligning the images in an affine transformation mode by continuously iterating until the template is successfully matched.
Disclosure of Invention
The invention aims to solve the technical problem of providing a template matching and aligning method based on affine iterative transformation, which mainly achieves the aim of completely aligning images by continuously iterating until the template matching is successful in an affine transformation mode.
In order to solve the technical problems, the invention adopts the technical scheme that: the template matching and aligning method based on affine iterative transformation specifically comprises the following steps:
s1 approximately aligned: firstly, dividing a scanning test paper of a test paper into two pieces including a mother paper and a sub paper to obtain a mother paper image and a sub paper image, respectively positioning character coordinates of the mother paper image and the sub paper image to obtain a mother paper character coordinate and a sub paper character coordinate, and moving the sub paper to enable the mother paper character coordinate and the sub paper character coordinate to reach an aligned state;
s2 local cutting: according to the sub-volume character positioning coordinates approximately aligned in the step S1, an X axis and a Y axis are obtained, meanwhile, a first character coordinate of the upper left corner is obtained, the first character coordinate is used as a starting point and is cut, and a cutting area is obtained and is used as an image to be corrected;
s3 iterative affine: scaling the image to be corrected obtained in the step S2 according to a homogeneous transformation matrix with translation characteristics, and performing affine iterative transformation on the image to be corrected to a corrected image matrix to obtain a local corrected image;
and S4 template matching: in the step S3, performing template matching on the local correction image after affine transformation and the local template image once every iteration, continuously iterating and continuously matching, and stopping affine iteration until matching is successful to obtain an affine transformation matrix;
s5 image alignment: and applying the affine transformation matrix obtained in the step S4 to the transformation in the sub-volume to complete the complete alignment of the parent volume and the sub-volume.
By adopting the technical scheme, the template matching and aligning method based on affine iterative transformation mainly comprises the steps of cutting images of partial areas, realizing image matching in the continuous iterative affine process by utilizing an affine transformation matrix, and finishing the aligning process, wherein the local template images are images corresponding to local correction images of sub-rolls in a mother roll, and the efficiency and the accuracy of aligning the mother roll and the sub-rolls are improved.
As a preferred technical solution of the present invention, the step S1 further includes calculating an offset and a scaling S of the parent volume character coordinates and the child volume character coordinates, and moving the child volume according to the offset to make the parent volume character coordinates and the child volume character coordinates approximately aligned. The offset and the scaling are also obtained by an affine transformation algorithm, and the adopted formula is a transformation matrix formula (1).
As a preferred embodiment of the present invention, in the step S3, the scaling factor S of the parent volume character coordinates and the child volume character coordinates calculated in the step S1 is a multiple of scaling by introducing a homogeneous transformation matrix including a translation characteristic.
As a preferred embodiment of the present invention, in step S3, a specific transformation formula (1) for performing affine iterative transformation on the image to be corrected to obtain a locally corrected image is as follows:
Figure BDA0002438971960000031
wherein s is a scaling factor, i.e. a scaling ratio; theta is a defined angle of affine iteration; t is the degree of translational freedom, txIs a translational degree of freedom in the horizontal direction, tyIs a translational degree of freedom in the vertical direction.
As a preferred embodiment of the present invention, in step S3, it is known from the transformation matrix of formula (1) that the transformation matrix of affine iterative transformation has 6 degrees of freedom, and is expressed as:
(s cos(θ),-s sin(θ),tx,s sin(θ),s cos(θ),ty) (ii) a And continuously iterating the theta value within the theta angle range by the affine iteration in a step size of 0.1 degrees to control the affine transformation matrix so as to obtain different corrected images.
In a preferred embodiment of the present invention, the θ angle is in a range of 1 ° to 3 °.
As a preferred embodiment of the present invention, in the step S3 in the step S4, the value θ is iterated every time affine transformation is iterated, and template matching is performed on the affine-transformed local rectification image and the local template image once.
Compared with the prior art, the invention has the beneficial effects that: the template matching and aligning method based on affine iterative transformation mainly comprises the steps of cutting images of partial areas, firstly realizing image matching in an affine continuous iteration process by utilizing an affine transformation matrix, completing an aligning process, and improving the efficiency and accuracy of aligning a mother roll and a child roll.
Drawings
The technical scheme of the invention is further described by combining the accompanying drawings as follows:
FIG. 1 is a flow chart of the affine iterative transformation based template matching alignment method of the present invention;
FIG. 2 is a schematic diagram of clipping the region to be corrected in step S2 in the template matching alignment method based on affine iterative transformation according to the present invention; wherein (a) is a master paper which is a printing test paper without handwritten answers; (b) the test paper is a printing test paper containing handwritten answers, namely a sub-paper.
Detailed Description
For the purpose of enhancing the understanding of the present invention, the present invention will be described in further detail with reference to the accompanying drawings and examples, which are provided for the purpose of illustration only and are not intended to limit the scope of the present invention.
Example (b): as shown in fig. 1, the template matching and aligning method based on affine iterative transformation specifically includes the following steps:
s1 approximately aligned: firstly, dividing a scanning test paper of a test paper into two pieces including a mother paper and a sub paper to obtain a mother paper image and a sub paper image, respectively positioning character coordinates of the mother paper image and the sub paper image to obtain a mother paper character coordinate and a sub paper character coordinate, and moving the sub paper to enable the mother paper character coordinate and the sub paper character coordinate to reach an aligned state;
step S1 further includes calculating an offset and a scaling S of the parent volume character coordinates and the child volume character coordinates, and moving the child volume according to the offset to make the parent volume character coordinates and the child volume character coordinates reach an approximately aligned state;
s2 local cutting: according to the sub-volume character positioning coordinates approximately aligned in the step S1, an X axis and a Y axis are obtained, meanwhile, a first character coordinate of the upper left corner is obtained, the first character coordinate is used as a starting point and is cut, and a cutting area is obtained and is used as an image to be corrected; as shown in fig. 2;
s3 iterative affine: scaling the image to be corrected obtained in the step S2 according to a homogeneous transformation matrix with translation characteristics, and performing affine iterative transformation on the image to be corrected to a corrected image matrix to obtain a local corrected image;
in the step S3, the scaling factor S of the parent volume character coordinates and the child volume character coordinates calculated in the step S1 is a multiple of scaling according to a homogeneous transformation matrix with translation characteristics;
in step S3, the specific transformation formula (1) for performing affine iterative transformation on the image to be corrected to obtain a locally corrected image is as follows:
Figure BDA0002438971960000041
wherein s is a scaling factor, i.e. a scaling ratio; theta is a defined angle of affine iteration; t is the degree of translational freedom, txIs a translational degree of freedom in the horizontal direction, tyIs a translational degree of freedom in the vertical direction.
In step S3, it is known from the transformation matrix of formula (1), and the transformation matrix of the affine iterative transformation has 6 degrees of freedom, which is expressed as: (s cos (θ), -s sin (θ), t)x,s sin(θ),s cos(θ),ty) (ii) a Continuously iterating the theta value within the theta angle range by the affine iteration in a step length of 0.1 degrees to control an affine transformation matrix to obtain different correction images; the theta angle ranges from 1 degree to 3 degrees;
and S4 template matching: in the step S3, iterating the affine every time, performing template matching on the affine-transformed local correction image and the local template image once, iterating continuously, and matching continuously until the matching is successful, stopping affine iteration, and obtaining an affine transformation matrix;
s5 image alignment: and applying the affine transformation matrix obtained in the step S4 to the transformation in the sub-volume to complete the complete alignment of the parent volume and the sub-volume.
It is obvious to those skilled in the art that the present invention is not limited to the above embodiments, and it is within the scope of the present invention to adopt various insubstantial modifications of the method concept and technical scheme of the present invention, or to directly apply the concept and technical scheme of the present invention to other occasions without modification.

Claims (7)

1. A template matching alignment method based on affine iterative transformation is characterized by comprising the following steps:
s1 approximately aligned: firstly, dividing a scanning test paper of a test paper into two pieces including a mother paper and a sub paper to obtain a mother paper image and a sub paper image, respectively positioning character coordinates of the mother paper image and the sub paper image to obtain a mother paper character coordinate and a sub paper character coordinate, and moving the sub paper to enable the mother paper character coordinate and the sub paper character coordinate to reach an aligned state;
s2 local cutting: according to the sub-volume character positioning coordinates approximately aligned in the step S1, an X axis and a Y axis are obtained, meanwhile, a first character coordinate of the upper left corner is obtained, the first character coordinate is used as a starting point and is cut, and a cutting area is obtained and is used as an image to be corrected;
s3 iterative affine: scaling the image to be corrected obtained in the step S2 according to a homogeneous transformation matrix with translation characteristics, and performing affine iterative transformation on the image to be corrected to a corrected image matrix to obtain a local corrected image;
and S4 template matching: in the step S3, performing template matching on the local correction image after affine transformation and the local template image once every iteration, continuously iterating and continuously matching, and stopping affine iteration until matching is successful to obtain an affine transformation matrix;
s5 image alignment: and applying the affine transformation matrix obtained in the step S4 to the transformation in the sub-volume to complete the alignment of the parent volume and the sub-volume.
2. The template matching alignment method based on affine iterative transformation of claim 1, wherein said step S1 further comprises calculating an offset and a scaling S of the parent volume character coordinates and the child volume character coordinates, and moving the child volume according to the offset to achieve approximate alignment of the parent volume character coordinates and the child volume character coordinates.
3. The affine iterative transformation-based template matching alignment method as claimed in claim 2, wherein in the step S3, the scaling factor S of the parent volume character coordinates and the child volume character coordinates calculated in the step S1 is a multiple of scaling by introducing a homogeneous transformation matrix containing translation characteristics.
4. The template matching alignment method based on affine iterative transformation of claim 3, wherein the concrete transformation formula (1) of the step S3 for transforming the image to be corrected into the corrected image matrix through affine iterative transformation to obtain the local corrected image is as follows:
Figure FDA0002438971950000021
wherein s is a scaling factor, i.e. a scaling ratio; theta is a defined angle of affine iteration; t is the degree of translational freedom, txIs a translational degree of freedom in the horizontal direction, tyIs a translational degree of freedom in the vertical direction.
5. The affine iterative transformation-based template matching alignment method as claimed in claim 4, wherein in step S3, it is known from the transformation matrix of formula (1), and the transformation matrix of affine iterative transformation has 6 degrees of freedom and is represented as: (scos (θ), -ssin (θ), tx,ssin(θ),scos(θ),ty) (ii) a And continuously iterating the theta value within the theta angle range by the affine iteration in a step size of 0.1 degrees to control the affine transformation matrix so as to obtain different corrected images.
6. The affine iterative transformation-based template matching alignment method as claimed in claim 5, wherein the θ angle is in a range of 1 ° to 3 °.
7. The affine iterative transformation-based template matching alignment method as claimed in claim 5, wherein in step S3 of step S4, the local rectification image after affine transformation is subjected to template matching with the local template image once for every iteration of θ.
CN202010260124.9A 2020-04-03 2020-04-03 Template matching alignment method based on affine iterative transformation Active CN111461030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010260124.9A CN111461030B (en) 2020-04-03 2020-04-03 Template matching alignment method based on affine iterative transformation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010260124.9A CN111461030B (en) 2020-04-03 2020-04-03 Template matching alignment method based on affine iterative transformation

Publications (2)

Publication Number Publication Date
CN111461030A true CN111461030A (en) 2020-07-28
CN111461030B CN111461030B (en) 2023-04-28

Family

ID=71681653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010260124.9A Active CN111461030B (en) 2020-04-03 2020-04-03 Template matching alignment method based on affine iterative transformation

Country Status (1)

Country Link
CN (1) CN111461030B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112200058A (en) * 2020-09-30 2021-01-08 珠海读书郎网络教育有限公司 System and method for intelligently correcting auxiliary data
CN113642573A (en) * 2021-07-20 2021-11-12 南京红松信息技术有限公司 Picture separation method based on grids

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398895A (en) * 2007-09-26 2009-04-01 杨高波 Image preprocess method based on data matrix two-dimension bar code identification
CN103676398A (en) * 2013-12-18 2014-03-26 重庆大学 Two-dimensional affine transformation full-gloss implementation method based on diffraction device array
CN106643545A (en) * 2016-10-09 2017-05-10 湖南大学 Calibration method for steel rail profile measured by adopting laser displacement technology
CN107203766A (en) * 2017-04-19 2017-09-26 杭州泽火科技有限公司 It is accurately positioned the method for character, apparatus and system in image

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398895A (en) * 2007-09-26 2009-04-01 杨高波 Image preprocess method based on data matrix two-dimension bar code identification
CN103676398A (en) * 2013-12-18 2014-03-26 重庆大学 Two-dimensional affine transformation full-gloss implementation method based on diffraction device array
CN106643545A (en) * 2016-10-09 2017-05-10 湖南大学 Calibration method for steel rail profile measured by adopting laser displacement technology
CN107203766A (en) * 2017-04-19 2017-09-26 杭州泽火科技有限公司 It is accurately positioned the method for character, apparatus and system in image

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112200058A (en) * 2020-09-30 2021-01-08 珠海读书郎网络教育有限公司 System and method for intelligently correcting auxiliary data
CN112200058B (en) * 2020-09-30 2021-07-06 珠海读书郎网络教育有限公司 System and method for intelligently correcting auxiliary data
CN113642573A (en) * 2021-07-20 2021-11-12 南京红松信息技术有限公司 Picture separation method based on grids
CN113642573B (en) * 2021-07-20 2023-10-13 南京红松信息技术有限公司 Picture separation method based on grids

Also Published As

Publication number Publication date
CN111461030B (en) 2023-04-28

Similar Documents

Publication Publication Date Title
WO2020156362A1 (en) Examination paper correction method and apparatus, electronic device and storage medium
CN111461030A (en) Affine iterative transformation-based template matching alignment method
CN109409374B (en) Joint-based same-batch test paper answer area cutting method
CN105913093A (en) Template matching method for character recognizing and processing
CN112200058B (en) System and method for intelligently correcting auxiliary data
CN107633239A (en) Bill classification and bill field extracting method based on deep learning and OCR
CN103729655A (en) Detection method for sheet element visual positioning
CN103745475A (en) Detection and positioning method used for spherical pin element
CN112966537B (en) Form identification method and system based on two-dimensional code positioning
CN102799850A (en) Bar code recognition method and device
US20140126839A1 (en) Defect detection using joint alignment and defect extraction
CN110991258B (en) Face fusion feature extraction method and system
CN116168404B (en) Intelligent document processing method and system based on space transformation
CN112784894B (en) Automatic labeling method for rock slice microscopic image
CN113673428A (en) Method for automatically identifying answer sheet picture
CN116474976A (en) High-speed spraying system with visual detection function
CN115457559A (en) Method, device and equipment for intelligently correcting text and license pictures
CN114255464A (en) Natural scene character detection and identification method based on CRAFT and SCRN-SEED framework
CN113627432A (en) Method and device for identifying seal in image, computer equipment and readable storage medium
CN113065477B (en) Intelligent classroom textbook content identification method
CN107315392A (en) The special-shaped workpiece nesting optimization algorithm and its tolerance algorithm of automatic feeder for punch
CN116189161A (en) Machine vision identification method, system, computer equipment and storage medium for qualification certificate
CN113657162A (en) Bill OCR recognition method based on deep learning
CN113111941B (en) Fabric pattern matching method and system based on color image and vector image
CN109579721A (en) A kind of biaxial stretch-formed extensometer measurement method of view-based access control model tracking

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