void ProcessImage(Image<Tout>& img_out, const Image<Tin>& img_in, bayer_method_t method, color_filter_t tile) { if(method == BAYER_METHOD_NONE) { PitchedImageCopy(img_out, img_in.template UnsafeReinterpret<Tout>() ); }else if(method == BAYER_METHOD_DOWNSAMPLE_MONO) { if( sizeof(Tout) == 1) { DownsampleToMono<int,Tout, Tin>(img_out, img_in); }else{ DownsampleToMono<double,Tout, Tin>(img_out, img_in); } }else if(method == BAYER_METHOD_DOWNSAMPLE) { DownsampleDebayer(img_out, img_in, tile); }else{ #ifdef HAVE_DC1394 if(sizeof(Tout) == 1) { dc1394_bayer_decoding_8bit( (uint8_t*)img_in.ptr, (uint8_t*)img_out.ptr, img_in.w, img_in.h, (dc1394color_filter_t)tile, (dc1394bayer_method_t)method ); }else if(sizeof(Tout) == 2) { dc1394_bayer_decoding_16bit( (uint16_t*)img_in.ptr, (uint16_t*)img_out.ptr, img_in.w, img_in.h, (dc1394color_filter_t)tile, (dc1394bayer_method_t)method, 16 ); } #endif } }
//! Implement VideoInput::GrabNext() bool DebayerVideo::GrabNext( unsigned char* image, bool wait ) { if(videoin[0]->GrabNext(buffer,wait)) { for(size_t s=0; s<streams.size(); ++s) { Image<unsigned char> img_in = videoin[0]->Streams()[s].StreamImage(buffer); Image<unsigned char> img_out = Streams()[s].StreamImage(image); #ifdef HAVE_DC1394 dc1394_bayer_decoding_8bit( img_in.ptr, img_out.ptr, img_in.w, img_in.h, (dc1394color_filter_t)tile, (dc1394bayer_method_t)method ); #else // use our simple debayering instead DownsampleDebayer(img_out, img_in, tile); #endif } return true; }else{ return false; } }