[go: up one dir, main page]

CN115375575B - Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device - Google Patents

Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device

Info

Publication number
CN115375575B
CN115375575B CN202211010822.9A CN202211010822A CN115375575B CN 115375575 B CN115375575 B CN 115375575B CN 202211010822 A CN202211010822 A CN 202211010822A CN 115375575 B CN115375575 B CN 115375575B
Authority
CN
China
Prior art keywords
value
variable
image
correction
data
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
CN202211010822.9A
Other languages
Chinese (zh)
Other versions
CN115375575A (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.)
Shenzhen Fuge Technology Co ltd
Original Assignee
Shenzhen Fuge 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 Shenzhen Fuge Technology Co ltd filed Critical Shenzhen Fuge Technology Co ltd
Priority to CN202211010822.9A priority Critical patent/CN115375575B/en
Publication of CN115375575A publication Critical patent/CN115375575A/en
Application granted granted Critical
Publication of CN115375575B publication Critical patent/CN115375575B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/32Handling requests for interconnection or transfer for access to input/output bus using combination of interrupt and burst mode transfer
    • G06F13/34Handling requests for interconnection or transfer for access to input/output bus using combination of interrupt and burst mode transfer with priority control
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30168Image quality inspection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本发明属于生物识别技术领域,具体的说是生物特征光电扫描装置图像快速梯形纠偏方法,包括以下步骤:S1:生产纠偏设定阶段,由工作人员先把一个标准治具放在扫描装置上,然后在计算机上用软件实时显示光电摄像芯片拍摄得到治具扫描图像,人工调整光路的机械参数,优先降低鼓形失真、枕形失真、以及旋转失真;对于梯形失真不必过多纠正,只需在人工用鼠标点击选定治具图像中的边缘梯形四个角作为四个纠偏控制点之后,当原始图像数据采集速度高于纠偏数据运算速度时,原始图像速度配适可以保证原始图像数据不会发生新旧数据拼接断裂;当上位机接口速度低于纠偏图像速度时,纠偏图像速度配适可以保证上位机收到的图像数据也不会发生新旧数据拼接断裂。

This invention belongs to the field of biometric technology, specifically a rapid trapezoidal correction method for biometric photoelectric scanning devices. The method includes the following steps: S1: In the production correction setting stage, a standard fixture is placed on the scanning device. Then, software on a computer displays the scanned image of the fixture captured by the photoelectric camera chip in real time. The mechanical parameters of the optical path are manually adjusted to prioritize reducing drum-shaped distortion, pincushion distortion, and rotational distortion. Trapezoidal distortion does not require extensive correction; simply selecting the four corners of the trapezoidal edge in the fixture image as four correction control points using a mouse ensures that the original image data acquisition speed is higher than the correction data processing speed, preventing splicing breaks between old and new data. Similarly, when the host computer interface speed is lower than the correction image speed, the correction image speed also ensures that the image data received by the host computer will not experience splicing breaks between old and new data.

Description

Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device
Technical Field
The invention belongs to the technical field of biological identification, and particularly relates to a rapid trapezoidal correction method for images of a biological characteristic photoelectric scanning device.
Background
The technology for automatically identifying and determining the identity of the person by collecting biological characteristics such as fingerprints, palmprints, faces, irises and the like in a photoelectric scanning mode has the advantages of convenient operation and no wound and is widely applied to the fields of security authentication, financial payment, attendance management, public security criminal investigation and the like, the biological identification is generally that an electronic device scans a specific part of a human body to obtain digitalized information data, the digitalized information data is sent to an upper computer to extract characteristic points, a sample library is searched, and each prestored sample is compared, so that the identity of the person is determined.
In the prior art, the biological characteristic optical scanning device mainly comprises an optical system, a photoelectric camera chip, a data processor, a memory and an upper computer interface, wherein the optical system consists of a series of optical lenses, a mechanical device is arranged in a light path of the acquisition device to image emergent rays of a human body scanning part to a light sensitive surface of the photoelectric camera chip, the processor caches image data output by the photoelectric chip into the memory and forwards the image data to the upper computer for characteristic recognition through the upper computer interface, and the output image always has drum distortion, pincushion distortion, trapezoidal distortion, rotation distortion and other conditions due to the existence of mechanical errors of the optical system, and various distortions can affect each other.
In use, the image digital correction technology is used for correcting the mechanical error of an original distorted image and improving the accuracy of the image, for example, the distorted image is multiplied by a correction matrix by a matrix method to realize the correction of the image, and because each pixel for generating the correction image needs to calculate the multiplication of the times of the product of the width and the height of the image and the addition of the times of the product of the width and the height of the image, a high-end processor with a hardware floating point multiplier is needed to be capable of working with huge calculation, the existing image quick correction methods capable of realizing low-cost devices mainly adopt a mode of extracting the nearest point pixel, the image quality output by the method is not high enough, the image can generate saw-tooth distortion in some areas, and even the image with some broken shapes is distorted, so the method for quickly correcting the trapezium of the image of the biological characteristic photoelectric scanning device is provided for the problems.
Disclosure of Invention
In order to overcome the defects of the prior art, the method for quickly rectifying the images of the low-cost device mainly adopts a mode of extracting the nearest point pixels, and the method has the advantages that the output image quality is not high enough, saw-tooth distortion can occur in some areas of the image, and even the image distortion with some fracture shapes can occur.
The invention solves the technical problems by adopting the technical scheme that the rapid trapezoidal correction method for the image of the biological characteristic photoelectric scanning device comprises the following steps:
The method comprises the steps of S1, setting a standard jig on a scanning device by a worker, displaying a scanning image of the jig by using a software real-time display photoelectric camera chip on a computer, manually adjusting mechanical parameters of a light path, preferentially reducing drum distortion, pincushion distortion and rotation distortion, and for trapezoidal distortion, not correcting the trapezoidal distortion too much, only clicking four corners of an edge trapezoid in a selected jig image by using a mouse manually to serve as four correction control points, and then sending coordinates of the correction control points to the scanning device for permanent storage;
S2, in the stage of generating correction control information, a processor in a scanning device calculates a group of data for correcting an image according to the stored coordinates of correction control points, the data is stored in a random memory, the group of image correction data is called as image correction information, the calculation amount is large when the image correction information is generated, but the calculation is only carried out once when the scanning device is reset and started, so that the actual use requirement can be met by using a low-cost processor, and the result data generated by the calculation, namely the image correction information, is required to be repeatedly and rapidly acquired in the stage of scanning image correction output, so that the correction information data is required to be stored in the random memory which can be rapidly read;
And S3, in the scanning image correction output stage, a processor in the scanning device calculates distorted image data of the photoelectric camera chip by utilizing image correction information, converts the distorted image data into an image with qualified error and outputs the image to a host computer or the processor, wherein the process is a main function execution process of the scanning device and is in a state of repeated and cyclic execution, and the process is required to have higher execution efficiency, so that excessive time-consuming complex calculation such as floating point division and the like cannot exist.
Preferably, in the production deviation correction setting stage, a scanning device is connected with a computer, a standard jig with the size equal to the size of a scanning window of equipment is placed on the scanning device, production test software is operated on the computer, and jig images obtained by shooting of a photoelectric camera chip are displayed in real time;
When the scanned image is distorted, the grid in the jig pattern can be used for visually observing the position of the distorted area of the scanning acquisition optical path, and prompting the direction of the fine adjustment machine when the distortion is used for correcting mechanical errors;
The production deviation correcting setting firstly adjusts the mechanical position of the optical train, although the image distortion is difficult to thoroughly eliminate, the mechanical position is adjusted as much as possible to reduce the distortion, the smaller the mechanical adjustment is, the more beneficial to improving the quality of the final output deviation correcting image, the drum distortion, the pincushion distortion and the rotation distortion are preferentially reduced, and the trapezoidal distortion does not need to be corrected excessively, and the adjustment is required to be carried out until all four vertexes of the rectangular jig are displayed in the scanned image.
Preferably, the four vertexes of the original jig are A, B, C and D respectively, the four vertexes E, F, G and H respectively correspond to the four vertexes of the original jig in a scanning image displayed on a computer through a scanning device, mechanical adjustment is required to enable EF lines and GH lines in the scanning image to be horizontal straight lines, EG lines and FH lines are not required to be vertical only to be straight lines, and thus an image formed by the vertexes E, F, G and H is any trapezoid with the upper bottom edge and the lower bottom edge in the horizontal direction;
and on the interface of the production test software, clicking four vertexes of the selected rectangular jig on the scanning image by using a mouse as deviation rectifying control points, and then transmitting coordinates of the four deviation rectifying control points on the jig scanning image to a scanning device by using the production test software, and permanently storing the coordinates in the device to finish production deviation rectifying setting.
Preferably, in the stage of generating the correction control information, the width of an original image acquired by the photoelectric camera chip is W 1, the height is H 1, the width of an output image after the original image is reduced and corrected is W 2, and the height is H 2;
the correction control information generation stage is to calculate a set of correction data by utilizing coordinates of four correction control points of a jig scanning image stored in a device in the production correction setting stage and store the correction data in a random memory of scanning equipment, wherein the correction data comprises three groups of information including top total loss data information, horizontal total loss line information and trapezoidal horizontal fusion line information;
The top total loss data information has only one numerical value, which is represented by GT and is equal to the number of pixels on the upper side of an EF line in a jig scanning chart, although mechanical adjustment is required to enable the EF line and GH of the jig scanning chart to be horizontal, errors exist in actual production, namely, the numerical values of E Y and F Y of an E point coordinate (E X,EY) and an F point coordinate (F X,FY) are different, so the calculation method of the top total loss data information is as follows:
Also, because of the machine model error, the values of G Y and H Y of the G point coordinate (G X,GY) and the H point coordinate (H X,HY) are different, and the method for calculating the trapezoid height LN is as follows;
The horizontal full-line-loss information comprises three data, namely a horizontal full-line-loss number TC, a horizontal full-line-loss number array TA and a horizontal full-line-loss marking array TS, wherein the horizontal full-line-loss number TC is a numerical value which represents the number of the horizontal lines reduced in the vertical reduction process of the image, the number of the definition elements is equal to H 1 minus the horizontal full-line-loss number array TA of H 2, and the number of the effective data actually stored is equal to TC;
The trapezoid horizontal fusion line information comprises a one-dimensional pixel coordinate array PS with the number of members equal to the width W 2 multiplied by the height H 2 and an array PL with the number of elements equal to H 2, wherein each element in the array PL is a data structure comprising two members, and the two members are respectively a line start coordinate SS and a line width WS.
Preferably, the specific execution steps of generating the deviation rectifying control information are as follows:
A1, setting all elements of a horizontal full-loss line marking array TS to be zero, setting the number TC of the horizontal full-loss line to be zero, calculating top full-loss data information GT and trapezoid height LN, defining a constant XN, wherein the larger the value of the XN is, the more beneficial to improving the precision, the overflow occurs if the binary bit number of a result obtained by XN is H 2 exceeds the bit width of a processor, and the precision is not obviously improved after the XN exceeds 16 times of the image width, so that the value of the XN must not be excessively large, for example, the XN can be set to be equal to 1000000 in a 32-bit processor;
a2, defining a variable LB, a variable LS and a variable yTar, and setting initial values to be equal to zero;
A3, defining a variable SP, and setting an initial value as XN;
a4, defining variables U, V and W, wherein the variables U, V and W are used for storing temporary calculation intermediate results;
A5, defining a variable STEP, and setting a numerical value as a numerical value;
a6, after adding STEP to the SP, if the value of the SP is larger than XN, executing the STEP A7, otherwise executing the STEP A11;
A7, shifting LS by four bits left, multiplying G X, saving the result in a variable U, shifting LN minus LS by four bits left, multiplying LN by E X, saving the result in a variable V, using yTar as an index of an array PL, representing PL [ yTar ], calculating the result of dividing LN by the variable U and adding variable V, and saving the result in a member SS of PL [ yTar ];
A8, shifting LS by four bits left, multiplying by H X, and storing the result in a variable U, shifting LN minus LS by four bits left, multiplying by F X, and storing the result in a variable V;
a9, taking yTar as an index of the array PL, and saving the numerical value of the member SS of the calculated variable W minus PL [ yTar ] to the member WS of the PL [ yTar ];
A10, subtracting XN from the SP, accumulating yTar to 1, and then executing A13;
A11, if yTar is greater than or equal to H 2, directly executing A12, otherwise, using yTar as an array TS of index, using TS [ yTar ] to indicate, and executing A12 after setting TS [ yTar ] to 1;
A12, taking TC as an array TA of an index, using TA [ TC ] to represent, calculating a variable LS, subtracting a value of a variable LB, and storing the value of the variable LS into the variable LB;
A13, comparing the sizes of the variables LS and LN, if LS is smaller than LN, executing the step A6, otherwise executing the step A14;
a14, setting a variable yTar to zero, defining a variable xTar;
a15, setting the value of the variable xTar to be zero;
A16, in the array PL with yTar as index, calculating the number value of member WS of PL [ yTar ] multiplied by variable xTar, dividing by W 2, adding the number value of member SS of PL [ yTar ] and storing in variable U;
A17, multiplying the calculated variable yTar by W 2, adding the numerical value of the variable xTar, and storing the numerical value in a variable V;
a18, the pixel coordinate array PS taking variable V as index is expressed by PS [ V ], and the value of PS [ V ] is set to be equal to variable U;
A19, accumulating the variables xTar to 1, if the value of the variable xTar is smaller than W 2, executing the step A16, otherwise executing the step A20;
A20, accumulating the variable yTar to 1, if the value of the variable yTar is smaller than H 2, executing the step A15, otherwise, completing the deviation rectifying control information stage.
Preferably, in the stage of correcting and outputting the scanned image, when the image data stream is processed, an original image is generated by a photoelectric chip in the scanning device, the original image enters a random memory RAM1 through a bus for temporary storage, the original image is changed into a corrected image after being processed by a processor, and then the corrected image is stored in a random memory RAM2 again and is sent to an upper computer interface by a bus output interface, the random memory RAM1 and the RAM2 can be two different memories or two different address spaces of the same memory, and the transmission of the original image and the corrected image is usually completed in a DMA mode;
The image speed adaptation of the original image and the deviation correcting image adopts the same strategy, the details of specific steps are different, the common point is that three image buffer areas are defined, only data are written in and data are read out for the operation of each buffer area at any moment, and three kinds of idle operation are realized, namely, the writing operation and the reading operation can not be simultaneously executed for one buffer area;
The photoelectric chip triggers the DMA1 to send original image data to the RAM1, the bus output interface triggers the DMA2 to send deviation correcting image data to the upper computer interface, the priority of the DMA1 is higher than that of the DMA2, when the DMA1 starts to transmit the last byte of an original image, the DMA1 is triggered to execute the interrupt 1 service processing step, when the DMA2 starts to transmit the last byte of a deviation correcting image, the DMA2 is triggered to execute the interrupt 2 service processing step, the priority of the interrupt 1 is set to be higher than that of the interrupt 2, thus the priority of the DMA and the interrupt is set to ensure that the situation that image splicing and breaking cannot occur even if the data processing or output speed is lower than the acquisition speed of the photoelectric chip;
The method comprises the steps of sending original image data of a photoelectric chip to a RAM1 through a DMA1, executing a data reading step in a main program loop of a processor, converting the original image data into deviation correcting image data by using the deviation correcting data, after storing the deviation correcting image data in the RAM2, executing a data sending step, sending the data to an upper interface by using the DMA2, and mainly dividing the three processes of original image speed adaptation, deviation correcting image output adaptation and deviation correcting processing.
Preferably, the original image speed adaptation usually adopts global variables as coordination to realize the process of the steps of RAM1, DMA1, interrupt 1 and data reading in a linkage way, specifically, a one-dimensional array BUF1 with three elements is defined, the three elements respectively store the initial addresses of three image cache areas in the RAM1 and are respectively represented by BUF1[0], BUF1[1] and BUF1[2 ];
The service processing step of the interrupt 1 is used for switching the original image buffer area, on one hand, the buffer area is prepared for the DMA1 to start to newly save an original image data, and on the other hand, the latest saved image data is prepared for the data reading step, and the specific steps are as follows;
b1, after accumulating the variable WR1 by 1, if the value of WR1 is larger than 2, setting WR1 to be zero;
b2, if the value of WR1 is equal to the value of RD1, executing the step B1, otherwise, executing the step B3 downwards;
B3, taking WR1 as an index of a plurality of groups of BUF1, and representing BUF1[ WR1], wherein the numerical value is the initial address of the original image buffer;
b4, sending the value of BUF1[ WR1] to the DMA1 controller, and after the DMA1 controller is started, exiting the interrupt 1 service to complete the service processing step of the interrupt 1;
the data reading step comprises the following steps of;
c1, comparing the values of the variables WR1 and RD1, if the values are equal, the original image data is not available for reading, so that the process directly exits, otherwise, executing the step C2;
c2, defining a variable R, and setting an initial value equal to WR1;
C3, subtracting one from the value of the variable R, and setting the value of R to be 2 if the value of R is smaller than zero;
C4, setting the value of the variable RD1 to be equal to the value of R;
C5, taking RD1 as an index of the array BUF1, and representing by BUF1[ RD1], wherein the numerical value is the starting address of the latest original image data and is sent to the correction processing process.
Preferably, the correction image speed adaptation usually adopts global variables as coordination to realize the process of the linkage operation of the steps of RAM2, DMA2, interrupt 2 and data transmission, specifically defining a one-dimensional array BUF2 with three elements, wherein the three elements respectively store the initial addresses of three image cache areas in the RAM2 and are respectively represented by BUF2[0], BUF2[1] and BUF2[2 ];
The service processing step of the interrupt 2 is used for switching the deviation correcting image buffer area, on one hand, preparing a buffer area for the DMA2 to newly send a deviation correcting image data, and on the other hand, preparing a buffer area for writing the deviation correcting image data into the safest buffer area in the data sending step, and the specific steps are as follows;
D1, after accumulating the values of the variables RD2 by 1, setting RD2 to be zero if the values of RD2 are larger than 2;
D2, if the value of RD2 is equal to the value of WR2, the result shows that the speed of the DMA2 is higher than the correction processing process, and no correction image data needs to be sent, the service processing of the interrupt 2 can be directly exited, otherwise, the step D3 is executed;
D3, taking RD2 as an index of the array BUF2, and representing by BUF2[ RD2], wherein the numerical value is the starting address of the latest correction image data and is sent to the DMA2 controller;
d4, exiting the interrupt 2 service after starting the DMA2 to start transmitting data, and completing the service processing step of the interrupt 2;
The data transmission step comprises the following steps of;
E1, taking WR2 as an index of an array BUF2, and representing with BUF2[ WR2], wherein the numerical value is a buffer initial address for storing correction data in the RAM 2;
E2, storing the latest deviation correcting image data into a buffer area corresponding to the BUF2 WR2 value;
E3, after the BUF2[ WR2] value is sent to the DMA2 controller, starting the DMA2 to start sending data;
e4, after accumulating the numerical value of the variable WR2 by 1, if the value of WR2 is larger than 2, setting the value of WR2 to be zero;
e5, comparing the values of the variable WR2 and the variable RD2, if the values are equal, executing the step E4, otherwise, completing data transmission;
Meanwhile, in the main program loop of the processor, correction processing needs to be executed, wherein the correction processing process is as follows:
F1, acquiring an original image from the RAM1 by using a data reading step, and re-executing the step F1 if a new image cannot be acquired;
f2, calculating correction data of the original image data to generate a correction image;
f3, after the deviation correction image is stored in the RAM2, executing a data transmission step;
f4, after the data transmission step is completed, the image data transmission is not required to be completed, and the step F1 is re-executed;
F1 to F4 are executed in an infinite loop, when the acquisition speed of the original image data is higher than the operation speed of the correction data, the original image speed is adapted to ensure that the original image data cannot be spliced and broken by new and old data, and when the interface speed of the upper computer is lower than the correction image speed, the correction image speed is adapted to ensure that the image data received by the upper computer cannot be spliced and broken by new and old data;
Calculating and generating a correction image by using correction data;
g1, defining a variable x and a variable y, and setting all the variables to zero;
g2, defining a variable TW and setting the value of TW to be equal to the top total loss data information GT;
g3, defining a variable TLE, a variable TLD, a variable TLU and a variable PUC, and adding TL to the initial address of the original image;
G4, taking the value of TL as an address in the RAM1 to obtain a horizontal full-missing line number, multiplying the horizontal full-missing line number by the width W 1 of the original image, adding the numerical value of the variable TW, and then storing the numerical value into the variable TW and the variable PUC again;
g5, adding the value of the variable TW to the width W 1 of the original image, and then saving the value of the variable TW to the variable TLE and the variable TLD;
g6, obtaining the value of the variable PUC as the address of the RAM1, and obtaining the pixel CA of the original image from the RAM 1;
G7, obtaining the value of the variable TLU as the address of the RAM1, obtaining the pixel CB of the original image from the RAM1, after calculating the average value CC of CA and CB, re-storing CC back to the TLU value as the storage address of the RAM 1;
G8, obtaining the value of the variable TLD as the address of the RAM1, obtaining the pixel CD of the original image from the RAM1, after calculating the average value CE of CA and CD, saving CE back to the TLD value as the storage address of the RAM 1;
After accumulating the variable PUC by 1, if the value of the variable PUC is smaller than the variable PLE, executing the step G6, otherwise executing the step G10;
G10, after accumulating the variable TL by 1, adding 1 to the value of the variable y, if the value of the variable y is smaller than the horizontal total loss line number TC, executing the step G4, otherwise, executing the step G11;
G11, defining a variable I, setting an initial value and the like to be zero, defining a variable PT, and setting the value of the variable PT to be equal to the initial address of the deviation correcting image data;
G12, defining a variable TX, and setting the value of the variable TX to be equal to the value of the initial address of the original image data plus the top total loss data information GT;
g13, setting the value of the variable y to be zero;
g14, using variable y as index of horizontal full-missing line mark array TS, using TS [ y ] to represent, if TS [ y ] value is not equal to zero, increasing the value stored by variable TX by W 1;
g15, setting the value of the variable x to zero;
g16, taking variable I as index of pixel coordinate array PS, using PS [ I ] to obtain value IX of PS [ I ], storing the value obtained by calculating that the binary lowest 4 bits of IX are all cleared as ILEFT, and storing the value obtained by calculating that the binary lowest 4 bits of IX are all 1 as IRIGHT;
G17, shift ILEFT to the right by 4 bits, add the value of variable TX, then use it as the address in RAM1 to obtain one pixel VL of the original image, shift IRIGHT to the right by 4 bits, add the value of variable TX, then use it as the address in RAM1 to obtain one pixel VR of the original image;
g18, after accumulating the values of the variable I by 1, calculating IX minus ILEFT to be XL, calculating IX minus IRIGHT to be XR, and calculating VAL;
VAL=VR*XL-VL*XR
G19, after the VAL is shifted to the right by 4 bits, storing the VAL in a deviation correcting image buffer area taking PT as an RAM2 address;
G20, adding 1 to the value of the variable x after accumulating 1 to the value of PT, if the value of the variable x is not more than the width W 2 of the correction image, executing the step G17, otherwise executing the step G18;
g21, after adding the value of the variable TX to the original image width W 1, saving the value in the variable TX again;
And G22, after accumulating the value of the variable y by 1, if the value of the variable y is smaller than the correction image H 2, executing the step G14, otherwise, completing the correction processing process, switching to executing the data transmission step, and transmitting the correction image to an upper computer interface.
The beneficial effects of the invention are as follows:
1. the invention provides a rapid trapezoid correction method for an image of a biological characteristic photoelectric scanning device, when the acquisition speed of original image data is higher than the calculation speed of correction data, the original image speed is adapted to ensure that the original image data cannot be spliced and broken by new and old data, and when the interface speed of an upper computer is lower than the correction image speed, the correction image speed is adapted to ensure that the image data received by the upper computer cannot be spliced and broken by new and old data.
2. The invention provides a rapid trapezoid correction method for images of a biological characteristic photoelectric scanning device, which comprises the steps of triggering an interrupt 2, switching to execute an interrupt 2 service processing step, setting the priority of the interrupt 1 to be higher than that of the interrupt 2, and setting the priority of DMA and the interrupt so as to ensure that the situation that the image is spliced and broken even if the data processing or output speed is lower than the acquisition speed of a photoelectric chip can be avoided.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of a method according to a first embodiment;
Fig. 2 is a scanning diagram of the jig according to the first embodiment.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1-2, the method for quickly correcting the trapezoid of the image of the biological feature photoelectric scanning device comprises the following steps:
The method comprises the steps of S1, setting a standard jig on a scanning device by a worker, displaying a scanning image of the jig by using a software real-time display photoelectric camera chip on a computer, manually adjusting mechanical parameters of a light path, preferentially reducing drum distortion, pincushion distortion and rotation distortion, and for trapezoidal distortion, not correcting the trapezoidal distortion too much, only clicking four corners of an edge trapezoid in a selected jig image by using a mouse manually to serve as four correction control points, and then sending coordinates of the correction control points to the scanning device for permanent storage;
S2, in the stage of generating correction control information, a processor in a scanning device calculates a group of data for correcting an image according to the stored coordinates of correction control points, the data is stored in a random memory, the group of image correction data is called as image correction information, the calculation amount is large when the image correction information is generated, but the calculation is only carried out once when the scanning device is reset and started, so that the actual use requirement can be met by using a low-cost processor, and the result data generated by the calculation, namely the image correction information, is required to be repeatedly and rapidly acquired in the stage of scanning image correction output, so that the correction information data is required to be stored in the random memory which can be rapidly read;
And S3, in the scanning image correction output stage, a processor in the scanning device calculates distorted image data of the photoelectric camera chip by utilizing image correction information, converts the distorted image data into an image with qualified error and outputs the image to a host computer or the processor, wherein the process is a main function execution process of the scanning device and is in a state of repeated and cyclic execution, and the process is required to have higher execution efficiency, so that excessive time-consuming complex calculation such as floating point division and the like cannot exist.
In the production deviation correcting setting stage, a scanning device is connected with a computer, a standard jig with the size equal to the size of a scanning window of equipment is placed on the scanning device, production test software is operated on the computer, and jig images obtained by shooting of a photoelectric camera chip are displayed in real time;
When the scanned image is distorted, the grid in the jig pattern can be used for visually observing the position of the distorted area of the scanning acquisition optical path, and prompting the direction of the fine adjustment machine when the distortion is used for correcting mechanical errors;
The production deviation correcting setting firstly adjusts the mechanical position of the optical train, although the image distortion is difficult to thoroughly eliminate, the mechanical position is adjusted as much as possible to reduce the distortion, the smaller the mechanical adjustment is, the more beneficial to improving the quality of the final output deviation correcting image, the drum distortion, the pincushion distortion and the rotation distortion are preferentially reduced, and the trapezoidal distortion does not need to be corrected excessively, and the adjustment is required to be carried out until all four vertexes of the rectangular jig are displayed in the scanned image.
The four vertexes of the original jig are A, B, C and D respectively, the four vertexes E, F, G and H respectively correspond to the four vertexes of the original jig in a scanning image displayed on a computer through a scanning device, mechanical adjustment is required to enable EF lines and GH lines in the scanning image to be horizontal straight lines, EG lines and FH lines are not required to be vertical only to be straight lines, and thus an image formed by the vertexes E, F, G and H is any trapezoid with the upper bottom edge and the lower bottom edge in the horizontal direction;
and on the interface of the production test software, clicking four vertexes of the selected rectangular jig on the scanning image by using a mouse as deviation rectifying control points, and then transmitting coordinates of the four deviation rectifying control points on the jig scanning image to a scanning device by using the production test software, and permanently storing the coordinates in the device to finish production deviation rectifying setting.
In the stage of generating correction control information, the width of an original image acquired by a photoelectric camera chip is W 1, the height of the original image is H 1, the width of an output image after the original image is reduced and corrected is W 2, and the height of the output image is H 2;
the correction control information generation stage is to calculate a set of correction data by utilizing coordinates of four correction control points of a jig scanning image stored in a device in the production correction setting stage and store the correction data in a random memory of scanning equipment, wherein the correction data comprises three groups of information including top total loss data information, horizontal total loss line information and trapezoidal horizontal fusion line information;
The top total loss data information has only one numerical value, which is represented by GT and is equal to the number of pixels on the upper side of an EF line in a jig scanning chart, although mechanical adjustment is required to enable the EF line and GH of the jig scanning chart to be horizontal, errors exist in actual production, namely, the numerical values of E Y and F Y of an E point coordinate (E X,EY) and an F point coordinate (F X,FY) are different, so the calculation method of the top total loss data information is as follows:
Also, because of the machine model error, the values of G Y and H Y of the G point coordinate (G X,GY) and the H point coordinate (H X,HY) are different, and the method for calculating the trapezoid height LN is as follows;
The horizontal full-line-loss information comprises three data, namely a horizontal full-line-loss number TC, a horizontal full-line-loss number array TA and a horizontal full-line-loss marking array TS, wherein the horizontal full-line-loss number TC is a numerical value which represents the number of the horizontal lines reduced in the vertical reduction process of the image, the number of the definition elements is equal to H 1 minus the horizontal full-line-loss number array TA of H 2, and the number of the effective data actually stored is equal to TC;
The trapezoid horizontal fusion line information comprises a one-dimensional pixel coordinate array PS with the number of members equal to the width W 2 multiplied by the height H 2 and an array PL with the number of elements equal to H 2, wherein each element in the array PL is a data structure comprising two members, and the two members are respectively a line start coordinate SS and a line width WS.
The specific implementation steps of generating the deviation rectifying control information are as follows:
A1, setting all elements of a horizontal full-loss line marking array TS to be zero, setting the number TC of the horizontal full-loss line to be zero, calculating top full-loss data information GT and trapezoid height LN, defining a constant XN, wherein the larger the value of the XN is, the more beneficial to improving the precision, the overflow occurs if the binary bit number of a result obtained by XN is H 2 exceeds the bit width of a processor, and the precision is not obviously improved after the XN exceeds 16 times of the image width, so that the value of the XN must not be excessively large, for example, the XN can be set to be equal to 1000000 in a 32-bit processor;
a2, defining a variable LB, a variable LS and a variable yTar, and setting initial values to be equal to zero;
A3, defining a variable SP, and setting an initial value as XN;
a4, defining variables U, V and W, wherein the variables U, V and W are used for storing temporary calculation intermediate results;
A5, defining a variable STEP, and setting a numerical value as a numerical value;
a6, after adding STEP to the SP, if the value of the SP is larger than XN, executing the STEP A7, otherwise executing the STEP A11;
A7, shifting LS by four bits left, multiplying G X, saving the result in a variable U, shifting LN minus LS by four bits left, multiplying LN by E X, saving the result in a variable V, using yTar as an index of an array PL, representing PL [ yTar ], calculating the result of dividing LN by the variable U and adding variable V, and saving the result in a member SS of PL [ yTar ];
A8, shifting LS by four bits left, multiplying by H X, and storing the result in a variable U, shifting LN minus LS by four bits left, multiplying by F X, and storing the result in a variable V;
a9, taking yTar as an index of the array PL, and saving the numerical value of the member SS of the calculated variable W minus PL [ yTar ] to the member WS of the PL [ yTar ];
A10, subtracting XN from the SP, accumulating yTar to 1, and then executing A13;
A11, if yTar is greater than or equal to H 2, directly executing A12, otherwise, using yTar as an array TS of index, using TS [ yTar ] to indicate, and executing A12 after setting TS [ yTar ] to 1;
A12, taking TC as an array TA of an index, using TA [ TC ] to represent, calculating a variable LS, subtracting a value of a variable LB, and storing the value of the variable LS into the variable LB;
A13, comparing the sizes of the variables LS and LN, if LS is smaller than LN, executing the step A6, otherwise executing the step A14;
a14, setting a variable yTar to zero, defining a variable xTar;
a15, setting the value of the variable xTar to be zero;
A16, in the array PL with yTar as index, calculating the number value of member WS of PL [ yTar ] multiplied by variable xTar, dividing by W 2, adding the number value of member SS of PL [ yTar ] and storing in variable U;
A17, multiplying the calculated variable yTar by W 2, adding the numerical value of the variable xTar, and storing the numerical value in a variable V;
a18, the pixel coordinate array PS taking variable V as index is expressed by PS [ V ], and the value of PS [ V ] is set to be equal to variable U;
A19, accumulating the variables xTar to 1, if the value of the variable xTar is smaller than W 2, executing the step A16, otherwise executing the step A20;
A20, accumulating the variable yTar to 1, if the value of the variable yTar is smaller than H 2, executing the step A15, otherwise, completing the deviation rectifying control information stage.
When the scanning image correction output stage faces to image data stream processing, an original image is generated by a photoelectric chip in the scanning device, the image data stream is temporarily stored in a random memory RAM1 through a bus, the original image is changed into a correction image after being processed by a processor, the correction image is stored in a random memory RAM2 again and then is sent to an upper computer interface by a bus output interface, the random memory RAM1 and the random memory RAM2 can be two different memories or two different address spaces of the same memory, and the transmission of the original image and the correction image is usually completed by adopting a DMA mode;
The image speed adaptation of the original image and the deviation correcting image adopts the same strategy, the details of specific steps are different, the common point is that three image buffer areas are defined, only data are written in and data are read out for the operation of each buffer area at any moment, and three kinds of idle operation are realized, namely, the writing operation and the reading operation can not be simultaneously executed for one buffer area;
The photoelectric chip triggers the DMA1 to send original image data to the RAM1, the bus output interface triggers the DMA2 to send deviation correcting image data to the upper computer interface, the priority of the DMA1 is higher than that of the DMA2, when the DMA1 starts to transmit the last byte of an original image, the DMA1 is triggered to execute the interrupt 1 service processing step, when the DMA2 starts to transmit the last byte of a deviation correcting image, the DMA2 is triggered to execute the interrupt 2 service processing step, the priority of the interrupt 1 is set to be higher than that of the interrupt 2, thus the priority of the DMA and the interrupt is set to ensure that the situation that image splicing and breaking cannot occur even if the data processing or output speed is lower than the acquisition speed of the photoelectric chip;
The method comprises the steps of sending original image data of a photoelectric chip to a RAM1 through a DMA1, executing a data reading step in a main program loop of a processor, converting the original image data into deviation correcting image data by using the deviation correcting data, after storing the deviation correcting image data in the RAM2, executing a data sending step, sending the data to an upper interface by using the DMA2, and mainly dividing the three processes of original image speed adaptation, deviation correcting image output adaptation and deviation correcting processing.
The method comprises the steps of starting the original image speed adaptation, namely defining a one-dimensional array BUF1 with three elements, wherein the three elements respectively store the initial addresses of three image cache areas in the RAM1, and the initial addresses are respectively represented by BUF1[0], BUF1[1] and BUF1[2 ];
The service processing step of the interrupt 1 is used for switching the original image buffer area, on one hand, the buffer area is prepared for the DMA1 to start to newly save an original image data, and on the other hand, the latest saved image data is prepared for the data reading step, and the specific steps are as follows;
b1, after accumulating the variable WR1 by 1, if the value of WR1 is larger than 2, setting WR1 to be zero;
b2, if the value of WR1 is equal to the value of RD1, executing the step B1, otherwise, executing the step B3 downwards;
B3, taking WR1 as an index of a plurality of groups of BUF1, and representing BUF1[ WR1], wherein the numerical value is the initial address of the original image buffer;
b4, sending the value of BUF1[ WR1] to the DMA1 controller, and after the DMA1 controller is started, exiting the interrupt 1 service to complete the service processing step of the interrupt 1;
the data reading step comprises the following steps of;
c1, comparing the values of the variables WR1 and RD1, if the values are equal, the original image data is not available for reading, so that the process directly exits, otherwise, executing the step C2;
c2, defining a variable R, and setting an initial value equal to WR1;
C3, subtracting one from the value of the variable R, and setting the value of R to be 2 if the value of R is smaller than zero;
C4, setting the value of the variable RD1 to be equal to the value of R;
C5, taking RD1 as an index of the array BUF1, and representing by BUF1[ RD1], wherein the numerical value is the starting address of the latest original image data and is sent to the correction processing process.
The correction image speed adaptation usually adopts global variables as coordination to realize the process of the linkage operation of the steps of RAM2, DMA2, interruption 2 and data transmission, specifically defines a one-dimensional array BUF2 with three elements, wherein the three elements respectively store the initial addresses of three image cache areas in the RAM2 and are respectively represented by BUF2[0], BUF2[1] and BUF2[2 ];
The service processing step of the interrupt 2 is used for switching the deviation correcting image buffer area, on one hand, preparing a buffer area for the DMA2 to newly send a deviation correcting image data, and on the other hand, preparing a buffer area for writing the deviation correcting image data into the safest buffer area in the data sending step, and the specific steps are as follows;
D1, after accumulating the values of the variables RD2 by 1, setting RD2 to be zero if the values of RD2 are larger than 2;
D2, if the value of RD2 is equal to the value of WR2, the result shows that the speed of the DMA2 is higher than the correction processing process, and no correction image data needs to be sent, the service processing of the interrupt 2 can be directly exited, otherwise, the step D3 is executed;
D3, taking RD2 as an index of the array BUF2, and representing by BUF2[ RD2], wherein the numerical value is the starting address of the latest correction image data and is sent to the DMA2 controller;
d4, exiting the interrupt 2 service after starting the DMA2 to start transmitting data, and completing the service processing step of the interrupt 2;
The data transmission step comprises the following steps of;
E1, taking WR2 as an index of an array BUF2, and representing with BUF2[ WR2], wherein the numerical value is a buffer initial address for storing correction data in the RAM 2;
E2, storing the latest deviation correcting image data into a buffer area corresponding to the BUF2 WR2 value;
E3, after the BUF2[ WR2] value is sent to the DMA2 controller, starting the DMA2 to start sending data;
e4, after accumulating the numerical value of the variable WR2 by 1, if the value of WR2 is larger than 2, setting the value of WR2 to be zero;
e5, comparing the values of the variable WR2 and the variable RD2, if the values are equal, executing the step E4, otherwise, completing data transmission;
Meanwhile, in the main program loop of the processor, correction processing needs to be executed, wherein the correction processing process is as follows:
F1, acquiring an original image from the RAM1 by using a data reading step, and re-executing the step F1 if a new image cannot be acquired;
f2, calculating correction data of the original image data to generate a correction image;
f3, after the deviation correction image is stored in the RAM2, executing a data transmission step;
f4, after the data transmission step is completed, the image data transmission is not required to be completed, and the step F1 is re-executed;
F1 to F4 are executed in an infinite loop, when the acquisition speed of the original image data is higher than the operation speed of the correction data, the original image speed is adapted to ensure that the original image data cannot be spliced and broken by new and old data, and when the interface speed of the upper computer is lower than the correction image speed, the correction image speed is adapted to ensure that the image data received by the upper computer cannot be spliced and broken by new and old data;
Calculating and generating a correction image by using correction data;
g1, defining a variable x and a variable y, and setting all the variables to zero;
g2, defining a variable TW and setting the value of TW to be equal to the top total loss data information GT;
g3, defining a variable TLE, a variable TLD, a variable TLU and a variable PUC, and adding TL to the initial address of the original image;
G4, taking the value of TL as an address in the RAM1 to obtain a horizontal full-missing line number, multiplying the horizontal full-missing line number by the width W 1 of the original image, adding the numerical value of the variable TW, and then storing the numerical value into the variable TW and the variable PUC again;
g5, adding the value of the variable TW to the width W 1 of the original image, and then saving the value of the variable TW to the variable TLE and the variable TLD;
g6, obtaining the value of the variable PUC as the address of the RAM1, and obtaining the pixel CA of the original image from the RAM 1;
G7, obtaining the value of the variable TLU as the address of the RAM1, obtaining the pixel CB of the original image from the RAM1, after calculating the average value CC of CA and CB, re-storing CC back to the TLU value as the storage address of the RAM 1;
G8, obtaining the value of the variable TLD as the address of the RAM1, obtaining the pixel CD of the original image from the RAM1, after calculating the average value CE of CA and CD, saving CE back to the TLD value as the storage address of the RAM 1;
After accumulating the variable PUC by 1, if the value of the variable PUC is smaller than the variable PLE, executing the step G6, otherwise executing the step G10;
G10, after accumulating the variable TL by 1, adding 1 to the value of the variable y, if the value of the variable y is smaller than the horizontal total loss line number TC, executing the step G4, otherwise, executing the step G11;
G11, defining a variable I, setting an initial value and the like to be zero, defining a variable PT, and setting the value of the variable PT to be equal to the initial address of the deviation correcting image data;
G12, defining a variable TX, and setting the value of the variable TX to be equal to the value of the initial address of the original image data plus the top total loss data information GT;
g13, setting the value of the variable y to be zero;
g14, using variable y as index of horizontal full-missing line mark array TS, using TS [ y ] to represent, if TS [ y ] value is not equal to zero, increasing the value stored by variable TX by W 1;
g15, setting the value of the variable x to zero;
g16, taking variable I as index of pixel coordinate array PS, using PS [ I ] to obtain value IX of PS [ I ], storing the value obtained by calculating that the binary lowest 4 bits of IX are all cleared as ILEFT, and storing the value obtained by calculating that the binary lowest 4 bits of IX are all 1 as IRIGHT;
G17, shift ILEFT to the right by 4 bits, add the value of variable TX, then use it as the address in RAM1 to obtain one pixel VL of the original image, shift IRIGHT to the right by 4 bits, add the value of variable TX, then use it as the address in RAM1 to obtain one pixel VR of the original image;
g18, after accumulating the values of the variable I by 1, calculating IX minus ILEFT to be XL, calculating IX minus IRIGHT to be XR, and calculating VAL;
VAL=VR*XL-VL*XR
G19, after the VAL is shifted to the right by 4 bits, storing the VAL in a deviation correcting image buffer area taking PT as an RAM2 address;
G20, adding 1 to the value of the variable x after accumulating 1 to the value of PT, if the value of the variable x is not more than the width W 2 of the correction image, executing the step G17, otherwise executing the step G18;
g21, after adding the value of the variable TX to the original image width W 1, saving the value in the variable TX again;
And G22, after accumulating the value of the variable y by 1, if the value of the variable y is smaller than the correction image H 2, executing the step G14, otherwise, completing the correction processing process, switching to executing the data transmission step, and transmitting the correction image to an upper computer interface.
In the description of the present specification, the descriptions of the terms "one embodiment," "example," "specific example," and the like, mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The foregoing has shown and described the basic principles, principal features and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, and that the above embodiments and descriptions are merely illustrative of the principles of the present invention, and various changes and modifications may be made without departing from the spirit and scope of the invention, which is defined in the appended claims.

Claims (8)

1.生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:生物特征光电扫描装置图像快速梯形纠偏方法包括以下步骤:1. A method for rapid trapezoidal correction of images from a biometric photoelectric scanning device, characterized in that: the method for rapid trapezoidal correction of images from a biometric photoelectric scanning device includes the following steps: S1:生产纠偏设定阶段,由工作人员先把一个标准治具放在扫描装置上,然后在计算机上用软件实时显示光电摄像芯片拍摄得到治具扫描图像,人工调整光路的机械参数,优先降低鼓形失真、枕形失真、以及旋转失真;对于梯形失真不必过多纠正,只需在人工用鼠标点击选定治具图像中的边缘梯形四个角作为四个纠偏控制点之后,发送这几个纠偏控制点的坐标到扫描装置永久保存;S1: During the production correction setting stage, the staff first places a standard fixture on the scanning device, and then uses software on the computer to display the scanned image of the fixture captured by the photoelectric camera chip in real time. The staff manually adjusts the mechanical parameters of the optical path, prioritizing the reduction of drum-shaped distortion, pincushion distortion, and rotational distortion. Trapezoidal distortion does not need much correction. After manually selecting the four corners of the edge trapezoid in the fixture image as four correction control points by clicking the mouse, the coordinates of these correction control points are sent to the scanning device for permanent storage. S2:生成纠偏控制信息阶段,扫描装置中的处理器根据保存好的纠偏控制点坐标,计算出一组用于图像纠偏的数据,保存到随机存贮器中,并且称呼这组图像纠偏数据为图像纠偏信息;虽然产生图像纠偏信息时计算量大,但是因为这些计算仅仅在扫描装置复位启动时执行一次,所以用低成本的处理器也能够满足实际使用需要;因为计算产生的结果数据,也就是图像纠偏信息需要在扫描图像纠偏输出阶段反复快速调取,所以需要把纠偏信息数据保存到可以快速读取的随机存贮器中;S2: In the stage of generating correction control information, the processor in the scanning device calculates a set of data for image correction based on the saved coordinates of the correction control points, saves it to random access memory, and calls this set of image correction data image correction information. Although the computational load is large when generating image correction information, since these calculations are only performed once when the scanning device is reset and started, a low-cost processor can meet the actual needs. Because the calculated result data, i.e., the image correction information, needs to be repeatedly and quickly retrieved in the scanning image correction output stage, the correction information data needs to be saved to a random access memory that can be read quickly. S3:扫描图像纠偏输出阶段,扫描装置中的处理器把光电摄像芯片的畸变图像数据,利用图像纠偏信息进行计算,转换成为误差合格的图像输出给上位计算机或处理器;这个过程是扫描装置的主要功能执行过程,处于反复循环执行的状态,因要求在此处必须具有高的执行效率,采用定点运算和DMA传输机制实现高效纠偏计算;S3: Scanning image correction output stage. The processor in the scanning device uses the image correction information to calculate the distorted image data of the photoelectric camera chip and convert it into an image with acceptable error, which is then output to the host computer or processor. This process is the main function execution process of the scanning device and is in a state of repeated loop execution. Because high execution efficiency is required here, fixed-point arithmetic and DMA transfer mechanism are used to achieve efficient correction calculation. 在所述生成纠偏控制信息阶段,光电摄像芯片采集到的原始图像宽度为W1,高度为H1;原始图像经过缩小并纠正之后输出图像的宽度为W2,高度为H2;每当扫描装置上电复位或者当更新治具扫描图像上四个纠偏控制点坐标时,都要执行一次生成纠偏控制信息阶段;During the generation of correction control information stage, the original image acquired by the photoelectric camera chip has a width of W1 and a height of H1 ; after the original image is reduced and corrected, the output image has a width of W2 and a height of H2 ; the generation of correction control information stage is performed every time the scanning device is powered on and reset or when the coordinates of the four correction control points on the jig scanning image are updated. 生成纠偏控制信息阶段是利用那四个在生产纠偏设定阶段保存在装置中治具扫描图像的四个纠偏控制点坐标,计算出一套纠偏数据,保存在扫描设备的随机存贮器中;纠偏数据包括顶部全丢数据信息,水平全丢行信息以及梯形水平融合行信息三组信息。The stage of generating correction control information uses the coordinates of the four correction control points stored in the device's jig scan image during the production correction setting stage to calculate a set of correction data, which is then stored in the random access memory of the scanning device. The correction data includes three sets of information: top all-loss data information, horizontal all-loss line information, and trapezoidal horizontal fusion line information. 2.根据权利要求1所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:在所述生产纠偏设定阶段需要把扫描装置与计算机联接起来,把一个大小等于设备扫描窗口尺寸的标准治具放在扫描装置上,在计算机上运行生产测试软件,实时显示光电摄像芯片拍摄得到的治具图像;标准治具是一个矩形平面,表面有正方形的网格,可以有一些空心与实心交错排列成图案的网格用于标示出基准位置;2. The rapid trapezoidal correction method for biometric photoelectric scanning device images according to claim 1, characterized in that: in the production correction setting stage, the scanning device needs to be connected to a computer, a standard fixture with a size equal to the size of the device scanning window is placed on the scanning device, and production testing software is run on the computer to display the fixture image captured by the photoelectric camera chip in real time; the standard fixture is a rectangular plane with square grids on the surface, and may have some hollow and solid grids arranged in an alternating pattern to mark the reference position; 治具图案以空心区域为主,可以直观看出扫描图像位置是否正确,重点观察网络线是否存在明显失真,若网格直线发生弯曲或者正方网络存在变形,则表明图像发生畸变失真;当扫描图像发生畸变时,通过这种治具图案中的网格,能够一眼看出畸变位于扫描采集光路的哪个区域部位,用于校正机械误差时提示微调机械的方位;The fixture pattern is mainly composed of hollow areas, which can visually show whether the position of the scanned image is correct. The focus is on observing whether there is obvious distortion in the grid lines. If the grid lines are bent or the square grid is deformed, it indicates that the image has been distorted. When the scanned image is distorted, the grid in this fixture pattern can be used to immediately identify which area of the scanning acquisition optical path the distortion is located in, which can be used to indicate the orientation of the fine-tuning mechanism when correcting mechanical errors. 生产纠偏设定首先调整光具组的机械位置,虽然这些图像畸变难以彻底消除,但是要尽量调整机械位置减小失真,机械调整削减畸变越小就越有利于提高最终输出纠偏图像的质量;优先降低鼓形失真、枕形失真、以及旋转失真,而对于梯形失真不必过多纠正,要求调整到扫描图像中使矩形治具的四个顶点全部显示出来即可。The production correction settings first adjust the mechanical position of the optical bench. Although these image distortions are difficult to completely eliminate, the mechanical position should be adjusted as much as possible to reduce distortion. The smaller the distortion reduction by mechanical adjustment, the better it is to improve the quality of the final output correction image. Prioritize reducing drum distortion, pincushion distortion, and rotational distortion, while trapezoidal distortion does not need to be corrected too much. The requirement is to adjust it so that all four vertices of the rectangular fixture are displayed in the scanned image. 3.根据权利要求2所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:原始治具的四个顶点分别为A,B,C,以及D;经过扫描装置传输到计算机上显示的扫描图中,四个顶点E,F,G,以及H分别对应原始治具的四个顶点;要求机械调整使扫描图中EF线与GH线均为水平直线,而EG线与FH线并不要求必须垂直只需为直线即可;这样由顶点E,F,G,以及H形成的图像是一个上下底边为水平方向的任意梯形;3. The rapid trapezoidal correction method for biometric photoelectric scanning device images according to claim 2, characterized in that: the four vertices of the original fixture are A, B, C, and D; in the scanned image transmitted to the computer by the scanning device, the four vertices E, F, G, and H correspond to the four vertices of the original fixture; mechanical adjustment is required so that the EF line and GH line in the scanned image are both horizontal straight lines, while the EG line and FH line are not required to be perpendicular, only straight lines are needed; thus, the image formed by vertices E, F, G, and H is an arbitrary trapezoid with the upper and lower bases in the horizontal direction; 在生产测试软件的界面上,用鼠标在扫描图像上点击选中矩形治具的四个顶点作为纠偏控制点之后,利用生产测试软件把这四个纠偏控制点在治具扫描图像上的坐标发送给扫描装置,永久保存在装置中就完成了生产纠偏设定。On the interface of the production testing software, after clicking on the scanned image with the mouse to select the four vertices of the rectangular fixture as correction control points, the production testing software sends the coordinates of these four correction control points on the fixture scanned image to the scanning device, which permanently saves them in the device, thus completing the production correction setting. 4.根据权利要求1所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:4. The rapid trapezoidal correction method for images from a biometric photoelectric scanning device according to claim 1, characterized in that: 在所述生成纠偏控制信息阶段,光电摄像芯片采集到的原始图像宽度为W1,高度为H1;原始图像经过缩小并纠正之后输出图像的宽度为W2,高度为H2During the stage of generating correction control information, the original image acquired by the photoelectric camera chip has a width of W1 and a height of H1 ; after the original image is reduced and corrected, the output image has a width of W2 and a height of H2 . 所述顶部全丢数据信息只有一个数值,用GT表示,等于治具扫描图中EF线上侧的像素数量;尽管要求机械调整使治具扫描图EF线和GH为水平,但是在实际生产中还是会存在误差,也就是E点坐标(EX,EY)和F点坐标(FX,FY)的EY与FY数值存在不相同的情况;所以顶部全丢数据信息的计算方法为:The top total loss data information has only one value, denoted by GT, which is equal to the number of pixels above the EF line in the jig scan image. Although mechanical adjustment is required to make the EF line and GH line in the jig scan image horizontal, errors still exist in actual production, that is, the EF and GH values of point E coordinates ( EX , Y ) and point F coordinates ( FX , Y ) may be different. Therefore, the calculation method for the top total loss data information is as follows: 同样因为存在机模误差,所以G点坐标(GX,GY)和H点坐标(HX,HY)的GY与HY数值也存在不相同的情况;计算梯形高度LN的方法为;Similarly, due to the existence of machine model error, the GY and HY values of the coordinates of point G ( GX , GY ) and the coordinates of point H ( HX , HY ) may also be different; the method for calculating the height LN of the trapezoid is as follows; 所述水平全丢行信息包括水平全丢行数量TC,水平全丢行号数组TA,以及水平全丢行标记数组TS三种数据;水平全丢行数量TC是一个数值,表示对在图像垂直缩小过程中缩减的水平行数量;定义元素数量等于H1减去H2的水平全丢行号数组TA,实际保存有效数据的个数等于TC;定义元素数量等于H2的水平全丢行标记数组TS;The horizontal line loss information includes three types of data: the horizontal line loss count TC, the horizontal line loss number array TA, and the horizontal line loss marker array TS. The horizontal line loss count TC is a numerical value representing the number of horizontal lines reduced during the vertical scaling of the image. The number of elements in the horizontal line loss number array TA is defined as equal to H1 minus H2 , and the actual number of valid data stored is equal to TC. The number of elements in the horizontal line loss marker array TS is defined as equal to H2 . 所述梯形水平融合行信息包括一个成员数量等于宽度为W2乘以高度为H2的一维像素坐标数组PS,以及一个元素数量等于H2的数组PL;数组PL中每个元素都是一个包含两个成员的数据结构,两个成员分别是行起始坐标SS,以及行宽度WS。The trapezoidal horizontal fusion row information includes a one-dimensional pixel coordinate array PS with a member number equal to the width W 2 multiplied by the height H 2 , and an array PL with an element number equal to H 2 ; each element in array PL is a data structure containing two members, namely the row start coordinate SS and the row width WS. 5.根据权利要求4所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:所述生成纠偏控制信息的具体执行步骤为:5. The rapid trapezoidal correction method for images from a biometric photoelectric scanning device according to claim 4, characterized in that: the specific execution steps for generating the correction control information are as follows: A1、水平全丢行标记数组TS的所有元素都置为零,并且设置水平全丢行数量TC也为零;计算顶部全丢数据信息GT,以及梯形高度LN;定义一个常量XN;A1. Set all elements of the horizontal all-lost row marker array TS to zero, and also set the horizontal all-lost row count TC to zero; calculate the top all-lost data information GT, and the trapezoidal height LN; define a constant XN; A2、定义变量LB,变量LS和变量yTar,设置初始值都等于零;A2. Define variables LB, LS, and yTar, and set their initial values to zero. A3、定义变量SP,并设置初始值为XN;A3. Define variable SP and set its initial value to XN; A4、定义变量U,V,以及W,用于保存临时的计算中间结果;A4. Define variables U, V, and W to store temporary intermediate calculation results; A5、定义变量STEP,并设置数值为;A5. Define the variable STEP and set its value to ; A6、把SP加上STEP之后,若SP的数值大于XN,则执行步骤A7,否则执行步骤A11;A6. After adding STEP to SP, if the value of SP is greater than XN, then execute step A7; otherwise, execute step A11. A7、把LS左移四位之后,再乘以GX,结果保存在变量U之中;把LN减去LS之后的结果左移四位之后,再乘以EX,把结果保存在变量V中;之后以yTar作为数组PL的索引,用PL[yTar]表示,计算变量U加上变量V之后再除以LN的结果保存在PL[yTar]的成员SS中;A7. Shift LS left by four bits, then multiply by GX , and store the result in variable U; shift the result of LN minus LS left by four bits, then multiply by EX , and store the result in variable V; then use yTar as the index of array PL, denoted as PL[yTar], calculate the result of adding variable U to variable V and then dividing by LN, and store the result in member SS of PL[yTar]. A8、把LS左移四位之后,再乘以HX,结果保存在变量U之中;把LN减去LS之后的结果左移四位之后,再乘以FX,把结果保存在变量V中;计算U加上V之后除以LN的值,保存在变量W中;A8. Shift LS left by four bits, then multiply by H X , and store the result in variable U; shift LN minus LS left by four bits, then multiply by F X , and store the result in variable V; calculate the value of U plus V divided by LN, and store it in variable W. A9、以yTar作为数组PL的索引,计算变量W减去PL[yTar]的成员SS的数值保存到PL[yTar]的成员WS中;A9. Using yTar as the index of array PL, calculate the value of variable W minus the value of member SS of PL[yTar] and save it to member WS of PL[yTar]. A10、把SP减去XN;把yTar累加1;之后执行A13;A10. Subtract XN from SP; increment yTar by 1; then execute A13; A11、如果yTar的值大于等于H2,那么直接去执行A12,否则需要先以yTar作为索引的数组TS,用TS[yTar]表示,在设置TS[yTar]的值为1之后,再去执行步骤A12;A11. If the value of yTar is greater than or equal to H2 , then proceed directly to A12. Otherwise, first use yTar as the index of the array TS, represented by TS[yTar]. After setting the value of TS[yTar] to 1, then proceed to step A12. A12、以TC为索引的数组TA,用TA[TC]表示,计算变量LS减去变量LB的值,保存到TA[TC]之中;然后把变量LS的值保存到变量LB之中;再把水平全丢行数量TC的值加1;A12. Array TA with index TC, denoted as TA[TC]. Calculate the value of variable LS minus the value of variable LB and store it in TA[TC]. Then store the value of variable LS in variable LB. Finally, increment the value of the number of horizontally dropped rows TC by 1. A13、比较变量LS与LN的大小,如果LS小于LN,那么去执行步骤A6,否则执行步骤A14;A13. Compare the size of variables LS and LN. If LS is less than LN, then proceed to step A6; otherwise, proceed to step A14. A14、把变量yTar设置为零,定义变量xTar;A14. Set the variable yTar to zero and define the variable xTar; A15、设置变量xTar的值为零;A15. Set the value of variable xTar to zero; A16、在以yTar为索引的数组PL中,计算PL[yTar]的成员WS乘以变量xTar之后再除以W2,最后加上PL[yTar]的成员SS的数值,保存在变量U中;A16. In the array PL indexed by yTar, calculate the value of PL[yTar] member WS, multiply it by the variable xTar, divide it by W 2 , and finally add the value of PL[yTar] member SS, and store it in the variable U. A17、计算变量yTar乘以W2之后加上变量xTar的数值,保存在变量V中;A17. Calculate the value of variable yTar by multiplying it by W 2 , then add the value of variable xTar and store it in variable V. A18、以变量V为索引的像素坐标数组PS,用PS[V]表示,设置PS[V]的数值等于变量U;A18. A pixel coordinate array PS indexed by variable V, denoted by PS[V], sets the value of PS[V] to be equal to the variable U; A19、把变量xTar累加1,如果变量xTar的值小于W2,那么去执行步骤A16,否则执行步骤A20;A19. Increment the variable xTar by 1. If the value of variable xTar is less than W2 , then proceed to step A16; otherwise, proceed to step A20. A20、把变量yTar累加1,如果变量yTar的值小于H2,那么去执行步骤A15,否则完成纠偏控制信息阶段。A20. Increment the variable yTar by 1. If the value of variable yTar is less than H2 , then proceed to step A15; otherwise, complete the correction control information stage. 6.根据权利要求1所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:所述扫描图像纠偏输出阶段在面对图像数据流处理时,可以通过扫描装置中,图像数据流向是先由光电芯片产生原始图像,通过总线进入随机存贮器RAM1暂存,经过处理器处理之后变成纠偏图像,再次保存到随机存贮器RAM2,之后利用总线输出接口送到上位机接口;随机存贮器RAM1与RAM2即可以是两个不同的存贮器,也可以是同一个存贮器的两个不同的地址空间,通常采用DMA方式完成原始图像和纠偏图像的传输;因为低成本处理器的纠偏计算速度不一定快于原始图像产生的速度,并且纠偏图像输出的速度也不一定快于纠偏图像生成的速度,所以在扫描运动图像时,原始图像与纠偏图像数据传输都必须采取图像速度配适方法,否则在最终图像上就会同时存在新旧两幅图像拼接断裂的情况;6. The rapid trapezoidal correction method for biometric photoelectric scanning devices according to claim 1, characterized in that: when facing image data stream processing in the scanning image correction output stage, the image data stream in the scanning device first generates the original image by the photoelectric chip, then enters the random access memory (RAM1) for temporary storage via the bus, and after being processed by the processor, it becomes the corrected image, which is then saved to the random access memory (RAM2) again, and then sent to the host computer interface via the bus output interface; RAM1 and RAM2 can be two different memory locations or two different address spaces of the same memory location, and DMA is usually used to complete the transmission of the original image and the corrected image; because the correction calculation speed of a low-cost processor is not necessarily faster than the speed of generating the original image, and the output speed of the corrected image is not necessarily faster than the speed of generating the corrected image, when scanning moving images, the data transmission of the original image and the corrected image must adopt an image speed matching method, otherwise there will be a situation where the splicing of the old and new images is broken in the final image; 原始图像与纠偏图像的图像速度配适采用相同的策略,具体步骤的细节存在不同,共同点都是定义三个图像缓存区,在任意时刻对于每一个缓存区的操作,只有数据写入,数据读取,以及空闲三种,也就是不可以对一个缓存区同时执行写入与读取两种操作;当DMA开始传输一幅图像的最后一个数据时,用中断通知处理器;The image speed matching of the original image and the corrected image adopts the same strategy, but the details of the specific steps are different. The common point is that three image buffers are defined. At any time, the operation on each buffer is only data writing, data reading, and idle. That is, it is not possible to perform both writing and reading operations on a buffer at the same time. When the DMA starts to transfer the last data of an image, the processor is notified by an interrupt. 光电芯片触发DMA1把原始图像数据到RAM1,总线输出接口触发DMA2把纠偏图像数据送到上位机接口,DMA1的优先级高于DMA2;当DMA1开始传输一幅原始图像的最后一个字节时,触发中断1,转去执行中断1服务处理步骤;当DMA2开始传输一幅纠偏图像的最后一个字节时,触发中断2,转去执行中断2服务处理步骤;设置中断1的优先级高于中断2;The photoelectric chip triggers DMA1 to transfer the original image data to RAM1, and the bus output interface triggers DMA2 to send the corrected image data to the host computer interface. DMA1 has a higher priority than DMA2. When DMA1 starts transferring the last byte of an original image, it triggers interrupt 1 and executes the interrupt 1 service routine. When DMA2 starts transferring the last byte of a corrected image, it triggers interrupt 2 and executes the interrupt 2 service routine. The priority of interrupt 1 is set to be higher than that of interrupt 2. 通过DMA1把光电芯片的原始图像数据送到RAM1,在处理器的主程序循环中,执行数据读取步骤,利用纠偏数据把原始图像数据转换成为纠偏图像数据,在保存到RAM2之后,执行数据发送步骤,用DMA2把数据送到上位接接口;主要分为原始图像速度配适,纠偏图像输出配适,以及纠偏处理三个过程。The original image data of the optoelectronic chip is sent to RAM1 via DMA1. In the main program loop of the processor, the data reading step is executed. The original image data is converted into corrected image data using the correction data. After being saved to RAM2, the data sending step is executed, and the data is sent to the upper interface using DMA2. The process is mainly divided into three parts: original image speed adaptation, corrected image output adaptation, and correction processing. 7.根据权利要求6所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:所述原始图像速度配适往往采用全局变量作为协调,使RAM1,DMA1,中断1,数据读取步骤联动运转实现这个过程;具体是定义一个具用三个元素的一维数组BUF1,三个元素分别保存RAM1中三个图像缓存区的起始地址,分别用BUF1[0],BUF1[1],以及BUF1[2]表示;定义两个全局变量WR1和RD1,并设置初始值为零;7. The rapid trapezoidal correction method for biometric photoelectric scanning device images according to claim 6, characterized in that: the original image speed adaptation often uses global variables as coordination to enable RAM1, DMA1, interrupt 1, and data reading steps to operate in conjunction to achieve this process; specifically, a one-dimensional array BUF1 with three elements is defined, the three elements respectively store the starting addresses of the three image buffer areas in RAM1, and are respectively represented by BUF1[0], BUF1[1], and BUF1[2]; two global variables WR1 and RD1 are defined and set to the initial value of zero; 中断1的服务处理步骤用于切换原始图像缓存区,一方面为DMA1即将开始新保存一幅原始图数据而准备好缓存区,另一方面为数据读取步骤准备好最新保存好的一幅图像数据,具体步骤为;The service processing steps of interrupt 1 are used to switch the original image buffer. On the one hand, the buffer is prepared for DMA1 to start saving a new original image data. On the other hand, the latest saved image data is prepared for the data reading step. The specific steps are as follows: B1、把变量WR1累加1之后,若WR1的值大于2,则把WR1设置为零;B1. After incrementing the variable WR1 by 1, if the value of WR1 is greater than 2, then set WR1 to zero. B2、若WR1的值等于RD1的值,则执行步骤B1,否则向下执行B3;B2. If the value of WR1 is equal to the value of RD1, then execute step B1; otherwise, proceed to step B3. B3、以WR1为数组BUF1的索引,用BUF1[WR1]表示,数值就是原始图像缓存区的起始地址;B3. Use WR1 as the index of array BUF1, represented by BUF1[WR1], and the value is the starting address of the original image buffer. B4、把BUF1[WR1]的值送给DMA1控制器,在启动DMA1控制器之后,退出中断1服务,完成了中断1的服务处理步骤;B4. Send the value of BUF1[WR1] to the DMA1 controller. After starting the DMA1 controller, exit the interrupt 1 service and complete the interrupt 1 service processing steps. 数据读取步骤具体为;The specific steps for reading data are as follows: C1、比较变量WR1和RD1的值,若二者相等,则表示没有原始图像数据可供读取故此直接退出,否则执行步骤C2;C1. Compare the values of variables WR1 and RD1. If they are equal, it means that there is no original image data available for reading, so exit directly. Otherwise, proceed to step C2. C2、定义变量R,并设置初始值等于WR1;C2. Define variable R and set its initial value to WR1; C3、把变量R的值减去一之后,如果R的值小于零,那么就把R的值设置成为2;C3. After subtracting one from the value of variable R, if the value of R is less than zero, then set the value of R to 2. C4、设置变量RD1的值等于R的值;C4. Set the value of variable RD1 to equal the value of R; C5、以RD1作为数组BUF1的索引,用BUF1[RD1]表示,数值就是最新一幅原始图像数据的起始地址,送给纠偏处理过程。C5. Using RD1 as the index of array BUF1, represented by BUF1[RD1], the value is the starting address of the latest original image data, which is sent to the correction process. 8.根据权利要求7所述的生物特征光电扫描装置图像快速梯形纠偏方法,其特征在于:所述纠偏图像速度配适往往采用全局变量作为协调,使RAM2,DMA2,中断2,数据发送步骤联动运转实现这个过程;具体是定义一个具用三个元素的一维数组BUF2,三个元素分别保存RAM2中三个图像缓存区的起始地址,分别用BUF2[0],BUF2[1],以及BUF2[2]表示;定义两个全局变量WR2和RD2,并设置初始值为零;8. The rapid trapezoidal correction method for biometric photoelectric scanning device images according to claim 7, characterized in that: the image speed adaptation for correction often uses global variables as coordination to enable RAM2, DMA2, interrupt 2, and data transmission steps to operate in conjunction to achieve this process; specifically, a one-dimensional array BUF2 with three elements is defined, the three elements respectively store the starting addresses of the three image buffers in RAM2, and are respectively represented by BUF2[0], BUF2[1], and BUF2[2]; two global variables WR2 and RD2 are defined and set to the initial value of zero; 中断2的服务处理步骤服务处理步骤用于切换纠偏图像缓存区,一方面为DMA2即将新发送一幅纠偏图数据而准备好缓存区,另一方面为数据发送步骤准备好一幅纠偏图像数据写入最安全的缓存区,具体步骤为;The service processing steps for interrupt 2 are used to switch the correction image buffer. On the one hand, the buffer is prepared for DMA2 to send a new correction image data. On the other hand, the correction image data is prepared for the data transmission step to be written into the safest buffer. The specific steps are as follows: D1、把变量RD2的值累加1之后,若RD2的值大于2,则把RD2设置为零;D1. After incrementing the value of variable RD2 by 1, if the value of RD2 is greater than 2, then set RD2 to zero. D2、若RD2的值等于WR2的值,则表明因DMA2的速度高于纠偏处理过程而没有纠偏图像数据需发送,可直接退出中断2的服务处理,否则执行步骤D3;D2. If the value of RD2 is equal to the value of WR2, it indicates that there is no image data to be sent because the speed of DMA2 is higher than that of the correction process. The service process of interrupt 2 can be exited directly. Otherwise, proceed to step D3. D3、以RD2作为数组BUF2的索引,用BUF2[RD2]表示,数值就是最新一幅纠偏图像数据的起始地址,送给DMA2控制器;D3. Using RD2 as the index of array BUF2, represented by BUF2[RD2], the value is the starting address of the latest corrected image data, which is sent to the DMA2 controller. D4、在启动DMA2开始发送数据之后退出中断2服务,完成了中断2的服务处理步骤;D4. After starting DMA2 and beginning to send data, the interrupt 2 service is exited, completing the service processing steps of interrupt 2. 数据发送步骤具体为;The specific steps for sending data are as follows: E1、以WR2作为数组BUF2的索引,用BUF2[WR2]表示,数值就是RAM2中一个可供保存纠偏数据的缓存区起始地址;E1. Use WR2 as the index of array BUF2, represented by BUF2[WR2]. The value is the starting address of a buffer in RAM2 that can store correction data. E2、把最新的一幅纠偏图像数据保存到BUF2[WR2]数值对应的缓存区中;E2. Save the latest corrected image data to the buffer corresponding to the value of BUF2[WR2]; E3、把BUF2[WR2]数值送给DMA2控制器之后,启动DMA2开始发送数据;E3. After sending the BUF2[WR2] value to the DMA2 controller, start DMA2 to begin sending data; E4、把变量WR2的数值累加1之后,若WR2的值大于2,则把WR2的值设置为零;E4. After incrementing the value of variable WR2 by 1, if the value of WR2 is greater than 2, then set the value of WR2 to zero. E5、比效变量WR2与变量RD2的值,若二者相等,则执行步骤E4,否则就完成了数据发送;E5. Compare the values of variable WR2 and variable RD2. If they are equal, proceed to step E4; otherwise, the data transmission is complete. 同时,在处理器的主程序循环中,需要进行执行纠偏处理,其中,纠偏处理过程为:Meanwhile, in the processor's main program loop, error correction processing needs to be performed. The error correction process is as follows: F1、用数据读取步骤从RAM1取得一幅原始图像,若未能获得一幅新图像,则重新执行步骤F1;F1. Use the data reading step to obtain an original image from RAM1. If a new image cannot be obtained, repeat step F1. F2、原始图像数据应用纠偏数据计算,生成一幅纠偏图像;F2. The original image data is used to calculate the correction data to generate a correction image; F3、纠偏图像保存到RAM2之后执行数据发送步骤;F3. After the corrected image is saved to RAM2, the data transmission step is executed. F4、在数据发送步骤完成之后不需要等图像数据发送完毕,重新执行步骤F1;F4. After the data sending step is completed, it is not necessary to wait for the image data to be sent completely before re-executing step F1. 步骤F1至F4无限循环执行;Steps F1 to F4 are executed in an infinite loop; 用纠偏数据计算生成一幅纠偏图像的具体步骤为;The specific steps for generating a corrected image using the corrected data are as follows: G1、定义变量x,变量y,并把这些变量全部设置为零;G1. Define variables x and y, and set all of them to zero; G2、定义变量TW并设置TW的值等于顶部全丢数据信息GT;定义变量TL并设置TL的值等于水平全丢行号数组TA第一个元素的地址;G2. Define variable TW and set its value to the top data information GT; define variable TL and set its value to the address of the first element of the horizontal row number array TA. G3、定入变量TLE,变量TLD,变量TLU,以及变量PUC;然后把TL加上原始图像的起始地址;G3, define variables TLE, TLD, TLU, and PUC; then add the starting address of the original image to TL; G4、把TL的值作为RAM1中的地址,取得一个水平全丢行号;把这个水平全丢行号乘以原始图像的宽度W1,再加上变量TW的数值之后,再次保存到变量TW和变量PUC中;G4. Use the value of TL as the address in RAM1 to obtain a horizontal full-line number; multiply this horizontal full-line number by the width W1 of the original image, add the value of variable TW, and then save it back to variables TW and PUC. G5、把变量TW的值加上原始图像的宽度W1之后,保存到变量TLE和变量TLD中;把变量TW的值减去原始图像的宽度W1之后,保存到变量TLU中;G5. Add the original image width W1 to the value of variable TW and save it to variables TLE and TLD; subtract the original image width W1 from the value of variable TW and save it to variable TLU. G6、取得变量PUC的数值,作为RAM1的地址,从RAM1中取得原始图像的像素CA;G6. Obtain the value of variable PUC as the address of RAM1, and retrieve the pixel CA of the original image from RAM1; G7、取得变量TLU的数值,作为RAM1的地址,从RAM1中取得原始图像的像素CB;计算CA和CB的平均值CC之后,把CC重新保存回到TLU数值作为RAM1这个存贮地址中;然后把变量TLU累加1;G7. Obtain the value of variable TLU as the address of RAM1, retrieve the pixel CB of the original image from RAM1; calculate the average value CC of CA and CB, and then save CC back to the value of TLU as the storage address of RAM1; then increment the variable TLU by 1. G8、取得变量TLD的数值,作为RAM1的地址,从RAM1中取得原始图像的像素CD;计算CA和CD的平均值CE之后,把CE重新保存回到TLD数值作为RAM1这个存贮地址中;然后把变量TLD累加1;G8. Obtain the value of variable TLD as the address of RAM1, retrieve the pixel CD of the original image from RAM1; calculate the average value CE of CA and CD, and then save CE back to the value of TLD as the storage address of RAM1; then increment variable TLD by 1. G9、把变量PUC累加1之后,若变量PUC的值小于变量PLE,则执行步骤G6,否则执行步骤G10;G9. After incrementing the variable PUC by 1, if the value of variable PUC is less than that of variable PLE, then execute step G6; otherwise, execute step G10. G10、把变量TL累加1之后,再把变量y的值加1,若变量y的值小于水平全丢行数量TC,则执行步骤G4,否则执行步骤G11;G10. After incrementing variable TL by 1, increment the value of variable y by 1. If the value of variable y is less than the total number of rows lost in the horizontal direction TC, then execute step G4; otherwise, execute step G11. G11、定义变量I并设置初始值等为零;定义变量PT,并设置变量PT的值等于纠偏图像数据的起始地址;G11. Define variable I and set its initial value to zero; define variable PT and set the value of variable PT to the starting address of the correction image data; G12、定义变量TX,并设置变量TX的值等于原始图像数据的起始地址加上顶部全丢数据信息GT的数值;G12. Define variable TX and set the value of variable TX to be equal to the starting address of the original image data plus the value of the top all-lost data information GT; G13、设置变量y的值为零;G13, Set the value of variable y to zero; G14、以变量y作为水平全丢行标记数组TS的索引,用TS[y]表示,若TS[y]的数值不等于零,则把变量TX保存的数值增加W1G14. Use variable y as the index of the horizontal full-row mark array TS, denoted by TS[y]. If the value of TS[y] is not equal to zero, then increase the value stored in variable TX by W 1 . G15、把变量x的值设置为零;G15. Set the value of variable x to zero; G16、把变量I作为像素坐标数组PS的索引,用PS[I]表示;取得PS[I]的数值IX,计算IX的二进制最低4位都清零后的值保存为ILEFT,计算IX的二进制最低4位都置1后的值保存为IRIGHT;G16. Use variable I as the index of pixel coordinate array PS, denoted as PS[I]; obtain the value IX of PS[I], calculate the value of IX after clearing the lowest 4 bits of the binary representation and save it as ILEFT, and calculate the value of IX after setting the lowest 4 bits of the binary representation to 1 and save it as IRIGHT. G17、把ILEFT右移4位,加上变量TX的值之后,作为在RAM1中的地址,取得原始图像的一个像素VL;把IRIGHT右移4位,加上变量TX的值之后,作为在RAM1中的地址,取得原始图像的一个像素VR;G17. Shift ILEFT right by 4 bits, add the value of variable TX, and use this as the address in RAM1 to obtain a pixel VL of the original image; shift IRIGHT right by 4 bits, add the value of variable TX, and use this as the address in RAM1 to obtain a pixel VR of the original image. G18、把变量I的值累加1之后,计算IX减去ILEFT的值为XL;计算IX减去IRIGHT的值为XR;计算VAL;G18. After incrementing the value of variable I by 1, calculate the value of IX minus ILEFT as XL; calculate the value of IX minus IRIGHT as XR; calculate VAL; VAL=VR*XL-VL*XRVAL = VR * XL - VL * XR G19、把VAL右移4位之后,保存在以PT作为RAM2地址的纠偏图像缓存区中;G19. After shifting VAL 4 bits to the right, store it in the correction image buffer area with PT as the RAM2 address; G20、把PT的值累加1之后,再把变量x的值加1;如果变量x的值不大于纠偏图像宽度W2,则去执行步骤G17,否则执行步骤G18;G20. After incrementing the value of PT by 1, increment the value of variable x by 1. If the value of variable x is not greater than the width W2 of the corrected image, proceed to step G17; otherwise, proceed to step G18. G21、把变量TX的值加上原始图像宽度W1之后,重新保存到变量TX中;G21. Add the original image width W1 to the value of variable TX and save it back to variable TX; G22、把变量y的值累加1之后,若变量y的值小于纠偏图像H2,则执行步骤G14,否则完成了纠偏处理过程,转去执行数据发送步骤,把纠偏图像发送给上位机接口。G22. After incrementing the value of variable y by 1, if the value of variable y is less than the corrected image H2 , then execute step G14; otherwise, the correction process is complete, and proceed to the data sending step to send the corrected image to the host computer interface.
CN202211010822.9A 2022-08-23 2022-08-23 Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device Active CN115375575B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211010822.9A CN115375575B (en) 2022-08-23 2022-08-23 Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211010822.9A CN115375575B (en) 2022-08-23 2022-08-23 Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device

Publications (2)

Publication Number Publication Date
CN115375575A CN115375575A (en) 2022-11-22
CN115375575B true CN115375575B (en) 2025-11-11

Family

ID=84067208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211010822.9A Active CN115375575B (en) 2022-08-23 2022-08-23 Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device

Country Status (1)

Country Link
CN (1) CN115375575B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077586A (en) * 2014-06-20 2014-10-01 深圳百佳安生物识别技术有限公司 Real-time trapezoidal distortion correction method and system for optical fingerprint sensor

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6002499A (en) * 1995-07-07 1999-12-14 Advanced Precision Technology, Inc Real time fingerprint sensor and verification system
DE10163351C1 (en) * 2001-12-14 2003-06-26 Heimann Biometric Systems Gmbh Method and arrangement for the low-distortion recording of intensity patterns created on a contact surface by disturbed total reflection

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077586A (en) * 2014-06-20 2014-10-01 深圳百佳安生物识别技术有限公司 Real-time trapezoidal distortion correction method and system for optical fingerprint sensor

Also Published As

Publication number Publication date
CN115375575A (en) 2022-11-22

Similar Documents

Publication Publication Date Title
CN107992869B (en) Method and device for correcting tilted characters and electronic equipment
CN110992244A (en) Picture generation method, system, equipment and storage medium with Moire patterns
CN111767752A (en) Two-dimensional code identification method and device
CN108460833A (en) A kind of information platform building traditional architecture digital protection and reparation based on BIM
WO1996029680A1 (en) Interframe coding method and apparatus
CN116777769A (en) Distorted image correction method and device, electronic equipment, storage medium
JP2007142495A (en) Planar projection apparatus and planar projection program
CN115375575B (en) Rapid trapezoidal correction method for image of biological characteristic photoelectric scanning device
JP2010176547A (en) Controller included in image processor, control method and control processing program
CN113569846A (en) A kind of text image orientation correction method, device and electronic equipment
JP6815741B2 (en) Image processing device and image processing method
CN107564084B (en) Method and device for synthesizing motion picture and storage equipment
CN112532884B (en) Identification method and device and electronic equipment
CN107993246A (en) Image processing equipment and connected component labeling method, system, device, storage medium
CN113239806B (en) Curtain wall plate identification method and system based on image identification
CN118365693A (en) Target object size detection method, device, equipment and storage medium
CN106780291B (en) Real-time distortion image processing accelerating device
CN111899184B (en) Image defect repair, neural network training methods, devices, equipment and systems
CN117095417A (en) A screen capture form image text recognition method, device, equipment and storage medium
CN113472998B (en) Image processing method, image processing device, electronic equipment and storage medium
TWI820541B (en) Image dewarping method
CN116010508B (en) Meteorological data collection and automatic processing system and method
JPH01134682A (en) Line folding processing system
CN114943972B (en) Real scene deformation digital picture generation method and system
CN118505825B (en) Cashmere product color measurement method and device based on image recognition

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
CB02 Change of applicant information

Country or region after: China

Address after: 518000 Guangdong Province Shenzhen City Hangcheng Street Sanwei Community Sanwei South Road No. 1 607

Applicant after: SHENZHEN FUGE TECHNOLOGY CO.,LTD.

Address before: 518000 Guangdong Province Shenzhen City Bao'an District Xin'an Street Xingdong Community 67 Area Dashi Industrial Park Building 2 5th Floor 07

Applicant before: SHENZHEN FUGE TECHNOLOGY CO.,LTD.

Country or region before: China

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant