This node/express app demonstrates the simplest way of calculating the average of a dataset while keeping all of the underlying data private. The client application opens up your camera and starts taking pictures of your face, obfuscating the image by salting random zero-centered numbers to the pixels, then sending the garbled images to the server. The server then takes the average of all the images. With a large enough sample size, the added noise cancels out (converges to zero) and you're left with approximately the average of the actual non-obfuscated data.
npm install heroku create
Also install python requirements.
pip install -r requirements.txt --user
Upload to heroku web app.
git push heroku master
Start the python client which will collect the noisy images. Make sure to modify the
HOST variable to your actual heroku url (e.g.
https://glacial-dusk-26636.herokuapp.com/ for heroku).
The app looks something like this:
Ideally you capture at least 1000 images. It works best with many clients (>20!) at same time in a room.
Take the average of all the collected images.
And you will see a file
myAverage.png show up in the root directory which contains the average.