26 #include <Base/Debug/Error.hh>
27 #include <Base/Image/ImageIO.hh>
28 #include <Base/Image/ImageConvert.hh>
40 int main(
int argc,
char ** argv)
44 if (argc>0) cerr << argv[0] <<
" <image 1> <image 2> <outfile> \n";
45 cerr <<
" adds image 1 to image 2 and writes the result to outfile"
46 <<
" scaling and shifting is done for unsigned char"<<
53 BIASERR(
"error loading "<<argv[1]);
57 BIASERR(
"error loading "<<argv[2]);
61 BIASERR(
"image size,depth,or ST does not match");
75 unsigned char *p1, *p2, *end;
79 pSum=sumImg.GetImageData();
84 *pSum= (float)(*p1) + (float)(*p2);
92 for (
unsigned int i=0;
93 i<sumImg.GetPixelCount()*sumImg.GetChannelCount();
95 sumImg.GetImageData()[i] *= (float)(255.0/max);
100 BIASERR(
"error writing "<<argv[3]);
116 cerr <<
"storage type not supported \n";
unsigned int GetSizeByte() const
returns the nr.
unsigned int GetWidth() const
static int ConvertST(const BIAS::ImageBase &source, BIAS::ImageBase &dest, ImageBase::EStorageType targetST)
Function to convert the storage type of images e.g.
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
bool SamePixelAndChannelCount(const ImageBase &Image) const
checks if data area has same "size" as Image of other type
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.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
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...
enum EStorageType GetStorageType() const
(8bit) unsigned char image storage type
This is the base class for images in BIAS.