44 #include <Base/Image/Image.hh>
45 #include <Base/Image/ImageIO.hh>
46 #include <Base/ImageUtils/ImageDraw.hh>
52 int main(
int argc,
char *argv[]) {
56 cout <<
"wrong parameter count!!" << endl << endl;
57 cout <<
"usage:" << endl;
58 cout << argv[0] <<
" " <<
"<brighter_image> <darker_image>" << endl;
66 cout <<
"image 1 could not be loaded!" << endl;
70 cout <<
"image 1 loaded!" << endl;
73 cout <<
"image 2 could not be loaded!" << endl;
77 cout <<
"image 2 loaded!" << endl;
80 cout <<
"images loaded" << endl;
93 unsigned char *imDiffData = imDiff.GetImageData();
94 unsigned int offset = 0;
96 unsigned int gammaX, gammaY;
98 cout <<
"starting iteration..." << endl;
101 for (
unsigned int y = 0; y < im1.
GetHeight(); y++) {
102 for (
unsigned int x = 0; x < im1.
GetWidth(); x++) {
106 diff = (int)im1Data[offset] - (
int)im2Data[offset]
107 + (int)im1Data[offset+1] - (
int)im2Data[offset+1]
108 + (
int)im1Data[offset+2] - (
int)im2Data[offset+2];
111 diff = diff < 0 ? 0 : diff;
112 diff = diff > 255 ? 255 : diff;
113 imDiffData[offset] = (
unsigned char)diff;
114 imDiffData[offset+1] = (
unsigned char)diff;
115 imDiffData[offset+2] = (
unsigned char)diff;
118 if (drawChannelDiffs) {
120 gammaX = (
unsigned int)im1Data[offset];
121 gammaY = 256 - (
unsigned int)im2Data[offset];
126 gammaX = (
unsigned int)im1Data[offset+1] + 256;
127 gammaY = 256 - (
unsigned int)im2Data[offset+1];
132 gammaX = (
unsigned int)im1Data[offset+2] + 512;
133 gammaY = 256 - (
unsigned int)im2Data[offset+2];
138 gammaX = (
unsigned int)im1Data[offset] + (
unsigned int)im1Data[offset+1] + (
unsigned int)im1Data[offset+2];
141 gammaY = (
unsigned int)im2Data[offset] + (
unsigned int)im2Data[offset+1] + (
unsigned int)im2Data[offset+2];
143 gammaY = 256 - gammaY;
145 imDiffData[offset] = 255;
146 imDiffData[offset + 1] = 255;
147 imDiffData[offset + 2] = 255;
154 cout <<
"done!" << endl;
unsigned int GetWidth() const
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
color values, 3 channels, order: red,green,blue
unsigned int GetHeight() const
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
enum EColorModel GetColorModel() const
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...