Quinn Okabayashi and Josh Vandervelde
-
Follow the instructions here for configuring your Raspberry Pi for headless mode and connecting via SSH.
-
Once connected via SSH, setup the project with the following command:
$ source <(curl -s https://raw.githubusercontent.com/QnnOkabayashi/scripts/master/PiDiffuserCam/setup.sh)
Warning: You should always verify that scripts from URLs are safe before running! Check out the source code below yourself.
This will:
- Update the package manager
- Install the required dependencies
- Clone the project repo code to the home directory
- Enable the PiCamera and RealVNC modules
- Display VNC server address
- Reboot, enabling the VNC server
Note: Sometimes this code doesn't do anything for reasons beyond me. If it doesn't work at first, wait a minute and try again.
-
On your local machine, install VNC Viewer.
-
Open VNC Viewer and enter the VNC Server address the setup process displayed in step 2. This will open a window where the camera feed will display when we enable it.
-
To start taking pictures, SSH into the Pi, navigate to
~/PiDiffuserCam/raspberrypi
, and enter:$ python3 main.py
The scp
command can be used to transfer files over SSH. The following command transfers images from the Raspberry Pi to your desktop (executed from your local shell):
$ scp -rp [email protected]:/home/pi/PiDiffuserCam/raspberrypi/captures /Users/$(whoami)/Desktop
Note: This command will fail if no images have been captured
- After transfering the images to your computer, convert them to
.tif
by renaming them. - Clone the tutorial code repository into a Jupyter Notebook.
- Upload them to the Jupyter Notebook and edit the config block (shown below) by entering in the image file names:
psfname = "./psf_file_name_here.tif" imgname = "./image_file_name_here.tif"
- You can also change the number of iterations for tweaking the clarity:
# Number of iterations iters = 5
- Restart the kernel to execute script, and the reconstruction will display at the bottom.