MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / solve

Method solve

tracking/src/munkres.cpp:316–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314 }
315
316 cv::Mat
317 Munkres::solve(cv::Mat& matrix_in, bool max)
318 {
319 // Preprocessing:
320 double** matrix = preprocess(matrix_in, max);
321
322 int max_dim = MAX(matrix_in.rows, matrix_in.cols);
323 int rows = max_dim;
324 int cols = max_dim;
325
326 bool done = false;
327 int step = 1;
328 int* rowCover = new int[rows];
329 int* colCover = new int[cols];
330 double** m = new double*[rows];
331 int path_row_0 = 0;
332 int path_col_0 = 0;
333 int path_count = 0;
334 for (int j = 0; j < cols; j++) {
335 colCover[j] = 0;
336 }
337 for (int i = 0; i < rows; i++) {
338 rowCover[i] = 0;
339 m[i] = new double[cols];
340 for (int j = 0; j < cols; j++) {
341 m[i][j] = 0;
342 }
343 }
344 int** path = new int*[rows*cols];
345 for (int i = 0; i < rows*cols; i++) {
346 path[i] = new int[2];
347 }
348
349 // Main loop:
350 while (!done) {
351 switch (step) {
352 case 1:
353 step_one(matrix, rows, cols, step);
354 break;
355 case 2:
356 step_two(matrix, rows, cols, rowCover, colCover, m, step);
357 break;
358 case 3:
359 step_three(rows, cols, colCover, m, step);
360 break;
361 case 4:
362 step_four(matrix, rows, cols, rowCover, colCover, m, path_row_0, path_col_0,
363 step);
364 break;
365 case 5:
366 step_five(rows, cols, rowCover, colCover, m, path_row_0, path_col_0,
367 path_count, path, step);
368 break;
369 case 6:
370 step_six(matrix, rows, cols, rowCover, colCover, step);
371 break;
372 case 7:
373 done = true;

Callers 5

test_solveMethod · 0.80
updateTracksMethod · 0.80
updateTracksMethod · 0.80
updateTracksMethod · 0.80
updateTracksMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_solveMethod · 0.64