00001
00002
00003 #include "Threshold.h"
00004
00005 template void Threshold< int >(Image< int >&, float, ByteImage&);
00006 template void Threshold< byte >(Image< byte >&, float, ByteImage&);
00007 template void Threshold< float >(Image< float >&, float, ByteImage&);
00008
00009 template< class T > void Threshold(Image< T >& input, float th_level, ByteImage& output)
00010 {
00011 ByteImage res(input.getWidth(), input.getHeight(), output.getName());
00012 for (int i = 0; i < input.getHeight(); i++)
00013 for (int j = 0; j < input.getWidth(); j++)
00014 res[i][j] = (input[i][j] < th_level) ? 0 : 255;
00015 output = res;
00016 }