00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <qvdta/qvdta.h>
00026
00027 #define NULL_NODE 256*256*256
00028
00030 namespace qvdta
00031 {
00032 class QVComponentTreeNode
00033 {
00034 public:
00035 uInt seedX, seedY;
00036 uInt child, brother, numChilds;
00037 uChar firstThreshold, lastThreshold;
00038 uInt area[256];
00039 bool inited;
00040 };
00041
00042 class QVComponentTree
00043 {
00044 public:
00045 QVComponentTree(uInt cols, uInt rows, const QVImage<uChar,1> image);
00046 ~QVComponentTree();
00047
00048 void pruneLowRegions(QVImage<uChar> &image, uInt area);
00049 void pruneHighRegions(QVImage<uChar> &image, uInt area);
00050
00051 public:
00052 uInt numNodes, freePoints, totalPoints, leafNodes, rootNode, maxNodes;
00053 QVComponentTreeNode *nodes;
00054
00055 uInt *nodeID;
00056 bool *valid;
00057
00058 void getComponentTree(const QVImage<uChar> &image);
00059 void pruneLowComponentTreeAux(QVImage<uChar> &image, uInt minArea, uInt node, uInt validThreshold);
00060 void pruneHighComponentTreeAux(QVImage<uChar> &image, uInt minArea, uInt node, uInt validThreshold);
00061 };
00062
00063 uInt debug_print_componentTree(QVComponentTree &componentTree);
00064 }