0

I am developing an application for monitoring live vehicle traffic using opencv, in c++.

Currently, I am doing background subtraction method to get the back ground and then I find contours.

I use createBackgroundSubtractorGMG method for finding the bg.

The problem I face is during the night time, when the headlight of the vehicle is turned on. The illuminated area in the road is also detected as new traffic. Is there any way I can overcome this problem, or have I chosen a complete wrong approach for traffic monitoring?

The methods I follow for traffic detection are as follow,

void detection(Mat Frame){

Mat bg;
vector<Mat> Channels(3);
vector<Mat> channels;
cvtColor(frame,bg,CV_BGR2YCrCb);
split(bg,Channels);
equalizeHist(Channels[0], Channels[0]);
equalizeHist(Channels[1], Channels[1]);
channels.push_back(Channels[0]);     
channels.push_back(Channels[1]);     
channels.push_back(Channels[2]);     
cv::merge(channels, bg);
cv::GaussianBlur(bg, bg, cv::Size(5,5), 1.5);
pMOG->apply(bg, fore);
cv::GaussianBlur(fore, fore, cv::Size(11,11), 1.5);
findContours(fore,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_SIMPLE);
vector<vector<Point> > contours_poly(contours.size());
vector<Rect> boundRect(contours.size());
double area;
bool found;
for(size_t i = 0; i < contours.size(); i++ )
{
    boundRect[i] = boundingRect( Mat(contours[i]) );
}

}

Image

Community
  • 1
  • 1
Som
  • 185
  • 15
  • Found this one useful, http://stackoverflow.com/questions/24647074/how-to-remove-lights-deflections – Som May 16 '17 at 21:02
  • this question cannot be answered properly without having seen images. what is it you want to "monitor"? provide more detail on what you want to achieve – Piglet May 16 '17 at 21:52
  • I need to detect, track and count number of vehicles within a ROI. I attached an image in the question , which shows my problem. Basically, during night time, when the headlight of the vehicle is on its difficult to find and track objects. – Som May 16 '17 at 22:26
  • Right now I am doing histogram equalization in the Y and r region of YCrCb color space, and to extent it performs ok. But , is there any other techniques I could employ which will enhance the detection, by reducing the effect of light. – Som May 26 '17 at 11:36
  • The methods I follow for traffic detection are as follow, void detection(Mat Frame){ vector Channels(3); vector channels; cvtColor(frame,bg,CV_BGR2YCrCb); split(bg,Channels); equalizeHist(Channels[0], Channels[0]); equalizeHist(Channels[1], Channels[1]); channels.push_back(Channels[0]); /// Merge the three channels channels.push_back(Channels[1]); /// Merge the three channels channels.push_back(Channels[2]); /// Merge the three channels – Som May 26 '17 at 11:40

0 Answers0