• 大小: 35.38MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-28
  • 语言: 其他
  • 标签: opencv  VS2010  

资源简介

基于opencv2.4.9中的立体匹配三种算法,去掉了校正图像的步骤,可以直接使用校正好的标准图像进行实验,对比视差图的效果!环境是VS2010!

资源截图

代码片段和文件信息

/*
 *  stereo_match.cpp
 *  calibration
 *
 *  Created by Victor  Eruhimov on 1/18/10.
 *  Copyright 2010 Argus Corp. All rights reserved.
 *
 */

#include “opencv2/calib3d/calib3d.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/highgui/highgui.hpp“
#include “opencv2/contrib/contrib.hpp“

#include 

using namespace cv;

static void print_help()
{
    printf(“\nDemo stereo matching converting L and R images into disparity and point clouds\n“);
    printf(“\nUsage: stereo_match   [--algorithm=bm|sgbm|hh|var] [--blocksize=]\n“
           “[--max-disparity=] [--scale=scale_factor>] [-i ] [-e ]\n“
           “[--no-display] [-o ] [-p ]\n“);
}

static void saveXYZ(const char* filename const Mat& mat)
{
    const double max_z = 1.0e4;
    FILE* fp = fopen(filename “wt“);
    for(int y = 0; y < mat.rows; y++)
    {
        for(int x = 0; x < mat.cols; x++)
        {
            Vec3f point = mat.at(y x);
            if(fabs(point[2] - max_z) < FLT_EPSILON || fabs(point[2]) > max_z) continue;
            fprintf(fp “%f %f %f\n“ point[0] point[1] point[2]);
        }
    }
    fclose(fp);
}

int main(int argc char** argv)
{
argc=8;
argv[0]=“ex“;
argv[1]=“view1.png“;
argv[2]=“view5.png“;
//-----------此参数可调整立体匹配算法--------------------/
argv[3]=“--algorithm=bm“;
//----------共三种算法bm,sgbm,var---------------------/
argv[4]=“-i“;
// argv[5]=“intrinsics.txt“;
argv[6]=“-e“;
// argv[7]=“extrinsics.txt“;

    const char* algorithm_opt = “--algorithm=“;
    const char* maxdisp_opt = “--max-disparity=“;
    const char* blocksize_opt = “--blocksize=“;
    const char* nodisplay_opt = “--no-display“;
    const char* scale_opt = “--scale=“;

    if(argc < 3)
    {
        print_help();
        return 0;
    }
    const char* img1_filename = 0;
    const char* img2_filename = 0;
    const char* intrinsic_filename = 0;
    const char* extrinsic_filename = 0;
    const char* disparity_filename = 0;
    const char* point_cloud_filename = 0;

    enum { STEREO_BM=0 STEREO_SGBM=1 STEREO_HH=2 STEREO_VAR=3 };
    int alg = STEREO_SGBM;
    int SADWindowSize = 0 numberOfDisparities = 0;
    bool no_display = false;
    float scale = 1.f;

    StereoBM bm;
    StereoSGBM sgbm;
    StereoVar var;

    for( int i = 1; i < argc; i++ )
    {
        if( argv[i][0] != ‘-‘ )
        {
            if( !img1_filename )
                img1_filename = argv[i];
            else
                img2_filename = argv[i];
        }
        else if( strncmp(argv[i] algorithm_opt strlen(algorithm_opt)) == 0 )
        {
            char* _alg = argv[i] + strlen(algorithm_opt);
            alg = strcmp(_alg “bm“) == 0 ? STEREO_BM :
                  strcmp(_alg “sgbm“) == 0 ? STEREO_SGBM :
                  strcmp(_alg “hh“) ==

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      61952  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.exe

     文件     502568  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.ilk

     文件    1305600  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.pdb

     文件   54919168  2019-03-08 17:47  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\ipch\stereo_match-6b0451e3\stereo_match-132f894a.ipch

     文件        758  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\cl.command.1.tlog

     文件      15458  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\CL.read.1.tlog

     文件        482  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\CL.write.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link-cvtres.read.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link-cvtres.write.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.6440-cvtres.read.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.6440-cvtres.write.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.6440.read.1.tlog

     文件          2  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.6440.write.1.tlog

     文件       3562  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.command.1.tlog

     文件       9888  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.read.1.tlog

     文件       1014  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\link.write.1.tlog

     文件        452  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.command.1.tlog

     文件        216  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.read.1.tlog

     文件        414  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.write.1.tlog

     文件        654  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.command.1.tlog

     文件        386  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.read.1.tlog

     文件        394  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.write.1.tlog

     文件       3171  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.Build.CppClean.log

     文件        406  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.embed.manifest

     文件        472  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.embed.manifest.res

     文件        381  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.intermediate.manifest

     文件         74  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.lastbuildstate

     文件       5276  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.log

     文件     180542  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.obj

     文件          0  2019-03-08 17:48  BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.write.1.tlog

............此处省略127个文件信息

评论

共有 条评论