Archived

This topic is now archived and is closed to further replies.

Tree Penguin

AVI masking?

Recommended Posts

Hi, i have created some mars-like landscape with some lava in it and i wanted to insert an AVI making me walk around a lava crater. I recorded the video using white sheets as a background (so i can filter them out, unfortunately i''ve got no green or bluescreen at home ) and i wanted to mask that AVI by filtering the background away. I succeeded using Adobe Premiere but i was wondering if it was possible to do such a thing in opengl but not by creating a mask for each frame. Thanks in advance!

Share this post


Link to post
Share on other sites
EDIT:Hope you didn't read what I said...It was wrong!!! Sorry I couldn't help

[edited by - tHiSiSbOb on March 23, 2004 11:27:53 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don''t know a darn thing about AVI vids or even video editing... but just to think out loud...
I would think that a hack & slash method could be used that involved an edge finding algorithm that you could run on each frame. Then just zero out or blacken or set a zero alpha value for everything outside of that edge. Since there is no standard set for your recording... I think that it would have to be tailored a lot for your specific purpose. Of course... this all assumes that you can access the data in the video much like you could any normal picture. I would also think that it wouldn''t so hot for real time use, so perhaps pre-processing it all so you could use it in that way.

Share this post


Link to post
Share on other sites
I can access the frame data, my problem is that doing it per frame is rather slow. The fastest way would be to loop through all pixels and place 0 in the masking texture for every white pixel and 255 for every other, creating a mask like that. This will be slow so i was wondering if there was any other way...

Share this post


Link to post
Share on other sites
quote:
Original post by Tree Penguin
The fastest way would be to loop through all pixels and place 0 in the masking texture for every white pixel and 255 for every other, creating a mask like that.


You could do this on GPU in ARB_FP or even NV_RC/ATI_TS. First enable blending with (alpha, one_minus_alpha). Then convert color to grayscale (via dot3) and compate it to something like 0.99 (almost white). If it''s higher then set alpha to 0 else set alpha to 1.



You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
since this is for a very specific purpose... why don''t you just do a lot of pre-processing & do all of the "masking" out of the non-colored bits beforehand, then you won''t have to worry about run-time performance.

Share this post


Link to post
Share on other sites
I am planning to do such things with high quality and long AVIs so i want to have the fastest and still not as much much memory needing way to mask the frames.

Share this post


Link to post
Share on other sites
I was also gonna suggest doing the masking beforehand, not as each frame was displayed. You don''t even have to do it every time you run the program, just do it once and save the results (probably in a custom file format). You''d probably write a custom program to do this for you. You could even compress the frames (e.g. tga compression is simple)to keep the file size down.

Share this post


Link to post
Share on other sites