extract the lane markings

asked 2015-04-16 23:14:28 -0500

duc.d.k gravatar image

Please review my code and tell me your advance because I cannot run this code. It alway return the below error: src CXX0017: Error: symbol “src” not found

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <math.h>

using namespace cv;
void LaneMarkingsDetector(Mat &srcGray, Mat &dstGray, int tau)
    {
        dstGray.setTo(0);
        int aux = 0;
        for (int j=0; j<srcGray.rows; ++j)
        {
            unsigned char *ptRowSrc = srcGray.ptr<uchar>(j);
            unsigned char *ptRowDst = dstGray.ptr<uchar>(j);
            for (int i=tau; i<srcGray.cols - tau; ++i)
            {
                if ( ptRowSrc[i]!=0)
                {
                    aux = 2*ptRowSrc[i];
                    aux += -ptRowSrc[i-tau];
                    aux += -ptRowSrc[i+tau];
                    aux += -abs((int)(ptRowSrc[i-tau] - ptRowSrc[i+tau]));
                    aux = (aux<0)?(0):(aux);
                    aux = (aux>255)?(255):(aux);
                    ptRowDst[i] = (unsigned char)aux;
                }
            }
        }
    } 

int main(int argc, char** argv)
{
    Mat dst, gray_dst,cdst;
    Mat src = imread("street.jpg");
    cvtColor(src, gray_dst, CV_RGB2GRAY);
    namedWindow( "Source", 1 );
    namedWindow( "laneMarkingsDetector", 1 );
    //Canny(src, gray_dst, 50, 200, 3);
    LaneMarkingsDetector(gray_dst,dst, 1);
    imshow( "Source", gray_dst );

    //imshow( "laneMarkingsDetector", dst );

    waitKey(0);
    return 0;
}

I referred the LaneMarkingsDetector function in the post of "Lane markings detection and vanishing point detection with OpenCV" Marcos Nieto Thank so much!

edit retag flag offensive close merge delete