[PYTHON] Change the output without touching the code using Argparse

This time, I improved the mosaic automatic generation program that I made last time. There are quite a few types of Cascade detectors, so I'm wondering which one to use and which value is the best for the detectMultiScale argument.

Execution environment

Specify parameters in openCV face detection to quickly improve detection accuracy A brief summary of how to use ArgumentParser

・ MacOS ・ Python3.6 (anaconda) ・ Opencv ・ VS Code

Originally desired function

Actually, I was wondering if Cascade is a function that finds the optimum solution ** in order to solve the problem of which detector should be used and what value should be entered for the argument of detectMultiScale. However, it seems that it was actually different.

Argparse With argparse, you can change the output by writing the ** argument value ** next to the filename when you run it on the command line.

Demerit

However, using this has the advantage that you do not have to change the program, but it becomes quite complicated, so I think that it is not necessary for those who think that it is troublesome.

Summary

I didn't know the existence of argparse in the first place, so I'm glad I knew it this time. Originally, I wanted something that returned optimized values, so I'd like to investigate a little more and find something like that library.

Recommended Posts

Change the output without touching the code using Argparse
python setup.py test the code using multiprocess
Modulo without using%
FizzBuzz with regular expressions etc. without using the'%' operator