I recently got a GoPro. You know to get cool selfies, videos and all :D I am very much impressed by all the cool things you can do with it but was specifically impressed by the fact that one can create a time lapse video.
After giving a couple of tries to time lapse videos, I wanted to go beyond. I had always seen photographers make a long exposure shots by using specific DSLR cameras. I wanted to create just that using the only camera I had, a GoPro. However I had something much more than the camera, I knew how to write a code that deals with a number of images (I am a Computer Vision Engineer).
I brainstormed a plan which involved two main components:
1. Taking a set of time lapsed pictures of a scene with both moving and stationary objects.
2. Write a code that uses these pictures and gives a single long exposure shot.
I found a scene and took time lapsed pictures with a 3 second time interval for about 10 minutes. I had enough 'data' that I knew I could use and build my code on. Here is what it looked like:
AND YES! The London Eye DOES MOVE!!
After giving a couple of tries to time lapse videos, I wanted to go beyond. I had always seen photographers make a long exposure shots by using specific DSLR cameras. I wanted to create just that using the only camera I had, a GoPro. However I had something much more than the camera, I knew how to write a code that deals with a number of images (I am a Computer Vision Engineer).
I brainstormed a plan which involved two main components:
1. Taking a set of time lapsed pictures of a scene with both moving and stationary objects.
2. Write a code that uses these pictures and gives a single long exposure shot.
I found a scene and took time lapsed pictures with a 3 second time interval for about 10 minutes. I had enough 'data' that I knew I could use and build my code on. Here is what it looked like:
London Eye |
AND YES! The London Eye DOES MOVE!!
Now the fun part - I wrote a simple script that loaded all the images and took a mean to create the final image - giving a nice long exposure.
Click to enlarge |
Click to enlarge |
And finally here is the Matlab Code:
% Script for creating long exposure using multiple images
close all
clear all
clc
folder = sprintf(' ');
% count the number of png files
D = dir([folder, '\*.jpg']);
cumulativeImage = [];
numOfImages = size(D, 1);
% loading and accumulating
for i = 1:numOfImages
(double(i)/numOfImages)*100
inImage = imread(D(i).name);
if( i == 1 )
cumulativeImage = double(inImage);
else
cumulativeImage = cumulativeImage + double(inImage);
end
end
longExposureImage = uint8(cumulativeImage./numOfImages);
imshow(longExposureImage);
imwrite(longExposureImage, 'longExposureImage.jpg');