Example for usage of ContourDetectorSimple Usage: ContourDetectorSimple segmentedImage distanceImage contourImage
#include "../ContourDetectorSimple.hh"
#include "Base/Image/ImageIO.hh"
#include "Base/Debug/TimeMeasure.hh"
#include "Base/Image/ImageConvert.hh"
using namespace BIAS;
using namespace std;
int main(int argc, char** argv)
{
int res;
if (argc <4) {
cerr<<"\n*********************************************************************************************************************"<<endl;
cerr<<"This program detects single objects in an image with black (0) background and returns all pixel of the contour of that object.\n"<<endl;
cerr<<"usage: "<< argv[0] <<" segmentedImage distanceImage contourImage" <<endl;
cerr<<"*********************************************************************************************************************"<<endl;
exit(1);
}
cerr << "error loading file " << argv[1] << " " << res << endl;
exit (-1);
}
cerr << "wrong channel count in image"<< endl;
}
cout << "Set Background" << endl;
std::vector<BIASContour> contour;
std::cout<<"Finding the contour did take: ";
BIASERR("error writing");
}
cout<<"Written distance image: "<<argv[2]<<endl;
cout<<"Contour:"<<endl;
for (unsigned int i=0;i<contour.size();i++){
for (unsigned int k=0;k<contour[i].length;k++){
cout<<contour[i].contourPixel[k]<<"\t ";
(unsigned int)contour[i].contourPixel[k][0],
(unsigned int)contour[i].contourPixel[k][1]);
}
cout<<endl;
}
BIASERR("error writing");
}
cout<<"Written contour image: "<<argv[3]<<endl;
}