| 3 | |
| 4 | |
| 5 | MatrixXf computeUnary( const float *prob, int H, int W, int C){ |
| 6 | MatrixXf r(C, H*W ); |
| 7 | for(int k=0; k<H*W; k++ ) |
| 8 | { |
| 9 | for(int c = 0; c < C; c++) |
| 10 | { |
| 11 | // Set the energy |
| 12 | float p = prob[k*C + c]; |
| 13 | if(p<0.01)p=0.01; |
| 14 | if(p>0.99)p=0.99; |
| 15 | r(c,k) = -log(p); |
| 16 | } |
| 17 | } |
| 18 | return r; |
| 19 | } |
| 20 | |
| 21 | VectorXs dense_crf_inference(const unsigned char * img, const float * prob, int H, int W, int C, CRFParam param) |
| 22 | { |
no test coverage detected