|
@@ -25,17 +25,25 @@
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
-const std::string trt_path = "./LaneATT_test.trt8"; // trt paths
|
|
|
|
|
|
+const std::string trt_path = "./model/LaneATT_test.trt8"; // trt paths
|
|
|
|
|
|
const bool calibrationstate = false;
|
|
const bool calibrationstate = false;
|
|
const std::string calibration_yamlpath = "./yaml/camera_middle_640_360.yaml";
|
|
const std::string calibration_yamlpath = "./yaml/camera_middle_640_360.yaml";
|
|
cv::Mat camera_matrix,dist_coe,map1,map2;
|
|
cv::Mat camera_matrix,dist_coe,map1,map2;
|
|
|
|
|
|
-
|
|
|
|
//透视变换的点
|
|
//透视变换的点
|
|
std::string PERS_FILE = "./yaml/pers_ori.yaml";
|
|
std::string PERS_FILE = "./yaml/pers_ori.yaml";
|
|
|
|
|
|
-bool test_video = true;
|
|
|
|
|
|
+
|
|
|
|
+const bool cropstate = false;
|
|
|
|
+cv::Range crop_height = cv::Range(240,600);
|
|
|
|
+cv::Range crop_width = cv::Range(320,960);
|
|
|
|
+
|
|
|
|
+//是否显示检测结果
|
|
|
|
+bool imshow_flag = true;
|
|
|
|
+
|
|
|
|
+//是否读取视频
|
|
|
|
+bool test_video = false;
|
|
string video_path = "v4l2src device=/dev/video0 ! video/x-raw, width=(int)1280, height=(int)720 ! videoconvert ! appsink";
|
|
string video_path = "v4l2src device=/dev/video0 ! video/x-raw, width=(int)1280, height=(int)720 ! videoconvert ! appsink";
|
|
//std::string video_path = "/home/nvidia/code/modularization/src/detection/laneATT_trt_old/test/camera_test1.mp4";
|
|
//std::string video_path = "/home/nvidia/code/modularization/src/detection/laneATT_trt_old/test/camera_test1.mp4";
|
|
bool stop_read = false;
|
|
bool stop_read = false;
|
|
@@ -45,10 +53,6 @@ void * gpcamera;
|
|
const std::string cameraname="image00"; //共享内存的名字
|
|
const std::string cameraname="image00"; //共享内存的名字
|
|
ConsumerProducerQueue<cv::Mat> * imageBuffer = new ConsumerProducerQueue<cv::Mat>(3,true);
|
|
ConsumerProducerQueue<cv::Mat> * imageBuffer = new ConsumerProducerQueue<cv::Mat>(3,true);
|
|
|
|
|
|
-const bool cropstate = false;
|
|
|
|
-cv::Range crop_height = cv::Range(240,600);
|
|
|
|
-cv::Range crop_width = cv::Range(320,960);
|
|
|
|
-
|
|
|
|
std::vector<cv::Point2f> warped_point, origin_point;
|
|
std::vector<cv::Point2f> warped_point, origin_point;
|
|
cv::Point2i transed_O;
|
|
cv::Point2i transed_O;
|
|
|
|
|
|
@@ -65,10 +69,6 @@ const std::string resultname="linearray"; //共享内存的名字
|
|
iv::Ivfault *gfault = nullptr;
|
|
iv::Ivfault *gfault = nullptr;
|
|
iv::Ivlog *givlog = nullptr;
|
|
iv::Ivlog *givlog = nullptr;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-cv::Mat img_warp,raw_image;
|
|
|
|
-
|
|
|
|
cv::VideoWriter outputVideo;
|
|
cv::VideoWriter outputVideo;
|
|
|
|
|
|
|
|
|
|
@@ -463,14 +463,14 @@ int main(int argc, char *argv[]) {
|
|
{
|
|
{
|
|
double waittotal = (double)cv::getTickCount() - waittime;
|
|
double waittotal = (double)cv::getTickCount() - waittime;
|
|
double totaltime = waittotal/cv::getTickFrequency();
|
|
double totaltime = waittotal/cv::getTickFrequency();
|
|
- //--------长时间获取不到图片则退出程序----------
|
|
|
|
- if(totaltime>30.0)
|
|
|
|
- {
|
|
|
|
- cout<<"Cant't get frame and quit"<<endl;
|
|
|
|
- cv::destroyAllWindows();
|
|
|
|
- std::cout<<"------end program------"<<std::endl;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+// //--------长时间获取不到图片则退出程序----------
|
|
|
|
+// if(totaltime>120.0)
|
|
|
|
+// {
|
|
|
|
+// cout<<"Cant't get frame and quit"<<endl;
|
|
|
|
+// cv::destroyAllWindows();
|
|
|
|
+// std::cout<<"------end program------"<<std::endl;
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
cout<<"Wait for frame "<<totaltime<<"s"<<endl;
|
|
cout<<"Wait for frame "<<totaltime<<"s"<<endl;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -484,15 +484,16 @@ int main(int argc, char *argv[]) {
|
|
std::cout <<"total time lane : "<<
|
|
std::cout <<"total time lane : "<<
|
|
std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() <<
|
|
std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() <<
|
|
"ms" << std::endl;
|
|
"ms" << std::endl;
|
|
-
|
|
|
|
- cv::imshow("rst",raw_image);
|
|
|
|
- cv::imshow("warp",img_warp );
|
|
|
|
- if (cv::waitKey(10) == 'q')
|
|
|
|
|
|
+ if(imshow_flag)
|
|
{
|
|
{
|
|
- stop_read = true;
|
|
|
|
- break;
|
|
|
|
|
|
+ cv::imshow("rst",raw_image);
|
|
|
|
+ cv::imshow("warp",img_warp );
|
|
|
|
+ if (cv::waitKey(10) == 'q')
|
|
|
|
+ {
|
|
|
|
+ stop_read = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
double waittime = (double)cv::getTickCount();
|
|
double waittime = (double)cv::getTickCount();
|
|
|
|
|
|
}
|
|
}
|