34 #include "StateEstimator/CondensHisto.hh"
35 #include "Base/ImageUtils/ImageDraw.hh"
36 #include "Base/Image/ImageBase.hh"
37 #include "Base/Image/ImageIO.hh"
38 #include "Base/Image/ImageConvert.hh"
39 #include "Image/ColorHistogram.hh"
40 #include "Filter/Rescale.hh"
41 #include <Base/Common/FileHandling.hh>
49 int main(
int argc,
char** argv)
51 stringstream fileName;
73 cerr<<
"Give a bin width and an image as arguments!"<<endl;
74 cerr<<
"Usage:"<< argv[0] <<
" binsize imagefile"<<endl;
81 cerr<<
"Error reading image!"<<endl;
87 (
int)floor((
double)image.
GetHeight()/2),3);
96 cerr<<
"Image is in HSL colorspace"<<endl;
98 fileName<<
"MeanImage.mip";
101 binsize = atoi(argv[1]);
112 condensation.
Init(250);
129 cerr<<
"Error reading image!"<<endl;
135 (
int)floor((
double)image2.
GetHeight()/2),3);
138 cout<<
"Image: "<<n<<
" imported."<<endl;
142 cerr<<
"Image is in HSL colorspace"<<endl;
154 stringstream samplesName;
159 stringstream meanName;
162 cout<<
"after Process()"<<endl;
void Release()
reimplemented from ImageBase
int InitPrior()
sets the sample positions for first time step
int Init(unsigned int nrSmaples)
Init the Condensation directly after constructor, with the desired amount of Samples, there more the better the approximation of the real densities.
static int ImportImage(const std::string &filename, ImageBase &result)
Try to load/import an image from a file using external libs.
void Process()
This really does one iteration of Condensation.
void SetColorModel(EColorModel Model)
void SetReferenceHistogram(ColorHistogram< unsigned char > &refHisto)
sets the reference colorhistogram
void Dump(std::ostream &os=std::cout)
dumps information on histogram
static BIASImageBase_EXPORT int ToHSL(const Image< StorageType > &source, Image< StorageType > &dest)
Create a HSL converted copy of source image in this Release() and Init() are called if necessary...
int Downsample(const Image< InputStorageType > &src, Image< OutputStorageType > &dst)
generic downsample function.
unsigned int GetWidth() const
void DrawWeightedSamples(Image< float > &img)
this draws the samples as circles and the color indicates the size of the histogram (the z-coordinate...
int GenerateHist(BIAS::Image< StorageType > &image, int ux, int uy, int lx, int ly)
calcluates the histogram from data and adds them to the internal data structures
virtual void DrawMean(BIAS::Image< unsigned char > &img)
Draws the mean as a rectangle which size is proportional to the histogram size.
void SetMinWeight(double min)
Sets the minimum weight each sample is assigned, when < lower minWeight_.
void SetArea(Vector3< double > min, Vector3< double > max)
The area for the initial uniform distribution.
color values, 3 channels, order: red,green,blue
int SetBinSize(int binsize)
set the binsize (must be divideable by 2pown)
static std::string LeadingZeroString(const int &n, const unsigned int &digits=DEFAULT_LEADING_ZEROS)
Create a string with leading zeroes from number.
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.
void SetActiveImage(Image< unsigned char > &img)
sets the present picture to compare and create new observation
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
class for tracking an object in an image
virtual void InitPriorPositions(unsigned int nrOfInitSamples)
The Prior condition is used to init the first sample positions.
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...
void SetFactor(double factor)
the downsampling factor
int PredictNewSamplePositions()