/* #########################################
 * Traffic monitoring using Raspberry PI
 * Author: Michal Zacpal
 * Library: Class RoadLane - Separation & Recognition RoadLane
 * 2015
 * ######################################### */
#ifndef ROADLANE_H
#define ROADLANE_H

#define dCoeffDash1 0.8
#define dCoeffDashCon1 0.3
#define dCoeffSolid1 0.8
#define dCoeffDash2  0.25
#define dCoeffDashCon2  0.45
#define dCoeffSolid2 0.1

#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace std;
using namespace cv;

typedef struct {
    vector<Point> L;
    vector<Point> R;
}LaneCoordinates;

class RoadLane{
public:
    int Type;               // 0 - solid; 1 - Dashed; 2 - DashedConnect
    int NumberLane;
    vector<LaneCoordinates> Lanes;
    bool NoLane;
    double Desc1;       // Descriptor 1 - Lane(s) length / Image height
    double Desc2;       // Descriptor 2 - Gap(s) length / Image height
    vector<vector<Point> > CenterOfLine;
    // Constructor
    RoadLane(LaneCoordinates _LaneCoor, int iImageHeight);
    RoadLane( const RoadLane &obj);         // Copy constructor
    RoadLane();
    // Destructor
    ~RoadLane();

private:
    double Length;
    double Height;
    double dCoeff;
    //double Desc1;       // Descriptor 1 - Lane(s) length / Image height
    //double Desc2;       // Descriptor 2 - Gap(s) length / Image height
    // Methods
    void SeparateLane(LaneCoordinates _LaneCoor, double dCoeff, int iImageHeight);
    void RecognizeLane(int iImageHeight);
    void LineCenter();

};

#endif // ROADLANE_H
