12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- // Beispielhafter Aufruf: BUILD_x86_64/progs/testSemanticSegmentation -config <CONFIGFILE>
- /**
- * @file test.cpp
- * @brief simple test program for everything
- * @author Björn Fröhlich
- * @date 03/10/2010
- */
- #ifdef NICE_USELIB_OPENMP
- #include <omp.h>
- #endif
- #include <iostream>
- #include <fstream>
- #include "objrec/segmentation/RSMeanShift.h"
- #include "objrec/segmentation/RSCache.h"
- #include "objrec/baselib/Globals.h"
- using namespace std;
- using namespace OBJREC;
- int main(int argc, char **argv)
- {
-
- //popen test
- string fn = "/tmp/img.ppm";
- std::string call = "ls *";
- const int buffersize = 65536;
- char *buffer = new char [buffersize];
-
- FILE *f = popen ( call.c_str(), "r" );
- cout << call << endl;
-
- if ( f == NULL )
- {
- fprintf (stderr, "FATAL ERROR, unable to run program\n");
- return -1;
- }
-
- while ( ! feof(f) )
- {
- if ( fgets ( buffer, buffersize, f ) <= 0 )
- {
- break;
- } else {
- fprintf (stderr, "%s", buffer );
- }
- }
- pclose(f);
- //openMP test
- #pragma omp parallel for
- for(int i = 0; i < 3; i++)
- {
- cout << i << endl;
- }
-
- Config * conf = new Config();
- RegionSegmentationMethod *tmprsm = new RSMeanShift(conf);
- RSCache rsm( conf, tmprsm );
- Image cimg(fn);
- Matrix mask;
- Globals::setCurrentImgFN ( fn );
- rsm.segRegions (cimg, mask);
-
-
- return 0;
- }
|