34 #include <bias_config.h>
35 #include <FeatureDetector/ConstantRegionDetector.hh>
36 #include <FeatureDetector/LinearRegionDetector.hh>
37 #include <FeatureDetector/BlobDetectorDOM.hh>
38 #include <Base/ImageUtils/ImageDraw.hh>
39 #include <Base/Image/ImageConvert.hh>
40 #include <Base/Image/ImageIO.hh>
49 const int nump=p.size();
53 for (
int l=0; l<nump; l++){
54 if (!p[l].IsAtInfinity()){
56 start[0]=(unsigned)rint(p[l][0]);
57 start[1]=(unsigned)rint(p[l][1]);
63 int main(
int argc,
char *argv[])
74 if (argc-argind<1 || argind<1){
75 cerr << argv[0] <<
" <im1> [ <im2> <im3> ... ] \n";
80 for (
int imgCount=argind; imgCount<argc; imgCount++){
84 BIASERR(
"error loading image "<<argv[imgCount] <<
" is storage type unsigned char?" << endl);
87 cerr <<
"read "<<argv[imgCount]<<endl;
92 BIASERR(
"could not convert to grey value image");
98 cout <<
"Constant Region Detection..."<<endl;
99 vector<HomgPoint2D> points2d;
100 vector<Vector3<unsigned char> > colors;
113 regionDetector.
Detect(ucim, points2d, colors,
true);
114 cout <<
"found " << points2d.size() <<
" constant regions " << endl;
117 Draw(result, points2d);
120 name <<
"constantRegions-"<<setw(4)<<setfill(
'0')<<imgCount-argind<<
".mip";
121 cout <<
"name " << name.str() << endl << flush;
126 cout <<
"Linear Region Detection..."<<endl;
129 vector<QUAL> quality;
131 linDet.
Detect(greyim, points2d, quality, NULL);
133 Draw(result, points2d);
135 name2 <<
"linearRegions-"<<setw(4)<<setfill(
'0')<<imgCount-argind<<
".mip";
136 cout <<
"name " << name2.str() << endl << flush;
141 cout <<
"Blob Region Detection..."<<endl;
143 vector<BIAS::BIASBlob> blobs;
145 blobDetector.
Detect(ucim, blobs);
146 unsigned char* color =
new unsigned char[3];
155 name3 <<
"blobRegions-"<<setw(4)<<setfill(
'0')<<imgCount-argind<<
".mip";
156 cout <<
"name3 " << name3.str() << endl << flush;
int DrawInImage(BIAS::Image< StorageType > &image, StorageType *color)
draws the detected blobs in image
void SetMaskImage(BIAS::Image< unsigned char > &maskImg)
void SetSubpixelAccuracy(bool subpixel_accuracy)
void SetThreshold(CalculationType threshold)
static void Circle(BIAS::Image< StorageType > &dstImg, const int ¢erX, const int ¢erY, const int &radius=3, const BIAS::ColourRGB< StorageType > &colorRGB=ColourRGB< StorageType >(255, 255, 255), const int &thickness=1, const int &linetype=8, const int &shift=0)
OpenCV: Draws a circle.
void SetMinDistance(int minDistance)
try to detect linear regions (const gradient) in images, experimental code for testing ...
void SetMaxSize(unsigned int maxSize)
Set maximum size of blobs.
void SetMaxNumFeatures(int maxNumFeatures)
restrict maximum number of features -1 is default and all features are returned.
virtual int Detect(Image< StorageType > &src, std::vector< HomgPoint2D > &points2d, std::vector< Vector3< StorageType > > &colors, bool useMedian=false)
Detects constant regions in image src.
void SetHalfWinSize(int halfWinSize)
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.
detects regions with close to zero gradients in images, works on color images only ...
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 Detect(BIAS::Image< StorageType > &image, std::vector< BIAS::BIASBlob > &blobs)
Detect and return blobs in an image.
Blob detector for 'Difference Of Means'-blobs (so this is not a binary blob detector).
virtual int Detect(const Image< StorageType > &image, std::vector< HomgPoint2D > &p, std::vector< QUAL > &quality, std::vector< Matrix2x2< double > > *cov=NULL)
detect corners in a grey image
static int ToGrey(const ImageBase &source, ImageBase &dest)
wrapper for the templated function ToGrey