c++ - How to Catch Lane departure and generate warning -


i beginner in open cv , c++. detecting lane through top view using 2 cameras , have detected , marked lane. want generate warnings in case of lane crossing or departure. please have deadline. appreciated.

cv::videocapture camera0 (0); cv::videocapture camera1 (1);  if( !camera0.isopened() ) return 1; if( !camera1.isopened() ) return 1;  while(true) {     //capture , retrieve each frames of video sequentially, 1 frame @ time displayed      // capture 1st camera     mat edges0, edges1;     cv::mat3b frame0;     camera0 >> frame0;     // performing edge detection on camera 1     mat dst0, cdst0;      gaussianblur(frame0, frame0, size(7,7), 1.5, 1.5);     canny(frame0, dst0, 50, 200, 3);     cvtcolor(dst0, cdst0, cv_gray2bgr);     vector<vec4i> lines;     houghlinesp(dst0, lines, 1, cv_pi/180, 50, 50, 100 );     for( size_t = 0; < lines.size(); i++ )     { vec4i l = lines[i]; line( cdst0, point(l[0], l[1]), point(l[2], l[3]), scalar(0,0,255), 3, cv_aa); }     //capturing frames second camera     cv::mat3b frame1;     camera1 >> frame1;     // performing edge detection on camera 2     mat dst1, cdst1;      gaussianblur(frame1, frame1, size(7,7), 1.5, 1.5);    canny(frame1, dst1, 50, 200, 3);    cvtcolor(dst1, cdst1, cv_gray2bgr);    houghlinesp(dst1, lines, 1, cv_pi/180, 50, 50, 100 );   for( size_t = 0; < lines.size(); i++ )   {   vec4i l = lines[i];   line( cdst1, point(l[0], l[1]), point(l[2], l[3]), scalar(0,0,255), 3, cv_aa);   }      cv::imshow("left lane", cdst0);     cv::imshow("right lane", cdst1);        //wait 40 milliseconds     int c = cvwaitkey(30);      //exit loop if user press "esc" key  (ascii value of "esc" 27)      if(27 == char(c)) break;   }   return 0; 

}


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -