by Tommaso Bellinato | 2032597
Development of the "Project C" for the “Elements of Embedded Systems Programming” course (6 ECTS, code INP8085258) 2023-24 edition.
The task is to implement an app that provides the average color detected by the camera.
- The first interface of the app must show
- the camera preview and
- the average value calculated for each of the three color components
- with real-time updates
- The second interface must show, for each of the three color components
- the average values of the last five minutes
- graphically
- with real-time updates
- It is not required for the calculation and recording of data to continue when the app is in the background, but in case the app goes into the background
- the app itself must not crash and must remain in a consistent state.
Images can be acquired using the Camera
class even though it is deprecated.
- Whatever the acquisition method used, it is recommended to
- set the size and frame rate of the preview to the minimum values supported by the device's camera.
External libraries can be used to implement data visualization.
- Camera Preview:
- Real-time display of the camera preview.
- Average Color Value Calculation:
- Real-time calculation of the average RGB values for each captured frame.
- OpenCV: A library used for image processing that can be used to optimize the average color values.
- Graphical Display of Average Values from the Last Five Minutes:
- Real-time graph showing the trend of color components from the last five minutes of acquisition
- MPAndroidChart: A comprehensive library for creating real-time charts on Android. Easy to use and highly customizable.
- Language Support
- The application fully supports both English (default) and Italian languages.
- Real-Time Interface Updates:
- UI Functionality in Both Portrait and Landscape Modes:
- Adaptability of the user interface to work correctly in both device orientations.
- ConstraintLayout: A versatile layout manager that facilitates the creation of responsive and adaptable UIs for different screen sizes and orientations.
- Consistent App State in Background:
- Management of the app lifecycle to ensure it does not crash and remains in a consistent state when going into the background.
- Setting Preview Size and Frame Rate to Minimum Supported Values:
- Configuration of the camera to use the lowest supported preview size and frame rate to reduce processing load.
- Performance Optimization:
- Techniques implemented to optimize the app's performance, especially regarding the calculation of average values and chart updates.
- Utilization of View Binding:
- The app uses View Binding to interact with XML views safely and efficiently.
- View Binding reduces the risk of crashes caused by
NullPointerException
errors, improves code readability, and facilitates maintenance by automatically generating binding classes for each XML layout, eliminating the need to callfindViewById()
.
The use of View Binding in the project ensures that interactions with views are safe and free from runtime errors, while also improving code readability and maintainability. This practice, together with the use of other technologies and libraries such as LiveData
, ViewModel
, Room
, and ConstraintLayout
, contributes to creating a robust and performant app.