Jump to content


Photo

How to get a .txt or .xml file listing the pixel RGB values of any given video


  • Please log in to reply
2 replies to this topic

#1 Chris Millar

Chris Millar
  • Basic Members
  • PipPipPipPip
  • 1642 posts
  • Other

Posted 28 March 2010 - 08:16 PM

Hello,

I'd like to learn how to read a video file have its output RGB values listed in a text file ready for consumption by another program not looking for video, but ready to take the values as they come...

So the text file might look like this:

102, 45, 56
107, 50, 60

and so on ...

each line being one pixel ... I guess starting from the top left and working to the right until the line/row is complete then going to the far left of the next row down (like a progressive CMOS sensor). For instance with a 100x100 spatial res on the 10,001th line you'd be inputting the top left pixel of the 2nd frame and so on...

There would be verticalRes*horizontalRes*frameNumber lines of comma delimited RGB values

I'm not a programmer (yet) - so any tips on the best way to make data easier for other programs to digest would be appreciated... maybe the lot could be simply be comma delimited rather than line and comma delimited ? (although this makes it easier for *me* to get my head around the data)

It is in its essence I guess just video data stored in a very clunky uncompressed fashion. But going about it this way means less work on the input side of the other program in teaching it (and myself) how to read movie files.

Where to start ?

Oooooor - perhaps this backasswards approach is silly as there is some file format I can easily transcode any given footage to that is in essence what I want anyway ?

Any help appreciated
  • 0

#2 John Sprung

John Sprung
  • Sustaining Members
  • 4635 posts
  • Other

Posted 29 March 2010 - 02:01 AM

Way back in the DOS days, one thing we could do was take a freeze frame into PhotoShop, and save it as a .BMP file. Look at the .BMP in DEBUG, and in the dump you see the RGB triples in hexadecimal. Dump to a file, and you have it in ASCII Hex. Had I wanted it in base ten, I could have written an assembly program to do that.

What I did with that was to write a program that simulated the problem of encoding something as 601, and decoding it as 709, and vice versa. That was one of the things we worried about back in the formative years of HD.




-- J.S.
  • 0

#3 Chris Millar

Chris Millar
  • Basic Members
  • PipPipPipPip
  • 1642 posts
  • Other

Posted 31 March 2010 - 03:31 AM

Gidday John,

I ended up writing a patch in Jitter (cyling74.com) to do it for me ...

OUCH amounts of data (should have thought of that) - I've rethought the way I'll go about it which means I need to understand .tiff files - I'm reading through the spec at the moment (http://partners.adob.../tiff/TIFF6.pdf) and downloading resorcerer for OS X - I think I should be able to search and see hex values directly instead of using a text editor like I am at the mo' ...

Speaking of which, I made two uncompressed 1x1 pixel greyscale .tiffs in photoshop - one full white pixel the other full black - everything else completely the same then compared the two files in a text editor

White:
<tiff:NativeDigest>256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,2
70,271,272,305,315,33432;DCD6C0D6F317D2C4B5156D7FC7F68A56</tiff:NativeDigest>

Black:
<tiff:NativeDigest>256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,2
70,271,272,305,315,33432;D895E4270CDCEAABC5E197F53297EBF8</tiff:NativeDigest>

Out of all the lines only these two were different - why so much data ? I was hoping to see maybe 00 and FF or similar

Back to the books ;)
  • 0


Opal

The Slider

Willys Widgets

Visual Products

Paralinx LLC

Metropolis Post

Rig Wheels Passport

Abel Cine

Wooden Camera

Media Blackout - Custom Cables and AKS

CineLab

FJS International, LLC

Gamma Ray Digital Inc

Ritter Battery

Glidecam

CineTape

Aerial Filmworks

rebotnix Technologies

Technodolly

Broadcast Solutions Inc

Tai Audio

Opal

Abel Cine

Aerial Filmworks

FJS International, LLC

Tai Audio

Rig Wheels Passport

The Slider

Media Blackout - Custom Cables and AKS

Broadcast Solutions Inc

Technodolly

rebotnix Technologies

Ritter Battery

Visual Products

Paralinx LLC

Gamma Ray Digital Inc

CineLab

Metropolis Post

Wooden Camera

Glidecam

CineTape

Willys Widgets