Author Topic: Frame interpolation?  (Read 1894 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Frame interpolation?
« on: July 05, 2011 »
How would you go about interpolating inbetween frames from a before and after? Best I can think of would be to choose a pixel, take the colour before add the colour after and average the two to create an inbetween. Is there a better solution?

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4381
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Frame interpolation?
« Reply #1 on: July 05, 2011 »
You could also take the surrounding pixel colours into account (giving them a lesser weight) - but generally I am agreeing with you!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Frame interpolation?
« Reply #2 on: July 05, 2011 »
You can get lots of inbetween frames too.
Say you have a number between 0 and 1, where 0 means entirely the previous frame, and 1 means entirely the next frame, and anything in between is a blend of some sort, then you can get
Code: [Select]
'pseudo code
r0,g0,b0 = pixel from previous frame
r1,g1,b1 = pixel from next frame
f = blend_factor_between_0_and_1
r = r0 + f * (r1 - r0)
g = g0 + f * (g1 - g0)
b = b0 + f * (b1 - b0)

But, exactly as you say, a 50:50 blend can be done like
Code: [Select]
r = (r0+r1)/2
g = (g0+g1)/2
b = (b0+b1)/2
which is a smidge simpler to compute

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1289
  • Karma: 466
    • View Profile
    • my stuff
Re: Frame interpolation?
« Reply #3 on: July 05, 2011 »
If you want a more convincing approach (and have plenty of cpu cycles to share) you could take the direction of motion into account.
For a start you could try to calculate blockwise motion vectors using autocorrelation (see eg block motion compensation).
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Frame interpolation?
« Reply #4 on: July 05, 2011 »
Thanks guys. That bock motion compensation looks like it's worth trying out. I hear that lag is a problem with interpolation so you cannot boost a low framerate from 12 fps to 24, but when you're talking about demos lag is hardly an issue. At speeds of 30 fps the lag would be barely noticable.

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Frame interpolation?
« Reply #5 on: July 07, 2011 »
merely interpolating the colours by taking the average works well, but only if the framerate is already high enough (say 25fps being boosted to 50fps). When the camera stops moving the effect disappears but when the scene is in motion it helps greatly to keep things greasy fast.
« Last Edit: July 07, 2011 by rain_storm »

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4381
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Frame interpolation?
« Reply #6 on: July 07, 2011 »
Looking good!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won: