Hi vertical farmers,
In the previous post we presented the key issues related to our Artificial LED lighting system.
In this post we will talk about our image acquisition system to monitor and control plant growth, introducing the image acquisition management. This system is of particular importance because it will be the base of our artificial intelligence system.
In the next post, we will proceed explaining the artificial intelligence tasks of reasoning and decision.
Hardware
Our initial prototype is composed by the following components (also depicted on figure 1):
- Logitech C170 webcam — It’s a 5 megapixels camera with a maximum resolution of 1024x768. For this particular webcam, the necessary drivers are available almost out of the box.
- Raspberry Pi 2 — It’s a single-board computer with 900 MHz quad-core ARM Cortex-A7 CPU, 1 GB RAM and running the Raspbian Linux distribution.
Figure 1. Prototype of image acquisition system.
We selected these components because were available in-house, allowing us to economize and deploy faster but there are better solutions in the market, especially cameras. To be fair, this is a complete shot in the dark concerning webcam image quality in the long run of the project. We took initial shots from lettuces germinated for system testing purposes (figure 2) and they showed acceptable image quality, but changes in lighting will degrade the quality of the samples. For now, and considering the deadline of the project, we will keep the webcam and we can easily upgrade it later.
The Raspberry Pi 2 will be used for image acquisition, post-processing and communication with external servers (e.g. MySQL and FTP).
Figure 2. Samples taken with the prototype.
Architecture
Figure 3. General overview of the image acquisition system.
In this stage, and after a few general discussions, it was defined that the majority of software (for the high-level features of our project) will be developed in Python. This choice was made to provide a fast and modular approach to our problems and to take advantage of the available open-source libraries for most of the important external modules of our project (e.g. connection, MySQL and FTP).
The acquisition process (figure 3) follows the following steps divided in two stages:
- 1. Configuration
- Bash script with image acquisition — A script is designed to change the directory and take a sample based on the fswebcam command line interface(cli) app.
- Crontab job registration — Using the command ‘crontab -e’ a new job is scheduled containing the desired trigger and the corresponding script.
- 2. Automation
- Image acquisition triggered by crontab — At a defined rate, an image is captured by the webcam and stored in a predefined directory.
- File watcher — In the Python node, an event is triggered based on the watchdog library for a new file on the watched directory.
- FTP server integration — FTPlib library is used to connect to a FTP server and store the detected image.
- MySQL database integration — Using the MySQLdb library, INSERT statements are performed to store the image path and capture date.
- Error handling — In cases where either the FTP or the MySQL transaction fail, a queue is maintained until the connection is reestablished or the problem solved.
To avoid naming collisions, each lot and each sensor have unique identifiers (keys) and the image stored in the FTP server contains a merged name (AllotmentKey + SensorKey + datetime + . + format).
In the following video we have an initial time-lapse from images acquired by our prototype. Each image was taken hourly in the course of one day and it’s possible to see clearly the plants moving and growing.
On our next post we will be describing in depth our database and the technical decisions made to provide a solid storage to our information. We will explain entity and relationship identifiers of database. We also plan to define the base communication frame, encryption and related topics. Also we will analyze the acquired images to extract useful information.
As always if you have any questions or comments please feel free to reply to this post.
Thanks for following and keep connected!



Top Comments