Skip to content

Instantly share code, notes, and snippets.

@harderthan
Created September 4, 2018 12:39
Show Gist options
  • Save harderthan/e30f3dbeb98d4e5e3b67ba9edd1d04b9 to your computer and use it in GitHub Desktop.
Save harderthan/e30f3dbeb98d4e5e3b67ba9edd1d04b9 to your computer and use it in GitHub Desktop.
Draw Lane on The image with Opencv
// Draw Lane on The image
cv::Mat laneOverlay = drawImg(cv::Rect(0,0,drawImg.cols, drawImg.rows)).clone();
lane_polylines.push_back(cv::Point(topic_lane[0], topic_lane[1]));
lane_polylines.push_back(cv::Point(topic_lane[2], topic_lane[3]));
lane_polylines.push_back(cv::Point(topic_lane[6], topic_lane[7]));
lane_polylines.push_back(cv::Point(topic_lane[4], topic_lane[5]));
cv::fillConvexPoly(laneOverlay, lane_polylines, cv::Scalar(0, 255, 0), 8);
double alpha = 0.3;
cv::addWeighted(laneOverlay, alpha, drawImg, 1 - alpha, 0, drawImg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment