| 185 | return Q; |
| 186 | } |
| 187 | void DenseCRF::stepInference( MatrixXf & Q, MatrixXf & tmp1, MatrixXf & tmp2 ) const{ |
| 188 | tmp1.resize( Q.rows(), Q.cols() ); |
| 189 | tmp1.fill(0); |
| 190 | if( unary_ ) |
| 191 | tmp1 -= unary_->get(); |
| 192 | |
| 193 | // Add up all pairwise potentials |
| 194 | for( unsigned int k=0; k<pairwise_.size(); k++ ) { |
| 195 | pairwise_[k]->apply( tmp2, Q ); |
| 196 | tmp1 -= tmp2; |
| 197 | } |
| 198 | |
| 199 | // Exponentiate and normalize |
| 200 | expAndNormalize( Q, tmp1 ); |
| 201 | } |
| 202 | VectorXs DenseCRF::currentMap( const MatrixXf & Q ) const{ |
| 203 | VectorXs r(Q.cols()); |
| 204 | // Find the map |