Omnimaga

General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: thepenguin77 on March 30, 2011, 11:03:55 pm

Title: Long Exposure Pictures from Video
Post by: thepenguin77 on March 30, 2011, 11:03:55 pm
I know I'm not the only one who has wanted to make a long exposure picture but didn't have the camera to do it. So I made a C++ program that will convert a video into one of those pictures. And after about 2 weeks, it works!!!

This is one of the coolest programs I have ever made. You just take a video file, send it through my program, and get a picture.

I am using DirectShow to do most of the dirty work for me. It parses the video file and gives me a copy of each frame which I then average together. But simply averaging isn't enough because it results in pictures that are very dark. I take each pixel to the 8th power, average them all together, then take the 8th root. This means that little bright spots get really bright, and bright pictures probably turn white.

To use it, the syntax is      longExposure <video> <picture.bmp>      . The video can be anything that DirectShow supports, but to be safe, I'd just use .wmv since DirectShow is made by windows. I'll also have to see about exporting these as .jpg because .bmp sucks.

As for what you need to run it, I feel bad for whoever tries first. I know you will need C++ runtime libraries (x86 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84) x64 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=bd512d9e-43c8-4655-81bf-9350143d5867)). And you will probably need DirectX (http://www.microsoft.com/downloads/en/details.aspx?familyid=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3&displaylang=en) as well.

Here are some pictures that I made in my basement with a flashlight.
Title: Re: Long Exposure Pictures from Video
Post by: Darl181 on March 30, 2011, 11:05:44 pm
Win.
Reminds me of one of the ps3 themes :P
I think it was called Air Paint
Title: Re: Long Exposure Pictures from Video
Post by: Spyro543 on May 16, 2011, 05:51:47 pm
That....is.......so......

COOL!!!

You should do it with a laz0r pointer.
Title: Re: Long Exposure Pictures from Video
Post by: ruler501 on May 16, 2011, 06:01:52 pm
I'll have to try this out sometime. Does it work on linux? if so what do I need to install?

Definitely do one of these with a laz0r(maybe not just a pointer one >:)
Title: Re: Long Exposure Pictures from Video
Post by: squidgetx on May 16, 2011, 06:05:23 pm
Wow, that looks so cool. I'll hope to try it out later...
Title: Re: Long Exposure Pictures from Video
Post by: ztrumpet on May 16, 2011, 06:09:50 pm
Wow, this looks really cool.  I especially like the pole vault pic. ;D
Title: Re: Long Exposure Pictures from Video
Post by: ruler501 on May 16, 2011, 06:11:42 pm
I love the pics. how do you draw them so well with a flashlight?
Title: Re: Long Exposure Pictures from Video
Post by: DJ Omnimaga on May 16, 2011, 06:20:07 pm
Wow this seems awesome! I'm gonna have to try to see if any of my many videos works with that :D

Where can I download it ThePenguin77?
Title: Re: Long Exposure Pictures from Video
Post by: ztrumpet on May 16, 2011, 06:22:43 pm
Wow this seems awesome! I'm gonna have to try to see if any of my many videos works with that :D

Where can I download it ThePenguin77?
Here? http://www.omnimaga.org/index.php?action=dlattach;topic=7427.0;attach=6956
Title: Re: Long Exposure Pictures from Video
Post by: thepenguin77 on May 16, 2011, 06:22:55 pm
I'll have to try this out sometime. Does it work on linux? if so what do I need to install?

I have no idea if it will work in linux. I use directShow, which is a windows thing, so it probably won't work. But in case it does, you need DirectX and the C++ runtime libraries I linked to up top.


I love the pics. how do you draw them so well with a flashlight?

I have no idea. They come out way better than you expect them to. You just have to try to remember where you are at in the dark.


Where can I download it ThePenguin77?

It's the .zip in the first post. It's actually the program, not just all the pictures.

Title: Re: Long Exposure Pictures from Video
Post by: DJ Omnimaga on May 16, 2011, 06:23:29 pm
Oh wait I didn't see the zip, it was very small above the many pics :P
Title: Re: Long Exposure Pictures from Video
Post by: DrDnar on May 16, 2011, 06:30:05 pm
That's pretty cool, inasmuch as it behaves nothing like a real long exposure. A real long exposure is the result of the sum of each pixel's luminance, not the average. You'd have to add in some code to clip pixels with a luminance below a certain level to deal with noise and compression artifacts. You also need a really dark room. You may also need to manually configure the ISO, f-stop, and shutter speed, or else the automatic exposure program might throw everything off.
Title: Re: Long Exposure Pictures from Video
Post by: DJ Omnimaga on May 16, 2011, 06:31:25 pm
On a side note, my video sound was played during converting. Does it open WMP in the background or something while doing so?

I wish I had a camera that supported that stuff...
Title: Re: Long Exposure Pictures from Video
Post by: thepenguin77 on May 16, 2011, 06:35:42 pm
That's pretty cool, inasmuch as it behaves nothing like a real long exposure. A real long exposure is the result of the sum of each pixel's luminance, not the average. You'd have to add in some code to clip pixels with a luminance below a certain level to deal with noise and compression artifacts. You also need a really dark room.

That made my day. You're right, it doesn't work like a real long exposure film, but I think this might be similar to what modern digital cameras do. If I had just summed rather than averaged, all the pictures would turn out white.


On a side note, my video sound was played during converting. Does it open WMP in the background or something while doing so?

I wish I had a camera that supported that stuff...

I never noticed that because all of my videos are silent. It used to actually play the video while it converted, but I turned that off. I didn't realize that it still played the sound though. DirectShow pretty much does what it wants :P
Title: Re: Long Exposure Pictures from Video
Post by: DJ Omnimaga on May 16, 2011, 06:42:42 pm
Yeah I just converted the rickroll video :P
Title: Re: Long Exposure Pictures from Video
Post by: ruler501 on May 16, 2011, 06:44:11 pm
It looks like a random blob... with what might be a face like thing in the middle
Title: Re: Long Exposure Pictures from Video
Post by: ztrumpet on May 16, 2011, 06:47:12 pm
Yeah I just converted the rickroll video :P
I love how it played the sound while it converted. XD
Title: Re: Long Exposure Pictures from Video
Post by: ruler501 on May 16, 2011, 06:48:57 pm
I wouldn't mind too much. That rickroll song grows on you after a while
Title: Re: Long Exposure Pictures from Video
Post by: DrDnar on May 16, 2011, 06:50:54 pm
I think this might be similar to what modern digital cameras do.
Wrong. DSLRs simply leave the sensor active for the duration of the exposure. (Each photon deposits a small amount of charge into the photosite. As the exposure progresses, the charge builds up. At the end, an ADC reads out the charge level.) The main difference between a digital long exposure and film long exposure is film suffers from problems like reciprocity failure and color shifts, whereas digital sensors suffer from noise issues, even at low ISOs.
If I had just summed rather than averaged, all the pictures would turn out white.
That's probably because your camera is trying very hard not to make each frame pure black, so it's pumping up the ISO. With manual control, you could fix that.
Title: Re: Long Exposure Pictures from Video
Post by: ztrumpet on May 16, 2011, 06:52:20 pm
I wouldn't mind too much. That rickroll song grows on you after a while
And this is why it's in my iTunes. :P
Title: Re: Long Exposure Pictures from Video
Post by: ruler501 on May 16, 2011, 06:54:00 pm
I'll probably download one of the ones off youtube later
Title: Re: Long Exposure Pictures from Video
Post by: alberthrocks on May 16, 2011, 07:02:01 pm
Hehe, I remember this post and was going to reply to it, but I forgot.... now I did! :D
This is just simply an awesome program! The only issue is that this isn't compatible with Linux... but that can't be helped, and definitely doesn't take away from how awesome this is! ;)
I guess me or some other C/C++ versed member will port this little guy to Linux (compat with Mac) someday...
Title: Re: Long Exposure Pictures from Video
Post by: DrDnar on May 16, 2011, 07:03:17 pm
Here's an example of an actual long exposure for comparison. I took this a few years ago during a dark, cold winter night. It was below freezing out. I set the camera up on a tripod, put it in bulb mode, hit the shutter, and then went inside to warm up. I came back a few minutes later and ended the exposure. This is from a Canon 20D, 365 seconds, f/10, ISO-200. The exposure was a complete random guess.
Title: Re: Long Exposure Pictures from Video
Post by: Builderboy on May 16, 2011, 07:09:11 pm
I actually just did a photo portfolio on long exposures, I should put it up! O.O
Title: Re: Long Exposure Pictures from Video
Post by: thepenguin77 on May 16, 2011, 07:18:52 pm
I think this might be similar to what modern digital cameras do.
Wrong. DSLRs simply leave the sensor active for the duration of the exposure. (Each photon deposits a small amount of charge into the photosite. As the exposure progresses, the charge builds up. At the end, an ADC reads out the charge level.) The main difference between a digital long exposure and film long exposure is film suffers from problems like reciprocity failure and color shifts, whereas digital sensors suffer from noise issues, even at low ISOs.
If I had just summed rather than averaged, all the pictures would turn out white.
That's probably because your camera is trying very hard not to make each frame pure black, so it's pumping up the ISO. With manual control, you could fix that.

Ok, that makes sense. I forgot that the camera actually changes the picture before it gets to the computer.