2 #include <bias_config.h>
4 #include <Base/Common/BIASpragmaStart.hh>
5 #include <Base/Common/BIASpragmaEnd.hh>
6 #include <Base/Image/ImageConvert.hh>
7 #include <Base/Common/FileHandling.hh>
8 #include <Utils/IOUtils.hh>
9 #include <Gui/biasgl.h>
11 #include <Utils/Param.hh>
12 #include <Utils/IOUtils.hh>
15 #include <OpenCLFramework/Algorithm/clfTVL1Flow.hh>
16 #include <Base/Debug/TimeMeasure.hh>
32 int main(
int argc,
char* argv[]) {
35 string *infile = p.
AddParamString(
"imglist",
"image list (uchar grey or rgb images, all same size)",
"img.lst" ,
'i');
36 string *outname = p.
AddParamString(
"out",
"out image base name (number and .mip are added)",
"out",
'o');
37 int *dispModus = p.
AddParamInt(
"dispModus",
"1 yes, 0 no", 0);
38 int *iter = p.
AddParamInt(
"iter",
"number of iterations", 20);
39 double *smoothness = p.
AddParamDouble(
"smoothness",
"values for smoothness, greater value => smaller smoothnes", 20);
44 IOUtils::ParseCommandLineEvalHelp(p, argc, argv);
47 Param::ParseListFile(*infile, names);
60 flowcl.SetSmoothness( (
float)(*smoothness));
61 flowcl.SetNumberOfIterations(*iter);
62 ImageIO::Load(names[0], image);
65 flowcl.AddImage(image);
67 for (
unsigned int i=1;i<names.size();i++) {
68 ImageIO::Load(names[i], image);
70 flowcl.AddImage(image);
79 flowcl.GetUVW(result);
83 for (
unsigned int x = 0; x < cutResult.
GetWidth(); x++) {
84 for (
unsigned int y = 0; y < cutResult.
GetHeight(); y++) {
88 val = result.
PixelValue(x,y,(
unsigned short)0);
90 val = result.
PixelValue(x,y,(
unsigned short)ch);
92 cutResult.
SetPixel(val,x,y,(
unsigned short)ch);
98 ImageIO::Save(*outname+
"-"+FileHandling::LeadingZeroString(i,2)+
".mip", cutResult);
void Print(std::ostream &os=std::cout) const
TVL1 optical flow opencl implementation.
double * AddParamDouble(const std::string &name, const std::string &help, double deflt=0.0, double min=-DBL_MAX, double max=DBL_MAX, char cmdshort=0, int Group=GRP_NOSHOW)
unsigned int GetWidth() const
int ParseCommandLine(int &argc, char *argv[])
scan command line arguments for valid parameters
StorageType PixelValue(const unsigned int x, const unsigned int y, const unsigned short int channel=0) const
Returns value of pixel at specific position, using specific channel as offset.
const std::string & GetDetailedString() const
detailed combination of all info available
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
clf Exception wrapper, is thrown in case of most clf errors
void Finish()
force finishing the command queue
unsigned int GetHeight() const
void SetPixel(const StorageType &value, const unsigned int &x, const unsigned int &y, const unsigned short int channel=0)
Set the value of a given pixel (x,y) in channel to value.
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
This class Param provides generic support for parameters.
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:
void ShowData(std::ostream &os=std::cout, int grp=GRP_ALL, bool showenhanced=true)
print all data in group grp including current values to os if grp = GRP_ALL, print all values if show...
std::string * AddParamString(const std::string &name, const std::string &help, std::string deflt="", char cmdshort=0, int Group=GRP_NOSHOW)
int PadToPowerOfTwo(BIAS::ImageBase &dest, const int &padVal=0) const
increase the size of this image to next power of two (e.g.
class TimeMeasure contains functions for timing real time and cpu time.