Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

main.py is the main program that includes a variety of functions that call functions from other files. From each file nameUsing file names in other module folders, main.py imports functions in from those files, and those functions can now be called anywhere in main.py. Each function written in main.py takes care of a different task.

callTrain() checks if the "targetAcquisition/yolov2_assets" path exists, then imports its module. callTrain() does not call any imported functions.

flightProgram() sets a pipeline, uses video frame capture, merges frames with telemetry data, gets info for bounding boxes, feeds tent coordinates into the pipeline, and feeds those tent coordinates into the geolocation module. The geolocation module will then get GPS locations with latitude and longitude, and coordinates are sent to the command module. Overall, the flightProgram module uses a decklink video stream with telemetry data to create a list of bounding box coordinates, gets latitude and longitude coordinates from geolocation, and stores these GPS coordinates to the flight command module. This method calls imported functions decklinkSrcWorker(), pipelineMergeWorker(), targetAcquisitionWorker(), geolocation_locator_worker(), geolocation_output_worker, and flight_command_worker().

...

qrProgram() uses the webcam to detect and decode a QR code to return the string message that the QR contains. The qrProgram() function also uses decklinkSrcWorker_taxi() to access a camera stream . Similar to showVideo(), decklinkSrcWorker_taxi which provides frames from the camera, and these frames are then passed into qr_worker() as its parameter pipelineIn.

QRWorker.py

QRWorker.py contains a function called qr_worker() that creates a QRScanner object. qrProgram() calls imported methods decklinkSrcWorker_taxi() and qr_worker() also uses opencv and the imshow() method to display the updated frame. In the QRScanner class, functions are defined that find a QR code in an image, decode the the QR code, and draw bounding boxes within the given frame. The QRScanner class also imports the pyzbar module that can read barcodes or QR codes and decodes them. The stacked procedures are shown below.

...

taxiProgram()

showVideo()

main.py includes a function named showVideo(), and it .

...

init_logger() initializes the logger with formatted date and time. This method does not call any imported functions.

taxiProgram() → ignore for now

showVideo() displays a user’s default webcam. This function calls imported methods from videoDisplayWorker.py and decklinkSrcWorker_taxi.py. In decklinkSrcWorker_taxi.py, a DeckLinkSRC object is created, and continuously grabs frames from the device’s webcam. Since all parameters in python are pass by reference, the piplineOut parameter is constantly updated to a new frame using the put() function. In showVideo, both functions videoDisplay() and decklinkSrcWorker() are run in a list of parallel processes. Since both functions run in parallel and the pipelineOut variable is constantly updated, this variable can be passed into videoDisplay() as a parameter for every new frame taken from the decklink webcam.

videoDisplayWorker.py

Video display in python uses OpenCV, which is a library of programming functions that allow various functionalities in real-time computer vision. This includes video and image processing, object detection, tracking, and many more. In the videoDisplayWorker.py file, the OpenCV library is imported and used to display the user’s default webcam.

In videoDisplayWorker.py, the videoDisplay() function takes in the frame captured by dekclinkSrcWorker_taxi() as a parameter (pipelineIn). In a continuous loop, the videoDisplay() function uses the cv2.imshow() method which creates as new window and sets the pipelineIn as the current frame. In the program, this displays each frame at a high speed in a loop. Altogether, these output a new window showing the user’s webcam video. Note that there is an if statement that closes the window when ‘q’ is clicked on the user’s keyboard. This closes the window but does not disactivate the user’s webcam (webcam light remains on). To completely end the program, click on the garbage can icon to the right of the terminal. This is highlighted in yellow below.

...

As mentioned before, main.py runs decklinkSrcWorker_taxi() and videoDisplay() functions at the same time. The frame acquired by decklinkSrcWorker_taxi() is instantly passed into videoDisplay() and output to the screen. This is done continuously to create a full video stream. The high-speed frames that are acquired and output is what creates a functional webcam display.

Image Removed

...