34 #include <Base/Image/Image.hh>
35 #include <Base/Image/ImageIO.hh>
36 #include <Base/ImageUtils/ImageDraw.hh>
37 #include <Base/Math/Random.hh>
38 #include <Image/HistogramImage.hh>
46 int main(
int argc,
char *argv[])
55 cerr<< argv[0] <<
" <pgm file> <pgm file2>"<<endl;
60 cerr <<
"error loading file " << argv[1] <<
" " << res << endl;
65 cerr <<
"wrong channel count in image"<< endl;
85 cerr <<
"error loading file " << argv[2] <<
" " << res << endl;
93 for (
int i=0; i<1024; i++){
94 for(
int j=0; j<1000; j++)
106 unsigned st[2], end[2];
107 double dst[2]={0, 1000}, dend[2];
108 dend[0] = (double)binc; dend[1] = 1000;
109 unsigned char col[]={255, 0, 255};
110 dst[0]=0; dend[0]=binc;
111 for (
int i=1000; i<15000; i+=1000){
115 cerr <<
"drawing "<<st[0]<<
", "<<st[1]<<
" -> "<<end[0]<<
", "<<end[1]<<endl;
121 BIASERR(
"error writing");
124 vector<unsigned> xd, yd;
125 unsigned char *id1, *id2;
130 for (
unsigned i=0; i<pc; i++) {
131 xd.push_back((
unsigned)id1[i]);
132 yd.push_back((
unsigned)id2[i]);
150 BIASERR(
"error writing");
void InitHist(unsigned xbincount=256, unsigned ybincount=256)
static int ImportImage(const std::string &filename, ImageBase &result)
Try to load/import an image from a file using external libs.
int InitHist(unsigned int bincount=256, unsigned int histcount=1)
reserves the internal data structures for histcount histograms with bincount bins in each in one imag...
int Draw()
actually draws histogram(s) from the internal data structures
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
int AddHist(const Image< StorageType > &Image, unsigned int hist=0)
calculates the histogram of image and adds them to the internal data structures
static int Line(Image< StorageType > &im, const unsigned int start[2], const unsigned int end[2], const StorageType value[])
lines
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
void SetFactor(unsigned short Factor)
sets the zoomfactor
void CooTransf(double datacoo[2], double imcoo[2], unsigned hist=0)
transforms data coordinates to image coordinates does automatic clipping
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.
Class for easy histogram image generation.
int SetColor(unsigned char R, unsigned char G, unsigned char B, unsigned int hist=0)
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
void SetDrawMode(HistMode m)
Select drawing style. Default is HIST_POINTS.
void AddHist(const std::vector< DataType > &xdata, const std::vector< DataType > &ydata)
unsigned long int GetPixelCount() const
returns number of pixels in image
void SetFactor(unsigned short Factor)
sets the zoomfactor
class for producing random numbers from different distributions