Scanning using PiCam
2 minutes
TL;DR
Using the PiCam to detect changes within the frame.
Network Lag
One thing that would happen if I constantly send image data over the network is that it would start to slow down the entire network which is not what I want. As such, instead of letting the PiCam constantly feed images, it would be more appropriate to only send the data when the entire object is within the frame. Therefore, the purpose for this week is to work on this.
Reset
Due to a minor issue that I faced earlier, I had to reinstall the Raspberry Pi. This meant that most of my work done previously was gone. During the reinstallation, I felt it would be better for me to do some documentation of what was done during the installations.
Installation of Raspberry Pi OS
This topic is rather matured and has an official documentation on the installation page. The easiest way is to utilise their Raspberry Pi Imager tool The entire download process does take up to an hour on my internet speed.
Requirements
PiCam
In order to run the PiCam, I needed to first activate it. All the steps could be found on the official documentation
OpenCV
First thing we need is OpenCV.
Errors
ImportError: No module named cv2
This was easy, I should have remembered that OpenCV does not come with Pi. A simple pip install opencv-python
and run again:
ImportError: libjasper .so.1: cannot open shared object file: No such file or directory
Oh. This I’ve not seen before. So I did a quick search and came across an xda post. After a few more searches, I finally found the full installation process which can be found here. This alone could take up another hour to complete. As much as I got put off by the long procedures, I needed OpenCV to work. Once everything is done however, I could start on the work.
Starting work
Once all the dependencies were finally installed, I could begin on the actual python script.
Reference
Throughout this entire process, I was refering to this site which gave basic instructions similar to the requirements of my project.
Capture single frame
Sending over network
One thing that needs to be done is to send all the images over the network once the image is captured within the frame. To do this, I had writen up a cliend and server python script using the socket
library. Firstly, I had some big ideas on how this communication should be done. At first, I was thinking of UDP to send the data over but then
(Updated: )