25 #include <Utils/Param.hh>
26 #include <Utils/IOUtils.hh>
27 #include <Base/Image/Image.hh>
28 #include <Base/Image/ImageIO.hh>
29 #include <Base/Image/ImageConvert.hh>
30 #include <OpenCLFramework/clfContext.hh>
32 #include <OpenCLFramework/Filter/clfGauss.hh>
33 #include <Filter/Mean.hh>
34 #include <Filter/Gauss.hh>
35 #include <OpenCLFramework/Filter/clfColorConversion.hh>
36 #include <OpenCLFramework/Filter/clfSimpleFilter.hh>
37 #include <Filter/StructureTensor.hh>
38 #include <FeatureDetector/CornerDetectorKLT.hh>
39 #include <Filter/GradientSimple.hh>
40 #include <Base/Debug/TimeMeasure.hh>
52 int main(
int argc,
char* argv[]) {
56 string *outname = par.
AddParamString(
"out",
"result",
"climage.mip",
'o');
57 bool *bench = par.
AddParamBool(
"benchmark",
"benchmark 100 (default) conversions on gpu againt cpu",
false,
'b');
58 int *numFrames = par.
AddParamInt(
"numframes",
"number of frames for benchmark", 100, 1, 10000,
'n');
80 clfImage2D *greyImage = context.CreateImage2D();
81 clfImage2D *dstImage = context.CreateImage2D();
86 cout <<
"doing bayer rggb to rgb" << endl;
94 for (
int i=0;i<*numFrames;i++) {
106 for (
int i=0;i<*numFrames;i++) {
113 cout <<
"GPU conversion runs at " << (1e6) / (gputime/(
float)(*numFrames)) <<
" frames/sec." << endl;
114 cout <<
"CPU conversion runs at " << (1e6) / (cputime/(
float)(*numFrames)) <<
" frames/sec." << endl;
115 cout <<
"GPU speed factor: " << cputime/gputime <<
"x"<<endl;
119 cout <<
"doing yuyv422 to rgb" << endl;
120 convert.UCharYUYV422ToRGBA(greyImage, dstImage);
127 for (
int i=0;i<*numFrames;i++) {
129 convert.UCharYUYV422ToRGBA(greyImage, dstImage);
139 for (
int i=0;i<*numFrames;i++) {
146 cout <<
"GPU conversion runs at " << (1e6) / (gputime/(
float)(*numFrames)) <<
" frames/sec." << endl;
147 cout <<
"CPU conversion runs at " << (1e6) / (cputime/(
float)(*numFrames)) <<
" frames/sec." << endl;
148 cout <<
"GPU speed factor: " << cputime/gputime <<
"x"<<endl;
YUYV422, 2 channels, full luminance Y, subsampled half U,V.
void Print(std::ostream &os=std::cout) const
Bayer_RGGB, 1 channel RGB image Bayer tile.
bool * AddParamBool(const std::string &name, const std::string &help, bool deflt=false, char cmdshort=0, int Group=GRP_NOSHOW)
unsigned int GetWidth() const
void AllocateFromBiasImage(const BIAS::ImageBase &image, bool readonly=false, bool writeonly=false, bool copy=false)
Allocation of a memory buffer as 2D image, either call directly or use wrapper for BIAS::ImageBase...
const std::string & GetDetailedString() const
detailed combination of all info available
void Usage(std::ostream &os=std::cout)
print Help-Information to stdout
clf Exception wrapper, is thrown in case of most clf errors
unsigned int GetHeight() const
static bool ParseCommandLineEvalHelp(Param ¶ms, int argc, char *argv[])
parses the command line, adds parameter "help"
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.
double GetRealTime() const
return real time (=wall time clock) in usec JW For Win32: real-time is measured differently from user...
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
enum EColorModel GetColorModel() const
This class Param provides generic support for parameters.
void CopyToBiasImage(BIAS::ImageBase &image, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0)
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...
int * AddParamInt(const std::string &name, const std::string &help, int deflt=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), char cmdshort=0, int Group=GRP_NOSHOW)
For all adding routines:
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
static int ToRGB(const Image< StorageType > &source, Image< StorageType > &dest)
Create a RGB converted copy of source image in this.
class TimeMeasure contains functions for timing real time and cpu time.
void WriteToImage(const void *data, unsigned int originX=0, unsigned int originY=0, unsigned int regionX=0, unsigned int regionY=0, bool blocking=true)
write from host memory to image