MCPcopy Create free account
hub / github.com/city-super/Scaffold-GS / buildGraphBinaryLabels

Method buildGraphBinaryLabels

SIBR_viewers/src/core/imgproc/MRFSolver.cpp:229–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227 }
228
229 void MRFSolver::buildGraphBinaryLabels(void)
230 {
231 int num_nodes = (int)_neighborMap->size();
232 int n_nodes_estimation = num_nodes;
233 int n_edges_estimation = num_nodes * 4;
234
235 _graph = new GraphType(n_nodes_estimation, n_edges_estimation);
236
237 for (int p = 0; p < num_nodes; p++) {
238 _graph->add_node();
239 _graph->add_tweights(p, unaryTotal(p, 0), unaryTotal(p, 1));
240 }
241
242 for (int p = 0; p < num_nodes; p++) {
243 std::vector<int> & neighors = (*_neighborMap)[p];
244 for (int q_id = 0; q_id < (int)neighors.size(); q_id++) {
245
246 int q = neighors[q_id];
247
248 if (q < p) { continue; }
249
250 double weight = pairwiseTotal(q, p, 0, 1);
251
252 _graph->add_edge(q, p, weight, weight);
253 }
254 }
255 }
256
257 double MRFSolver::unaryTotal(int p, int lp_id)
258 {

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected