Files
004_comission/vinniesniper-54816/task1/_lab/009-github-haar/utils/options.py
louiscklaw b3cc8e8323 update,
2025-01-31 22:57:47 +08:00

43 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
#
# Copyright 2016 Vale Tolpegin
# Distributed under the terms of the MIT License.
# -- Modules ------------------------------------------------------------------
from optparse import OptionParser
# -- global options -----------------------------------------------------------
global __Options__
# -- getOption ===-------------------------------------------------------------
def getOption(string):
"""
Fetches an option by name
"""
return getattr(__Options__, string)
# -- parseOptions -------------------------------------------------------------
def parseOptions():
"""
Completes command line argument parsing
"""
parser = OptionParser(usage='usage: %prog [options]', version='0.0.1')
parser.add_option('-d', '--debug', action='store_true', dest='debug', default=False, help="whether debugging to the console should be on or off")
parser.add_option('-w', '--width', dest='width', help="cascade target width")
parser.add_option('-l', '--height', dest='height', help="cascade target height")
parser.add_option('-i', '--images', dest='images', help="total number of images to use in training")
parser.add_option('-n', '--num-stages', dest='num_stages', help="number of stages to train the cascade with")
global __Options__
(__Options__, args) = parser.parse_args()
return (__Options__, args)