| 117 | } |
| 118 | |
| 119 | FaceBitSet GraphCut::fillLeft( const ProgressCallback& progress ) |
| 120 | { |
| 121 | MR_TIMER; |
| 122 | |
| 123 | size_t numCycles = 0; |
| 124 | while ( !active_[Left].empty() ) |
| 125 | { |
| 126 | auto lf = active_[Left].front(); |
| 127 | active_[Left].pop_front(); |
| 128 | processActive_( lf, Left ); |
| 129 | |
| 130 | if ( !active_[Right].empty() ) |
| 131 | { |
| 132 | auto rf = active_[Right].front(); |
| 133 | active_[Right].pop_front(); |
| 134 | processActive_( rf, Right ); |
| 135 | } |
| 136 | |
| 137 | ++numCycles; |
| 138 | if ( !reportProgress( progress, |
| 139 | [numCycles]() { return std::erf( numCycles * 1e-7f ); }, // report 84% for numCycles == 10'000'000 |
| 140 | numCycles, 65536 ) ) |
| 141 | break; |
| 142 | } |
| 143 | |
| 144 | // this will return all connected components without single Left seed on them |
| 145 | // if ( active_[Right].empty() ) |
| 146 | // return topology_.getValidFaces() - filled_[Right]; |
| 147 | |
| 148 | return filled_[Left]; |
| 149 | } |
| 150 | |
| 151 | void GraphCut::processActive_( FaceId f, int side ) |
| 152 | { |
no test coverage detected