#include #include namespace OBJREC { template void SemanticSegmentation::make3DImage ( const std::vector & filelist, NICE::MultiChannelImage3DT & imgData ) { bool isInit = false; for ( int it = 0; it < ( int ) filelist.size(); it++ ) { if ( imagetype == IMAGETYPE_RGB ) { NICE::ColorImage img; try { img.read ( filelist[it] ); } catch ( NICE::ImageException iE ) { fprintf ( stderr, "Failed to open color image file: %s\n", filelist[it].c_str() ); fprintf ( stderr, "%s\n", iE.what() ); exit ( -1 ); } if ( !isInit ) { imgData.reInit ( img.width(),img.height(),filelist.size(),3 ); isInit = true; } for ( int y = 0; y < img.height(); y++ ) { for ( int x = 0; x < img.width(); x++ ) { for ( int r = 0; r < 3; r++ ) { imgData.set ( x, y, it, (SrcP)img.getPixel ( x,y,r ), r ); } } } } else { NICE::Image img; try { img.read ( filelist[it] ); } catch ( NICE::ImageException iE ) { fprintf ( stderr, "Failed to open image file: %s\n", filelist[it].c_str() ); fprintf ( stderr, "%s\n", iE.what() ); exit ( -1 ); } if ( !isInit ) { imgData.reInit ( img.width(),img.height(),filelist.size(),1 ); isInit = true; } for ( int y = 0; y < img.height(); y++ ) { for ( int x = 0; x < img.width(); x++ ) { imgData.set ( x, y, it, (SrcP)img.getPixel ( x,y ), 0 ); } } } } if ( imagetype == IMAGETYPE_GRAY ) { imgData.equalizeHistogram( 0 ); } } }