LSD 直线检测

 

 


#include 
#include 
using namespace std;


using namespace cv;

int main(int argc, char** argv)
{

	Mat image, imageShow;
	Mat imageOR = imread("HTCPump.jpg");
	imageShow = imageOR.clone();
	cvtColor(imageOR, image, CV_BGR2GRAY);
	if (image.empty())
	{
		return -1;
	}
	// Create LSD detector
	Ptr lsd = createLineSegmentDetector();
	vector lines_lsd;
	lines_lsd.clear();

	for (int run_count = 0; run_count < 10; run_count++) {
		
		lsd->detect(image, lines_lsd);

	}

	// Show found lines with LSD
	Mat line_image_lsd(image);
	lsd->drawSegments(line_image_lsd, lines_lsd);
	imshow("LSD result", line_image_lsd);
	// Show found lines with FLD

	waitKey();

	return 0;
}

 

http://www.ipol.im/pub/art/2012/gjmr-lsd/

LSD: a Line Segment Detector and source code

LSD 直线检测_第1张图片

 

LSD 直线检测_第2张图片

 

你可能感兴趣的:(C/C++,机器视觉与图形图像,Opencv/Halcon)