//void inline junctionRecovery(Contours* polygons) void junctionRecovery(Contours *polygons, VectorizerCoreGlobals &g) { globals = &g; unsigned int i, j; std::vector<JunctionArea> junctionAreasList; //For all joints not processed by the Recoverer, launch a new junction //area reconstruction for (i = 0; i < globals->organizedGraphs.size(); ++i) { currJSGraph = &globals->organizedGraphs[i]; currContourFamily = &(*polygons)[contourFamilyOfOrganized[i]]; junctionAreasList.clear(); //First, graph roads are found and signed on the skeleton findRoads(*currJSGraph); //Then, junction areas are identified and reconstructions are calculated for (j = 0; j < currJSGraph->getNodesCount(); ++j) if (!currJSGraph->getNode(j).hasAttribute(JointSequenceGraph::REACHED)) { junctionAreasList.push_back(JunctionArea()); junctionAreasList.back().expandArea(j); if (!junctionAreasList.back().calculateReconstruction()) junctionAreasList.pop_back(); } //Finally, reconstructions are substituted inside the skeleton for (j = 0; j < junctionAreasList.size(); ++j) junctionAreasList[j].apply(); } }
// Find the 'roads' of the current Graph. void findRoads(const JointSequenceGraph &JSGraph) { unsigned int i, j; // For all Sequence of currGraph, extract roads for (i = 0; i < JSGraph.getNodesCount(); ++i) { for (j = 0; j < JSGraph.getNode(i).getLinksCount(); ++j) // if(JSGraph.getNode(i).getLink(j)->isForward()) findRoads(*JSGraph.getNode(i).getLink(j)); } }