Produce a color image from a bunch of labels
| 37 | } |
| 38 | // Produce a color image from a bunch of labels |
| 39 | unsigned char * colorize( const VectorXs & labeling, int W, int H ){ |
| 40 | unsigned char * r = new unsigned char[ W*H*3 ]; |
| 41 | for( int k=0; k<W*H; k++ ){ |
| 42 | int c = colors[ labeling[k] ]; |
| 43 | putColor( r+3*k, c ); |
| 44 | } |
| 45 | //printf("%d %d %d \n",r[0],r[1],r[2]); |
| 46 | return r; |
| 47 | } |
| 48 | // Read the labeling from a file |
| 49 | VectorXs getLabeling( const unsigned char * im, int N, int M ){ |
| 50 | VectorXs res(N); |