Programming image filters for video lomography - Script Writing - CHDK Forum

Programming image filters for video lomography

  • 6 Replies
  • 4584 Views
Programming image filters for video lomography
« on: 12 / February / 2013, 17:37:36 »
Advertisements
I have an old SD780 IS and I would like to try to turn it into a video camera for lomography. Part of this will involve purposefully adding physical light leaks / reflections into the sensor itself.

I would also like to create some filters to modify the colors digitally.

I just found out about CHDK and have quickly gone through some of the starting pages on the wiki. It seems almost all of the scripting documentation refers to controlling various functions on the camera, rather than working with the image data itself.

It looks like I can access and write to memory using the Lua interface. But I'm not convinced this is the right approach.

Is it realistic at all to expect that I can write an image filter that works with video? If so, how can I get started? Is there some kind of example I can look at?

I was thinking a good practice filter could be a vignette or maybe some black & white dithering. But I'm not really sure how to get started with that. Would I use the Lua interface? Would I have to use DryOS?

Re: Programming image filters for video lomography
« Reply #1 on: 12 / February / 2013, 22:58:33 »
The short answer you are probably going to get to this question is "why not just filter your images on your PC".

Still, if you are willing to dive into CHDK's C code and create your own version,  you can get access to the RAW picture buffer before it gets encoded as a jpeg and saved to the SD card.   So depending on your creativity you could write something in C and fiddle with what's in that buffer. Be aware that the camera's Digic processors is not really very fast so whatever you tried to do to an entire sensor image could take a very long time.

Otherwise,  I can't see anyway you could do much useful with a Lua script.  I suppose you could open an image file after its been written to the SD card ( RAW or JPG ) and with enough software development effort do "something".  But here you are talking about an interpreted language on a slow processor with limited program memory.  Hard to see what you would practically be able to do.

Stranger things have happened though.
« Last Edit: 12 / February / 2013, 23:00:14 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Programming image filters for video lomography
« Reply #2 on: 13 / February / 2013, 06:03:57 »
He is referring to special effects in video mode.

There is no way the video capture will tolerate interference for the length of time it would take  to process each frame.
It is, of course, pointless to do this directly on the source movie anyway.

Re: Programming image filters for video lomography
« Reply #3 on: 13 / February / 2013, 07:11:51 »
Video?  Sorry - I missed that - the wikipedia page doesn't say anything about video.

http://en.wikipedia.org/wiki/Lomography

And I guess that it  never occurred to me that anyone would try to do filters on the fly while shooting video.   Not without hacking the camera DSP - something nobody has really done so far.
« Last Edit: 13 / February / 2013, 07:15:52 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Programming image filters for video lomography
« Reply #4 on: 13 / February / 2013, 16:31:34 »
Cool, thanks for your feedback guys, this is exactly the info I was looking for. I guess I will just stick with physical hacks and experimenting with weird settings when it comes to the actual camera.

I'm just too used to programming shaders, so I get these crazy ideas. :P

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: Programming image filters for video lomography
« Reply #5 on: 13 / February / 2013, 18:41:51 »
You may have some luck with effects already built into DIGIC.

No idea if any of those works on compacts though.

Code: [Select]
poke(0xc0f0f070, 0x01000100); // grayscale
poke(0xc0f0f000, 0xb1); // negative
poke(0xc0f0de2c, 0x10); // swap u-v
poke(0xc0f23164, -1); // cartoon look

https://www.youtube.com/watch?v=qMq0NeTLJiU

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Programming image filters for video lomography
« Reply #6 on: 14 / February / 2013, 05:12:32 »
You may have some luck with effects already built into DIGIC.

No idea if any of those works on compacts though.

Code: [Select]
poke(0xc0f0f070, 0x01000100); // grayscale
poke(0xc0f0f000, 0xb1); // negative
poke(0xc0f0de2c, 0x10); // swap u-v
poke(0xc0f23164, -1); // cartoon look

https://www.youtube.com/watch?v=qMq0NeTLJiU

The first three sort of work on my G1X so long as I keep storing the value in the IO register.
Looking at the ML code you do this in a VSync function - unfortunately we don't have anything like this in CHDK.

If I keep poking the value in the keyboard task I get the effect; but with tearing across the image (where the effect kicks in).

It also has the side effect of crashing the camera when you try and shutdown.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal