25 #include <Image/Camera.hh>
26 #include <Base/Image/ImageBase.hh>
27 #include <Base/Image/ImageIO.hh>
28 #include <Base/Image/ImageConvert.hh>
29 #include <Base/Image/ImageAttributes.hh>
30 #include <Geometry/PMatrix.hh>
31 #include <bias_config.h>
34 #include <Utils/Param.hh>
37 # include "Base/Common/getopt_W32.h"
50 int main(
int argc,
char *argv[]) {
53 bool *help = param.
AddParamBool(
"help",
"display help",
false,
'h');
54 int *channel = param.
AddParamInt(
"channel",
"channel to extract", 0, 0, INT_MAX,
'c');
58 if (*help || fup + 1 >= argc) {
59 cout <<
"Usage: " << argv[0] <<
" [options] infile outfile\n";
63 string ifile = argv[fup];
64 string ofile = argv[fup + 1];
67 ifile = argv[argc - 2];
68 ofile = argv[argc - 1];
73 BIASERR(
"could not load " <<ifile);
77 BIASERR(
"image "<<ifile<<
" has only "<<pic.
GetChannelCount()<<
" channels"<<endl);
bool * AddParamBool(const std::string &name, const std::string &help, bool deflt=false, char cmdshort=0, int Group=GRP_NOSHOW)
int ParseCommandLine(int &argc, char *argv[])
scan command line arguments for valid parameters
static int GetChannel(const Image< StorageType > &source, Image< StorageType > &dest, const unsigned int channel)
Create a new image dest by cropping one of the source images channels.
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
This class Param provides generic support for parameters.
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...
int * AddParamInt(const std::string &name, const std::string &help, int deflt=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), char cmdshort=0, int Group=GRP_NOSHOW)
For all adding routines:
This is the base class for images in BIAS.