Skip to content

SLUVisLab/multicam

Repository files navigation

BII Multi-Camera Phenotype Capture for iOS

This Multi-Camera app uses all three front-facing iphone cameras to near-simultaneously record streams of photos and upload them to the cloud.

Contents

Using the App

The main screen of the app contains three options: 1) Capture for opening the camera view and taking photos, 2) Gallery for viewing previous sessions as well as uploading or deleting them, and 3) The settings page indicated by the gear icon in the top right corner. Let's take a look at what's available in each view!

Taking Photos

Taking photos

In order to start the camera, you will need to use the text inputs to enter the field site and block/plot id that you want to take photos of. Once you've input a field site ID the app should remember it for next time.

Once you've filled out the text fields, the record button at the bottom of the screen should be white to incdicate it is enabled. After pressing the record button the app will start taking photos continuously at a set framerate using multiple device cameras. The screen should show an animation indicating that photo capture is in progress.

If enabled, a sound will also play while photo capture is in progress. This can be disabled from the settings screen.

To stop recording, hit the record button again. Voila! You've taken a bunch of photos!

Uploading & Deleting Photo Sessions

Uploading photos

After navigating to the Gallery view, you can view and manage collections of photos that have been recorded.

To see the individual photos included in a recording session, just click on the session in the gallery.

To upload or delete recording sessions, enter gallery selection mode by clicking the Select button in the top right corner. You can now select individual or multiple recording sessions and use the Delete or Upload buttons at the botton of the view to perform those actions.

NOTE: Recording sessions are automatically deleted after they are uploaded! This can be disabled in the Settings view.

On Deleting Recording Sessions: The photos taken using this app are stored the natiuve iOS Photos Library. If you delete photos using the standard Photos app, it can corrupt the references used internally by this app. We reccomend only using this app to delete photos associated with it. If you do run into issues with this, see the next section: Configuration and Troubleshooting

Configuration and Troubleshooting

App Configuration

The app is packaged with a default configuration for things like camera framerate, size of uploaded images, and pre-defined lists of available field sites and plots. It also checks the cloud database for an updated configuration file on startup and saves it locally for future use. You can see the configuration values from the Settings view and also manually check for a new configuration file using the provided button.

The firebase config schema includes a nested documenet containing available field site and plot (block) information that users can select from before recording images. This is not included in the default config.json file however. The app will not be able to record if selections aren't available from the remote config. This means that the app needs to have been loaded at least once while connected a network before it will be ready for recording!

max_resolution: The maximum resolution of the largest dimension of an image to be uploaded

jpeg_compression_quality: Downsamples raw image data when it is converted to .jpeg format for uploading. 1.0 is highest quality.

frame_rate_seconds: The interval in seconds between image captures. This is the framerate for each individual camera. So a framerate of 3 means each camera is firing at 3 frames per second.

Sample config.json file and firebase document schema:

{
    "id": "config",
    "max_resolution": "1024",
    "jpeg_compression_quality": "0.8",
    "frame_rate_seconds": "1.0",

}

Firebase config schema

Troubleshooting

Sometimes the on-device database can become corrupted and get out of sync with the native iOS Photos library. If you run into issues with crashing or freezing, go to the Settings view and click the "Clear Database Cache" button. This will delete any current recording sessions you have made with the app and clear the local database.

Backend Setup

The app requires two cloud services from google to run:

  1. Firebase Storage: This is essentially a standard GCP storage bucket that is accessible through firebase SDKs. It's where the raw image data is stored and also the service that provides URL's to the hosted images

  2. Firebase Firestore: This is a NoSQL database that stores data related to images such as site ID, block ID, session ID, and related timestamps as well as the hosted URL of the associated image.

Authentication

You'll need to include a GoogleService-Info.plist file in the root directory of the project. The Firebase SDKs will use this for authenticating with cloud services. You find setup instructions here: Add Firebase to your Apple Project

Resources

Camera capture code inspired by WWDC '19 project: https://developer.apple.com/documentation/avfoundation/capture_setup/avmulticampip_capturing_from_multiple_cameras

MongoDB Realm Swift SDK Docs

Firebase Storage SDK

Firebase Firestore SDK

Apple PhotoKit Docs

AVFoundation Docs

Remote Configuration Loader

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages