Summary of the invention
The technical problem that the present invention will solve is, a kind of stereo-picture color calibration method and device are provided, strategy that can self adaptation adjustment color correction; Have good real-time and versatility; Need not manual operation, problem such as it is inconsistent to have solved the stereo-picture tone, and brightness is inconsistent; Help improving the accuracy of parallax result of calculation, thereby improve the accuracy of three-dimensional reconstruction based on principle of stereoscopic vision, scene measurement etc.
The invention provides a kind of stereo-picture color calibration method, comprising:
Receive stereo-picture, said stereo-picture comprises first image and second image;
According to the adjustment function second image is carried out the gray scale adjustment; Said adjustment function is the mapping relations function between the gray values of pixel points of mating in first image and second image;
Said first image and adjusted second image of process gray scale are carried out the gray scale coupling, obtain disparity map;
Add up the ratio of pixel correct match in the said disparity map; If do not surpass preset threshold value; With the gray values of pixel points of mating in said first image and said second image as the said adjustment function of known quantity substitution; Calculate the adjustment parameter in the said adjustment function, upgrade the adjustment parameter in the current adjustment function according to this.
Further, said method also can have following characteristics:
All pixels in said second image are carried out the gray scale adjustment according to same adjustment function.
Further, said method also can have following characteristics:
Judge the characteristic of each pixel in said second image respectively, select the adjustment function corresponding that said pixel is carried out the gray scale adjustment with the characteristic of said pixel.
Further, said method also can have following characteristics:
Whether the pixel of the coupling that from second image, finds through the pixel of judging in said first image is consistent with the pixel of the coupling that the said pixel in second image finds from first image; Whether correct to confirm said pixel coupling, if unanimity then think that coupling is correct; Otherwise think matching error.
Further, said method also can have following characteristics:
Through the gray value of each Color Channel in the color space of pixel being adjusted to realize gray scale adjustment to pixel.
In order to solve the problems of the technologies described above, the present invention also provides a kind of stereo-picture color correction device, comprising:
Receiver module is used to receive stereo-picture, and said stereo-picture comprises first image and second image;
Configuration module is used for storage adjustment function, and said adjustment function is the mapping relations function between the gray values of pixel points of mating in first image and second image;
Color adjustment module all links to each other with said receiver module with said configuration module, is used for according to said adjustment function second image being carried out the gray scale adjustment;
The parallax computing module links to each other with said color adjustment module with said receiver module, is used for said first image and adjusted second image of process gray scale are carried out the gray scale coupling, obtains disparity map;
Update module; All link to each other with said configuration module with said parallax computing module; Be used for adding up the ratio of said disparity map pixel correct match, if surpass preset threshold value, with the gray values of pixel points of mating in said first image and said second image as the said adjustment function of known quantity substitution; Calculate the adjustment parameter in the said adjustment function, upgrade the adjustment parameter in the adjustment function in the said configuration module according to this.
Further, said apparatus also can have following characteristics:
Said color adjustment module is used for said all pixels of second image are carried out the gray scale adjustment according to same adjustment function.
Further, said apparatus also can have following characteristics:
Said color adjustment module is used for judging respectively the characteristic of said second each pixel of image, selects the adjustment function corresponding with the characteristic of said pixel that said pixel is carried out the gray scale adjustment.
Further, said apparatus also can have following characteristics:
Said update module; Whether the pixel of the coupling that is used for finding from second image through the pixel of judging said first image is consistent with the pixel of the coupling that the said pixel in second image finds from first image; Whether correct to confirm said pixel coupling, if unanimity then think that coupling is correct; Otherwise think matching error.
Further, said apparatus also can have following characteristics:
Said color adjustment module is through adjusting the gray value of each Color Channel in the color space of pixel to realize the gray scale adjustment to pixel.
A kind of stereo-picture color calibration method provided by the invention and device; Can self adaptation the strategy of adjustment color correction, have good real-time and versatility, need not manual operation; It is inconsistent to have solved the stereo-picture tone; Problems such as brightness is inconsistent help improving the accuracy of parallax result of calculation, thereby improve the accuracy of three-dimensional reconstruction based on principle of stereoscopic vision, scene measurement etc.
Figure of description
Fig. 1 is that the embodiment of the invention provides a kind of stereo-picture color calibration method flow chart;
Fig. 2 is a kind of concrete stereo-picture color calibration method flow chart of application example of the present invention;
Fig. 3 is a kind of stereo-picture color correction device of embodiment of the invention structure chart.
Embodiment
Below description and accompanying drawing illustrate specific embodiments of the present invention fully, to enable those skilled in the art to put into practice them.Other embodiments can comprise structure, logic, electric, process and other change.Embodiment only represents possible variation.Only if explicitly call for, otherwise independent assembly and function are optional, and the order of operation can change.The part of some embodiments and characteristic can be included in or replace the part and the characteristic of other embodiments.The scope of embodiment of the present invention comprises the gamut of claims, and all obtainable equivalents of claims.In this article; These embodiments of the present invention can be represented with term " invention " individually or always; This only is for ease, and if in fact disclose and surpass one invention, not that the scope that will automatically limit this application is any single invention or inventive concept.
?
First embodiment
The embodiment of the invention provides a kind of stereo-picture color calibration method, and is as shown in Figure 1, comprises step:
Step S101: receive stereo-picture, said stereo-picture comprises first image and second image;
Said first image and said second image are through obtain same target images acquired from different perspectives;
Step S102: second image is carried out the gray scale adjustment according to the adjustment function;
Said adjustment function is the mapping relations function between the gray values of pixel points of mating in first image and second image;
Step S103: said first image and adjusted second image of process gray scale are carried out the gray scale coupling, obtain disparity map;
Can pass through for example based on the minimized Algorithm of Parallax of energy function (graph cuts-based stereo correspondence algorithm), perhaps Algorithm of Parallax (the block-matching stereo correspondence algorithm) scheduling algorithm based on the piece coupling carries out the gray scale coupling to calculate parallax;
Step S104: the ratio of adding up pixel correct match in the said disparity map; If do not surpass preset threshold value; With the gray values of pixel points of mating in said first image and said second image as the said adjustment function of known quantity substitution; Calculate the adjustment parameter in the said adjustment function, upgrade the adjustment parameter in the current adjustment function according to this.
For example can adopt feature extracting method (sift) scheduling algorithm to find the pixel that matees in said first image and said second image based on the conversion of yardstick invariant features.
The stereo-picture color calibration method that the embodiment of the invention provides can effectively be applicable to different stereoscopic cameras or three-dimensional film source, and stereoscopic image is carried out color correction adaptively; Problems such as it is inconsistent to solve the stereo-picture tone, and brightness is inconsistent help improving the accuracy of parallax result of calculation; Thereby improve the accuracy of three-dimensional reconstruction based on principle of stereoscopic vision, scene measurement etc.; Have adaptivity, real-time full-automatic color adjustment can be provided, need not manual operation.
When stereoscopic image is carried out color correction, can stereoscopic image carry out the global color correction, that is, all pixels in said second image are carried out the gray scale adjustment according to same adjustment function.
Preferably, can also stereoscopic image carry out the local color correction, that is, judge the characteristic of each pixel in said second image respectively, select the adjustment function corresponding that said pixel is carried out the gray scale adjustment with the characteristic of said pixel.Said characteristic can be that for example illumination is strong and weak, perhaps characteristic such as texture complexity.Thereby reach meticulousr color correction effect.
When image being carried out the gray scale adjustment, be that pixel in the image is carried out the gray scale adjustment.Through the gray value of each Color Channel in the color space of pixel being adjusted to realize gray scale adjustment to pixel.Said color space can be rgb space, HIS space etc.
Said adjustment function
can be expressed as:
expression row-coordinate is
, the gray value of a certain Color Channel of the pixel that the row coordinate is
;
expression is carried out the adjusted gray value of gray scale to this Color Channel of this pixel.
Wherein,
function can be set to linear representation; For example
; Also can be set to non-linear expressions, for example
.Adjustment parameter in the adjustment function is meant coefficient and the constant term in the adjustment function; For example adjust function
, the adjustment parameter is
,
and
.Be the adjustment parameter configuration initial value in
function; When carrying out color correction first,
function uses the initial value of adjustment function to accomplish the gray scale adjustment of image.
When needs recomputate and upgrade the adjustment function: for the scheme that adopts the overall situation to proofread and correct; Select the pixel that matees in enough said first images and said second image; With said gray values of pixel points as known quantity; Substitution adjustment function
; Through Simultaneous Equations, can solve the adjustment parameter.For the scheme that adopts partial correction; Also need judge the characteristic of the pixel that matees in said first image and said second image; Selection has the pixel of the coupling of identical characteristics; With said gray values of pixel points as known quantity; Substitution adjustment function
; Through Simultaneous Equations, can solve the adjustment parameter of the adjustment function corresponding
with the characteristic of said pixel.
When needs recomputate and upgrade the adjustment function; It is non-linear that the adjustment values of parameters possibly cause
function to become from linearity, perhaps from the non-linear linearity that becomes.For example
; If in the adjustment parameter that calculates
, then will cause adjusting function from the non-linear linearity that becomes.
The ratio of adding up pixel correct match in the said disparity map comprises: confirm the number of pixel correct match, calculate the ratio of correct match according to the number of the number of pixel correct match and pixel erroneous matching.
Can confirm the ratio that pixel is correct through following method: whether the pixel of the coupling that from second image, finds through the pixel of judging in said first image is consistent with the pixel of the coupling that the said pixel in second image finds from first image; Whether correct to confirm said pixel coupling, if unanimity then think that coupling is correct; Otherwise think matching error.
In addition, can also adopt additive method to confirm the ratio that pixel is correct, for example: the actual range that adopts the laser acquisition target; Based on the binocular vision principle, under the prerequisite of known parallax,, can obtain the corresponding depth of field distance of this location of pixels through the method for three-dimensional reconstruction; With the said depth of field distance that calculates and said actual range relatively,, think that then this parallax value is correct, otherwise think this parallax value mistake if identical.
Further specify embodiment of the invention stereo-picture color calibration method with an instantiation below.
Application example
Application example of the present invention provides a kind of concrete stereo-picture color calibration method, and is as shown in Figure 2, comprises step:
Step S201: initial adjustment parameter is set;
If first image (left image) ImageL and second image (right image) ImageR color of image integral body are linear relationship, like formula (2)
Set initial adjustment parameter value
.
Receive stereo-picture ImageL, the rgb value of each location of pixels among the ImageR.
Step S202: according to current adjustment function ImageR is carried out color correction, obtain ImageR_new;
According to formula (3) ImageR is carried out color correction:
Step S203: the disparity map that calculates imageL and imageR_new;
Step S204: the ratio of adding up pixel correct match in the said disparity map;
Step S205: whether the ratio of judging pixel correct match in the said disparity map greater than preset threshold value, if greater than, then return step S202; Otherwise, execution in step S206;
Step S206: calculate ImageL, the matched feature points of ImageR;
Sift algorithm capable of using is realized;
Step S207: the gray value of said matched feature points as the said adjustment function of known quantity substitution, is calculated the adjustment parameter in the said adjustment function, upgrade the adjustment parameter in the current adjustment function according to this, return step S202.
The gray value of matched feature points is:
be known quantity; The rgb value of the characteristic point on the coupling is brought each into formula (2); Simultaneous Equations is calculated
value that makes new advances.
Second embodiment
The embodiment of the invention also provides a kind of stereo-picture color correction device, and is as shown in Figure 3, comprising:
Receiver module 301 is used to receive stereo-picture, and said stereo-picture comprises first image and second image;
Configuration module 302 is used for storage adjustment function, and said adjustment function is the mapping relations function between the gray values of pixel points of mating in first image and second image;
Color adjustment module 303 all links to each other with said receiver module 301 with said configuration module 302, is used for according to said adjustment function second image being carried out the gray scale adjustment;
Parallax computing module 304 links to each other with said color adjustment module 303 with said receiver module 301, is used for said first image and adjusted second image of process gray scale are carried out the gray scale coupling, obtains disparity map;
Update module 305; All link to each other with said configuration module 302 with said parallax computing module 304; Be used for adding up the ratio of said disparity map pixel correct match, if surpass preset threshold value, with the gray values of pixel points of mating in said first image and said second image as the said adjustment function of known quantity substitution; Calculate the adjustment parameter in the said adjustment function, upgrade the adjustment parameter in the adjustment function in the said configuration module 302 according to this.
Wherein, said color adjustment module 303 can be carried out the gray scale adjustment according to same adjustment function to all pixels in said second image.
Wherein, said color adjustment module 303 also can be judged the characteristic of each pixel in said second image respectively, selects the adjustment function corresponding with the characteristic of said pixel that said pixel is carried out the gray scale adjustment.
Wherein, Said update module 305; Whether the pixel of the coupling that can from second image, find through the pixel of judging in said first image is consistent with the pixel of the coupling that the said pixel in second image finds from first image; Whether correct to confirm said pixel coupling, if unanimity then think that coupling is correct; Otherwise think matching error.
Wherein, said color adjustment module 303 can be through adjusting the gray value of each Color Channel in the color space of pixel to realize the gray scale adjustment to pixel.
Wherein, said adjustment function is linear function or nonlinear function.
According to said disclosed embodiment, can be so that those skilled in the art can realize or use the present invention.To those skilled in the art, the various modifications of these embodiment are conspicuous, and the general principles of definition here also can be applied to other embodiment on the basis that does not depart from the scope of the present invention with purport.Above-described embodiment is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.