How to improve the CRF threshold for lane detection

asked 2019-02-22 20:20:14 -0600

karan_maverick gravatar image

I am using Conditional Random Fields (CRF) for multi- lane detection in bad weather. However the super markings generated create false positive curves on the output images.

Secondly the EKF does not seem to perform tracking well on the generated supermarkings.

Are there some threshold values and parameters which I need to change?

![Caltech Lane Data set Cordova][1]

![Cordova Caltech lane Dataset][2]

The snippet of the lane detection code is given below:

#pragma warning(disable: 4819)
#include "opencv.hpp"
#include <stdlib.h>
#include <time.h>
#include <math.h>

#include "LaneDetection.h"


// Lane marking definition 
#define MAX_LANE_MARKING 3000
#define MAX_LW_N 55//40     // Max lane width, nearest
#define MAX_LW_F 12//8      // Max lane width, farest
#define MAX_LW_D 10     // Max lane width, delta
#define MIN_LW_N 20         // Min lane width, nearest
#define MIN_LW_F 2          // Min lane width, farest
#define SCAN_INTERVAL1 1    //lower
#define SCAN_INTERVAL2 1    //upper

// Lane Marking Grouping
#define MAX_LANE_SEED 300
#define SEED_MARKING_DIST_THRES 90
#define VALID_SEED_MARKING_NUMBER_THRES 6
#define LOW_LEVEL_ASS_THRES 1.96

// Initializing variables depending on the resolution of the input image.

double valueAt(std::vector<float>& f, float x) {
    float ans = 0.f;
    for (int i = (int)f.size() - 1; i >= 0; --i)
        ans = ans * x + f[i];
    return ans;
}

bool LaneDetection::initialize_variable(cv::Mat in_img) {

    // Image variable setting
    cv::Mat img_src = in_img;
    //cv::Mat img_src = cv::imread(img_name);
    if (img_src.empty()) {
        std::cout << "Err: Cannot find an input image for initialization: " << std::endl;
        return false;
    }

    img_size = img_src.size();
    img_height = img_src.rows;
    img_width = img_src.cols;
    img_roi_height = (int)(img_size.height*0.5);
    img_depth = img_src.depth();

    max_lw.resize(img_height);
    min_lw.resize(img_height);
    max_lw_d.resize(img_width);



// Estimated Lane Width
        for (int hh = img_roi_height; hh < img_height; ++hh) {
            max_lw[hh] = (int)((MAX_LW_N - MAX_LW_F)*(hh - img_roi_height) / (img_size.height - img_roi_height) + MAX_LW_F);
            min_lw[hh] = (int)((MIN_LW_N - MIN_LW_F)*(hh - img_roi_height) / (img_size.height - img_roi_height) + MIN_LW_F);
        }

        int w = img_width - 1;
        while (img_width - 1 - w < w) {
            max_lw_d[w] = (int)(MAX_LW_D*(abs(w - (img_width - 1) / 2.0)) / ((img_width - 1) / 2.0));
            max_lw_d[img_width - 1 - w] = (int)(MAX_LW_D*(abs(w - (img_width - 1) / 2.0)) / ((img_width - 1) / 2.0));
            w--;
        }

        return true;
    }

The entire code is hosted on Google Drive link below..

https://drive.google.com/open?id=1Ep9...

Caltech Lanes Dataset Cordova: C:\fakepath\027.jpg: Caltech Lanes Dataset Cordova seeds: Lanes Super markings Seeds

edit retag flag offensive close merge delete