MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / read_lane_file

Function read_lane_file

eval/LANE_evaluation/lane2d/src/evaluate.cpp:277–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void read_lane_file(const string &file_name, vector<vector<Point2f>> &lanes, vector<uint8_t> &lane_flags)
278{
279 lanes.clear();
280 std::ifstream fin(file_name);
281
282 neb::CJsonObject oJson;
283 std::stringstream ssContent;
284 ssContent << fin.rdbuf();
285 oJson.Parse(ssContent.str());
286
287 for (int j = 0; j < oJson["lane_lines"].GetArraySize(); j++)
288 {
289 vector<Point2f> curr_lane;
290 int category_flag;
291 if (oJson["lane_lines"][j]["uv"][0].GetArraySize() < 2) {
292 continue;
293 }
294 for (int i = 0; i < oJson["lane_lines"][j]["uv"][0].GetArraySize(); ++i)
295 {
296 double u, v;
297 oJson["lane_lines"][j]["uv"][0].Get(i, u);
298 oJson["lane_lines"][j]["uv"][1].Get(i, v);
299 curr_lane.push_back(Point2f(u, v));
300 }
301
302 std::sort(curr_lane.begin(), curr_lane.end(), lessmark);
303 oJson["lane_lines"][j].Get("category", category_flag);
304
305 lane_flags.push_back(uint8_t(category_flag));
306 lanes.push_back(curr_lane);
307 }
308
309 fin.close();
310}
311
312void visualize(string &full_im_name, vector<vector<Point2f>> &anno_lanes, vector<vector<Point2f>> &detect_lanes, vector<int> anno_match, int width_lane, string visualize_path)
313{

Callers 1

mainFunction · 0.85

Calls 3

ParseMethod · 0.80
GetArraySizeMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected