mask
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
+17
-8
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
bool gRun;
|
bool gRun;
|
||||||
|
|
||||||
|
|
||||||
cv::Mat frame_v;
|
cv::Mat frame_v;
|
||||||
cv::Mat frame_top_v;
|
cv::Mat frame_top_v;
|
||||||
std::mutex sem;
|
std::mutex sem;
|
||||||
@@ -45,7 +44,6 @@ void *showImages(void *x_void_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_arrow(float angleRad, float vel, cv::Scalar color, cv::Point center, cv::Mat &frame)
|
void draw_arrow(float angleRad, float vel, cv::Scalar color, cv::Point center, cv::Mat &frame)
|
||||||
{
|
{
|
||||||
int angle = angleRad * 180.0 / CV_PI;
|
int angle = angleRad * 180.0 / CV_PI;
|
||||||
@@ -78,11 +76,12 @@ int main(int argc, char *argv[])
|
|||||||
int CAM_IDX = 0;
|
int CAM_IDX = 0;
|
||||||
if (argc > 5)
|
if (argc > 5)
|
||||||
CAM_IDX = atoi(argv[5]);
|
CAM_IDX = atoi(argv[5]);
|
||||||
bool to_show = false;
|
bool to_show = true;
|
||||||
if (argc > 6)
|
if (argc > 6)
|
||||||
to_show = atoi(argv[6]);
|
to_show = atoi(argv[6]);
|
||||||
|
char *maskfile = "../demo/demo/data/mask36.jpg";
|
||||||
|
if (argc > 7)
|
||||||
|
maskfile = argv[7];
|
||||||
|
|
||||||
tk::dnn::Yolo3Detection yolo;
|
tk::dnn::Yolo3Detection yolo;
|
||||||
yolo.init(net);
|
yolo.init(net);
|
||||||
@@ -130,6 +129,10 @@ int main(int argc, char *argv[])
|
|||||||
double east, north, up;
|
double east, north, up;
|
||||||
double lat, lon, alt;
|
double lat, lon, alt;
|
||||||
|
|
||||||
|
/*Mask info*/
|
||||||
|
cv::Mat mask;
|
||||||
|
mask = cv::imread(maskfile, cv::IMREAD_GRAYSCALE);
|
||||||
|
|
||||||
/*tracker infos*/
|
/*tracker infos*/
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
std::vector<Tracker> trackers;
|
std::vector<Tracker> trackers;
|
||||||
@@ -142,6 +145,7 @@ int main(int argc, char *argv[])
|
|||||||
int frame_nbr = 0;
|
int frame_nbr = 0;
|
||||||
while (gRun)
|
while (gRun)
|
||||||
{
|
{
|
||||||
|
|
||||||
cap >> frame;
|
cap >> frame;
|
||||||
if (!frame.data)
|
if (!frame.data)
|
||||||
{
|
{
|
||||||
@@ -176,6 +180,11 @@ int main(int argc, char *argv[])
|
|||||||
int y1 = b.y + b.h;
|
int y1 = b.y + b.h;
|
||||||
int obj_class = b.cl;
|
int obj_class = b.cl;
|
||||||
|
|
||||||
|
cv::Scalar intensity = mask.at<uchar>(cv::Point(int(x0 + b.w / 2), y1));
|
||||||
|
|
||||||
|
if (intensity[0])
|
||||||
|
{
|
||||||
|
|
||||||
if (obj_class == 0 /*person*/ || obj_class == 1 /*bicycle*/ || obj_class == 2 /*car*/
|
if (obj_class == 0 /*person*/ || obj_class == 1 /*bicycle*/ || obj_class == 2 /*car*/
|
||||||
|| obj_class == 3 /*motorbike*/ || obj_class == 5 /*bus*/)
|
|| obj_class == 3 /*motorbike*/ || obj_class == 5 /*bus*/)
|
||||||
{
|
{
|
||||||
@@ -187,7 +196,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//std::cout<<obj_class<<" ("<<prob<<"): "<<x0<<" "<<y0<<" "<<x1<<" "<<y1<<"\n";
|
//std::cout<<obj_class<<" ("<<prob<<"): "<<x0<<" "<<y0<<" "<<x1<<" "<<y1<<"\n";
|
||||||
cv::rectangle(frame, cv::Point(x0, y0), cv::Point(x1, y1), yolo.colors[obj_class], 2);
|
cv::rectangle(frame, cv::Point(x0, y0), cv::Point(x1, y1), yolo.colors[obj_class], 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_START
|
TIMER_START
|
||||||
@@ -239,7 +248,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
cv::circle(frame, cv::Point(camera_p[0].x, camera_p[0].y), 3.0, cv::Scalar(t.r_, t.g_, t.b_), CV_FILLED, 8, 0);
|
cv::circle(frame, cv::Point(camera_p[0].x, camera_p[0].y), 3.0, cv::Scalar(t.r_, t.g_, t.b_), CV_FILLED, 8, 0);
|
||||||
|
|
||||||
if(p == t.pred_list_.size()-1)
|
/*if(p == t.pred_list_.size()-1)
|
||||||
{
|
{
|
||||||
auto center = cv::Point(camera_p[0].x, camera_p[0].y);
|
auto center = cv::Point(camera_p[0].x, camera_p[0].y);
|
||||||
auto color = cv::Scalar(t.r_, t.g_, t.b_);
|
auto color = cv::Scalar(t.r_, t.g_, t.b_);
|
||||||
@@ -247,7 +256,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
center = cv::Point(pix_x,pix_y);
|
center = cv::Point(pix_x,pix_y);
|
||||||
draw_arrow(t.pred_list_[p].yaw_, t.pred_list_[p].vel_,color, center, frame_top);
|
draw_arrow(t.pred_list_[p].yaw_, t.pred_list_[p].vel_,color, center, frame_top);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user