PDA

View Full Version : How to save pixel color data to a file?


McPoodle
21st January 2004, 08:02
I need to extract the Y values for the same 16 x/y coordinates for every frame of an MPEG file. Is there any existing combination of filters that can do this? Or is AviSynth even close to the right tool for the job? GeneralParser only appears to perform packet processing, not image processing.

To explain a bit further, I've got a 720x512 MPEG-2 file where the first 28 lines contain the VBI (vertical blanking area--the black band you see when the TV image "rolls"). Row 28 of the image corresponds to Line 21, which contains the closed captions I would like to extract, encoded as a series of 16 bars (gray for on or black for off). The easiest way to convert this into the sixteen-bit closed caption code is to sample Y values with a cutoff of 64 between an on bit and and off bit.

For example, here is the first 35 rows of a frame from my file:
http://www.geocities.com/mcpoodle43/keep/000.gif

Sampling the Y values at coordinates (475, 28), (449, 28), (422, 28), (395, 28), (368, 28), (341, 28), (314, 28), (287, 28), (691, 28), (664, 28), (637, 28), (610, 28), (583, 28), (556, 28), (529, 28) and (502, 28) gives you 110, 110, 0, 110, 0, 0, 110, 110, 0, 110, 0, 0, 0, 110, 0, 110. I would be able to translate this into the hex bytes D345, which is closed captioned code for displaying the characters "SE" on the screen.

I figure if I could get a text file output with one row for each frame made up of 16 comma-separated Y values then I would have enough to work with. Heck, I'd even settle for a separate text file for every single frame listing the Y, Cb, and Cr values for every single pixel if that would make the filter generalized enough to be worth developing.

In quiet desperation,

--McPoodle

Si
22nd January 2004, 21:22
I'll add the option to output the values to a file in my ShowPixelValues filter.

Unfortunately, I'm currently up to my neck in relaying the dining room/kitchen floor/ building a PC for my daughter's birthday :(

But I will get round to it :)

regards

Simon

McPoodle
25th February 2004, 05:49
Seeing the opportunity to increase my very limited experience with C++, I managed to put together a preliminary version of the filter I was asking for. This is not to say I still wouldn't want to see your filter, Simon, as mine is slower than bbMPEG on a 286.

On the off chance that it might be useful, I've got the .dll, source code, and documentation for my first-ever AviSynth filter available for download at http://www.geocities.com/mcpoodle43/Tools/DumpPixelValues.html. I developed it against version 2.52 of AviSynth, so I assume it won't work with 2.08.

Si
25th February 2004, 08:56
Mine will not be quicker that's for certain :o

regards
Simon