33 #include <Base/Image/ImageBase.hh>
34 #include <Base/ImageUtils/ImageDraw.hh>
35 #include <Base/Image/ImageConvert.hh>
36 #include <Base/Image/ImageIO.hh>
43 const unsigned int w = 640;
44 const unsigned int h = 400;
50 for(
unsigned int i=0; i<(w*h); i++)
53 unsigned char ti = (
unsigned char)(i%256);
55 pData[i*3+1] = (
unsigned char)((i>>8)%256);
56 pData[i*3+2] = (
unsigned char)((i>>16)%256);
62 cout<<
"image planar flags inconsistend (plan1)"<<endl;
66 pData = im.GetImageData();
67 for(
unsigned int i=0; i<(w*h); i++)
70 unsigned char ti = (
unsigned char)(i%256);
71 if((pData[i*3+0] != ti)||(pData[i*3+1] != ((i>>8)%256))
72 ||(pData[i*3+2] != ((i>>16)%256)))
74 cout<<
"image data changed after conversion"<<endl;
78 if(im.IsPlanar()||(!im.IsInterleaved()))
80 cout<<
"image planar interleaved flags inconsistend"<<endl;
85 cout<<
"image planar interleaved flags inconsistend (plan1)"<<endl;
92 cout<<
"loaded image not planar anymore..."<<endl;
97 pData = im.GetImageData();
98 for(
unsigned int i=0; i<(w*h); i++)
101 unsigned char ti = (
unsigned char)(i%256);
102 if((pData[i*3+0] != ti)||(pData[i*3+1] != ((i>>8)%256))
103 ||(pData[i*3+2] != ((i>>16)%256)))
105 cout<<
"image data changed after conversion"<<endl;
112 cout<<
"image planar interleaved flags inconsistend"<<endl;
bool IsInterleaved() const
static BIASImageBase_EXPORT int ToPlanar(const Image< StorageType > &source, Image< StorageType > &dest)
Converts the existing image to an planar version.
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.
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...
static BIASImageBase_EXPORT int ToInterleaved(const Image< StorageType > &source, Image< StorageType > &dest)
Takes the source image, and build an interleaved version.