EIEdgeImage.h

00001 /*
00002 Copyright 2010, Ming-Yu Liu
00003 
00004 All Rights Reserved 
00005 
00006 Permission to use, copy, modify, and distribute this software and 
00007 its documentation for any non-commercial purpose is hereby granted 
00008 without fee, provided that the above copyright notice appear in 
00009 all copies and that both that copyright notice and this permission 
00010 notice appear in supporting documentation, and that the name of 
00011 the author not be used in advertising or publicity pertaining to 
00012 distribution of the software without specific, written prior 
00013 permission. 
00014 
00015 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
00016 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
00017 ANY PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 
00018 ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
00019 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
00020 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 
00021 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
00022 */
00023 
00024 
00025 #pragma once
00026 #include "plugins/SceneUnderstanding/LFLineFitter/LFLineSegment.h"
00027 #include "plugins/SceneUnderstanding/LFLineFitter/LFLineFitter.h"
00028 #include <vector>
00029 using namespace std;
00030 
00031 
00032 
00033 class EIEdgeImage {
00034 public:
00035         EIEdgeImage();
00036         ~EIEdgeImage();
00037         void SafeRelease();     
00038         void Read(char* fileName);
00039         void Read(LFLineFitter &lf);
00040   void Read(int width, int height, int nLines, LFLineSegment* linesSegment);
00041   
00042 
00043         void SetNumDirections(const int nDirections) {nDirections_=nDirections;};
00044         void Scale(double s);
00045   void setWeights();
00046 
00047         void ConstructDirectionImage(int index,IplImage* image);
00048         double Length();
00049 
00050         void operator=(EIEdgeImage& ei);
00051         void Boundary(double &minx, double &miny, double &maxx, double &maxy);
00052         void SetDirectionIndices();
00053 
00054 
00055         // Display
00056         void ConstructImage(IplImage *image, int thickness = 1);
00057 
00058         int width_;
00059         int height_;
00060         int     nLines_;
00061         LFLineSegment* lines_;
00062         int* directionIndices_;
00063   double length;
00064 
00065 private:
00066 
00067         void SetLines2Grid();
00068         void SetDirections();
00069         int Theta2Index(double theta);
00070         double Index2Theta(int index);
00071 
00072 private:
00073         int nDirections_;
00074 
00075         vector<LFLineSegment*>* directions_;
00076 
00077 
00078         friend class LMLineMatcher;
00079         friend class LMDistanceImage;
00080 };
Generated on Sun May 8 08:41:09 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3