| 280 | return Q; |
| 281 | } |
| 282 | void DenseCRF::stepInference( MatrixXf & Q, MatrixXf & tmp1, MatrixXf & tmp2 ) const{ |
| 283 | tmp1.resize( Q.rows(), Q.cols() ); |
| 284 | tmp1.fill(0); |
| 285 | if( unary_ ) |
| 286 | tmp1 -= unary_->get(); |
| 287 | |
| 288 | // Add up all pairwise potentials |
| 289 | for( unsigned int k=0; k<pairwise_.size(); k++ ) { |
| 290 | pairwise_[k]->apply( tmp2, Q ); |
| 291 | tmp1 -= tmp2; |
| 292 | } |
| 293 | |
| 294 | // Exponentiate and normalize |
| 295 | expAndNormalize( Q, tmp1 ); |
| 296 | } |
| 297 | VectorXs DenseCRF::currentMap( const MatrixXf & Q ) const{ |
| 298 | VectorXs r(Q.cols()); |
| 299 | // Find the map |