00001 #ifndef LINE_SEGMENT_SET
00002 #define LINE_SEGMENT_SET
00003
00004 #include <vector>
00005 #include <iostream>
00006 #include "lines/lineSegment.hpp"
00007
00008
00009 namespace jafar{
00010 namespace lines{
00011
00012 class LineSegment;
00013
00015
00020 class LineSegmentSet{
00021 public:
00023 int eraseInvalid();
00024
00026 void clearPredFlags();
00027
00029 void clearParameters();
00030
00032 void addLine(LineSegment* lineSegment);
00033
00035 void addLine(LineSegment& lineSegment);
00036
00038 void clear();
00039
00040
00041
00042
00044 void print();
00045
00047 void extractGreyscales(jafar::image::Image* image, int parallel_flag=0);
00048
00050 void extractGradientscales(jafar::image::Image* image, int gradientimage, int parallel_flag=0);
00051
00053 void extractLaplacescales(jafar::image::Image* image, int laplaceimage, int parallel_flag=0);
00054
00056 void changeNumberOfNeighbours(int number);
00057
00059 void calcHistogramDescriptor(jafar::image::Image* image, int nParallels=1, int d=3, jafar::image::Image* colorImage=0);
00060
00062 void calcHistogramDescriptor();
00063
00065 void normaliseHistogramDescriptors();
00066
00068 void calcGreyspaceDescriptor(jafar::image::Image* image);
00070
00073 void assignContourPts(jafar::image::Image* image);
00074
00075
00077 void orientLines(jafar::image::Image* image);
00078
00080 void growLinesParallel( jafar::image::Image* image, int dist=3, int thresh=5, int distThresh=20);
00081
00083 void growLines( jafar::image::Image* image, int gapThresh=1, int thresh=40, int maxOffset=2);
00084
00086 void fitLines( jafar::image::Image* image, int gradientimage=0, int nPoints=20, int pDist=25, jafar::image::Image* colorImage=0);
00087
00089 void fitLinesOrientation(LineSegmentSet lsSet, jafar::image::Image* gradX, jafar::image::Image* gradY, int nPoints=10, int pDist=25, double aDist=M_PI*0.5, double minLength=0, double extend=0, jafar::image::Image* colorImage=0);
00090
00092 static void clone(LineSegmentSet& old, LineSegmentSet& clone);
00093
00094 void drawLineSegments(jafar::image::Image* image, CvScalar color, int width);
00095 void drawLineSegments(jafar::image::Image* image, int width);
00096
00098 std::vector<LineSegment> lineSegments;
00099
00101 unsigned int size(){return lineSegments.size();}
00102
00104 LineSegment& ls(unsigned int index){return lineSegments[index];}
00105 };
00106
00107 }
00108 }
00109 #endif