Skip to content

Tutorial - Make required input args positional.#15754

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
float13:patch-1
Oct 23, 2019
Merged

Tutorial - Make required input args positional.#15754
opencv-pushbot merged 1 commit intoopencv:3.4from
float13:patch-1

Conversation

@float13
Copy link
Copy Markdown
Contributor

@float13 float13 commented Oct 22, 2019

I think it would help to change all 3 of the the input file arguments to be "positional" for consistency with the other tutorials. This also simplifies the command line input to run this tutorial by reducing typing, and helpfully prints the "usage" info if any of the 3 required inputs are missing.

I'm new to OpenCV and working through the tutorials. I kept getting runtime errors with this one until I realized that the arguments weren't positional, and I was missing the "--input1", "--input2, "--input3" flags preceding the filenames. All of the previous tutorials had required filenames as positional arguments and didn't require this.

The original code would require each input to be specified like this:
./compareHist_Demo --input1 filename1 --input2 filename2 --input3 filename3

But with this change, the above command is simplified to:
./compareHist_Demo filename1 filename2 filename3

This avoids a confusing runtime error to make things simpler for newcomers like me :)

This pullrequest changes

samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp

@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 22, 2019

Thank you for contribution!

This patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@float13 float13 changed the base branch from master to 3.4 October 22, 2019 19:21
@float13
Copy link
Copy Markdown
Contributor Author

float13 commented Oct 23, 2019 via email

I think it would help to change all 3 of the the input file arguments to be "positional" for consistency with the other tutorials. This also simplifies the command line input to run this tutorial by reducing typing, and helpfully prints the "usage" info if any of the 3 required inputs are missing.

I'm new to OpenCV and working through the tutorials. I kept getting runtime errors with this one until I realized that the arguments weren't positional, and I was missing the "--input1", "--input2, "--input3" flags preceding the filenames. All of the previous tutorials had required filenames as positional arguments and didn't require this.

The original code would require each input to be specified like this:
./compareHist_Demo --input1 filename1 --input2 filename2 --input3 filename3 

But with this change, the above command is simplified to:
./compareHist_Demo  filename1 filename2 filename3

This avoids a confusing runtime error to make things simpler for newcomers like me :)
@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 23, 2019

I pushed rebased patch.

P.S. I don't have instructions for GitHub editor about rebasing process.

@float13
Copy link
Copy Markdown
Contributor Author

float13 commented Oct 23, 2019

Thanks! Now I know for next time.

Anything else to do?

opencv-pushbot pushed a commit that referenced this pull request Oct 23, 2019
@opencv-pushbot opencv-pushbot merged commit 1accf3b into opencv:3.4 Oct 23, 2019
@alalek alalek mentioned this pull request Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants