最近在自学opencv算法,保存代码和效果图

配置:opencv3.0.0+VS2010

#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()  
{  
    //读入图像  
    cv::Mat srcImage =   
    cv::imread("F:/temp/image.jpg", 0);  
    if (!srcImage.data)     
       return -1;  
    // canny边缘检测  
    Canny(srcImage, srcImage, 50, 200, 3);  
    // 创建LSD检测类  
#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;  
    // 线检测  
    ls->detect(srcImage, lines_std);  
    double duration_ms = (double(getTickCount()) - start) * 1000 / getTickFrequency();  
    std::cout << "It took " << duration_ms << " ms." << std::endl;  
    // 绘图线检测结果  
    Mat drawnLines(srcImage);  
    ls->drawSegments(drawnLines, lines_std);  
    cv::imshow("Standard refinement", drawnLines);  
    cv::waitKey();  
    return 0;  

}  

LSD算法在opencv中的实现

LSD算法在opencv中的实现

相关文章:

  • 2021-06-13
  • 2021-10-06
  • 2021-11-19
  • 2021-07-27
  • 2021-04-22
  • 2021-07-24
  • 2022-12-23
猜你喜欢
  • 2022-01-02
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2021-07-17
相关资源
相似解决方案