Search code examples
arraysopencvgraphicsjavacv

Get line as two point on cvCanny() in OpenCV


Sorry for stupid question. I want get line as two point, but cvCanny() put line in CvArr (image matrix). I can parse matrix for get line, but it slowly... I use JavaCV. Code example

IplImage image;
IplImage gray;
IplImage dst;
gray = cvCreateImage( cvGetSize(image), IPL_DEPTH_8U, 1 );
dst = cvCreateImage( cvGetSize(image), IPL_DEPTH_8U, 1 );
cvCanny(gray, dst, 100, 200, 3);

Image result (dst object)


Solution

  • If you need to find a line inside a picture, use HoughLines

    Of course, it is best to use it on the result of the edge detection (canny)