Author Topic: Long Exposure Pictures from Video  (Read 10484 times)

0 Members and 1 Guest are viewing this topic.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Long Exposure Pictures from Video
« 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 x64). And you will probably need DirectX as well.

Here are some pictures that I made in my basement with a flashlight.
« Last Edit: March 30, 2011, 11:32:21 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Long Exposure Pictures from Video
« Reply #1 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
« Last Edit: March 31, 2011, 10:41:08 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #2 on: May 16, 2011, 05:51:47 pm »
That....is.......so......

COOL!!!

You should do it with a laz0r pointer.

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #3 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 >:)
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #4 on: May 16, 2011, 06:05:23 pm »
Wow, that looks so cool. I'll hope to try it out later...

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #5 on: May 16, 2011, 06:09:50 pm »
Wow, this looks really cool.  I especially like the pole vault pic. ;D

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #6 on: May 16, 2011, 06:11:42 pm »
I love the pics. how do you draw them so well with a flashlight?
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Long Exposure Pictures from Video
« Reply #7 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?
« Last Edit: May 16, 2011, 06:21:06 pm by DJ_O »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #8 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

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #9 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.

zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Long Exposure Pictures from Video
« Reply #10 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

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #11 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.
« Last Edit: May 16, 2011, 06:34:02 pm by DrDnar »
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Long Exposure Pictures from Video
« Reply #12 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...

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Long Exposure Pictures from Video
« Reply #13 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
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Long Exposure Pictures from Video
« Reply #14 on: May 16, 2011, 06:42:42 pm »
Yeah I just converted the rickroll video :P