逆_美丽的年华 逆_美丽的年华
高二生爱玩三国杀
关注数: 102 粉丝数: 59 发帖数: 283 关注贴吧数: 53
新人求指教 关于opencv 3.0的lsd直线检测测试代码 http://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fblog.csdn.net%2Fu012566751%2Farticle%2Fdetails%2F54602958&urlrefer=2d47c61d0b0c7aa32e06f00089d3d967 这个是我在论坛里找的例子,我把图片放在了D盘里面,名字是123.jpg 但是运行时候出现了访问冲突和断点,不知道该怎么办 本人完全小白,因为毕业设计没接触过这方面的东西所以现在在自学,求大佬指教 下面是我运行的代码段和运行结果 好头疼 #include <iostream> #include <string> #include "opencv2/core/core.hpp" #include "opencv2/core/utility.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui/highgui.hpp" using namespace std; using namespace cv; int main(int argc, char** argv) { std::string in; if (argc != 2) { std::cout << "Usage: lsd_lines [input image]. Now loading D:\\123.jpg" << std::endl; in = "D:\\123.jpg"; } else { in = argv[1]; } Mat image = imread(in, IMREAD_GRAYSCALE); #if 0 Canny(image, image, 50, 200, 3); // Apply canny edge #endif // Create and LSD detector with standard or no refinement. #if 1 Ptr<LineSegmentDetector> ls = createLineSegmentDetector(LSD_REFINE_STD); #else Ptr<LineSegmentDetector> ls = createLineSegmentDetector(LSD_REFINE_NONE); #endif double start = double(getTickCount()); vector<Vec4f> lines_std; // Detect the lines ls->detect(image, lines_std); double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency(); std::cout << "It took " << duration_ms << " ms." << std::endl; // Show found lines Mat drawnLines(image); ls->drawSegments(drawnLines, lines_std); imshow("Standard refinement", drawnLines); waitKey(); return 0; }
1 下一页