• 大小: 3.77MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-13
  • 语言: Matlab
  • 标签:

资源简介

LSD直线检测算法是检测结果比霍夫变换更好的算法,本工具箱支持opencv和matlab,使用起来非常简单方便

资源截图

代码片段和文件信息

#include 
#include 
#include 
#include 
#include 
#include 
void mexFunction(int nlhs mxArray *plhs[] int nrhs const mxArray *prhs[])
{
    std::string picture = mxArrayToString(prhs[0]);
    cv::Mat src = cv::imread(picture.c_str() CV_LOAD_IMAGE_COLOR);
    cv::Mat tmp src_gray;
    cv::cvtColor(src tmp CV_RGB2GRAY);
    tmp.convertTo(src_gray CV_64FC1);

    image_double image = new_image_double(src_gray.cols src_gray.rows);
    image->data = src_gray.ptr(0);

    ntuple_list ntl = lsd(image);

    plhs[0] = mxCreateDoubleMatrix(5 ntl->size mxREAL);
    double *pos_mat = mxGetPr(plhs[0]);

    for (int j = 0; j != ntl->size ; ++j)
    {
        pos_mat[5 * j + 0] = ntl->values[0 + j * ntl->dim] + 1;
        pos_mat[5 * j + 2] = ntl->values[1 + j * ntl->dim] + 1;
        pos_mat[5 * j + 1] = ntl->values[2 + j * ntl->dim] + 1;
        pos_mat[5 * j + 3] = ntl->values[3 + j * ntl->dim] + 1;
        pos_mat[5 * j + 4] = ntl->values[4 + j * ntl->dim]; // width
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\
     文件         845  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\CMakeLists.txt
     文件       35120  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\LICENSE
     文件        4076  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\README.md
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\images\
     文件      122550  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\images\result.jpg
     文件       91264  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\images\test.jpg
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\include\
     文件        9862  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\include\lsd.h
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\
     文件        1977  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\CMakeLists.txt
     文件        1045  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\lsd.cpp
     文件        1463  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\lsd_image.cpp
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\images\
     文件       91264  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\images\test.jpg
     文件       40960  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\lsd.mexw64
     文件         160  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\lsd2.m
     文件         282  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\lsd2_example.m
     文件         438  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\lsd_example.m
     文件       43520  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\lsd_image.mexw64
     文件     2520576  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\opencv_core247.dll
     文件     2363904  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\opencv_highgui247.dll
     文件     2203648  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x64\opencv_imgproc247.dll
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\images\
     文件       91264  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\images\test.jpg
     文件         160  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\lsd2.m
     文件         282  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\lsd2_example.m
     文件         438  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\matlab\x86\lsd_example.m
     目录           0  2017-02-06 04:04  LSD-OpenCV-MATLAB-master\opencv\
............此处省略37个文件信息

评论

共有 条评论