0

I have 'stereo_match' through the g++ compiler.

My environment is :

  • Ubuntu 15.1 Of VirtualBox
  • OpenCV 3.1.0

I don't know the running command. I tried :

./stereo_match --left left12.jpg --right right12.jpg --method BM --ndisp 32.

But it failed with error :

OpenCV Error: Bad argument (undeclared position 0 requested) in getByIndex, file /home/usera/opencv-3.1.0/modules/core/src/command_line_parser.cpp line 169

terminate called after throwing an instance of 'cv::Exception'
what(): /home/usera/opencv-3.1.0/modules/core/src/command_line_parser.cpp:169: error: (-5) undeclared position 0 requested in function getByIndex

Aborted (core dumped)

IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
Junsuk Lee
  • 57
  • 7
  • This seems to be a bug in `cv::CommandLineParser` -- I just hard coded my input file names in the source (yuck) -- I don't have time to chase the bug down for now. – wcochran Jul 27 '16 at 21:24

1 Answers1

2

This is caused by a wrong parser key string. It is missing the positional arguments for the two filenames (the most important parameters!)

In "stereomatch.cpp", instead of:

cv::CommandLineParser parser(argc, argv,
    "{help h||}{algorithm||}{max-disparity|0|}{blocksize|0|}{no-display||}{scale|1|}{i||}{e||}{o||}{p||}");

it should read:

cv::CommandLineParser parser(argc, argv,
    "{@image1||} {@image2||} {help h||}{algorithm||}{max-disparity|0|}{blocksize|0|}{no-display||}{scale|1|}{i||}{e||}{o||}{p||}");

trivial error, maybe a leftover from a previous version.

JayneDoe
  • 21
  • 3