CPP_Birdtracker
A C++ object tracking program specifically for lunar bird tracking
Functions | Variables
fog_removal Namespace Reference

Functions

def create_directions ()
 Create intro/directions slide for the thresholding Python script. More...
 
def ascii_version (in_frame)
 This is a terminal-only version of the fog removal code. More...
 
def ascii_proc (in_frame, thresh)
 This function does the heavy lifting for the ASCII version of this code. More...
 
def is_valid_file (parser, arg)
 Check if arg is a valid file that already exists on the file system. More...
 
def check_positive (value)
 Check that the input integer for the starting frame number is valid. More...
 
def get_parser ()
 Get parser object for this script. More...
 
def main ()
 Perform primary functions of this script. More...
 

Variables

bool BLACK_BACK = True
 

Function Documentation

◆ ascii_proc()

def fog_removal.ascii_proc (   in_frame,
  thresh 
)

This function does the heavy lifting for the ASCII version of this code.

The input image is cropped to ignore as much black background as possible, then resized to fit the user's terminal (using output from tput). The image is thresholded, and the output from this thresholding operaiton is converted to a string of ASCII characters. There are 97 characters in the grayscale list. If the user has a black background, as determined by the global variable BLACK_BACK, the order of ASCII characters are reversed. After printing our "image", the user is informed if the image was resized and reminded of what value they entered.

Parameters
in_frameThe input 1-channel OpenCV image
threshAn integer between 0-255 to represent the threshold of to test here

Definition at line 117 of file fog_removal.py.

Here is the caller graph for this function:

◆ ascii_version()

def fog_removal.ascii_version (   in_frame)

This is a terminal-only version of the fog removal code.

In this loop, the user is prompted for a threshold value to test or to exit by entering "q". The in_frame param passes through to the nested function.

Parameters
in_frameThe input 3-channel OpenCV image

Definition at line 90 of file fog_removal.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_positive()

def fog_removal.check_positive (   value)

Check that the input integer for the starting frame number is valid.

Definition at line 209 of file fog_removal.py.

◆ create_directions()

def fog_removal.create_directions ( )

Create intro/directions slide for the thresholding Python script.

Returns
image A 1080x1080 black 3 color image with red text (CV Mat)

Definition at line 64 of file fog_removal.py.

Here is the caller graph for this function:

◆ get_parser()

def fog_removal.get_parser ( )

Get parser object for this script.

Returns
Parser object

Definition at line 219 of file fog_removal.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_valid_file()

def fog_removal.is_valid_file (   parser,
  arg 
)

Check if arg is a valid file that already exists on the file system.

Parameters
parserthe argparse object
argthe string of the filename we want to test
Returns
arg

Definition at line 193 of file fog_removal.py.

Here is the caller graph for this function:

◆ main()

def fog_removal.main ( )

Perform primary functions of this script.

Command line arguments are first parsed to get the file name on which we want to operate. Then, we ensure that this is a valid file. The video file is opened and the first frame is read. We then create our output window of size 1080x1080 and trackbars for the Directions toggle and Image Threshold. If everything was successful, the window opens with the Diretions image. When the user tells the Directions to toggle closed, the first frame from the video is shown after conversion to grayscale and thresholded to zero. The image threshold is determined by the value of the threshold trackbar. The user exits with the ESC key. On exit, the final value of the threshold is printed to the terminal.

Definition at line 236 of file fog_removal.py.

Here is the call graph for this function:

Variable Documentation

◆ BLACK_BACK

bool fog_removal.BLACK_BACK = True

Definition at line 51 of file fog_removal.py.