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() instantiates a video pipeline, video mediator, and frame capture. flightProgram() then feeds tent coordinates into pipeline, feeds the tent coordinates from pipeline into geolocation, retrieves GPS coordinates from geolocation, and sends these coordinates to the 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 after the QRScanner object is created. 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 allows the program to read barcodes or QR codes and decode them. The stacked procedures are shown below.

...

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.

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 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.

...