00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HxBlob2d_h
00012 #define HxBlob2d_h
00013
00014 #include "list"
00015 #include "map"
00016 #include "HxImageRep.h"
00017 #include "HxFreemanChain2d.h"
00018 #include "HxFeatureFunctor.h"
00019
00020
00021 class HxBlob2d
00022 {
00023 public:
00024 HxBlob2d();
00025 HxBlob2d(HxImageRep inputIm, HxImageRep labIm,
00026 int label, int xmin, int ymin,
00027 int width, int height, HxFreemanChain2d ch);
00028 ~HxBlob2d();
00029
00030 int ident() const;
00031 HxImageRep getInputImage() const;
00032 HxImageRep getLabeledImage() const;
00033 int getLabel() const;
00034
00035 HxPoint startMaer() const;
00036 HxSizes sizeMaer() const;
00037
00038 HxFreemanChain2d getContour() const;
00039
00040
00041 int getContourX() const;
00042 int getContourY() const;
00043 int getContourLength() const;
00044 void getContourCodes(int* codes) const;
00045 void getRgbPixels(int* pixels) const;
00046
00047 HxValue getFeature(HxString name);
00048 static void registerFeatureFunctor(HxFeatureFunctor* ff);
00049 void addFeature(HxString name, HxValue val);
00050 void deleteFeature(HxString name);
00051
00052 private:
00053 HxImageRep _inputImage;
00054 HxImageRep _labImage;
00055
00056 int _ident;
00057 int _label;
00058 int _xmin;
00059 int _ymin;
00060 int _xmax;
00061 int _ymax;
00062 int _width;
00063 int _height;
00064 HxFreemanChain2d _chain;
00065
00066 static int _nr;
00067
00068 static std::list<HxFeatureFunctor*> _functorList;
00069 std::map<HxString, HxValue, std::less<HxString> > _featureList;
00070 };
00071
00072 inline HxString
00073 makeString(const HxBlob2d& b)
00074 {
00075 return HxString("HxBlob2d") + makeString(b.ident());
00076 }
00077
00078 #endif