The hardware for the Pi Camera 2 is relatively simple; the sensor is connected to the Raspberry Pi 4 via the 2-lane MIPI CSI port and a ribbon cable:

Raspberry Pi Camera 2 connected via 2-line MIPI CSI ribbon cable. Source: Raspberry Pi Foundation.

Image and video capture using the Pi Camera 2 was accomplished using the built-in functions supplied with the MATLAB Support Package for Raspberry Pi:

  1. The images are displayed in one of the MATLAB GUI axes when taken. The “Pic” button, when pressed, will capture a photo.
  2. Video capture was implemented using the “Video” button. When pressed, the MATLAB GUI will prompt the user for the duration of video capture. Once provided, the GUI feeds this information to the Pi Camera, which will then record 25 fps video at 640 x 480 resolution.
    1. When completed, the plugin FFMPEG will convert the Pi Camera video to a .mp4 file. This .mp4 file will be saved to the folder designated for storing collected data.