Please have a look at the following code

```
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <vector>

using namespace cv;
using namespace std;

void houghTransform(int,void*);
Mat image,lines,dst,cdst;
int thresh;
const char* imageWindow = "Image Window";

int main()
{
    image = imread("DSC01894.jpg");

    //Turning the dst image into greyscale

    if(image.data!=0)
    {
        cv::Canny(image,dst,50,200,3);
        cv::cvtColor(dst,cdst,CV_GRAY2BGR);

        cv::createTrackbar("Threshold",imageWindow,&thresh,255,houghTransform);
        houghTransform(0,0);
    }
    else
    {
        cout << "Image cannot be read" << endl;
    }

    namedWindow("Image");
    imshow("Image",image);

    waitKey(0);

}

void houghTransform(int, void *)
{
    vector<Vec4i>lines;

    cv::HoughLinesP(dst,lines,1,CV_PI/180,thresh,50,10);

    for(size_t i=0;i<lines.size();i++)
    {
        Vec4i l = lines[i];

        cv::line(cdst,Point(l[0],l[1]),Point(l[2],l[3]),Scalar(0,0,255),3,CV_AA);
    }

    imshow(imageWindow,cdst);
}

```

When this is runing, I am getting a run time error, 

`One of arguments' values is out of range`. It should be in

`cv::HoughLinesP(dst,lines,1,CV_PI/180,thresh,50,10);` or 

```
cv::line(cdst,Point(l[0],l[1]),Point(l[2],l[3]),Scalar(0,0,255),3,CV_AA);

```

Why is this?