CUDA::StereoSGM can not run

Hey friends. I’m writing a program to calculate the parallax using a binocular camera. Since the calculation speed of the CPU is too slow, I plan to use the cuda function to speed up the stereo matching operation, but the program cannot run. I already have two images Left.jpg and Right.jpg that have been registered using the remap function in the root directory. When I use the following code to read the image and calculate the disparity, it prompts an error

error: (-217:Gpu API call) out of memory in function 'allocate'.

When I set the numDisparities parameter to 128, the program can run, but in my simple knowledge, the MX250 has 2g of video memory, and there should be no problem of insufficient video memory when processing two pictures.I don’t know what is wrong with my code,and i am asking for some help.
Below is my program code:

int main()
{
    using namespace cv;
    using namespace cuda;
    GpuMat left,right,disp;
    left.upload(imread("./Left.jpg",ImreadModes::IMREAD_GRAYSCALE));
    right.upload(imread("./Right.jpg",ImreadModes::IMREAD_GRAYSCALE));
    Ptr<cuda::StereoSGM> sgm = cuda::createStereoSGM(0,256);
    sgm->compute(left,right,disp);
    Mat now;
    disp.download(now);
    now.convertTo(now,CV_32F,1.0/16);

    namedWindow("--",0);
    resizeWindow("--",Size(800,600));
    imshow("--",now);
    waitKey(0);
    return 0;
}

The environment I use is Ubuntu22.04, i5-8265u MX250 graphics card and 16G RAM.
I cloned the 4.x branch and the opencv_contrib branch in the GitHub repository of opencv, compiled the opencv library and completed the installation.

What size are the images you are using?

Have you tried the sample opencv_test_cudastereo to see if that also runs out of memory. It shouldn’t as the test images are small.

The image size is 1920x1080 3 channels .
Now I try opencv_test_cudastereo,here is the output.

eunll0@eunll0:~/Downloads/Newopencv$ ./opencv/build/bin/opencv_test_cudastereo

Available options besides google test option: 
Usage: opencv_test_cudastereo [params] 

	--cuda_device (value:-1)
		CUDA device on which tests will be executed (-1 means all devices)
	-h, --help (value:false)
		Print help info

Run tests on all supported CUDA devices 

CTEST_FULL_OUTPUT
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-96-gb3c9842a98
Build type: Release
Compiler: /usr/bin/c++  (ver 11.3.0)
Parallel framework: pthreads (nthreads=8)
CPU features: SSE? SSE2? SSE3? *SSE4.1? *SSE4.2? *FP16? *AVX? *AVX2? *AVX512-SKX?
Intel(R) IPP version: disabled
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong'
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from CudaStereo_StereoSGM
[ RUN      ] CudaStereo_StereoSGM.regression
/home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp:618: Failure
Failed

	failure reason: cvError invoked
	test case #-1
	seed: 0000000000000000
-----------------------------------
	LOG:
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp, line 1071
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp, line 1071

-----------------------------------

[  FAILED  ] CudaStereo_StereoSGM.regression (0 ms)
[----------] 1 test from CudaStereo_StereoSGM (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] CudaStereo_StereoSGM.regression

 1 FAILED TEST
eunll0@eunll0:~/Downloads/Newopencv$ ./opencv/build/bin/opencv_test_cudastereo --tesp_bigdata

Available options besides google test option: 
Usage: opencv_test_cudastereo [params] 

	--cuda_device (value:-1)
		CUDA device on which tests will be executed (-1 means all devices)
	-h, --help (value:false)
		Print help info

Run tests on all supported CUDA devices 

CTEST_FULL_OUTPUT
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-96-gb3c9842a98
Build type: Release
Compiler: /usr/bin/c++  (ver 11.3.0)
Parallel framework: pthreads (nthreads=8)
CPU features: SSE? SSE2? SSE3? *SSE4.1? *SSE4.2? *FP16? *AVX? *AVX2? *AVX512-SKX?
Intel(R) IPP version: disabled
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong'
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from CudaStereo_StereoSGM
[ RUN      ] CudaStereo_StereoSGM.regression
/home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp:618: Failure
Failed

	failure reason: cvError invoked
	test case #-1
	seed: 0000000000000000
-----------------------------------
	LOG:
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp, line 1071
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/opencv/modules/ts/src/ts.cpp, line 1071

-----------------------------------

[  FAILED  ] CudaStereo_StereoSGM.regression (0 ms)
[----------] 1 test from CudaStereo_StereoSGM (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] CudaStereo_StereoSGM.regression

 1 FAILED TEST


you need the data from here to run that test:

Its possible your running out of memory then, I would suggest resizing to 1280x720 and seeing if you get the same issue. If not I would time the execution of

sgm->compute(left,right,disp);

after a few warm up runs to see if its quicker than the CPU version. If not you don’t need to worry about not having enough memory.

You need to clone the extra repo

and

export OPENCV_TEST_DATA_PATH=EXTRA_REPO/testdata/

@cudawarped , btw, is there any known trick for partial download from the extra repo (it’s huge !) ?

It appears you can use DownGit but it would be a bit of a manual job as the images are in two different locations and you would need to manually create all the parent folders.

Regarding this issue, if the repo is large I would suggest @Bay_Esan tries resizing his images until he has enough memory and seeing if there is any speed increase over CPU processing which I suspect there may not be.

1 Like

Hey my friends, I just did two things.
The first thing is that I downloaded some test data and ran the program opencv_test_cudastereo. I only downloaded two test data, the structure tree is as follows

$ tree -L 3
.
└── testdata
    β”œβ”€β”€ gpu
    β”‚   β”œβ”€β”€ caltech
    β”‚   β”œβ”€β”€ connectedcomponents
    β”‚   β”œβ”€β”€ csstereobp
    β”‚   β”œβ”€β”€ denoising
    β”‚   β”œβ”€β”€ features2d
    β”‚   β”œβ”€β”€ haarcascade
    β”‚   β”œβ”€β”€ hog
    β”‚   β”œβ”€β”€ labeling
    β”‚   β”œβ”€β”€ lbpcascade
    β”‚   β”œβ”€β”€ matchtemplate
    β”‚   β”œβ”€β”€ meanshift
    β”‚   β”œβ”€β”€ opticalflow
    β”‚   β”œβ”€β”€ perf
    β”‚   β”œβ”€β”€ stereobm
    β”‚   └── stereobp
    └── stereomatching
        β”œβ”€β”€ algorithms
        └── datasets


The following is the result of running the program, but I can’t read its result.(Due to the limitation of the number of words in the forum, I deleted some β€œRUN OK” results in the middle part)

eunll0@eunll0:~/Downloads/Newopencv/oo/opencv/build/bin$ ./opencv_test_cudastereo 

Available options besides google test option: 
Usage: opencv_test_cudastereo [params] 

	--cuda_device (value:-1)
		CUDA device on which tests will be executed (-1 means all devices)
	-h, --help (value:false)
		Print help info

Run tests on all supported CUDA devices 

*** CUDA Device Query (Runtime API) version (CUDART static linking) *** 

Device count: 1

Device 0: "NVIDIA GeForce MX250"
  CUDA Driver Version / Runtime Version          12.0 / 12.0
  CUDA Capability Major/Minor version number:    6.1
  Total amount of global memory:                 2001 MBytes (2098331648 bytes)
  GPU Clock Speed:                               1.58 GHz
  Max Texture Dimension Size (x,y,z)             1D=(131072), 2D=(131072,65536), 3D=(16384,16384,16384)
  Max Layered Texture Size (dim) x layers        1D=(32768) x 2048, 2D=(32768,32768) x 2048
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per block:           1024
  Maximum sizes of each dimension of a block:    1024 x 1024 x 64
  Maximum sizes of each dimension of a grid:     2147483647 x 65535 x 65535
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and execution:                 Yes with 2 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Concurrent kernel execution:                   Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support enabled:                No
  Device is using TCC driver mode:               No
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Bus ID / PCI location ID:           1 / 0
  Compute Mode:
      Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) 

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version  = 12.0, CUDA Runtime Version = 12.0, NumDevs = 1

CTEST_FULL_OUTPUT
OpenCV version: 4.7.0-dev
OpenCV VCS version: 4.7.0-96-gb3c9842a98
Build type: Release
Compiler: /usr/bin/c++  (ver 11.3.0)
Parallel framework: pthreads (nthreads=8)
CPU features: SSE? SSE2? SSE3? *SSE4.1? *SSE4.2? *FP16? *AVX? *AVX2? *AVX512-SKX?
Intel(R) IPP version: disabled
OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong'
[==========] Running 128 tests from 9 test cases.
[----------] Global test environment set-up.
[----------] 1 test from CudaStereo_StereoSGM
[ RUN      ] CudaStereo_StereoSGM.regression
/home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp:618: Failure
Failed

	failure reason: cvError invoked
	test case #-1
	seed: 0000000000000000
-----------------------------------
	LOG:
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp, line 1071
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp, line 1071

-----------------------------------

[  FAILED  ] CudaStereo_StereoSGM.regression (0 ms)
[----------] 1 test from CudaStereo_StereoSGM (0 ms total)

[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/0, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-L.png", whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/0 (71 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/1, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-L.png", sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/1 (21 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/2, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-R.png", whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/2 (22 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/3, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-R.png", sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/3 (23 ms)
[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage (137 ms total)

[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/0 (1 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/1 (1 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/2, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/2 (0 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/3, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/3 (1 ms)
[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom (3 ms total)

[----------] 96 tests from CUDA_StereoSGM_funcs/StereoSGM_PathAggregation
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/1 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/5 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/7 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/8 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/9 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/11 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/1 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/2 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/3 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/4 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/5 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/8 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/9 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/10 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/11 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/1 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/5 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/6 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/7 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/8 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/9 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/11 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/0 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/1 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/2 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/3 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/4 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/8 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/9 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/10 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/11 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/0 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/1 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/2 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/3 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/7 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/8 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/9 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/11 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/1 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/2 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/3 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/11 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/0 (19 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/1 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/6 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/8 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/9 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/11 (13 ms)
[----------] 96 tests from CUDA_StereoSGM_funcs/StereoSGM_PathAggregation (1422 ms total)

[----------] 8 tests from CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, false, 3)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/0 (24 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, false, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/7 (30 ms)
[----------] 8 tests from CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll (219 ms total)

[----------] 5 tests from CUDA_Stereo/StereoBM
[ RUN      ] CUDA_Stereo/StereoBM.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Regression/0 (33 ms)
[ RUN      ] CUDA_Stereo/StereoBM.PrefilterXSobelRegression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.PrefilterXSobelRegression/0 (31 ms)
[ RUN      ] CUDA_Stereo/StereoBM.PrefilterNormRegression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.PrefilterNormRegression/0 (33 ms)
[ RUN      ] CUDA_Stereo/StereoBM.Streams/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Streams/0 (31 ms)
[ RUN      ] CUDA_Stereo/StereoBM.Uniqueness_Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Uniqueness_Regression/0 (32 ms)
[----------] 5 tests from CUDA_Stereo/StereoBM (160 ms total)

[----------] 1 test from CUDA_Stereo/StereoBeliefPropagation
[ RUN      ] CUDA_Stereo/StereoBeliefPropagation.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBeliefPropagation.Regression/0 (129 ms)
[----------] 1 test from CUDA_Stereo/StereoBeliefPropagation (129 ms total)

[----------] 1 test from CUDA_Stereo/StereoConstantSpaceBP
[ RUN      ] CUDA_Stereo/StereoConstantSpaceBP.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoConstantSpaceBP.Regression/0 (315 ms)
[----------] 1 test from CUDA_Stereo/StereoConstantSpaceBP (315 ms total)

[----------] 8 tests from CUDA_Stereo/ReprojectImageTo3D
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_8U, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/0 (2 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_8U, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/1 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_16S, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/2 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_16S, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/3 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/4, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_8U, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/4 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/5, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_8U, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/5 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_16S, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/6 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_16S, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/7 (0 ms)
[----------] 8 tests from CUDA_Stereo/ReprojectImageTo3D (5 ms total)

[----------] Global test environment tear-down
[==========] 128 tests from 9 test cases ran. (2390 ms total)
[  PASSED  ] 127 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] CudaStereo_StereoSGM.regression

 1 FAILED TEST

The second thing is that I modified my program, the code is as follows:

int main()
{
    using namespace cv;
    using namespace cuda;
    Mat Leftimg,Rightimg,now;
    Leftimg = imread("./Left.jpg",ImreadModes::IMREAD_GRAYSCALE);
    Rightimg = imread("./Right.jpg",ImreadModes::IMREAD_GRAYSCALE);
    cv::resize(Leftimg,Leftimg,Size(1280,720));
    cv::resize(Rightimg,Rightimg,Size(1280,720));
    GpuMat left,right,disp;
    int64 t= getTickCount();
    left.upload(Leftimg);
    right.upload(Rightimg);
    Ptr<cuda::StereoSGM> sgm = cuda::createStereoSGM(0,256);
    sgm->compute(left,right,disp);
    disp.download(now);
    cout<<"GPUMODE:  "<<(getTickCount() - t)*1000/getTickFrequency()<<endl;
    t = getTickCount();
    Mat now1;
    Ptr<StereoSGBM> sgbm = StereoSGBM::create(0,256);
    sgbm->compute(Leftimg,Rightimg,now1);
    cout<<"CUPMODE:  "<<(getTickCount() - t)*1000/getTickFrequency()<<endl;

    waitKey(0);
    return 0;
}

As my friend @cudawarped said, after I used the resize function, my program was able to run successfully under the condition of numDisparities == 256 and gave the following results:

$ ./t3 
GPUMODE:  113.534
CUPMODE:  542.072
$ ./t3 
GPUMODE:  111.887
CUPMODE:  538.276
$ ./t3 
GPUMODE:  111.675
CUPMODE:  540.552

Since I do not have a deep understanding of the implementation process of the SGBM algorithm, I can only briefly summarize the following conclusions under this question:

  1. Compared with i5-8265u CPU, MX250+CUDA can accelerate the speed of stereo image matching
  2. The calculation amount of the SGBM matching algorithm at different resolutions should increase exponentially. However, I don’t know the storage space required to calculate the stereo matching at 1920x1080 resolution.

All in all, thanks a lot for everyone on the forum who helped me

1 Like

I just moved some data to the root directory of the program, and the results of the new program are as follows.

OpenCL is disabled
TEST: Skip tests with tags: 'mem_6gb', 'verylong'
[==========] Running 128 tests from 9 test cases.
[----------] Global test environment set-up.
[----------] 1 test from CudaStereo_StereoSGM
[ RUN      ] CudaStereo_StereoSGM.regression
/home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp:618: Failure
Failed

	failure reason: cvError invoked
	test case #-1
	seed: 0000000000000000
-----------------------------------
	LOG:
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp, line 1071
OpenCV Error:
	Unspecified error (OpenCV tests: Can't find required data file: stereomatching/datasets/datasets.xml) in findData, file /home/eunll0/Downloads/Newopencv/oo/opencv/modules/ts/src/ts.cpp, line 1071

-----------------------------------

[  FAILED  ] CudaStereo_StereoSGM.regression (0 ms)
[----------] 1 test from CudaStereo_StereoSGM (0 ms total)

[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/0, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-L.png", whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/0 (68 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/1, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-L.png", sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/1 (22 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/2, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-R.png", whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/2 (22 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/3, where GetParam() = (NVIDIA GeForce MX250, "stereobm/aloe-R.png", sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage.Image/3 (23 ms)
[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformImage (135 ms total)

[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/0 (1 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/1 (1 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/2, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/2 (1 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/3, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom.Random/3 (0 ms)
[----------] 4 tests from CUDA_StereoSGM_funcs/StereoSGM_CensusTransformRandom (3 ms total)

[----------] 96 tests from CUDA_StereoSGM_funcs/StereoSGM_PathAggregation
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/1 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/5 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/6 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/7 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/8 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/9 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomLeft2Right/11 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/0 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/1 (15 ms)
[
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/8 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/9 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/10 (11 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomRight2Left/11 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/1 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/3 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/4 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/5 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/7 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/8 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/9 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/10 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUp2Down/11 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/0 (19 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/1 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/2 (20 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/4 (19 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/6 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/7 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/8 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/9 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/10 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDown2Up/11 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/0 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/1 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/2 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/4 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/5 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/6 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/7 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/8 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/9 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/10 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpLeft2DownRight/11 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/0 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/1 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/2 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/3 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/4 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/5 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/6 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/8 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/9 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/10 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomUpRight2DownLeft/11 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/0 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/1 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/2 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/3 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/4 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/6 (12 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/8 (15 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/9 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownRight2UpLeft/11 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/0 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/1 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/2 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/3 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/4, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/4 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/5, where GetParam() = (NVIDIA GeForce MX250, 128x128, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/5 (16 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/6 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/7 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/8, where GetParam() = (NVIDIA GeForce MX250, 113x113, whole matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/8 (14 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/9, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 0)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/9 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/10, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/10 (13 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/11, where GetParam() = (NVIDIA GeForce MX250, 113x113, sub matrix, 10)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_PathAggregation.RandomDownLeft2UpRight/11 (13 ms)
[----------] 96 tests from CUDA_StereoSGM_funcs/StereoSGM_PathAggregation (1446 ms total)

[----------] 8 tests from CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, false, 3)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/0 (24 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, false, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/1 (38 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, true, 3)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/2 (23 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, true, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/3 (35 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/4, where GetParam() = (NVIDIA GeForce MX250, 113x113, false, 3)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/4 (18 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/5, where GetParam() = (NVIDIA GeForce MX250, 113x113, false, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/5 (27 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, true, 3)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/6 (17 ms)
[ RUN      ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, true, 1)
[       OK ] CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll.RandomLeft/7 (26 ms)
[----------] 8 tests from CUDA_StereoSGM_funcs/StereoSGM_WinnerTakesAll (208 ms total)

[----------] 5 tests from CUDA_Stereo/StereoBM
[ RUN      ] CUDA_Stereo/StereoBM.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Regression/0 (30 ms)
[ RUN      ] CUDA_Stereo/StereoBM.PrefilterXSobelRegression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.PrefilterXSobelRegression/0 (30 ms)
[ RUN      ] CUDA_Stereo/StereoBM.PrefilterNormRegression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.PrefilterNormRegression/0 (31 ms)
[ RUN      ] CUDA_Stereo/StereoBM.Streams/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Streams/0 (30 ms)
[ RUN      ] CUDA_Stereo/StereoBM.Uniqueness_Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBM.Uniqueness_Regression/0 (31 ms)
[----------] 5 tests from CUDA_Stereo/StereoBM (152 ms total)

[----------] 1 test from CUDA_Stereo/StereoBeliefPropagation
[ RUN      ] CUDA_Stereo/StereoBeliefPropagation.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoBeliefPropagation.Regression/0 (128 ms)
[----------] 1 test from CUDA_Stereo/StereoBeliefPropagation (128 ms total)

[----------] 1 test from CUDA_Stereo/StereoConstantSpaceBP
[ RUN      ] CUDA_Stereo/StereoConstantSpaceBP.Regression/0, where GetParam() = NVIDIA GeForce MX250
[       OK ] CUDA_Stereo/StereoConstantSpaceBP.Regression/0 (316 ms)
[----------] 1 test from CUDA_Stereo/StereoConstantSpaceBP (316 ms total)

[----------] 8 tests from CUDA_Stereo/ReprojectImageTo3D
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/0, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_8U, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/0 (2 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/1, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_8U, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/1 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/2, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_16S, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/2 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/3, where GetParam() = (NVIDIA GeForce MX250, 128x128, CV_16S, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/3 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/4, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_8U, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/4 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/5, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_8U, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/5 (1 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/6, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_16S, whole matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/6 (0 ms)
[ RUN      ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/7, where GetParam() = (NVIDIA GeForce MX250, 113x113, CV_16S, sub matrix)
[       OK ] CUDA_Stereo/ReprojectImageTo3D.Accuracy/7 (0 ms)
[----------] 8 tests from CUDA_Stereo/ReprojectImageTo3D (5 ms total)

[----------] Global test environment tear-down
[==========] 128 tests from 9 test cases ran. (2393 ms total)
[  PASSED  ] 127 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] CudaStereo_StereoSGM.regression

But I don’t know if the meaning of the first error is that other data is needed?I have placed the following two files in the root directory of the program

β”œβ”€β”€ stereobm
β”‚   β”œβ”€β”€ aloe-disp.png
β”‚   β”œβ”€β”€ aloe-disp-prefilter-norm.png
β”‚   β”œβ”€β”€ aloe-disp-prefilter-xsobel.png
β”‚   β”œβ”€β”€ aloe-disp-uniqueness15.png
β”‚   β”œβ”€β”€ aloe-L.png
β”‚   └── aloe-R.png
β”œβ”€β”€ stereobp
β”‚   β”œβ”€β”€ aloe-disp.png
β”‚   β”œβ”€β”€ aloe-L.png
β”‚   └── aloe-R.png
└── stereomatching
    β”œβ”€β”€ algorithms
    β”‚   β”œβ”€β”€ cuda_stereosgm_params.xml
    β”‚   β”œβ”€β”€ cuda_stereosgm_res.xml
    β”‚   β”œβ”€β”€ stereobm_params.xml
    β”‚   β”œβ”€β”€ stereobm_res.xml
    β”‚   β”œβ”€β”€ stereogc_params.xml
    β”‚   β”œβ”€β”€ stereogc_res.xml
    β”‚   β”œβ”€β”€ stereosgbm_params.xml
    β”‚   └── stereosgbm_res.xml
    └── datasets
        β”œβ”€β”€ barn2
        β”œβ”€β”€ bull
        β”œβ”€β”€ cones
        β”œβ”€β”€ datasets.xml
        β”œβ”€β”€ poster
        β”œβ”€β”€ sawtooth
        β”œβ”€β”€ teddy
        β”œβ”€β”€ tsukuba
        └── venus

I wouldn’t worry about it. I only suggested the test as its a good way to check if things work on your system. As you managed to get it to work by changing the resolution there is no need.

For future reference it is probably because you haven’t added the environmental variable I mentioned.

export OPENCV_TEST_DATA_PATH=EXTRA_REPO/testdata/

Addtionaly your measuring the upload, download and createStereoSGM functions not just the disparity calculation so the speed up could be even greater. To be sure I would also remove Ptr<StereoSGBM> sgbm = StereoSGBM::create from your CPU timing and run some warm up calls to sgm->compute(left,right,disp); before starting your GPU timing.

I’m not sure if this is the case but it would be easy to find out by running a loop at different resolutions and querying the free memory using cuda::DeviceInfo::freeMemory().

Before anything else I would check the disparity results compared to the GPU. I worked on a project several years ago and at that time the GPU results were not as good and certain algorithms exhibited what looked like quantization artifacts.

1 Like