00001 #ifndef HOUGH_H
00002 #define HOUGH_H
00003 #include <vector>
00004
00005 struct hitnode
00006 {
00007 int hit;
00008 float weight;
00009 hitnode *c0;
00010 };
00011
00012 struct node
00013 {
00014 int rho;
00015 int theta;
00016 int hitcount;
00017 float weight;
00018 hitnode *hitlist;
00019 node *c0;
00020 node *c1;
00021 int treeready;
00022 int goodsort;
00023 };
00024
00025
00026 namespace rpr{
00027
00028 class Hough
00029 {
00030 public:
00031 Hough();
00032 ~Hough();
00033
00034 void AddPoint(double x1, double sigx1, double x2, double sigx2, double y1, double sigy1, double y2, double sigy2, double w, int ih1);
00035 void FindLines(double* theta, double* rho, double* score);
00036 bool TestHit(double x, double y,
00037 double thmx, double rhomx,
00038 double sigth, double sigr);
00039 bool TestHit(double x, double y,
00040 double thmx, double rhomx,
00041 double sigr);
00042 float DistHit(double x, double y,
00043 double thmx, double rhomx);
00044
00045 int getHit();
00046
00047 static void MakeTree(float thresh);
00048
00049 static int UpdateTree();
00050
00051 static void SetThresh(float thresh);
00052
00053 private:
00054 static void InsertSort(node * head, node *item);
00055 static void DeleteChain(node *head);
00056 static void DeleteChain(hitnode * head);
00057
00058 static node * newNode(int t, int r);
00059 static void nodeUpdate(node * head, double ww, int ih1);
00060 static void AddPoint(double theta, double rho, double ww, int ih1);
00061 static void RemovePoint(double theta, double rho, double ww, int ih1);
00062 };
00063 }
00064 #endif