Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
As shown in Figure 1, in the hardware running environment that Fig. 1, which is the embodiment of the present invention, to be related to distortion parameter optimization device
The structure diagram of affiliated terminal.
Terminal of the embodiment of the present invention can be PC or smart mobile phone, tablet computer, E-book reader, MP3
(Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio aspect 3)
Player, MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard sound
Frequency aspect 4) player, pocket computer etc. have the packaged type terminal device of display function.
As shown in Figure 1, the terminal can include:Processor 1001, such as CPU, network interface 1004, user interface
1003, memory 1005, communication bus 1002.Wherein, communication bus 1002 is used for realization the connection communication between these components.
User interface 1003 can include display screen (Display), input unit such as keyboard (Keyboard), optional user interface
1003 can also include standard wireline interface and wireless interface.Network interface 1004 can optionally connect including the wired of standard
Mouth, wave point (such as WI-FI interfaces).Memory 1005 can be high-speed RAM memory or the memory of stabilization
(non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor
1001 storage device.
Alternatively, terminal can also include camera, RF (Radio Frequency, radio frequency) circuit, sensor, audio
Circuit, WiFi module etc..Wherein, sensor ratio such as optical sensor, motion sensor and other sensors.Specifically, light
Sensor may include ambient light sensor and proximity sensor, wherein, ambient light sensor can according to the light and shade of ambient light come
The brightness of display screen is adjusted, proximity sensor can close display screen and/or backlight when mobile terminal is moved in one's ear.As
One kind of motion sensor, gravity accelerometer can detect in all directions the size of (generally three axis) acceleration, quiet
It can detect that size and the direction of gravity when only, the application available for identification mobile terminal posture is (such as horizontal/vertical screen switching, related
Game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;Certainly, mobile terminal can also match somebody with somebody
The other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared ray sensor are put, details are not described herein.
It will be understood by those skilled in the art that the restriction of the terminal structure shown in Fig. 1 not structure paired terminal, can wrap
Include than illustrating more or fewer components, either combine some components or different components arrangement.
As shown in Figure 1, it can lead to as in a kind of memory 1005 of computer-readable storage medium including operating system, network
Believe the optimizing program of module, Subscriber Interface Module SIM and distortion parameter.
In the terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, is carried out with background server
Data communication;User interface 1003 is mainly used for connecting client (user terminal), with client into row data communication;And processor
1001 can be used for calling the optimizing program of distortion parameter stored in memory 1005.
In the present embodiment, the optimization device of distortion parameter includes:Memory 1005, processor 1001 and it is stored in described
On memory and the optimizing program of distortion parameter that can run on the processor, wherein:
When processor 1001 calls the optimizing program of the distortion parameter stored in memory 1005, following operation is performed:
The corresponding first parameter set group of fish eye images is obtained, wherein, the first parameter set group includes multigroup parameter set;
According to of the first preset order successively based on the parameter set in the first parameter set group, and the fish eye images
One feature point set, calculates the corresponding first straight line degree error of each parameter set in the first parameter set group;
Based on the corresponding parameter set of first straight line degree error for meeting preset condition in the first parameter set group, institute is generated
The corresponding second parameter set group of fish eye images is stated, wherein, the second parameter set group includes multigroup parameter set;
According to of the second preset order successively based on the parameter set in the second parameter set group, and the fish eye images
One feature point set, calculates the corresponding second straight line degree error of each parameter set in the second parameter set group;
Obtain the corresponding parameter set of straightness error minimum in the second straight line degree error, and the parameter that will be got
Target distortion parameter of the distortion parameter of concentration as the fish eye images.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
The fisrt feature point set of the fish eye images is obtained according to the first preset rules;
According to the first preset order successively based on the parameter set in the first parameter set group, and the fisrt feature got
Point set calculates the second feature point set of target image;
Based on the second feature point set being calculated, the first straight line degree error is calculated.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
Obtain the default center point coordinates of the target image;
According to the first preset order successively based on the parameter set in the first parameter set group, the fisrt feature point set and described
Default center point coordinates, calculates the second feature point set.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
The first straight line equation and Ge Lie of the second feature point set corresponding each row are calculated according to the first preset rules
Second straight line equation;
The coordinate of each characteristic point is concentrated to calculate row error according to the first straight line equation and second feature point, and
The coordinate for concentrating each characteristic point according to the second straight line equation and second feature point calculates row error;
Based on first straight line degree error described in each row error and each row error calculation.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
Calculated successively based on the parameter set in the second parameter set group, and the fisrt feature point set according to the second preset order
The third feature point set of target image;
Based on the third feature point set being calculated, the second straight line degree error is calculated.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
Obtain the default center point coordinates of the target image;
According to the second preset order successively based on the parameter set in the second parameter set group, the fisrt feature point set and described
Default center point coordinates, calculates the third feature point set.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
The adjusting range of centre coordinate, center of distortion based on the fish eye images, calculates the value of center of distortion coordinate
Scope;
The scaling coefficient of reference radius and distortion radius based on the fish eye images, calculates the value model of distortion radius
Enclose;
Value range, the first adjusting step of value range based on center of distortion coordinate, the radius that distorts, obtain described the
One parameter set group.
Further, processor 1001 can call the optimizing program of the distortion parameter stored in memory 1005, also hold
The following operation of row:
Obtain the corresponding parameter set of straightness error of preceding predetermined number minimum in the first straight line degree error;
Successively according to the parameter set and second adjustment step-length got, the second parameter set group is generated.
First embodiment of the invention provides a kind of optimization method of distortion parameter, and with reference to Fig. 2, Fig. 2 joins for present invention distortion
The flow diagram of several optimization method first embodiments, the optimization method of the distortion parameter include:
Step S100, obtains the corresponding first parameter set group of fish eye images, wherein, the first parameter set group includes multigroup
Parameter set;
The distortion correction of fish eye images is put down firstly the need of fish-eye geometrical model is established further according to geometrical relationship
Face perspective projection correction.Used in the present embodiment using equidistant projection model, this geometrical model in camera lens manufacture
It is most extensive, and carry out preferably a kind of geometrical model of effect during correcting fisheye image.Due to the correcting fisheye image of the present invention
Using equidistant projection model in method, therefore its distortion parameter is mainly center of distortion coordinate and the distortion half of fish eye images
Footpath, center of distortion coordinate can be refined as the X-coordinate of horizontal direction and the Y-coordinate of vertical direction again.Fish eye images corresponding
One parameter set group includes multigroup parameter set, wherein, each group of parameter set all includes 3 kinds of distortion parameters, and the first distortion parameter refers to
The used distortion parameter when first time determining distortion parameter scope.
In the present embodiment, center of distortion point coordinates value range and the radius that distorts can be set to take according to preset rules
It is worth scope, while one the first adjusting step of the parameter setting such as resolution ratio according to fish eye images, it is preferable that in the present embodiment
Fish eye images resolution ratio is 1280 × 720, therefore the first adjusting step is arranged to 10.Wherein, center of distortion point coordinates value
Scope and the calculation formula of value range for the radius that distorts are respectively:
CenterX ∈ [ImgCenterX-Range, ImgCenterX+Range]
CenterY ∈ [ImgCenterY-Range, ImgCenterY+Range]
R ∈ [REFER_R*MinCoe, REFER_R*MaxCoe]
Wherein, Center X and Center Y are required center of distortion X-coordinate and Y-coordinate, and R is required distortion half
Footpath, ImgCenterX and ImgCenterY are the central point X-coordinate and Y-coordinate of fish eye images to be corrected, and REFER_F is user's root
According to the reference radius set by the size of fish eye images to be corrected, it is preferable that point of the fish eye images to be corrected in the present embodiment
Resolution is 1280 × 720, therefore reference radius is arranged to 600.Range is the adjusting range of center of distortion, it is preferable that this reality
It is 100 to apply the Range values in example.MaxCoe and MinCoe is respectively the scaling coefficient of distortion radius, it is preferable that this implementation
MaxCoe and MinCoe in example are respectively 1.2 and 0.8.For example, the fish-eye image to be corrected that a resolution ratio is 1280 × 720
The centre coordinate of picture is (640,360), and the adjusting range of center of distortion is 100, can obtain the value of center of distortion point X-coordinate
Scope is (540,740), and the value range of center of distortion point Y-coordinate is (260,460);The value of reference radius is 600, then is divided
Be not multiplied by scaling coefficient can obtain distortion radius value range be (480,720).Due in the present embodiment, adjusting step
Value be 10, according to adjusting step travel through three the first distortion parameters value range can obtain their value set,
The value set of center of distortion point X-coordinate respectively, i.e. CenterX ∈ { 540,550,560...730,740 }, center of distortion
The value set of point Y-coordinate, i.e. CenterY ∈ { 260,270,280...450,460 }, and the value collection of distortion radius R
Close, i.e. R ∈ { 480,490,500...700,710,720 }.
Afterwards, operation is combined to the element in the value set of the first distortion parameter of above three so that wherein every
One element can carry out all possible combination with the element in two other set, wherein, total combined number is equal to
The element number that element number in the point X-coordinate value set of center of distortion is multiplied by the point Y-coordinate value set of center of distortion multiplies
With the element number in the radius R value set that distorts.For example, 2 elements are included in the value set of center of distortion point X-coordinate,
It is [1,2] that 2 elements are included in the value set of center of distortion point Y-coordinate, are [3,4] respectively respectively, the value for the radius that distorts
2 elements [5,6] are included in set, then after permutation and combination is carried out to the value set of first distortion parameter, can be obtained
To the combination of all possible distortion parameter include:(1,3,5), (2,3,5), (Isosorbide-5-Nitrae, 5), (2,4,5), (1,3,6), (2,
3,6), (Isosorbide-5-Nitrae, 6), (2,4,6).By the value set of all first distortion parameters obtain after permutation and combination it is all can
The combination of energy, is the first parameter set group, wherein comprising multigroup parameter set, each parameter set includes three parameters, is respectively
Center of distortion point X-coordinate, center of distortion point Y-coordinate and distortion radius R.
Step S200, according to the first preset order successively based on the parameter set in the first parameter set group and the flake
The fisrt feature point set of image, the corresponding first straight line degree of each parameter set calculated in the first parameter set group miss
Difference;
The present embodiment is merely able to, and the chessboard cloth angle point on to fish eye images to be corrected obtains by way of demarcating
Fisrt feature point set.Preferably, in the present embodiment by the way of black and white chessboard calibration to the spy on fish eye images to be corrected
Sign point set is demarcated and is determined as fisrt feature point set.M row N row feature point sets can be got on fish eye images to be corrected
{(uij, vij), 0≤i<M, 0≤j<N, wherein uijFor abscissa of this on fish eye images, vijIt is the point in fish eye images
On ordinate.
Processor can select all parameter sets from the first parameter set group successively according to the first preset order, based on parameter set
Calculate the corresponding second feature point set of fisrt feature point set.First preset order refers to the value collection from center of distortion point X-coordinate
In conjunction according to from small to large take out a value in turn and then successively from the value set of center of distortion point Y-coordinate and abnormal
Become in the set of radius R according to the ginseng for taking out a value in turn and being combined in one the first parameter set group of generation from small to large
Manifold, until taking all possible situation, it is readily appreciated that, three parameters in the first distortion parameter can use from big to small
It is smooth or from small to large be smoothed out value, therefore, the first preset order can be above three parameter value order
Any combination, its process is similar with the above process, and details are not described herein.For a specific parameter set (CenterX,
CenterY, R), each that fisrt feature point is concentrated can be calculated according to the following equation out and put corresponding second feature point set
In corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting,
(AmdImgCenterX, AmdImgCenterY) be default correction after picture centre point coordinates, (CenterX, CenterY)
For center of distortion coordinate, R is distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one of extraction
A fish eye images characteristic point { (uij, vij) corresponding to correction after image second feature point concentrate point { (xij, yij), 0≤i<
M, 0≤j<N.
Based on the second feature point set being calculated, straightness error is calculated.Since the distortion at fish eye images center is opposite
Minimum, therefore most middle 2 points chosen per a line can determine M linear equation fm(x), 0≤m<M, based on the M straight line
The all elements of equation and second feature point set point, the horizontal direction straightness that can calculate all the points according to the following equation miss
Difference:
Similarly, N number of linear equation f can be determined by choosing each most middle 2 points of rown(x), 0≤n<N is N number of straight based on this
The all elements of line equation and second feature point set point, can calculate the vertical direction straightness of all the points according to the following equation
Error:
The straightness error of straightness error and vertical direction based on above-mentioned horizontal direction, can obtain according to the following equation
To total straightness error:
Error=Errorhor+Errorver
The total straightness error being calculated is the straightness error of the specific set of parameters.For the first parameter set group
In any one parameter set, corresponding first straight line degree error can be calculated according to above-mentioned steps and formula.
Step S300, based on the corresponding parameter of first straight line degree error for meeting preset condition in the first parameter set group
Collection, generates the corresponding second parameter set group of the fish eye images, wherein, the second parameter set group includes multigroup parameter set;
After the corresponding first straight line degree error group of all parameter sets in obtaining the first parameter set group, it is arranged
Sequence, exports the corresponding parameter set of preceding Z straightness error of minimum.Preferably, exported in the present embodiment after sequence terminates
Three groups of parameter sets of straightness error minimum, afterwards readjust it according to preset rules, so as to obtain new parameter
The value range of collection.In the present embodiment, user can according to preset formula arrange parameter concentrate center of distortion point coordinates and
The adjusting range of distortion radius, concurrently sets a second adjustment step-length, it is preferable that the second adjustment step-length in the present embodiment is set
It is set to 1.Preset rules mainly include 3 formula:
CenterX∈[CenterXk- NEW_RANGE, CenterXk+NEW_RANGE]
CenterY∈[CenterYk- NEW_RANGE, CenterYk+NEW_RANGE]
R ∈ [R-NEW_RANGE, R+NEW_RANGE]
Wherein, NEW_RANGE is new parameter adjustment scope, it is preferable that NEW_RANGE is arranged to 10 in the present embodiment,
I.e. new value range is adjusted to 10, and each parameter adjustment step-length is 1, i.e. PARAMS_STEP is 1.Second distortion parameter refers to
The distortion parameter got based on the first distortion parameter, including center of distortion X-coordinate, center of distortion Y-coordinate and distortion radius
This 3 parameters.For the distortion parameter in each parameter set, processor can be pressed in the adjusting range of the distortion parameter
Whole value range is traveled through from small to large successively according to second adjustment step-length.For each distortion parameter, take all
After possible values, all numerical value got are put into the set of establishment, generate the second distortion parameter of the fish eye images
Corresponding second parameter set group, including, the value set of the X-coordinate of center of distortion, the value set of the Y-coordinate of center of distortion,
And the value set of distortion radius.For example, preceding 3 parameter set groups of straightness error minimum are (Isosorbide-5-Nitraes, 7), (2,5,8), (3,
6,9), it is meant that the corresponding center of distortion X-coordinate of first three minimum straightness error includes [1,2,3], center of distortion Y-coordinate
Including [4,5,6], distortion radius R includes [7,8,9], and a distortion ginseng is generated all in accordance with preset rules to each of which value
Several value ranges, can generate the value range of [- 9,11] when center of distortion X-coordinate takes 1, simultaneously because second adjustment walks
Long value be 1, can obtain corresponding center of distortion X-coordinate when center of distortion X coordinates take 1 value range -9, -8 ...,
0,1,2 ..., 10,11 }, correspondingly, the value of corresponding center of distortion X-coordinate when center of distortion X-coordinate takes 2 can be obtained
Scope -8, -7 ..., 1,2,3 ... and 11,12 }, the value model of corresponding center of distortion X-coordinate when center of distortion X-coordinate takes 3
Enclose -7, -6 ..., 2,3,4 ..., 12,13], after collecting, the value set of center of distortion X-coordinate in the second distortion parameter
For [- 9, -8 ..., 0,1,2,3,4 ..., 12,13].Similarly, center of distortion Y-coordinate in the second distortion parameter can be obtained
Value collection is combined into [- 6, -5 ..., 3,4,5,6,7 ..., 15,16], and the value for the radius R that distorts in the second distortion parameter
Collection is combined into [- 3, -2 ..., 6,7,8,9,10 ..., 18,19].Arrangement group is carried out to the value set of first distortion parameter
After conjunction, the combination of available all possible distortion parameter is the first parameter set group, and in the present embodiment, one is shared
23 × 23 × 23 groups of parameter sets, each parameter set include three parameters, are center of distortion point X-coordinate respectively, center of distortion point Y
Coordinate and distortion radius R.
Step S400, according to the second preset order successively based on the parameter set in the second parameter set group, and the fish
The fisrt feature point set of eye pattern picture, the corresponding second straight line degree of each parameter set calculated in the second parameter set group miss
Difference;
Second preset order refers to from the parameters set that the second distortion parameter includes according to order from small to large
Value is selected successively form set, specifically, according to from small to large first from the value set of center of distortion point X-coordinate
Take out in turn a value and then successively from the value set of center of distortion point Y-coordinate and the set of distortion radius R according to
From small to large take out in turn a value be combined generation one the first parameter set group in parameter set, until take it is all can
Can situation, it is readily appreciated that, three parameters in the first distortion parameter can use from big to small smooth or from small to large
Be smoothed out value, therefore, the first preset order can be above three parameter value order any combination, its process with it is upper
It is similar to state process, details are not described herein obtains M row N row fisrt feature point sets according to presetting method on fish eye images to be corrected
{(uij, vij), 0≤i<M, 0≤j<N, wherein uijFor abscissa of this on fish eye images, vijIt is the point in fish eye images
On ordinate.
Processor can select all parameter sets from the second parameter set group successively according to the second preset order, for a spy
Fixed parameter set, can be calculated according to the following equation out each corresponding third feature point set of point of fisrt feature point concentration
In corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting,
(AmdImgCenterX, AmdImgCenterY) is picture centre point coordinates after default correction, and (CenterX, CenterY) is
Center of distortion coordinate, R are distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one extracted
Fish eye images characteristic point { (uij, vij) corresponding to correction after image third feature point concentrate point { (xij, yij), 0≤i<M,
0≤j<N。
Based on the third feature point set being calculated, straightness error is calculated.Since the distortion at fish eye images center is opposite
Minimum, therefore most middle 2 points chosen per a line can determine M linear equation fm (x), 0≤m<M, based on the M straight line
The all elements of equation and third feature point set point, the horizontal direction straightness that can calculate all the points according to the following equation miss
Difference:
Similarly, N number of linear equation fn (x), 0≤n can be determined by choosing each most middle 2 points of row<N is N number of straight based on this
The all elements of line equation and third feature point set point, can calculate the vertical direction straightness of all the points according to the following equation
Error:
The straightness error of straightness error and vertical direction based on above-mentioned horizontal direction, can obtain according to the following equation
To total straightness error:
Error=Errorhor+Errorver
The total straightness error being calculated is the straightness error of the specific set of parameters.For the first parameter set group
In any one parameter set, corresponding second straight line degree error can be calculated according to above-mentioned steps and formula.
Step S500, obtains the corresponding parameter set of straightness error minimum in the second straight line degree error, and will obtain
Target distortion parameter of the distortion parameter as the fish eye images in the parameter set got.
After the corresponding second straight line degree error group of all parameter sets in obtaining the second parameter set group, it is arranged
Sequence, exports the corresponding parameter set of straightness error of minimum.The distortion parameter that the parameter set includes is determined as fish eye images
Target distortion parameter.
The optimization method of distortion parameter in the present embodiment, by obtaining the corresponding first parameter set group of fish eye images, its
In, the first parameter set group includes multigroup parameter set;Then first parameter set is based on successively according to the first preset order
Parameter set in group, and the fisrt feature point set of the fish eye images, calculate each ginseng in the first parameter set group
The corresponding first straight line degree error of manifold;It is next based on meeting in the first parameter set group that the first straight line degree of preset condition misses
The corresponding parameter set of difference, generates the corresponding second parameter set group of the fish eye images, wherein, the second parameter set group includes more
Group parameter set;Afterwards according still further to the second preset order successively based on the parameter set in the second parameter set group, and the flake
The fisrt feature point set of image, the corresponding second straight line degree of each parameter set calculated in the second parameter set group miss
Difference;Then the corresponding parameter set of straightness error minimum in the second straight line degree error, and the ginseng that will be got are obtained again
Target distortion parameter of the distortion parameter as the fish eye images in manifold, improves the low optimization accuracy and standard to distortion parameter
Exactness, avoids the shortcomings that existing method depends on fish eye images circular contour, can effectively utilize line constraint generation school
Plus effect is more conform with desired image, and solid foundation is provided for follow-up image registration.
Based on first embodiment, the second embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 3, at this
In embodiment, step S200 includes:
Step S210, the fisrt feature point set of the fish eye images is obtained according to the first preset rules;
The method for obtaining fisrt feature point set is to the chessboard cloth angle point on fish eye images to be corrected according to presetting method
Demarcated, so as to obtain the feature point set of fish eye images to be corrected.Preferably, in the present embodiment using black and white chessboard calibration
Method the feature point set on fish eye images to be corrected is demarcated and is determined as fisrt feature point set.In fish-eye image to be corrected
M row N row feature point sets { (uij, vij) }, 0≤i can be got on picture<M, 0≤j<N, wherein uij are the point in fish-eye image
As upper abscissa, vij is ordinate of this on fish eye images.
Step S220, according to the first preset order successively based on the parameter set in the first parameter set group, and the institute got
State the second feature point set that fisrt feature point set calculates target image;
Processor can select all parameter sets from the first parameter set group successively according to the first preset order, based on parameter set
Calculate the corresponding second feature point set of fisrt feature point set.First preset order refers to the value collection from center of distortion point X-coordinate
In conjunction according to from small to large take out a value in turn and then successively from the value set of center of distortion point Y-coordinate and abnormal
Become in the set of radius R according to the ginseng for taking out a value in turn and being combined in one the first parameter set group of generation from small to large
Manifold, until taking all possible situation, it is readily appreciated that, three parameters in the first distortion parameter can use from big to small
It is smooth or from small to large be smoothed out value, therefore, the first preset order can be above three parameter value order
Any combination, its process is similar with the above process, and details are not described herein.For a specific parameter set (CenterX,
CenterY, R), each that fisrt feature point is concentrated can be calculated according to the following equation out and put corresponding second feature point set
In corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting
(AmdImgCenterX, AmdImgCenterY) be default correction after picture centre point coordinates, (CenterX, CenterY)
For center of distortion coordinate, R is distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one of extraction
The point { (xij, yij) } that image second feature point is concentrated after correction corresponding to a fish eye images characteristic point { (uij, vij) }, 0
≤i<M, 0≤j<N.
Step S230, based on the second feature point set being calculated, calculates the first straight line degree error.
Based on the second feature point set being calculated, straightness error is calculated.Since the distortion at fish eye images center is opposite
Minimum, therefore most middle 2 points chosen per a line can determine M linear equation fm (x), 0≤m<M, based on the M straight line
The all elements of equation and second feature point set point, the horizontal direction straightness that can calculate all the points according to the following equation miss
Difference:
Similarly, N number of linear equation fn (x), 0≤n can be determined by choosing each most middle 2 points of row<N is N number of straight based on this
The all elements of line equation and second feature point set point, can calculate the vertical direction straightness of all the points according to the following equation
Error:
The straightness error of straightness error and vertical direction based on above-mentioned horizontal direction, can obtain according to the following equation
To total straightness error:
Error=Errorhor+Errorver
The total straightness error being calculated is the straightness error of the specific set of parameters.For the first parameter set group
In any one parameter set, corresponding first straight line degree error can be calculated according to above-mentioned steps and formula.
The optimization method of distortion parameter in the present embodiment, by obtaining the fish eye images according to the first preset rules
Fisrt feature point set;Then according to the first preset order successively based on the parameter set in the first parameter set group, and the institute got
State the second feature point set that fisrt feature point set calculates target image;Afterwards again based on the second feature point being calculated
Collection, calculates the first straight line degree error, improves the accuracy of the second parameter set group, and then can improve first straight line degree mistake
The accuracy of difference, further increases low optimization accuracy and the accuracy of distortion parameter.
Based on second embodiment, the 3rd embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 4, at this
In embodiment, step S220 includes:
Step S221, obtains the default center point coordinates of the target image;
Since target image needs to meet certain size requirement after the corresponding correction of fish eye images, in distortion parameter
Searching process before, can judge as the case may be correction after target image size, and then determine target image it is pre-
If center point coordinate.
Step S222, according to the first preset order successively based on the parameter set in the first parameter set group, the fisrt feature
Point set and the default center point coordinates, calculate the second feature point set.
Processor can select all parameter sets from the first parameter set group successively according to the first preset order, based on parameter set
Calculate the corresponding second feature point set of fisrt feature point set.First preset order refers to the value collection from center of distortion point X-coordinate
In conjunction according to from small to large take out a value in turn and then successively from the value set of center of distortion point Y-coordinate and abnormal
Become in the set of radius R according to the ginseng for taking out a value in turn and being combined in one the first parameter set group of generation from small to large
Manifold, until taking all possible situation, it is readily appreciated that, three parameters in the first distortion parameter can use from big to small
It is smooth or from small to large be smoothed out value, therefore, the first preset order can be above three parameter value order
Any combination, its process is similar with the above process, and details are not described herein.For a specific parameter set (CenterX,
CenterY, R), each that fisrt feature point is concentrated can be calculated according to the following equation out and put corresponding second feature point set
In corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting,
(AmdImgCenterX, AmdImgCenterY) be default correction after picture centre point coordinates, (CenterX, CenterY)
For center of distortion coordinate, R is distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one of extraction
The point { (xij, yij) } that image second feature point is concentrated after correction corresponding to a fish eye images characteristic point { (uij, vij) }, 0
≤i<M, 0≤j<N.
The optimization method of distortion parameter in the present embodiment, by the default center point coordinates for obtaining the target image;
Then according to the first preset order successively based on the parameter set in the first parameter set group, the fisrt feature point set and described default
Center point coordinate, calculates the second feature point set;First has been calculated based on each parameter set in the second parameter set group
The corresponding second feature point set of feature point set, can be accurately obtained second feature point set, improve the standard of the second parameter set group
Exactness, and then can improve the accuracy of first straight line degree error, further increases the low optimization accuracy of distortion parameter and accurate
Degree.
Based on second embodiment, the fourth embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 5, at this
In embodiment, step S230 includes:
Step S231, the first straight line equation of the corresponding each row of the second feature point set is calculated according to the second preset rules
With the second straight line equation of each row;
Since the distortion at fish eye images center is relatively minimal, can be determined by choosing at most middle 2 points per a line by M
Linear equation fm (x), 0≤m<M;Similarly, N number of linear equation fn (x), 0≤n can be determined by choosing each most middle 2 points of row<
N.Second preset rules refer to 2 points of equations that can determine straight line in plane, since the two point form equation is existing skill
Art, details are not described herein.
If the feature points of the row or column are even number, most middle 2 points of calculating linear equation is selected;If the row or
The feature points of row are odd number, select the characteristic point of most middle both sides to calculate linear equation.
Step S232, the coordinate for concentrating each characteristic point according to the first straight line equation and second feature point calculate
Row error, and concentrate the coordinate of each characteristic point to calculate row error according to the second straight line equation and second feature point;
All elements point based on the M linear equation and second feature point set, can calculate institute according to the following equation
Horizontal direction straightness error a little:
Similarly, all elements point based on N number of linear equation and second feature point set, can calculate according to the following equation
Go out the vertical direction straightness error of all the points:
Step S233, based on first straight line degree error described in each row error and each row error calculation.
The straightness error of straightness error and vertical direction based on above-mentioned horizontal direction, can obtain according to the following equation
To total straightness error:
Error=Errorhor+Errorver
The total straightness error being calculated is the straightness error of the specific set of parameters.For the first parameter set group
In any one parameter set, corresponding first straight line degree error can be calculated according to above-mentioned steps and formula.
The optimization method of distortion parameter in the present embodiment, is first according to the second preset rules and calculates the second feature point
Collect the first straight line equation of corresponding each row and the second straight line equation of Ge Lie;Then according to the first straight line equation and described
Second feature point concentrates the coordinate of each characteristic point to calculate row error, and according to the second straight line equation and the second feature
Point concentrates the coordinate of each characteristic point to calculate row error;It is based on each row error and each row error calculation again afterwards
The first straight line degree error.All parameter sets have been carried out to screen for the first time using the method for comparing first straight line degree error,
Retain qualified parameter set and carry out next step screening, improve the Searching efficiency of distortion parameter, improve first straight line degree
The accuracy of error, further increases low optimization accuracy and the accuracy of distortion parameter, save technical staff time and
The limited resources of processor.
Based on first embodiment, the 5th embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 6, at this
In embodiment, step S400 includes:
Step S410, according to the second preset order successively based on the parameter set in the second parameter set group, and first spy
Levy the third feature point set that point set calculates target image;
Second preset order refers to from the parameters set that the second distortion parameter includes according to order from small to large
Value is selected successively form set, specifically, according to from small to large first from the value set of center of distortion point X-coordinate
Take out in turn a value and then successively from the value set of center of distortion point Y-coordinate and the set of distortion radius R according to
From small to large take out in turn a value be combined generation one the first parameter set group in parameter set, until take it is all can
The situation of energy.
After getting fisrt feature point set, processor can be selected from the second parameter set group successively according to the second preset order
Go out all parameter sets, for a specific parameter set, the every of fisrt feature point concentration can be calculated according to the following equation out
The corresponding third feature point of one point concentrates corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting,
(AmdImgCenterX, AmdImgCenterY) be default correction after picture centre point coordinates, (CenterX, CenterY)
For center of distortion coordinate, R is distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one of extraction
The point { (xij, yij) } that image third feature point is concentrated after correction corresponding to a fish eye images characteristic point { (uij, vij) }, 0
≤i<M, 0≤j<N.
Step S420, based on the third feature point set being calculated, calculates the second straight line degree error.
Based on the third feature point set being calculated, straightness error is calculated.Since the distortion at fish eye images center is opposite
Minimum, therefore most middle 2 points chosen per a line can determine M linear equation fm (x), 0≤m<M, based on the M straight line
The all elements of equation and third feature point set point, the horizontal direction straightness that can calculate all the points according to the following equation miss
Difference:
Similarly, N number of linear equation fn (x), 0≤n can be determined by choosing each most middle 2 points of row<N is N number of straight based on this
The all elements of line equation and third feature point set point, can calculate the vertical direction straightness of all the points according to the following equation
Error:
The straightness error of straightness error and vertical direction based on above-mentioned horizontal direction, can obtain according to the following equation
To total straightness error:
Error=Errorhor+Errorver
The total straightness error being calculated is the straightness error of the specific set of parameters.For the first parameter set group
In any one parameter set, corresponding second straight line degree error can be calculated according to above-mentioned steps and formula.
The optimization method of distortion parameter in the present embodiment, is first according to the second preset order and is based on the second parameter set successively
Parameter set in group, and the fisrt feature point set calculate the third feature point set of target image;It is then based on what is be calculated
The third feature point set, calculates the second straight line degree error.The calculating of second straight line degree error is to be based on the second parameter set
What group was calculated, the small but excellent degree of parameters obtained collection scope is high, can get the parameter being not included in the first parameter set group
Collect data, improve low optimization accuracy and the accuracy of distortion parameter, further increase the accuracy to correcting fisheye image.
Based on the 5th embodiment, the sixth embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 7, at this
In embodiment, step S410 includes:
Step S411, obtains the default center point coordinates of the target image;
Since target image needs to meet certain size requirement after the corresponding correction of fish eye images, in distortion parameter
Searching process before, can judge as the case may be correction after target image size, and then determine target image it is pre-
If center point coordinate.
Step S412, according to the second preset order successively based on the parameter set in the second parameter set group, the fisrt feature
Point set and the default center point coordinates, calculate the third feature point set.
Processor can select all parameter sets from the second parameter set group successively according to the second preset order, for a spy
Fixed parameter set, can be calculated according to the following equation out each corresponding third feature point set of point of fisrt feature point concentration
In corresponding point:
Wherein, (u, v) is a bit on fish eye images to be corrected, and (x, y) is a bit on image after correcting,
(AmdImgCenterX, AmdImgCenterY) be default correction after picture centre point coordinates, (CenterX, CenterY)
For center of distortion coordinate, R is distortion radius.According to above-mentioned formula, fisrt feature point can be calculated and concentrate any one of extraction
The point { (xij, yij) } that image third feature point is concentrated after correction corresponding to a fish eye images characteristic point { (uij, vij) }, 0
≤i<M, 0≤j<N.
The optimization method of distortion parameter in the present embodiment, by the default center point coordinates for obtaining the target image;
Then according to the first preset order successively based on the parameter set in the second parameter set group, the fisrt feature point set and described default
Center point coordinate, calculates the third feature point set.Second parameter set group optimizes to obtain based on the first parameter set group, can be with
So that third feature point set is optimized on the basis of second feature point set, the precision of third feature point set is improved, so that
Improve the optimizing quality of distortion parameter.
Based on first embodiment, the 7th embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 8, at this
In embodiment, step S100 includes:
Step S110, the adjusting range of centre coordinate, center of distortion based on the fish eye images, calculates center of distortion and sits
Target value range;
User can set distortion based on the center point coordinate of fish eye images to be corrected and the adjusting range of center of distortion
The value range of centre coordinate.The adjusting range of center of distortion can voluntarily be set by user, it is preferable that abnormal in the present embodiment
The adjusting range value at change center is 100.When getting the central point X-coordinate and Y-coordinate of fish eye images to be corrected, processor
The value range of center of distortion X coordinates and Y-coordinate can be calculated according to the following equation:
CenterX ∈ [ImgCenterX-Range, ImgCenterX+Range]
CenterY ∈ [ImgCenterY-Range, ImgCenterY+Range]
R ∈ [REFER_R*MinCoe, REFER_R*MaxCoe]
Wherein, Center X and Center Y are required center of distortion X-coordinate and Y-coordinate, and R is required distortion half
Footpath, ImgCenterX and ImgCenterY are the central point X-coordinate and Y-coordinate of fish eye images to be corrected, and Range is center of distortion
Adjusting range.For example, the centre coordinate for the fish eye images to be corrected that a resolution ratio is 1280 × 720 is (640,360),
The adjusting range of center of distortion is 100, therefore the value range that can obtain center of distortion point X-coordinate is (540,740), distortion
The value range of central point Y coordinates is (260,460).
Step S120, the scaling coefficient of reference radius and distortion radius based on the fish eye images, calculates distortion radius
Value range;
User can set the value range of distortion radius based on the scaling coefficient of reference radius and distortion radius.With reference to
The adjusting range of radius can voluntarily be set by user, it is preferable that due to the fish eye images to be corrected used in the present embodiment
Resolution ratio be 1280 × 720, therefore reference radius is arranged to 600, meanwhile, MaxCoe and MinCoe are respectively set to
1.2 and 0.8.When getting the reference radius and distortion parameter of fish eye images to be corrected, processor can be according to following public affairs
Formula calculates the value range of distortion radius R:
R ∈ [REFER_R*MinCoe, REFER_R*MaxCoe]
Wherein, REFER_F is reference radius of the user according to set by the size of fish eye images to be corrected,.For example, one
Resolution ratio is that the centre coordinate of 1280 × 720 fish eye images to be corrected is (640,360), and MaxCoe and MinCoe are respectively
The scaling coefficient of distortion radius.For example, the value of reference radius is 600, then scaling coefficient is multiplied by respectively can obtain distortion half
The value range in footpath is (480,720).
Step S130, the value range based on center of distortion coordinate, value range, the first adjusting step of the radius that distorts,
Obtain the first parameter set group.
In the present embodiment, user can set center of distortion point coordinates value range and distortion radius according to preset rules
Value range, concurrently set first adjusting step, it is preferable that the first adjusting step in the present embodiment is arranged to 10.
For each distortion parameter, processor can in the value range of the distortion parameter, according to the first adjusting step successively from
It is small to being traveled through to whole value range greatly.Afterwards, the element in the set of the first distortion parameter of above three is arranged
Row combination operation so that each of which element can carry out all possible combination with the element in two other set,
Wherein, the element number that total combined number is equal in the point X-coordinate value set of center of distortion is multiplied by center of distortion point Y coordinates
Element number in value set is multiplied by the element number in distortion radius R value set.For example, center of distortion point X-coordinate
2 elements are included in value set, are respectively [1,2], 2 elements are included in the value set of center of distortion point Y coordinates, point
It is not [3,4], 2 elements [5,6] is included in the value set for the radius that distorts, then in the value collection to first distortion parameter
Close after carrying out permutation and combination, the combination of available all possible distortion parameter includes:(1,3,5), (2,3,5), (1,
4,5), (2,4,5), (1,3,6), (2,3,6), (Isosorbide-5-Nitrae, 6), (2,4,6).By the value set of all first distortion parameters into
The all possible combination obtained after row permutation and combination, is the first parameter set group, wherein comprising multigroup parameter set, each
Parameter set includes three parameters, is center of distortion point X-coordinate, center of distortion point Y-coordinate and distortion radius R respectively.
The optimization method of distortion parameter in the present embodiment, be primarily based on the fish eye images centre coordinate, distortion in
The adjusting range of the heart, calculates the value range of center of distortion coordinate;It is then based on reference radius and the distortion of the fish eye images
The scaling coefficient of radius, calculates the value range of distortion radius;Value range again based on center of distortion coordinate, distortion half afterwards
The value range in footpath, the first adjusting step, obtain the first parameter set group.The first parameter set group is carried out by empirical method
Estimation, meets the basic demand of image rectification, and the process for obtaining distortion parameter is simplified by the means of science, is improved abnormal
The low optimization accuracy of variable element.
Based on above-described embodiment, the 8th embodiment of the optimization method of proposition distortion parameter of the present invention, with reference to Fig. 9, at this
In embodiment, step S300 includes:
Step S310, obtains the corresponding ginseng of straightness error of preceding predetermined number minimum in the first straight line degree error
Manifold;
After the corresponding first straight line degree error group of all parameter sets in obtaining the first parameter set group, it is arranged
Sequence, exports the corresponding parameter set of preceding Z straightness error of minimum.Preferably, exported in the present embodiment after sequence terminates
Three groups of parameter sets of straightness error minimum, afterwards readjust it according to preset rules, so as to obtain new parameter
The value range of collection.
Step S320, successively according to the parameter set and second adjustment step-length got, generates second parameter set
Group.
In the present embodiment, the center of distortion point coordinates and distortion half that user can concentrate according to preset formula arrange parameter
The adjusting range in footpath, concurrently sets a second adjustment step-length, it is preferable that the second adjustment step-length in the present embodiment is arranged to 1.
Preset rules mainly include 3 formula:
CenterX∈[CenterXk- NEW_RANGE, CenterXk+NEW_RANGE]
CenterY∈[CenterYk- NEW_RANGE, CenterYk+NEW_RANGE]
R ∈ [R-NEW_RANGE, R+NEW_RANGE]
Wherein, NEW_RANGE is new parameter adjustment scope, it is preferable that NEW_RANGE is arranged to 10 in the present embodiment,
I.e. new value range is adjusted to 10, and each parameter adjustment step-length is 1, i.e. PARAMS_STEP is 1.Second distortion parameter refers to
The distortion parameter got based on the first distortion parameter, including center of distortion X-coordinate, center of distortion Y-coordinate and distortion radius
This 3 parameters.For the distortion parameter in each parameter set, processor can be pressed in the adjusting range of the distortion parameter
Whole value range is traveled through from small to large successively according to second adjustment step-length.For each distortion parameter, take all
After possible values, all numerical value got are put into the set of establishment, generate the second distortion parameter of the fish eye images
Corresponding second parameter set group, including, the value set of the X-coordinate of center of distortion, the value set of the Y-coordinate of center of distortion,
And the value set of distortion radius.For example, preceding 3 parameter set groups of straightness error minimum are (Isosorbide-5-Nitraes, 7), (2,5,8), (3,
6,9), it is meant that the corresponding center of distortion X-coordinate of first three minimum straightness error includes [1,2,3], center of distortion Y-coordinate
Including [4,5,6], distortion radius R includes [7,8,9], and a distortion ginseng is generated all in accordance with preset rules to each of which value
Several value ranges, can generate the value range of [- 9,11] when center of distortion X-coordinate takes 1, simultaneously because second adjustment walks
Long value be 1, can obtain corresponding center of distortion X-coordinate when center of distortion X coordinates take 1 value range -9, -8 ...,
0,1,2 ..., 10,11 }, correspondingly, the value of corresponding center of distortion X-coordinate when center of distortion X-coordinate takes 2 can be obtained
Scope -8, -7 ..., 1,2,3 ... and 11,2 }, the value range of corresponding center of distortion X-coordinate when center of distortion X-coordinate takes 3
- 7, -6 ..., 2,3,4 ..., 12,13], after collecting, the value collection of center of distortion X-coordinate is combined into the second distortion parameter
[- 9, -8 ..., 0,1,2,3,4 ..., 12,13].Similarly, taking for center of distortion Y-coordinate in the second distortion parameter can be obtained
Value set is [- 6, -5 ..., 3,4,5,6,7 ..., 15,16], and the value collection for the radius R that distorts in the second distortion parameter
It is combined into [- 3, -2 ..., 6,7,8,9,10 ..., 18,19].Permutation and combination is carried out to the value set of first distortion parameter
Afterwards, the combination of available all possible distortion parameter is the first parameter set group, and in the present embodiment, one shares 23
× 23 × 23 groups of parameter sets, each parameter set include three parameters, are center of distortion point X-coordinate respectively, and center of distortion point Y is sat
Be marked with and distort radius R.
The optimization method of distortion parameter in the present embodiment, by obtain in the first straight line degree error it is minimum before it is pre-
If the corresponding parameter set of the straightness error of number;It is raw again successively according to the parameter set and second adjustment step-length got
Into the second parameter set group.After a certain number of optimal solution is got, it is refined, with the adjusting step of smaller
Recalculate a second parameter set group so that bearing calibration of the invention more becomes more meticulous, and improves the second parameter set group
Precision, and then improve the low optimization accuracy of distortion parameter.
The present invention also provides a kind of computer-readable recording medium, in the present embodiment, on computer-readable recording medium
The optimizing program of distortion parameter is stored with, wherein:
When the optimizing program of the distortion parameter is performed by the processor, following steps are realized:
The corresponding first parameter set group of fish eye images is obtained, wherein, the first parameter set group includes multigroup parameter set;
According to of the first preset order successively based on the parameter set in the first parameter set group, and the fish eye images
One feature point set, calculates the corresponding first straight line degree error of each parameter set in the first parameter set group;
Based on the corresponding parameter set of first straight line degree error for meeting preset condition in the first parameter set group, institute is generated
The corresponding second parameter set group of fish eye images is stated, wherein, the second parameter set group includes multigroup parameter set;
According to of the second preset order successively based on the parameter set in the second parameter set group, and the fish eye images
One feature point set, calculates the corresponding second straight line degree error of each parameter set in the second parameter set group;
Obtain the corresponding parameter set of straightness error minimum in the second straight line degree error, and the parameter that will be got
Target distortion parameter of the distortion parameter of concentration as the fish eye images.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
The fisrt feature point set of the fish eye images is obtained according to the first preset rules;
According to the first preset order successively based on the parameter set in the first parameter set group, and the fisrt feature got
Point set calculates the second feature point set of target image;
Based on the second feature point set being calculated, the first straight line degree error is calculated.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
Obtain the default center point coordinates of the target image;
According to the first preset order successively based on the parameter set in the first parameter set group, the fisrt feature point set and described
Default center point coordinates, calculates the second feature point set.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
The first straight line equation and Ge Lie of the second feature point set corresponding each row are calculated according to the second preset rules
Second straight line equation;
The coordinate of each characteristic point is concentrated to calculate row error according to the first straight line equation and second feature point, and
The coordinate for concentrating each characteristic point according to the second straight line equation and second feature point calculates row error;
Based on first straight line degree error described in each row error and each row error calculation.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
Calculated successively based on the parameter set in the second parameter set group, and the fisrt feature point set according to the second preset order
The third feature point set of target image;
Based on the third feature point set being calculated, the second straight line degree error is calculated.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
Obtain the default center point coordinates of the target image;
According to the second preset order successively based on the parameter set in the second parameter set group, the fisrt feature point set and described
Default center point coordinates, calculates the third feature point set.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
Obtain the corresponding parameter set of straightness error of preceding predetermined number minimum in the first straight line degree error;
Successively according to the parameter set and the first adjusting step got, the second parameter set group is generated.
Further, when the optimizing program of the distortion parameter is performed by the processor, following steps are also realized:
The adjusting range of centre coordinate, center of distortion based on the fish eye images, calculates the value of center of distortion coordinate
Scope;
The scaling coefficient of reference radius and distortion radius based on the fish eye images, calculates the value model of distortion radius
Enclose;
Value range, the second adjustment step-length of value range based on center of distortion coordinate, the radius that distorts, obtain described the
One parameter set group.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property includes, so that process, method, article or system including a series of elements not only include those key elements, and
And other elements that are not explicitly listed are further included, or further include as this process, method, article or system institute inherently
Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this
Also there are other identical element in the process of key element, method, article or system.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on such understanding, technical scheme substantially in other words does the prior art
Going out the part of contribution can be embodied in the form of software product, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions use so that a station terminal equipment (can be mobile phone,
Computer, server, air conditioner, or network equipment etc.) perform method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
The equivalent structure or equivalent flow shift that bright specification and accompanying drawing content are made, is directly or indirectly used in other relevant skills
Art field, is included within the scope of the present invention.