# Glossary
* **Labgrid**: an embedded systems control library for development, testing, and installation. See [Labrid on GitHub](https://github.com/labgrid-project/labgrid).
* **Board State Distriubtion System (BoSS)**: a non-invasive DUT board state detection and reporting system. For a concept see: [BoSS on GitHub](https://github.com/missinglinkelectronics/boss).
* **OpenCV**: A computer vision library. See [OpenCV in Python](https://pypi.org/project/opencv-python/)
# Functional requirements LED Detection
1. **Webcam integration**
Shall access the webcam via labrid (the webcam is provided as a labgrid resource) and get the current, yet unedited, video stream.
2. **Webcam calibration**
The video stream provided by the webcam shall be calibrated, i.e taking into account angle, rotation, shaking, and lighting conditions.
3. **Different lighting conditions and angle**
The system shall work under different lighting conditions, namely every degree between well-lit and dark. In addition, the angle of the camera shall not matter for the detection.
4. **Feature database**
A database that shall provide features for the boards. In the beginning, this shall include the Xilinx ZCU102, the Raspberry Pi and could be extended to cover more boards. The database is used to provide feature detection. The data is stored in a directory structure, includes a picture of the board, the coordinates of the regions of the LEDs, and the name of the LED.
5. **Feature database extension**
A GUI tool shall be provided which allows selecting features of a board based on an image. The data generated in this way are stored in the feature database.
6. **Feature detection**
The provided video stream gets preprocessed to allow the detection of features, comparison with the feature database, and finally to return the board which is shown in the video stream.
7. **ROI**
With the board type and the angle known, the LEDRoiExtractor shall extract the regions of interest in the provided frame. These regions contain the lighting of the LEDs (if they are powered on).
8. **State detection**
From the ROI the state shall be detected by using OpenCV's provided methods for finding bright pixels (this could be a threshold in HSV). The state includes the name/function of the LED (provided by the feature database, for instance, BOOT_DONE), the state (on/off), the color, and the blink rate.
9. **Blink rate**
The blink rate could be detected based on the state and be returned in Hz. This is an optional requirement.
10. **Events**
The events belong to different event channels (for instance BOOT, ALL). The user shall be able to subscribe to one or more of them. If an event in the subscribed channel occurs the user gets notified.
11. **Labgrid integration**
The system shall be integrated into labgrid functionality, i.e that the functionally is wrapped by the labgrid provider interface. This allows access to the led state via the labgrid system.
# Non-functional requirements
1. **Language**
To facilitate support from the open-source community, the system and documentation language is English.
2. **Programming language**
For better integration and a more effortless setup, the project is written in Python 3.
3. **Computer vision library**
The computer vision library used for this project is OpenCV. It provides a variety of functions useful in this project and is therefore perfectly suited.
4. **False-negative rate**
The led detection shall detect the status correctly in at least *XX* percent of the cases.
5. **Python standard**
*TODO: The python standard used for this project*
6. **License**
With the aim to not have a strong copyleft, the project is under the [LGPL v2.1 License](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.de.html).