cv::Mat GraphComparator::_paintGraph(shared_ptr<OsmMap> map, DirectedGraph& graph, ShortestPath& sp) { const WayMap& ways = map->getWays(); cv::Mat mat(cvSize(_width, _height), CV_32FC1); for (int y = 0; y < _height; y++) { float* row = mat.ptr<float>(y); for (int x = 0; x < _width; x++) { row[x] = -1.0; } } for (WayMap::const_iterator it = ways.begin(); it != ways.end(); ++it) { shared_ptr<Way> w = it->second; double cost = sp.getNodeCost(w->getNodeIds()[0]); if (cost >= 0) { double friction = graph.determineCost(w); if (friction >= 0) { double startCost = cost; double endCost = sp.getNodeCost(w->getNodeIds()[w->getNodeCount() - 1]); _paintWay(mat, map, w, friction, startCost, endCost); _maxGraphCost = std::max(startCost, endCost); } } } return mat; }