Summary of the invention
The purpose of this invention is to provide a kind of method of discrimination of night running vehicle country beam opening, solved prior art and be subjected to surrounding environment influence, cause the form of the headlight for vehicle light modulation that photographs larger difference to be arranged, the problem that is difficult to accurately identify.
The technical solution adopted in the present invention is, a kind of method of discrimination of night running vehicle country beam opening is implemented according to following steps:
Step 1, the car light polarisation filtering image of taking pictures and obtaining driving vehicle
At first, horizontal polarization sheet and vertical polarization sheet are set before the camera lens of monitoring camera, by regulating two angles between the polaroid, the light-inletting quantity of control camera, until after the picture of catching only keeps the light of car light part of driving vehicle, good these two polaroids of fixed adjustment are realized the polarisation filtering of driving vehicle is taken pictures;
Extract the car light zone in step 2, the polarisation filtering image processed in the upper step
2.1) removal steering indicating light zone
To the current time that reads in, namely t three components of red, green, blue through the filtered frame of video coloured image of polarisation constantly are [r
t(x, y)]
M * n, [g
t(x, y)]
M * n, [b
t(x, y)]
M * n, wherein, m * n represents that the size of two field picture is the capable n row of m, the coordinate of (x, y) expression pixel, and [] represents whole image;
If the steering indicating light judgment matrix is [L
t(x, y)]
M * n, the computing formula of then judging the steering indicating light zone is as follows:
Wherein, x=1,2 ..., m, y=1,2 ..., n, δ are adjustment amount, Th
rIt is the red component threshold value of differentiating vehicle lamp light source;
2.2) the distance-light car light zone of extracting all vehicles in the image
Brightness value is made as [f
t(x, y)]
M * n, computing formula is as follows:
f
t(x,y)=0.299·r
t(x,y)+0.587·g
t(x,y)+0.114·b
t(x,y), (2)
This brightness value is carried out binary conversion treatment, extract distance-light car light zone, i.e. binary image [g
t(x, y)]
M * nComputing formula is:
Wherein, the range of choice of threshold value Th is that [ε+Δ ε, ξ-Δ ξ, ε are the brightness in darker non-car light zone to Th ∈, and Δ ε is an increment, and ξ is the brightness in brighter car light zone, and Δ ξ is an increment;
Step 3, according to the riding position of camera, delimit the effective monitoring zone of road
Set effective guarded region, only the connected domain that falls into the effective monitoring area part analyzed, namely carry out following processing:
Wherein, Ω is the effective monitoring zone of delimiting;
Step 4, the image after step 3 processed carry out opening operation and process
4.1) the upper step was obtained
Carry out opening operation and process, during opening operation, the structural element of selection is N * N, and N is odd number, and initial point is the structural element center, and it is right to establish
The as a result figure that carries out after opening operation is processed is
4.2) split the as a result figure after the calculation process
Carry out connected domain and merge processing
For when the vehicle country beam is opened, same zone is merged into the passing light zone in the country beam zone that light simultaneously the same side, it is as follows that connected domain merges the computing formula of processing:
Wherein, the distance that [a, b] merges for connected domain, a<0, b>0 is integer;
4.3) to the as a result figure after the processing of connected domain union operation
The processing of labelling;
Step 5, determine the car light of same vehicle
According to from top to bottom, order is from left to right at first selected the connected domain in left side, asks its barycenter (xc, yc), and the computing formula of barycenter is as follows:
Wherein, Ω
kBe the connected domain that finds;
Afterwards, according to the position (x of barycenter
c, y
c) draw a horizontal linear, namely at x=x
cOn judge whether the connected domain of passing through,
If there is one, then regard it as the car light of same vehicle;
If several are arranged, then with the car light that is considered as its same vehicle of the leftmost side;
Step 6, judge whether the car light of same vehicle is the country beam state
To being judged as a pair of car light zone that belongs to same vehicle, be made as Ω
LkAnd Ω
Rk, judge area features and the shape facility in its UNICOM territory, left side lamp area S
LWith starboard light area S
RThe feature calculation formula be respectively:
Shape facility is the aspect ratio of boundary rectangle, finds respectively Ω
LkAnd Ω
RkThe leftmost side, the rightmost side, top side, four points of lower side, these four points are consisted of boundary rectangle as the left side, the right, top, the following starting point of boundary rectangle, be made as ReC
LkAnd ReC
Rk, its length and width is respectively L
Lk, L
Rk, H
Lk, H
Rk, the computing formula of shape facility is as follows:
Calculating country beam decision condition 1 is: ρ
Lk+ ρ
Rk<th
ρ, (12)
Wherein, th
ρJudgment threshold for country beam;
Calculating country beam decision condition 2 is: S
R+ S
L>2Th
S, (13)
Wherein, th
SBe the judgment threshold of country beam, be the average area of all connected domains on the same level position;
When condition 1 and condition 2 satisfy simultaneously, show that the country beam of this vehicle is in opening, otherwise, be judged to be and be in closed condition;
Repeating step 5, step 6 are finished until all vehicles are all judged.
The invention has the beneficial effects as follows, can adapt to different street lamp photoenvironments at night, by the mode of polarisation filtering, suppress non-light zone, extract afterwards the country beam feature, determine exactly the vehicle of opening country beam.
The specific embodiment
The method of discrimination of night running vehicle country beam opening of the present invention, implement according to following steps:
Step 1, the car light polarisation filtering image of taking pictures and obtaining driving vehicle
At first, horizontal polarization sheet and vertical polarization sheet are set before the camera lens of monitoring camera, by regulating two angles between the polaroid, the light-inletting quantity of control camera, until after the picture of catching only keeps the light of car light part of driving vehicle, good these two polaroids of fixed adjustment are realized the polarisation filtering of driving vehicle is taken pictures.
Such as Fig. 1, Fig. 2, shown in Figure 3, the car light polarisation filtering of a plurality of vehicles of travelling on the road among the embodiment, and the car light filter effect under two states of a vehicle, wherein, Fig. 1 is the polarisation filtering image of a plurality of vehicles of travelling on the road, be steering indicating light in the rectangle frame, Fig. 2 vehicle has been opened the image of passing light state, and Fig. 3 is the image that vehicle has been opened the country beam state.
Extract the car light zone in step 2, the polarisation filtering image processed in the upper step
2.1) removal steering indicating light zone
To the current time that reads in, namely t three components of RGB through the filtered frame of video coloured image of polarisation constantly are [r
t(x, y)]
M * n, [g
t(x, y)]
M * n, [b
t(x, y)]
M * n, wherein, m * n represents that the size of two field picture is the capable n row of m, the coordinate of (x, y) expression pixel, and [] represents whole image;
Since steering indicating light different from long-and-short distant light be, steering indicating light is red, at this, establishing the steering indicating light judgment matrix is [L
t(x, y)]
M * n, the computing formula of then judging the steering indicating light zone is as follows:
Wherein, x=1,2 ..., m, y=1,2 ..., n, δ are adjustment amount, according to the place value of erecting equipment, preferred span is [10,40], Th
rBe the red component threshold value of differentiating vehicle lamp light source, preferred span is [80,150];
2.2) the distance-light car light zone of extracting all vehicles in the image
Brightness value is made as [f
t(x, y)]
M * n, computing formula is as follows:
f
t(x,y)=0.299·r
t(x,y)+0.587·g
t(x,y)+0.114·b
t(x,y), (2)
This brightness value is carried out binary conversion treatment, extracts distance-light car light zone,
Because the car light part is very large with the luminance difference of other parts, therefore, adopt the method for global threshold to realize at this, i.e. binary image [g
t(x, y)]
M * nComputing formula is:
Wherein, the range of choice of threshold value Th is Th ∈ [ε+Δ ε, ξ-Δ ξ], ε is the brightness in darker non-car light zone, Δ ε is an increment, preferred span is Δ ε ∈ [0.5 ε, ε], ξ is the brightness in brighter car light zone, Δ ξ is an increment, preferred span is Δ ξ ∈ [0.2 ξ, 0.8 ξ]; ε, the value of ξ depends on polarisation filtering result.
For polarisation filtering ideal situation comparatively, namely such as the situation of Fig. 1, suggestion preferably the most simply definite threshold be 7L/8, wherein L is the peak of the given brightness of image value scope [0, L] of camera.
Such as Fig. 4, Fig. 5, shown in Figure 6, it is the car light extracted region effect among the embodiment, wherein, Fig. 4 is the car light extracted region images of all vehicles in travelling on Fig. 1 road, wherein be the steering indicating light zone in the rectangle frame, after formula (1) computing, be eliminated, Fig. 5 is the car light zone of Fig. 2, and Fig. 6 is the car light zone of Fig. 3.
Step 3, according to the riding position of camera, delimit the effective monitoring zone of road
Consider that night, may there be illumination on shop or the building road both sides, when binaryzation, can be mistaken for car light, therefore, according to scheme drawing shown in Figure 7, set effective guarded region, only the connected domain that falls into the effective monitoring area part is analyzed, is namely carried out following processing:
Wherein, the effective monitoring zone of Ω for being delimited by Fig. 7,
As shown in Figure 7, it is the effective monitoring area schematic among the embodiment, wherein, the trapezoidal part of confining is the effective monitoring zone, the border of both sides is borders of the road both sides in the monitoring camera monitoring image, the front and back boundary is in the Vehicle Driving Cycle process, and camera can capture the scope that is enough to effectively judge the car light size.If (rear boundary is too far away, and car light is too little, is taken as easily noise remove, if prezone is too near, then car light is not in picture.)
Step 4, the image after step 3 processed carry out opening operation and process
4.1) the upper step was obtained
Carry out opening operation and process, in order to eliminate the impact of noise, the opening operation method all is described in detail on existing digital image processing relevant speciality teaching material, no longer describes in detail here.During opening operation, the structural element of selection is N * N, and N is odd number, and initial point is the structural element center, and it is right to establish
The as a result figure that carries out after opening operation is processed is
4.2) split the as a result figure after the calculation process
Carry out connected domain and merge processing
Because the country beam of vehicle and passing light are on the same level position, when country beam is opened, passing light is simultaneously bright, connected domain described here merges to be processed, for when the vehicle country beam is opened, same zone is merged into the passing light zone in the country beam zone that light simultaneously the same side, and it is as follows that connected domain merges the computing formula of processing:
Wherein, the distance that [a, b] merges for connected domain, a<0, b>0 is integer, and rule of thumb value is advised preferred a ∈ [8 ,-4], b ∈ [4,8];
4.3) to the as a result figure after the processing of connected domain union operation
The processing of labelling
Labeling method all is described in detail on the specialized teaching material aspect the digital image processing, no longer describes in detail here.After Fig. 3, Fig. 4, Fig. 5 labelled, just can different connected domains be identified, the result of labelling such as Fig. 8, shown in Figure 9, wherein, Fig. 8 carries out image after the tag processes to Fig. 5, Fig. 9 carries out image after the tag processes to Fig. 6, and the light color in the accompanying drawing represents label No. 1, No. 2 labels of dark expression;
Step 5, determine the car light of same vehicle
On the vehicle structure topological design, car light is arranged at sustained height position, headstock both sides, so according to from top to bottom, order is from left to right at first selected the connected domain in left side, asks its barycenter (x
c, y
c), the computing formula of barycenter is as follows:
Wherein, Ω
kBe the connected domain that finds;
Afterwards, according to the position (x of barycenter
c, y
c) draw a horizontal linear, namely at x=x
cOn judge whether the connected domain of passing through, if there is one, then regard it as the car light of same vehicle; If several are arranged, then with the car light that is considered as its same vehicle of the leftmost side;
As shown in Figure 4, be that the same vehicle car light among the embodiment detects scheme drawing, the straight line that dotted line wherein provides, connection be exactly according to formula (6), after (7) calculate centroid position, two side lights of the same vehicle that records.
Step 6, judge whether the car light of same vehicle is the country beam state
To being judged as a pair of car light zone that belongs to same vehicle, be made as Ω
LkAnd Ω
Rk, judge area features and the shape facility in its UNICOM territory, left side lamp area S
LWith starboard light area S
RThe feature calculation formula be respectively:
Shape facility is the aspect ratio of boundary rectangle, finds respectively Ω
LkAnd Ω
RkThe leftmost side, the rightmost side, top side, four points of lower side, these four points are consisted of boundary rectangle as the left side, the right, top, the following starting point of boundary rectangle, be made as ReC
LkAnd ReC
Rk, its length and width is respectively L
Lk, L
Rk, H
Lk, H
Rk, the computing formula of shape facility is as follows:
Calculating country beam decision condition 1 is: ρ
Lk+ ρ
Rk<th
ρ, (12)
Wherein, th
ρBe the judgment threshold of country beam, when country beam is opened, because two lamps of a side are all lighted, be empirical value, so suggestion th
ρPreferred span be th
ρ∈ [1,1.6];
Calculating country beam decision condition 2 is: S
R+ S
L>2Th
S, (13)
Wherein, th
SBe the judgment threshold of country beam, be the average area of all connected domains on the same level position;
When condition 1 and condition 2 satisfy simultaneously, show that the country beam of this vehicle is in opening, otherwise, be judged to be and be in closed condition.
Repeating step 5, step 6 are finished until all vehicles are all judged.
Method of the present invention is by above step, just in the time of can be in driving vehicle enters the effective monitoring zone, judge whether its country beam is opened, if belong to the country beam opening, recycling motion target tracking technology, calculate again it continues to open country beam in guarded region time, for intelligent transportation system provides a kind of safing effective method of inspection.