OpenCV上的StereoBM CPU和StereoBM GPU版本提供了非常不同的输出

时间:2018-02-26 16:06:24

标签: opencv computer-vision stereo-3d

我正在研究Jetson TX1,我发现CPU和GPU版本的StereoBM的输出之间存在巨大差异。我在我的机器上编译了一个 GPU版本的OpenCV 3.2

我提到CPU和GPU的输出以及GPU代码。

StereoBM CPU StereoBM GPU

#include "opencv2/opencv.hpp"
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/cudaarithm.hpp"
#include <iostream>
#include <stdio.h>
#include <limits.h>

using namespace cv;

int main()
{
    cv::Mat img1, img2;

    img1 = imread( "~/left.png", cv::IMREAD_GRAYSCALE);
    img2 = imread( "~/right.png", cv::IMREAD_GRAYSCALE);

    cuda::GpuMat d_left, d_right;
    Ptr<cuda::StereoBM> bm;
    bm = cuda::createStereoBM(64, 11); //numDisparities=64, windowSize=11
    Mat disp(img1.size(), CV_8U);

    cuda::GpuMat d_disp(img1.size(), CV_8U);
    cuda::GpuMat d_disp_color(img1.size(), CV_8U);

    d_left.upload(img1);
    d_right.upload(img2);
    bm->compute(d_right, d_left, d_disp);
    cuda::drawColorDisp(d_disp, d_disp_color, 64);
    d_disp.download(disp);
    imwrite("~/disparity.png", disp);

    d_disp_color.download(disp);
    imwrite("~/disparity_color.png", disp);

    return 0;
}

以下是有关正在使用的机器的一些细节: 1.输出ldd

    linux-vdso.so.1 =>  (0x0000007fb3fc8000)
libopencv_cudastereo.so.3.2 => /mnt/newssd/OPENCV/opencv-3.2.0/build/lib/libopencv_cudastereo.so.3.2 (0x0000007fb3e20000)
libopencv_imgcodecs.so.3.2 => /mnt/newssd/OPENCV/opencv-3.2.0/build/lib/libopencv_imgcodecs.so.3.2 (0x0000007fb3cfa000)
libopencv_core.so.3.2 => /mnt/newssd/OPENCV/opencv-3.2.0/build/lib/libopencv_core.so.3.2 (0x0000007fb3903000)
libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007fb3732000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007fb3710000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fb35c9000)
/lib/ld-linux-aarch64.so.1 (0x000000555c9ee000)
libcudart.so.8.0 => /usr/local/cuda-8.0/lib64/libcudart.so.8.0 (0x0000007fb3566000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fb34b8000)
libopencv_imgproc.so.3.2 => /mnt/newssd/OPENCV/opencv-3.2.0/build/lib/libopencv_imgproc.so.3.2 (0x0000007fb313f000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fb3113000)
libjpeg.so.8 => /usr/lib/aarch64-linux-gnu/libjpeg.so.8 (0x0000007fb30cb000)
libwebp.so.5 => /usr/lib/aarch64-linux-gnu/libwebp.so.5 (0x0000007fb306f000)
libpng12.so.0 => /lib/aarch64-linux-gnu/libpng12.so.0 (0x0000007fb3040000)
libtiff.so.5 => /usr/lib/aarch64-linux-gnu/libtiff.so.5 (0x0000007fb2fc8000)
libjasper.so.1 => /usr/lib/aarch64-linux-gnu/libjasper.so.1 (0x0000007fb2f6c000)
libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000007fb2f45000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007fb2f31000)
libtbb.so.2 => /usr/lib/aarch64-linux-gnu/libtbb.so.2 (0x0000007fb2ef2000)
libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x0000007fb2893000)
librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000007fb287b000)
liblzma.so.5 => /lib/aarch64-linux-gnu/liblzma.so.5 (0x0000007fb284e000)
libjbig.so.0 => /usr/lib/aarch64-linux-gnu/libjbig.so.0 (0x0000007fb2830000)
libgfortran.so.3 => /usr/lib/aarch64-linux-gnu/libgfortran.so.3 (0x0000007fb2742000)

Cuda版本:8.0

TX1发布28.1

EDIT1: 我将speckleFilter应用于StereoBM GPU的输出,这就是我得到的: StereoBM_GPU with Speckle Filter

0 个答案:

没有答案