MCPcopy Create free account
hub / github.com/creatale/node-dv / icvAddBasicVariable

Function icvAddBasicVariable

deps/opencv/modules/imgproc/src/emd.cpp:1050–1088  ·  view source on GitHub ↗

\ * icvAddBasicVariable * \****************************************************************************************/

Source from the content-addressed store, hash-verified

1048* icvAddBasicVariable *
1049\****************************************************************************************/
1050static void
1051icvAddBasicVariable( CvEMDState * state,
1052 int min_i, int min_j,
1053 CvNode1D * prev_u_min_i, CvNode1D * prev_v_min_j, CvNode1D * u_head )
1054{
1055 float temp;
1056 CvNode2D *end_x = state->end_x;
1057
1058 if( state->s[min_i] < state->d[min_j] + state->weight * CV_EMD_EPS )
1059 { /* supply exhausted */
1060 temp = state->s[min_i];
1061 state->s[min_i] = 0;
1062 state->d[min_j] -= temp;
1063 }
1064 else /* demand exhausted */
1065 {
1066 temp = state->d[min_j];
1067 state->d[min_j] = 0;
1068 state->s[min_i] -= temp;
1069 }
1070
1071 /* x(min_i,min_j) is a basic variable */
1072 state->is_x[min_i][min_j] = 1;
1073
1074 end_x->val = temp;
1075 end_x->i = min_i;
1076 end_x->j = min_j;
1077 end_x->next[0] = state->rows_x[min_i];
1078 end_x->next[1] = state->cols_x[min_j];
1079 state->rows_x[min_i] = end_x;
1080 state->cols_x[min_j] = end_x;
1081 state->end_x = end_x + 1;
1082
1083 /* delete supply row only if the empty, and if not last row */
1084 if( state->s[min_i] == 0 && u_head->next->next != 0 )
1085 prev_u_min_i->next = prev_u_min_i->next->next; /* remove row from list */
1086 else
1087 prev_v_min_j->next = prev_v_min_j->next->next; /* remove column from list */
1088}
1089
1090
1091/****************************************************************************************\

Callers 1

icvRusselFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected