CN106204480B - Pattern distortion antidote and real-time apparatus for correcting based on conic section - Google Patents

Pattern distortion antidote and real-time apparatus for correcting based on conic section Download PDF

Info

Publication number
CN106204480B
CN106204480B CN201610536266.7A CN201610536266A CN106204480B CN 106204480 B CN106204480 B CN 106204480B CN 201610536266 A CN201610536266 A CN 201610536266A CN 106204480 B CN106204480 B CN 106204480B
Authority
CN
China
Prior art keywords
conic section
distortion
value
equation
hook
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
CN201610536266.7A
Other languages
Chinese (zh)
Other versions
CN106204480A (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.)
SHIJIAZHUANG YULIAN VISUAL CONTROL TECHNOLOGY Co Ltd
Original Assignee
SHIJIAZHUANG YULIAN VISUAL CONTROL 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 SHIJIAZHUANG YULIAN VISUAL CONTROL TECHNOLOGY Co Ltd filed Critical SHIJIAZHUANG YULIAN VISUAL CONTROL TECHNOLOGY Co Ltd
Priority to CN201610536266.7A priority Critical patent/CN106204480B/en
Publication of CN106204480A publication Critical patent/CN106204480A/en
Application granted granted Critical
Publication of CN106204480B publication Critical patent/CN106204480B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction

Landscapes

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

Abstract

Pattern distortion antidote and real-time apparatus for correcting based on conic section, belong to technical field of image processing, more particularly to a kind of pattern distortion antidote based on conic section and the device corrected in real time using this method to image, it is distorted using oval or Hyperbolic Equation formula analog image, is realized in embedded systems.The calibration for carrying out camera lens first corrects fault image further according to calibration result in real time.The following steps are included: step 1: obtaining the photo for having lattice picture;Step 2: establishing plane right-angle coordinate;Step 3: according to photo, judging pattern distortion type;Step 4: obtaining the equation of the approximate conic section of hook;Step 5: obtaining the corresponding relationship of fault image and correcting image pixel.By the CPU of corresponding relationship write-in embedded system;When work, CPU reads the Pixel Information of fault image, and according to corresponding relationship, translation bit postpones write-in correcting image file.Using the present invention, the configuration requirement of CPU can be reduced, while image is corrected to the maximum extent, obtains acceptable correcting image.

Description

Pattern distortion antidote and real-time apparatus for correcting based on conic section
Technical field
The invention belongs to technical field of image processing, and in particular to a kind of pattern distortion antidote based on conic section And the device that image is corrected in real time using this method.
Background technique
At present in monitoring field, in order to be suitble to the demand of different situations, different types of camera lens need to be used.General camera lens All there is a degree of optical distortion in imaging process, make the size and shape of image that certain variations have occurred, schemes The quality of picture declines, and brings error to subsequent image analysis and image measurement, or even cause to judge by accident, it is therefore necessary to by imaging Piecture geometry fault caused by machine camera lens is corrected.
Due to the difference of camera lens, it is possible to create distortion be divided into two classes: barrel distortion and pincushion distortion.
Two classes can be divided into for the correcting algorithm of camera lens nonlinear distortion: the first kind is based on calibrating template side Method, such as dot chart, plane grid, concentric loop, checkerboard are used, according to the position of characteristic point in template and its ideal point Position deviation seek distortion factor;Second class is without using calibrating template, such as based on aberration rate, based on the equivalent song that distorts Face based on the correcting algorithms such as measuring device iteration or directly finds out distortion factor.
Chinese patent application " a kind of scaling method and caliberating device of fish eye lens radial distortion " (application number: 201410244246.3) a kind of method that processing is fitted to distortion using the conllinear circular arc group in the center of circle is disclosed, this method is calculated Method is complicated, requires cpu performance high;Chinese patent application " a kind of method and device for correcting image barrel-shaped distortion " (application number: 201510019338.6) a kind of method is disclosed, according to lens parameters and pixel coordinate, determines the curvature and compression at the coordinate Rate, and then obtain the coordinate points after pixel coordinate correction.This method relies on lens parameters, and can only correct the barrel-shaped of image Distortion.
Summary of the invention
With a large amount of investments of monitoring device, applies number of shots, the type in embedded system more and more, how to look for The image correction method for meeting monitoring image requirement in monitoring system is applied to one kind with can be convenient, be that the present invention to be solved Certainly the problem of.
In order to solve the above technical problems, the technical solution adopted by the present invention is that: a kind of pattern distortion based on conic section Antidote is distorted using oval or Hyperbolic Equation formula analog image, and the pixel quantity for the camera lens that distorts is H*W, including following Step:
Step 1: one there is the picture of rectangular or square lattice, before being placed on distortion camera lens, picture and camera lens Keeping parallelism, shoots the photo of the picture, and photo center is a crosspoint of grid, the horizontal direction across crosspoint Grid lines be in the horizontal position in photo center;
Step 2: on photo, using above-mentioned grid intersection as origin, two grid lines across crosspoint are X-axis and Y Axis, the distance in X-axis between two neighboring pixel is length unit, establishes plane right-angle coordinate;
Step 3: according to photo, judging pattern distortion type;
Step 4: the approximate conic for the hook that grid lines is distorted in horizontal and vertical direction is obtained according to photo The equation of line;
Step 5: according to equation, obtaining the corresponding relationship of fault image and correcting image pixel.
A kind of real-time apparatus for correcting of pattern distortion is closed including embedded system and the video camera for being equipped with distortion camera lens Key is: the corresponding relationship of fault image and correcting image pixel is stored in the CPU of embedded system;Apparatus for correcting work When, CPU reads the Pixel Information of each frame distortion image, and according to corresponding relationship, translation bit postpones write-in correcting image file.
The camera lens that monitoring device uses is generally tight shot, with perfect, the skill of each batch camera lens of manufacture craft Art index is essentially identical, and therefore, a selected camera lens is demarcated, and obtained parameter can be used for monitoring device by the gross. In addition, monitoring image requirement is not particularly severe, as long as being able to satisfy the requirement of subsequent processing, such as the identification of license plate, fault image The effect of correction can receive.
The resolution ratio of camera lens is H*W, such as 1280*960, then photo can regard 1280 row of horizontal direction, vertical direction as 960 column compositions, the intersection point of row, column is exactly pixel.
The distortion of image can be divided into barrel distortion and pincushion distortion, as depicted in figs. 1 and 2, Fig. 1 according to the difference of camera lens It is the schematic diagram of barrel distortion, Fig. 2 is the schematic diagram of pincushion distortion.In figure, solid line is the line in actual picture, and dotted line is basis In the photo that picture obtains, solid line generates the hook after distortion.That is, individually solid line is original picture, individually Dotted line be according to picture obtain photo, Fig. 1 and Fig. 2 are the images for being formed by stacking original image and photo.In figure, P2, P4 is the intersection point of two lines in original image, and P1, P3 are the friendships of the deformation lines of two lines in corresponding original image in photo Point.
Distortion correction restores original image exactly on the basis of the photo of acquisition being distorted.By taking diagram as an example, just It is the numerical value obtained in photo on P1 or P3 pixel, is written in correcting image, on P2 or P4 pixel.
Problem to be solved by this invention is obtained between fault image and correcting image, the corresponding relationship of each pixel, And in subsequent processes, according to corresponding relationship, each pixel is handled.
The present invention includes two processes: the 1, calibration of camera lens, 2, the real-time correction of image.
The calibration of camera lens:
The distortion of image, can be with conic section come approximate fits: barrel distortion, can be with ellipse come approximate fits deformation Line, pincushion distortion can be with hyperbola come approximate fits hook.
For convenience of description, the photo that we will be obtained by camera lens, center are set as coordinate origin, across the water of origin Horizontal line and vertical line are that X-axis and Y-axis form coordinate system.In X-axis and Y-axis, it is believed that be not pattern distortion, other portions Position, according to the difference of camera lens, can generate barrel distortion and pincushion distortion, further away from coordinate origin, distort more serious.Such as Fig. 3 institute Show, is the schematic diagram carried out to barrel distortion after ellipse fitting, the photo that intermediate interdigitated part is.Fig. 3 is one and shows It is intended to, in actual fitted figure, elliptical long axis is very long.It can be seen that being deformed in the whole sub-picture of a series of ellipse fitting The distortion of line such as upwards and to the right from origin, is done an ellipse every a pixel, is calculated oval by intensively selecting ellipse The coordinate value of upper each point, the coordinate value of available whole secondary fault image each point.
Each point on fault image, can regard two elliptical intersection points as, fault image and correcting image it Between, the corresponding relationship of this point, as shown in Figure 1, P1 point corresponds to P2.The coordinate of P2 is exactly two ellipses by P1, with X The value of axis and the intersection point of Y-axis away from origin.
The real-time correction of image:
CPU is written into above-mentioned corresponding relationship, when work, CPU obtains a pixel on fault image, finds this point Two ellipses, pixel of this on correction image is obtained according to ellipse, the data of corresponding fault image pixel are write The new pixel position on correcting image forms media file, completes the real-time correction of fault image.
The above is the processing for barrel distortion image, and for pincushion distortion, principle is identical, only changes ellipse into hyperbolic Line, it is no longer redundant later here.
In addition, since anamorphose causes overlapping, the missing of pixel, it can be using prior arts means such as bilinear interpolations It is handled.
The method have the benefit that: the pattern distortion correction algorithm based on circular cone line of present disclosure, is one The completely new pattern distortion correction algorithm of kind.It selects hyperbola or elliptic equation from the shape of morphological analysis lens distortion Distortion is simulated, relevant parameter is calculated according to distortion degree automatically, and by the corresponding relationship of distortion front and back, according to pixel It calculates one by one, generates corresponding relationship.Compared with traditional correction algorithm, either principle or operation is all extremely simple, can be certainly The camera lens of dynamic adaptation different distort shapes and aberration rate.For a collection of camera lens, a progress calibrated and calculated is chosen, calculated result can It is embedded into various hardware devices, in actual operation, the CPU of embedded equipment reads the image obtained, according to pair of write-in It should be related to, acquisition of being tabled look-up corrects pixel address and completes to replace, and realizes the correction of image.Using the present invention, CPU can be reduced Configuration requirement, while image is corrected to the maximum extent, obtains acceptable correcting image.
The present invention is described in detail with reference to the accompanying drawing.
Detailed description of the invention
Fig. 1 is the superposition schematic diagram of barrel distortion and original image,
Fig. 2 is the superposition schematic diagram of pincushion distortion and original image,
Fig. 3 is the lines fitted figure of barrel distortion,
Fig. 4 is the coordinate diagram that barrel distortion photo is formed,
Fig. 5 is the coordinate diagram that pincushion distortion photo is formed,
Fig. 6 is the picture of barrel distortion,
Fig. 7 is the picture after Fig. 6 correction,
Fig. 8 is the picture of pincushion distortion,
Fig. 9 is the picture after Fig. 8 correction,
Figure 10 is camera lens calibration process,
Figure 11 is real-time correcting process,
Figure 12 is the schematic diagram of approximate calculation coordinate points.
Specific embodiment
The present invention includes two parts: 1, the calibration process of camera lens and 2, real-time correcting process.
As shown in Figure 10, the calibration process of camera lens is to obtain the photo with grid picture first, according to what is distorted on photo Hook judges distortion type, and then obtains equation of conic section, and the coordinate of each point on hook is calculated further according to curvilinear equation Value, is finally calculated the corresponding relationship between fault image and correcting image pixel.
The CPU of obtained corresponding relationship write-in embedded system is subjected to real-time correcting process when embedded system works, As shown in figure 11, fault image is obtained first, corresponding relationship is then read, according to corresponding relationship, by the pixel in fault image Information, conversion position are written in correcting image file, complete the real-time correction of image.
Concrete implementation is described as follows:
The calibration process of camera lens:
A kind of pattern distortion antidote based on conic section, it is abnormal using oval or Hyperbolic Equation formula analog image Become, the pixel quantity for the camera lens that distorts is H*W, comprising the following steps:
Step 1: one there is the picture of rectangular or square lattice, before being placed on distortion camera lens, picture and camera lens Keeping parallelism, shoots the photo of the picture, and photo center is a crosspoint of grid, the horizontal direction across crosspoint Grid lines be in the horizontal position in photo center;
Fig. 1 is the schematic diagram of barrel distortion, and Fig. 2 is the schematic diagram of pincushion distortion.In figure, solid line is the net in actual picture Lattice, dotted line are in the photo obtained according to picture, and solid line generates the hook after distortion.That is, individually solid line is former The picture of beginning, individual dotted line are the photos obtained according to picture, and Fig. 1 and Fig. 2 are to be formed by stacking original image and photo Image.When selecting picture, when guaranteeing lines and intersection point clearly, hachure pattern is selected as far as possible.
Step 2: on photo, using above-mentioned grid intersection as origin, two grid lines across crosspoint are X-axis and Y Axis, the distance in X-axis between two neighboring pixel is length unit, establishes plane right-angle coordinate;
As shown in Figure 4 and Figure 5, coordinate system is established.The pixel coordinate (Ox, Oy) of origin o is read, other pixels are being sat Position in mark system can be calculated according to the location of pixels of the point and the location of pixels of origin.Due to the lines ratio in picture Relatively thick, the crosspoint on photo may include that multiple pixels take the average value of each pixel coordinate position in a little in this case Coordinate position as intersection point.
Step 3: according to photo, judging pattern distortion type;
Step 4: the approximate conic for the hook that grid lines is distorted in horizontal and vertical direction is obtained according to photo The equation of line;
Picture is put into computer, above-mentioned two step is completed.
Above-mentioned two step can have been manually done, and can also be automatically performed with computer.
It has been manually done:
Photo is shown to the metamorphosis for visually observing hook on a display screen, determines pattern distortion type;According to abnormal Become type, selection is oval by hand or hyperbola, modification parameter of curve are fitted the hook of a horizontal direction in photo, record The parameter of conic section after fitting obtains the equation of the approximate conic section of the horizontal direction hook:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: X2/a12+Y2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: Y2/a22-X2/b22=1, a2 > 0, b2 > 0;
As shown in figure 3, L1-x is the elliptic curve of hook.
For a camera lens, can be simply considered that, the distortion of horizontal direction and vertical direction is consistent, therefore, from The hook fit equation that above-mentioned steps obtain, the approximate circular cone of available pattern distortion vertical direction corresponding position hook The equation of curve:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a12+X2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a22-Y2/b22=1, a2 > 0, b2 > 0;
The corresponding position are as follows: vertical direction hook is with X-axis intersection point away from the horizontal direction for being equal to fitting at a distance from origin Hook and Y-axis intersection point away from origin at a distance from, referring to Fig. 3, L1-y is L1-x in vertical direction corresponding position hook.
In order to more accurately, individually be fitted: photo be shown on a display screen, according to abnormal to the hook of vertical direction Become type, select conic section by hand, modify parameter of curve, is fitted the hook of a vertical direction in photo, record fitting The parameter of conic section afterwards obtains the equation of the approximate conic section of the vertical direction hook:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a32+X2/b32=1, a3 > b3 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a42-Y2/b42=1, a4 > 0, b4 > 0.
Computer is automatically performed judgement distortion type:
In the horizontal direction on a hook, the intersection point D1 and D2 of two with vertical direction hook are chosen, two points Coordinate is D1 (x1, y1), and D2 (x2, y2), the condition of selection is abs (x1) ≠ abs (x2) or abs (y1) ≠ abs (y2), if The absolute value of x coordinate and the absolute value of y-coordinate of one of point are both greater than another point, then pattern distortion type is that pincushion is abnormal Become, otherwise, pattern distortion type is barrel distortion;
Alternatively, on one hook of vertical direction, two intersection point D3 and D4 with horizontal direction hook are chosen, two The coordinate of point is D3 (x3, y3), and D4 (x4, y4), the condition of selection is abs (x3) ≠ abs (x4) or abs (y3) ≠ abs (y4), If the absolute value of x coordinate and the absolute value of y-coordinate of one of point are both greater than another point, pattern distortion type is pillow Shape distortion, otherwise, pattern distortion type are barrel distortion.
As shown in figure 4, selection two points of D1, D2, the X-coordinate value of D1 is less than the X-coordinate value of D2, and the Y-coordinate value of D1 is greater than The Y-coordinate value of D2, therefore Fig. 4 is barrel distortion;Or selection two points of D3, D4, the Y-coordinate value of D3 are greater than the Y-coordinate value of D4, The X-coordinate value of D3 is less than the X-coordinate value of D4, therefore Fig. 4 is barrel distortion;
As shown in figure 5, selection two points of d1, d2, the absolute value of the X-coordinate of d2 and the absolute value of Y coordinate are both greater than d1's X-coordinate absolute value and Y coordinate absolute value, therefore Fig. 5 be pincushion distortion;Or selection two points of d3, d4, it can also obtain Above-mentioned conclusion out.
Computer automatically generates equation of conic section:
If it is barrel distortion, conic section is ellipse, and the coordinate value of D1, D2 are substituted into formula X by such as Fig. 42/a2+Y2/b2 =1, it solves equation to obtain the elliptic equation of the horizontal direction hook L2-x where D1, D2: X2/a12+Y2/b12=1, a1 > b1 > 0;
If it is pincushion distortion, conic section is hyperbola, such as Fig. 5, and the coordinate value of d1, d2 are substituted into formula Y2/a2-X2/ b2=1, it solves equation to obtain the Hyperbolic Equation formula of the horizontal direction hook L3-x where d1, d2: Y2/a22-X2/b22=1, a2 > 0, b2 > 0;
The almost the same reason of distortion based on horizontal direction and vertical direction, obtains pattern distortion vertical direction and corresponds to position Set the equation of the approximate conic section of hook:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a12+X2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a22-Y2/b22=1, a2 > 0, b2 > 0;
The corresponding position are as follows: vertical direction hook is with X-axis intersection point away from the level where being equal to D1, D2 at a distance from origin Direction distortion line and Y-axis intersection point away from origin at a distance from, in Fig. 4 and Fig. 5, L2-x and L2-y, L3-x and L3-y are corresponding position Hook.
In order to more accurately, be individually fitted to the hook of vertical direction: if it is barrel distortion, as shown in figure 4, circle Boring curve is ellipse, and the coordinate value of D3, D4 are substituted into formula Y2/a2+X2/b2=1, it solves equation to obtain the vertical side where D3, D4 To the elliptic equation of hook: Y2/a32+X2/b32=1, a3 > b3 > 0;
If it is pincushion distortion, as shown in figure 5, conic section is hyperbola, the coordinate value of d3, d4 are substituted into formula X2/ a2-Y2/b2=1, it solves equation to obtain the Hyperbolic Equation formula of the vertical direction hook where d3, d4: X2/a42-Y2/b42=1, a4 > 0, b4 > 0.
Above-mentioned steps have obtained the circular cone equation of horizontal direction and each hook of vertical direction.
Step 5: according to equation, obtaining the corresponding relationship of fault image and correcting image pixel;
Initially set up two fault image concordance lists, in concordance list 1, content is y-axis coordinate in index key and table Value;In concordance list 2, content is x-axis coordinate value in index key and table.The initial configuration of concordance list is as follows:
Concordance list 1
Concordance list 2
Step 5.1, concordance list 1 is initially set up:
Step 5.1.1, the horizontal direction hook obtained according to step 4 equation of conic section f (x, y)=1, x value [- W/2, W/2], corresponding y value is successively calculated in x ∈ N, and the difference of two neighboring x is 1;If it is barrel distortion, f (x, y)= X2/a12+Y2/b12, if it is pincushion distortion, f (x, y)=Y2/a22-X2/b22
Store above-mentioned coordinate value, and y value when using x=0 is as index key;
It records p0=abs (y), y is above-mentioned index key;
The concordance list that the first step generates is as follows:
Concordance list 1
Increase by two rows in concordance list, index key is that the xxxx for p0 and-p0, in table is corresponding X value respectively, with ellipse For circle, according to formula y=± b1 (1-x2/a12)1/2The y value calculated.In this way, by the ellipse of p0 point in Y-axis and-p0 point Circle, both the coordinate of all the points had been found out on two hooks.
In experimenting, we find out that, the hook in same direction, can be such as barrel-shaped abnormal with a general formula come approximate representation The general formula of change are as follows: K* (x2/a2+y2/b2)=1, a > b > 0, the general formula of pincushion distortion are as follows: K* (x2/a2-y2/b2)=1, a > 0, b > 0。
In the following, by taking barrel distortion as an example, using known elliptic equation and above-mentioned principle, using following methods find out by The coordinate of each point on the hook of each integral point of Y-axis.
Step 5.1.2, finds out each ellipse formula first: p value [1, p0) ∪ (p0, H/2], the difference of two neighboring p is 1, For each p, coordinate value (0, p) is updated to equation K*f (x, y)=1, obtains K value:
K*(0/a12+p2/b12)=1, K=b12/p2,
And then the ellipse formula b1 of p point is obtained2/p2*( x2/a12+ y2/b12)=1。
Step 5.1.3, according to formula derived above, x value [- W/2, W/2], corresponding y value is calculated in x ∈ N, The difference of two neighboring x is 1;
Store above-mentioned coordinate value, and y value when using x=0 is as index key.
It, can using the coordinate and K value by all the points on the ovalizing deflection line of p0 point in Y-axis and-p0 point found out With the alternatively approximate y value for finding out each point on other hooks:
Referring to Figure 12, it is known that the elliptic equation for crossing P0 point is X2/a12+Y2/b12=1,
The elliptic equation for crossing P point is K* (X2/a12+Y2/b12)=1,
By the straight line of X=x0, y value with above-mentioned two elliptical intersection point:
P0y2=(1-x02/a12)*b12
Py2=(1/K-x02/a12)*b12
P0y2/Py2= K* ( a12-x02)/(a12-K*x02)
Since elliptical focus is far away from coordinate origin, a1 is much larger than x0, therefore, P0y2/Py2Approximation be K, have Py= ±P0y/K1/2
According to relation above, design factor is the Y value of each point coordinate on the ellipse of K:
py=±p0y/K1/2,
Wherein, p0y is the Y coordinate of each point on the ellipse found out, and py is the Y coordinate on the ellipse to be calculated, p0y and py Corresponding identical x value, the value range of x is [- W/2, W/2], x ∈ N.
Store above-mentioned coordinate value, and py value when using x=0 is as index key;
Now, complete concordance list 1 has been obtained.In concordance list 1, storage is horizontally oriented each point on straight line, generates abnormal Position coordinates of the hook on photo after change.Shared H+1 item, distance of the adjacent deformations line in Y-axis between intersection point is 1 picture Element, the distance of consecutive points horizontal direction are 1 pixels, and index key is the intersecting point coordinate of the hook and Y-axis.
Index key in concordance list 1 is the coordinate value of hook and y-axis intersection point, and the content in table is y-axis coordinate value. Some data in concordance list 1 form coordinate data with corresponding X value.
Concordance list 2 is established using similar method:
Step 5.2.1, the conic for the vertical direction hook that the distortion type and step 4 obtained according to step 3 obtains Line equation g (x, y)=1, y value [- H/2, H/2], y ∈ N, are calculated corresponding x value, and the difference of two neighboring y is 1;With ellipse For, g (x, y)=Y2/a12+X2/b12Or g (x, y)=Y2/a32+X2/b32
Store above-mentioned coordinate value, and x value when using y=0 is as index key;
It records q0=abs (x), x is above-mentioned index key;
Step 5.2.2, q value [1, q0) and ∪ (q0, W/2], the difference of two neighboring q is 1, for each q, by coordinate value (q, 0) is updated to equation M*f (x, y)=1, obtains M value;
Step 5.2.3, according to above-mentioned formula, y value [- H/2, H/2], y ∈ N is calculated corresponding x value, and adjacent two The difference of a y is 1;
Store above-mentioned coordinate value, and x value when using y=0 is as index key;
Equally, the coordinate and M by all the points on the ovalizing deflection line of q0 point in Y-axis and-q0 point found out is utilized Value, can alternatively the approximate x value for finding out each point on other hooks, method be consistent with the above.
Concordance list 2 is established according to above-mentioned steps;
In concordance list 2, storage is each point on vertical direction straight line, position of the hook after generating distortion on photo Coordinate.Shared W+1 item, distance of the adjacent deformations line in Y-axis between intersection point is 1 pixel, and the distance of consecutive points vertical direction is 1 A pixel, index key are the intersecting point coordinates of the hook and X-axis.
Index key in concordance list 2 is the coordinate value of hook and x-axis intersection point, and the content in table is x-axis coordinate value. Some data in concordance list 2 form coordinate data with corresponding Y value.
In above-described embodiment, elliptic equation is used.When handling pincushion distortion, using Hyperbolic Equation, the two it Between difference be to use the difference of function, the principle of calculating is the same, no longer describes.
Step 5.3, according to two concordance lists, the corresponding relationship of fault image and correcting image pixel is established:
In this example, corresponding relationship is a bivariate table, and the size of table is H*W, and the content in table is coordinate value.The structure of table It is as follows:
Corresponding relationship bivariate table
Referring to Fig. 1, position of the P1 point in correcting image in fault image is P2 point, acquires bivariate table according to this principle In content.
The data of the position [i, j] are expressed as P (i, j) in table, wherein and i, j are integer ,-W/2≤i≤W/2 ,-H/2≤j≤ H/2。
The value of P (i, j) determines as follows:
Using i as the index key of concordance list 2, j is the index key of concordance list 1;
In two concordance lists, find identical under two index keys, jointly owned coordinate value, both sat in other words Data are marked, the coordinate data found is (x, y), in bivariate table, P (i, j)=(x, y).
The practical significance of the above process is the intersection point for looking for two curves, and in the ideal case, intersection point can pass through above-mentioned mistake Journey is found.But a line is described here by a series of coordinate, be it is discrete, in calculating process, due to error Presence, it is possible to can not find common coordinate data.If can not find identical coordinate value, find under two index keys Immediate coordinate value, by position [i, j] in the average write-in bivariate table of two coordinate values.
By above step, the corresponding relationship of fault image and correcting image pixel is obtained, corresponding relationship is completed Bivariate table;
Pixel is all integer, in calculating process, will appear decimal certainly.A kind of scheme is to generate corresponding relationship two When dimension table, (x, y) round numbers partial write corresponding relationship bivariate table.In order to improve the quality of correcting image, can also protect always Decimal is stayed, in real time when correction, after reading (x, y), x, y are rounded, and are obtained the information of central pixel point, further according to fractional part, are obtained To the information of peripheral image vegetarian refreshments, the information of obtained pixel is weighted processing, information write-in correction is schemed by treated As (i, j) location of pixels.
In above-described embodiment, corresponding relationship bivariate table is using camera lens center as coordinate origin, and general camera lens is with lower-left Angle is pixel counts starting point.It, can be by corresponding relationship bivariate table by coordinate translation, by coordinate original in order to be more convenient when in use Point is set in the lower left corner.It is as follows:
Corresponding relationship bivariate table
Real-time correcting process:
A kind of real-time apparatus for correcting of pattern distortion, it is embedding including embedded system and the video camera for being equipped with distortion camera lens The corresponding relationship of fault image and correcting image pixel is stored in the CPU of embedded system;When apparatus for correcting works, CPU is read The Pixel Information of each frame distortion image, according to corresponding relationship, translation bit postpones write-in correcting image file.
When equipment making, by corresponding relationship, both in the CPU of above-mentioned corresponding relationship bivariate table write-in embedded system.
When embedded system works, video camera obtains distortion in real time image by camera lens, and for each frame, CPU reads abnormal Become the Pixel Information of image;For each pixel (i, j) ,-W/2≤i≤W/2 ,-H/2≤j≤H/2 read corresponding relationship The data (x, y) of corresponding position in bivariate table;By the information of (x, y) pixel in fault image, be written correcting image (i, j) as Plain position, correcting image form new media file, complete real-time correction.
If the value of (x, y) is integer, handled according to the method described above, if it is decimal, x, y are rounded, and obtain center The information of pixel obtains the information of peripheral image vegetarian refreshments further according to fractional part, and the information of obtained pixel is weighted Processing, by treated, correcting image (i, j) location of pixels is written in information.
By Fig. 6-9 as can be seen that can effectively correct barrel distortion and pincushion distortion using the present invention.
It detects card (ISO12233 resolution card) using image definition to test image, the figure of this method correction Picture, horizontal and vertical direction loss of sharpness 2% or so, on picture quality influence less, can satisfy Car license recognition, The monitoring requirements such as recognition of face.

Claims (9)

1. a kind of pattern distortion antidote based on conic section is distorted using oval or Hyperbolic Equation formula analog image, The pixel quantity of distortion camera lens is H*W, it is characterised in that the following steps are included:
Step 1: one being had the picture of rectangular or square lattice, before being placed on distortion camera lens, picture and camera lens are kept In parallel, the photo of the picture is shot, photo center is a crosspoint of grid, across the net of the horizontal direction in crosspoint Ruling is in the horizontal position in photo center;
Step 2: on photo, using the grid intersection in photo center as origin, across crosspoint two grid lines be X-axis and Y-axis, the distance in X-axis between two neighboring pixel is length unit, establishes plane right-angle coordinate;
Step 3: according to photo, judging pattern distortion type;
Step 4: the approximate conic section for the hook that grid lines is distorted in horizontal and vertical direction is obtained according to photo Equation;
Step 5: according to equation, obtaining the corresponding relationship of fault image and correcting image pixel;
Step 5 the following steps are included:
5.1: establishing fault image concordance list 1, content is y-axis coordinate value in index key and table, comprising the following steps:
5.1.1: according to equation of conic section f (x, y)=1, x value [- W/2, the W/ for the horizontal direction hook that step 4 obtains 2], x ∈ N, is calculated corresponding y value, and the difference of two neighboring x is 1;
Store above-mentioned coordinate value, and y value when using x=0 is as index key;
It records p0=abs (y), y is above-mentioned index key;
5.1.2:p value [1, p0) ∪ (p0, H/2], the difference of two neighboring p are 1, and for each p, coordinate value (0, p) is substituted into To equation K*f (x, y)=1, K value is obtained;
5.1.3: according to 5.1.2 obtain as a result, corresponding y value is successively calculated in x value [- W/2, W/2], x ∈ N;
Store above-mentioned coordinate value, and y value when using x=0 is as index key;
5.2: establishing fault image concordance list 2, content is x-axis coordinate value in index key and table, comprising the following steps:
5.2.1: according to equation of conic section g (x, y)=1, y value [- H/2, the H/ for the vertical direction hook that step 4 obtains 2], y ∈ N, is calculated corresponding x value, and the difference of two neighboring y is 1;
Store above-mentioned coordinate value, and x value when using y=0 is as index key;
It records q0=abs (x), x is above-mentioned index key;
5.2.2:q value [1, q0) ∪ (q0, W/2], the difference of two neighboring q are 1, and for each q, coordinate value (q, 0) is substituted into To equation M*f (x, y)=1, M value is obtained;
5.2.3: according to 5.2.2 obtain as a result, corresponding x value is successively calculated in y value [- H/2, H/2], y ∈ N;
Store above-mentioned coordinate value, and x value when using y=0 is as index key;
5.3: establishing the corresponding relationship bivariate table of fault image and correcting image pixel, the data acquisition of the position [i, j] in table Mode is as follows:
Using i as the index key of concordance list 2, j is the index key of concordance list 1;
In two concordance lists, identical coordinate value under two index keys is found, the coordinate value (x, y) found is written The position [i, j] in corresponding relationship bivariate table ,-W/2≤i≤W/2 ,-H/2≤j≤H/2.
2. the pattern distortion antidote according to claim 1 based on conic section, it is characterised in that:
In step 3, pattern distortion type is visually observed;
In step 4, photo is shown on a display screen, according to distortion type, conic section is selected by hand, modifies parameter of curve, It is fitted the hook of a horizontal direction in photo, the parameter of the conic section after record fitting obtains horizontal direction deformation The equation of the approximate conic section of line:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: X2/a12+Y2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: Y2/a22-X2/b22=1, a2 > 0, b2 > 0;
And then obtain the equation of the approximate conic section of pattern distortion vertical direction corresponding position hook:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a12+X2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a22-Y2/b22=1, a2 > 0, b2 > 0;
The corresponding position are as follows: vertical direction hook is deformed with X-axis intersection point away from the horizontal direction for being equal to fitting at a distance from origin Line and Y-axis intersection point away from origin at a distance from.
3. the pattern distortion antidote according to claim 2 based on conic section, it is characterised in that:
In step 4, photo is shown on a display screen, according to distortion type, conic section is selected by hand, modifies parameter of curve, It is fitted the hook of a vertical direction in photo, the parameter of the conic section after record fitting obtains vertical direction deformation The equation of the approximate conic section of line:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a32+X2/b32=1, a3 > b3 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a42-Y2/b42=1, a4 > 0, b4 > 0.
4. the pattern distortion antidote according to claim 1 based on conic section, it is characterised in that: in step 3, On one hook of horizontal direction, the intersection point D1 and D2 of two with vertical direction hook are chosen, the coordinate of two points is D1 (x1, y1), D2 (x2, y2), the condition of selection are abs (x1) ≠ abs (x2) or abs (y1) ≠ abs (y2), if wherein one The absolute value of x coordinate and the absolute value of y-coordinate of a point are both greater than another point, then pattern distortion type is pincushion distortion, no Then, pattern distortion type is barrel distortion;
Alternatively, on one hook of vertical direction, two intersection point D3 and D4 with horizontal direction hook are chosen, two points Coordinate is D3 (x3, y3), and D4 (x4, y4), the condition of selection is abs (x3) ≠ abs (x4) or abs (y3) ≠ abs (y4), if The absolute value of x coordinate and the absolute value of y-coordinate of one of point are both greater than another point, then pattern distortion type is that pincushion is abnormal Become, otherwise, pattern distortion type is barrel distortion.
5. the pattern distortion antidote according to claim 4 based on conic section, it is characterised in that: in step 4,
If it is barrel distortion, conic section is ellipse, and the coordinate value of D1, D2 are substituted into formula X2/a2+Y2/b2=1, it solves equation To the elliptic equation of the horizontal direction hook where D1, D2: X2/a12+Y2/b12=1, a1 > b1 > 0;
If it is pincushion distortion, conic section is hyperbola, and the coordinate value of D1, D2 are substituted into formula Y2/a2-X2/b2=1, it solves equation Obtain the Hyperbolic Equation formula of the horizontal direction hook where D1, D2: Y2/a22-X2/b22=1, a2 > 0, b2 > 0;
And then obtain the equation of the approximate conic section of pattern distortion vertical direction corresponding position hook:
When barrel distortion, conic section is ellipse, elliptic equation are as follows: Y2/a12+X2/b12=1, a1 > b1 > 0,
When pincushion distortion, conic section is hyperbola, Hyperbolic Equation formula are as follows: X2/a22-Y2/b22=1, a2 > 0, b2 > 0;
The corresponding position are as follows: vertical direction hook is with X-axis intersection point away from the horizontal direction where being equal to D1, D2 at a distance from origin Hook and Y-axis intersection point away from origin at a distance from.
6. the pattern distortion antidote according to claim 5 based on conic section, it is characterised in that: in step 4, such as Fruit is barrel distortion, and conic section is ellipse, and the coordinate value of D3, D4 are substituted into formula Y2/a2+X2/b2=1, solve equation to obtain D3, The elliptic equation of vertical direction hook where D4: Y2/a32+X2/b32=1, a3 > b3 > 0;
If it is pincushion distortion, conic section is hyperbola, and the coordinate value of D3, D4 are substituted into formula X2/a2-Y2/b2=1, it solves equation Obtain the Hyperbolic Equation formula of the vertical direction hook where D3, D4: X2/a42-Y2/b42=1, a4 > 0, b4 > 0.
7. the pattern distortion antidote according to claim 1 based on conic section, it is characterised in that: in step 5.3 In, if can not find identical coordinate value, immediate coordinate value under two index keys is found, by the flat of two coordinate values Position [i, j] in bivariate table is written in mean.
8. the pattern distortion antidote according to claim 1 based on conic section, it is characterised in that: in step 5.3 In, (x, y) round numbers partial write corresponding relationship bivariate table.
9. a kind of real-time apparatus for correcting of pattern distortion is based on including embedded system and the video camera for being equipped with distortion camera lens The corresponding relationship of the fault image and correcting image pixel that obtain in claim 1 is realized, it is characterised in that: embedded system CPU in store fault image and correcting image pixel corresponding relationship;When apparatus for correcting works, it is abnormal that CPU reads each frame The Pixel Information for becoming image, according to corresponding relationship, translation bit postpones write-in correcting image file.
CN201610536266.7A 2016-07-08 2016-07-08 Pattern distortion antidote and real-time apparatus for correcting based on conic section Active CN106204480B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610536266.7A CN106204480B (en) 2016-07-08 2016-07-08 Pattern distortion antidote and real-time apparatus for correcting based on conic section

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610536266.7A CN106204480B (en) 2016-07-08 2016-07-08 Pattern distortion antidote and real-time apparatus for correcting based on conic section

Publications (2)

Publication Number Publication Date
CN106204480A CN106204480A (en) 2016-12-07
CN106204480B true CN106204480B (en) 2018-12-18

Family

ID=57472538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610536266.7A Active CN106204480B (en) 2016-07-08 2016-07-08 Pattern distortion antidote and real-time apparatus for correcting based on conic section

Country Status (1)

Country Link
CN (1) CN106204480B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102016217792A1 (en) * 2016-09-16 2018-03-22 Xion Gmbh alignment system
CN108510549B (en) * 2018-03-27 2022-01-04 京东方科技集团股份有限公司 Distortion parameter measuring method, device and system of virtual reality equipment
CN110544209B (en) 2018-05-29 2022-10-25 京东方科技集团股份有限公司 Image processing method and equipment and virtual reality display device
CN110533618B (en) * 2019-09-03 2022-11-01 西安奇维科技有限公司 Lens distortion correction method and photographic device
CN111768341B (en) * 2020-07-01 2023-09-19 成都国科微电子有限公司 Image processing method and image processing device
CN113158924A (en) * 2021-04-27 2021-07-23 深圳赋能软件有限公司 Speckle image correction method, face recognition method, face correction device and face recognition equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271966A (en) * 2009-01-06 2011-12-07 株式会社伊美吉内柯斯特 Method and apparatus for generating a surrounding image
CN104835159A (en) * 2015-05-07 2015-08-12 中国科学院长春光学精密机械与物理研究所 Digital image correction method for continuous variable-focal-length optical imaging system
CN104917955A (en) * 2014-03-10 2015-09-16 全视技术有限公司 Image Transformation And Multi-View Output Systems And Methods

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4104571B2 (en) * 2004-03-29 2008-06-18 三洋電機株式会社 Distortion correction apparatus and imaging apparatus provided with the distortion correction apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271966A (en) * 2009-01-06 2011-12-07 株式会社伊美吉内柯斯特 Method and apparatus for generating a surrounding image
CN104917955A (en) * 2014-03-10 2015-09-16 全视技术有限公司 Image Transformation And Multi-View Output Systems And Methods
CN104835159A (en) * 2015-05-07 2015-08-12 中国科学院长春光学精密机械与物理研究所 Digital image correction method for continuous variable-focal-length optical imaging system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
二维激光振镜扫描控制系统设计;徐亮亮;《中国优秀硕士学位论文全文数据库》;20130215;正文第36-37页 *

Also Published As

Publication number Publication date
CN106204480A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
CN106204480B (en) Pattern distortion antidote and real-time apparatus for correcting based on conic section
CN104363986B (en) A kind of image processing method and equipment
CN108230397B (en) Multi-view camera calibration and correction method and apparatus, device, program and medium
CN110717942B (en) Image processing method and device, electronic equipment and computer readable storage medium
JP5558973B2 (en) Image correction apparatus, correction image generation method, correction table generation apparatus, correction table generation method, correction table generation program, and correction image generation program
CN108761777B (en) Method and equipment for determining distortion quantity and distortion correction of optical device
CN110060200A (en) Perspective image transform method, device and equipment
CN104994367B (en) A kind of image correction method and camera
TW201541410A (en) Lens distortion calibration method
CN105869142A (en) Method and device for testing imaging distortion of virtual reality helmets
CN102236790B (en) Image processing method and device
CN107871329A (en) A kind of quick calibrating method and device at camera opticses center
CN107657595A (en) A kind of distortion correction method and mobile terminal and related media production
CN116012241A (en) Image distortion correction method, apparatus, computer device, and storage medium
KR20160040330A (en) A method of correcting for distorted image from fish-eye lens by using concentric circles type standard patterns
JP2011155412A (en) Projection system and distortion correction method in the same
CN109087253A (en) A kind of method for correcting image and device
JP2013187822A (en) Correction formula calculation method, correction method, correction apparatus, and imaging apparatus
CN107645634A (en) A kind of undistorted wide angle network video camera and safety defense monitoring system
JP7012058B2 (en) Image correction method and its device
WO2023221290A1 (en) Pixel positioning method, apparatus, and device for curved screen
CN105488764B (en) Fisheye image correcting method and device
JP2006010613A (en) Correcting method of image distortion
JP2019106589A (en) Projector, geometric distortion correction method, and program
JP6273881B2 (en) Image processing apparatus, image processing method, and program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 050000 1006, room 10, block E, Sheng he square, 88 Qilian street, Shijiazhuang high tech Zone, Hebei.

Applicant after: Shijiazhuang Yulian Visual Control Technology Co., Ltd.

Address before: 050000 E, 3rd floor, city hall, 1 mosque street, Xinhua District, Shijiazhuang, Hebei.

Applicant before: Shijiazhuang Yulian Visual Control Technology Co., Ltd.

CB02 Change of applicant information
CB03 Change of inventor or designer information

Inventor after: Luo Qihong

Inventor after: Cao Jing

Inventor after: Zhao Qingbo

Inventor after: Xiong Wei

Inventor after: Hu Chunmei

Inventor after: Miao Junfeng

Inventor before: Luo Qihong

Inventor before: Fan Cuilin

Inventor before: Nie Hongquan

Inventor before: Huo Jingjing

Inventor before: Gu Lin

Inventor before: Li Hui

Inventor before: Li Bingzheng

Inventor before: Gao Haijun

Inventor before: Zhao Caiping

Inventor before: Gao Dingwen

Inventor before: Zhao Zhihui

Inventor before: Dai Mingli

Inventor before: Zhang Peng

Inventor before: Chen Chunfang

Inventor before: Meng Junbo

Inventor before: Yan Jinyao

Inventor before: Gui Shijin

Inventor before: Guo Huanjun

Inventor before: Liu Tingting

Inventor before: Huo Yongle

Inventor before: Niu Yuebin

Inventor before: Zhou Jie

Inventor before: Cao Jing

Inventor before: Zhao Qingbo

Inventor before: Xiong Wei

Inventor before: Hu Chunmei

Inventor before: Luo Zhanhong

Inventor before: Luo Xu

CB03 Change of inventor or designer information
GR01 Patent grant
GR01 Patent grant