Embodiment
Below in conjunction with the drawings and specific embodiments the present invention is further described.
As shown in Figure 1, the input of method for calculating image object size constance is a single width two dimension erect(ing) image; Output be in the image each object on the one dimension dimension with assigned direction on the relative perception size of (generally being horizontal or vertical direction); Camera model is the pin-hole imaging model.Erect(ing) image is meant: the image sky be positioned at the image medium line above, image ground be positioned at the image medium line below.
According to the size constancy theory, realize each object relative size shape constancy perception in the image is needed the imaging visual angle A and relative perceived depth D of correct calculation image object.The one dimension size expression of imaging visual angle A available object in image, the promptly available pixel quantitaes that it covers along a certain direction in image.To the image object of given profile, calculate function and finish this calculation task easily.We suppose that the profile of image object all is artificial given.In calculating, the parameter of all images object is to use the function manual interaction of Ginput (n) that the MATLAB environment provides and Imcrop (I) to realize.
Remaining now work is the relative depth D of computed image object.From the relevant conclusion of psychology of vision about human visual perception degree of depth clue, we have proposed a kind of simple, effective method for solving, and it calculates principle as shown in Figure 2.At first, utilize object height and two kinds of degree of depth clues of aerial perspective in image, go out medium line L with the sky detection technique computes
1, the image above ground portion is separated from entire image.Secondly,, utilize two kinds of degree of depth clues of linear perspective and texture gradient, can calculate the fastest direction straight line of change in depth L from sideline, image bottom to medium line at the image above ground portion
2L
2With L
1Intersection point V (V
x, V
y) be the point of the perceived depth maximum in the image, i.e. vanishing point.L
2Intersection point U (U with sideline, bottom, image ground
x, U
y), the point for the perceived depth minimum in the image is referred to as near point.Psychology studies show that to the human visual system's in certain scope, the picture depth perception is a linear change.Die near point U to the image medium line, along the fastest direction straight line of change in depth L
2, the image depth values linear increment reaches maximum until vanishing point V.At last, the relative perceived depth figure in computed image ground.With L
2On the perpendicular straight line have the identical degree of depth a little.As straight line L
3Cross some P (m, n) and and L
2Vertically, L then
3On the perceived depth of being had a few with the some P identical.So the relative perceived depth of some P can be with near point U to L
3Distance D
U-L3Expression.So just can calculate the relative perceived depth of image ground each point automatically, and then form dense phase perceived depth figure.
Obtained the imaging visual angle A and relative perceived depth D of each object, computing machine just can realize that image object relative size shape constancy calculates, and computing formula is as follows:
S=B×A×D (1)
S is the perception size of object, A is the imaging visual angle of object, D is the perceived depth (also claiming perceived distance) of object, be human visual system perceives to image on object when the imaging from the distance of camera, B is the imaging coefficient (for a together imaging, B value to all objects all be identical) relevant with eyes (camera).The one dimension size of imaging visual angle A available object in image of object represented.
The computation process of relative size shape constancy is elaborated to wherein key step as shown in Figure 1 below.
1, calculates medium line L
1
Outdoor depth image generally comprises the above ground portion of lower and the sky part of eminence simultaneously, and indoor depth image generally also comprises the ceiling portion of lower ground plate portion and eminence simultaneously.The sky part that we are referred to as outdoor images respectively is the image sky with the ceiling portion of off-the-air picture, and above ground portion is image ground with the ground plate portion, and claims that the separatrix on image sky and image ground is a medium line.Image does not have medium line sometimes yet, has only above ground portion this moment.
The colour consistency of image sky part (comprising ceiling) is better, and layout is simpler.Utilize this characteristic, use image Segmentation Technology sky can be separated.Because of tone Hue (H) component the most approaching with people's vision comparatively speaking to colored descriptive power, so earlier rgb space is converted to the HSI space.Because of pending image all is upright,,, calculate the one dimension color histogram so only the first half of image is added up so must have a day dummy section in the first half of image.Having the corresponding H value of peaked Nogata bar (Bin) is exactly the H value of sky, and note is made H
SKYIn order to improve computing velocity and to avoid the single-point of above ground portion to be mistaken for sky, image is divided into the fritter of 2*2, and its H value is the mean value of 4 pixels.If W is arbitrary image fritter, its H value is designated as H
wIf, | H
SKY-H
w|<=T
I* H
SKY, then piece W belongs to sky.T
IBe the similarity threshold value, the experiment value is 0.05.The calculating of sky is carried out on entire image.If the area that calculates sky is less than 5% of image, we just think and do not comprise sky in this image.Being positioned in the every row of image, the sky ignore of below forms separatrix, the world.With least square method separatrix, the world is fitted to horizontal linear, this horizontal linear is exactly medium line L
1
When not comprising sky in the image, medium line generally moves back to one of the sideline, top of image or dual-side.Because all images all are upright, medium line can not appear at the sideline, bottom of image.At this moment, the position of medium line is by vanishing point position and the fastest direction straight line of change in depth L
2Decision.When comprising sky in the image, image ground is by medium line, sideline, bottom and the formed zone of dual-side; When not comprising sky in the image, image ground is entire image.
2. calculate the fastest direction straight line of ground change in depth L
2
Psychologic content as can be known, two kinds of degree of depth clues of linear perspective and texture gradient can be used to indicate the fastest direction of ground change in depth.These two kinds of clues are only effective at the image above ground portion, so calculated line L
2Image support that scope only is the image above ground portion.Utilize the linear perspective clue separately, can calculate one from sideline, image bottom to the fastest direction straight line of the change in depth of medium line, we claim that this straight line is linear perspective straight line L
PUtilize the texture gradient clue separately, also can calculate one from sideline, image bottom to the fastest direction straight line of the change in depth of medium line, we claim that this straight line is texture gradient straight line L
TL
PWith L
TComputing method introduce after a while, suppose that now these two straight lines obtain.Generally speaking, these two straight lines can not overlap, so during fast direction, can produce conflict in common indication ground change in depth inevitably.Because of these two straight lines all produce with least square fitting, so can think, the relative error of fitting of straight line is big more, and its indicated the fastest direction of change in depth is inaccurate more.A kind of solution of conflict is: two straight lines are power with relative error of fitting separately, and the fastest direction straight line of ground change in depth L is found the solution in linear combination
2, error of fitting is big more relatively, and the combination weights of line correspondence are more little, and concrete grammar is as follows:
If the fastest direction straight line of change in depth L
2, linear perspective straight line L
P, texture gradient straight line L
TRelative error of fitting be respectively δ
2, δ
P, δ
T, the angle of their slope correspondences is respectively θ
2, θ
P, θ
T, the span of all θ is [pi/2, a pi/2], then has
θ
2=θ
P×δ
T/(δ
T+δ
P)+θ
T×δ
P/(δ
T+δ
P) (2)
δ
2=δ
P×δ
P/(δ
T+δ
P)+δ
T×δ
P/(δ
T+δ
P) (3)
So, straight line L
2By its slope corresponding angles θ
2With straight line L
PWith L
TIntersection point uniquely determine.Introduce straight line L below respectively
PWith L
TComputing method.
2.1 find the solution linear perspective straight line L
P
To the parallel lines that extend, in the plane of delineation, will lean on more and more closelyer at a distance in the objective world, even assemble.Such one group of line is called the convergence line, and their convergent point is called vanishing point.In image, the line indication is assembled to the surface of extending at a distance in the surface that the parallel lines indication is smooth.For outdoor images, the linear perspective effect generally only appears at the image above ground portion.But, act on above ground portion and sky part simultaneously for off-the-air picture.The depth perception rule of linear perspective is: the object in the image is near more from vanishing point, and perceived depth is big more, otherwise more little.Simultaneously, the center line of assembling line can point out that also the image perceived depth changes the fastest direction.
To every width of cloth image, use the Hough converter technique to find out the corresponding respectively image point set of 10 the longest straight lines earlier, with least square method these point sets are fitted to straight line respectively then, and obtain equation, slope corresponding angles θ and the relative error of fitting δ of every straight line.Utilizing the thought of similar formula (2), formula (3), serves as power linear combination by these 10 straight lines with separately relative error of fitting, and linear perspective straight line L is easy to get
PSlope corresponding angles θ
P, relative error of fitting δ
PAnd straight-line equation.
2.2 find the solution texture gradient straight line L
T
By the content of psychology of vision as can be known: surperficial far away more from the observer, it is more little that texture becomes.Its reason is: near more from viewpoint, the homogeneity object that retina of the same area (imaging plane) zone comprises is few more, and promptly image resolution ratio is big more, and the size of texel is big more.In the interior of articles zone, the difference of pixel intensity is little, so object generally is perceived as homogeneous region.This also just means: say that from the statistical significance near more from viewpoint, the pixel intensity difference sum in the identical image zone should be more little.For this reason, we are with the luminance difference degree of each pixel texture gradient as it, and further find the solution texture gradient straight line L with it
T, concrete computation process is as follows:
(1) establish I (m is the brightness I=(R+G+B)/3 at arbitrary pixel place, image ground n), be calculated as follows this some place luminance difference degree Idiff (m, n).Z
1Determine the computer capacity of each pixel intensity difference, certain value of getting in 1,2,3 is advisable.
(2) the image above ground portion is divided into Z equably
2* Z
2Fritter, the piece number of establishing horizontal direction (OK) and vertical direction (row) is respectively S, T.Every luminance difference degree Mdiff is the pixel intensity diversity factor Idiff sum of being had a few in the piece, finds out the piece that has minimum brightness diversity factor Mdiff in every row (horizontal direction), and note is made R respectively
1, R
2..., R
T-1, R
TSay piece R from the statistical significance
1, R
2..., R
T-1, R
TRepresent in each row from the nearest zone of viewpoint.Z
2Value unsuitable excessive, get about 5 and be advisable.
(3) with least square method to piece R
1, R
2..., R
T-1, R
TCenter point coordinate carry out match, just can calculate texture gradient straight line L
TSlope corresponding angles θ
T, relative error of fitting δ
TAnd straight-line equation.
3. computed image ground perceived depth figure
As shown in Figure 2, the perceived depth minimum of near point U is made as D
U, its value equal camera from the distance of the nearest imaging point of objective world scene divided by the camera imaging coefficient B.Changing Pattern at image above ground portion each point perceived depth is: near point U to the image medium line, along the fastest direction straight line of change in depth L
2, the image depth values linear increment reaches maximum until vanishing point V; With the fastest direction straight line of change in depth L
2On the perpendicular straight line have the identical degree of depth (sea-bottom contour) a little.If (m is m for the arbitrary coordinate of image above ground portion n) to P, the pixel of n, solution point P (m, the relative perceived depth D that n) locates
PMethod as follows:
If the fastest direction straight line of change in depth L
2Slope be K
2, straight line L
3(m is n) and perpendicular to straight line L to cross some P
2So, straight line L
3Slope K
3=-1/K
2, straight line L then
3Equation be:
X+K
2Y-mK
2-n=0 (5)
If near point U is to straight line L
3Distance be D
U-L3, then have:
D
U-L3=|U
x+K
2U
y-mK
2-n|/(1+K
2 2)
1/2 (6)
So some P (m, the perceived depth D that n) locates
PFor:
D
P=D
U+D
U-L3 (7)
Generalized case, the perceived depth D of near point
UBe difficult to estimate, consider it and D
U-L3Compare much smallerly,, be set as 0 so in the experiment of back, do not consider.
4. the perception size of computed image object
Utilize formula (1) to calculate the perception size of each image object.Because we only calculate relative perception size, so the middle B value of formula (1) can be made as 1.
S=B×A×D=A×D (8)
Other variations of the present invention and modification it will be apparent to those skilled in the art that the present invention is not limited to described embodiment.Therefore, with the true spirit of the disclosed content of the present invention and any/all modifications, variation or the equivalent transformation in the cardinal rule scope, all belong to claim protection domain of the present invention.