calib3d/imgproc: add GCGraph::maxFlow() missing empty checks

This commit is contained in:
Alexander Alekhin 2020-10-01 15:20:32 +00:00
parent 969b55036f
commit c6b63e0e28

View File

@ -152,6 +152,8 @@ void GCGraph<TWeight>::addTermWeights( int i, TWeight sourceW, TWeight sinkW )
template <class TWeight>
TWeight GCGraph<TWeight>::maxFlow()
{
CV_Assert(!vtcs.empty());
CV_Assert(!edges.empty());
const int TERMINAL = -1, ORPHAN = -2;
Vtx stub, *nilNode = &stub, *first = nilNode, *last = nilNode;
int curr_ts = 0;