Displaying grayscale images with VGA
homosapien
Posts: 147
I'm using a P8X32A to manipulate images produced by a CMOS camera, basically an array of bytes that define the grayness of each pixel from 0 = black to 15 = white, grays are values in-between. I need to display the image on a VGA monitor to help myself with debugging issues, simply plot each byte as a pixel ranging from white to black, depending on the value of the byte.
I do not see any suitable objects in OBEX, and am willing to roll my own, but am beginning to think this may be more complicated than I originally thought: The standard system for outputting VGA from the prop using 2 bits for RGB with a resistor ladder seems to limit me to 4 'gray' values, namely white, light gray, dark gray and black -> corresponding to $11_11_11, $10_10_10, $01_01_01 and $00_00_00, which is going to make a pretty choppy picture, essentially cutting my resolution from 16 to 4. Am I missing something obvious? Is there a way to display a 16-bit grayscale via VGA?
I have found the TV grayscale overlay object created by Phil P., and may end up using that for this debugging, but that means I would need to find an analog TV, which are non-existent in my household at this point in time....
Thanks,
Nate
I do not see any suitable objects in OBEX, and am willing to roll my own, but am beginning to think this may be more complicated than I originally thought: The standard system for outputting VGA from the prop using 2 bits for RGB with a resistor ladder seems to limit me to 4 'gray' values, namely white, light gray, dark gray and black -> corresponding to $11_11_11, $10_10_10, $01_01_01 and $00_00_00, which is going to make a pretty choppy picture, essentially cutting my resolution from 16 to 4. Am I missing something obvious? Is there a way to display a 16-bit grayscale via VGA?
I have found the TV grayscale overlay object created by Phil P., and may end up using that for this debugging, but that means I would need to find an analog TV, which are non-existent in my household at this point in time....
Thanks,
Nate
Comments
I am thinking the only way to do it with one pixel to show more shades of gray would be to use more pins and a larger resistor ladder/network. I am assuming that for a VGA signal to produce gray R must equal G must equal B. Is that true?
Nate
Even the latest TVs seem to include an old style NTSC input...
I've posted info on hardware and drivers to use the SSD1963 chip with the Prop to output DVI/HDMI or VGA in 24-bit color.
This would give a perfect image, but uses several Propeller pins...
You might also want to look at Phil Pilgrims' camera drivers and see what he may have done in this area...
Here are the resistor values that give you 64 level VGA grayscale
http://forums.parallax.com/showthread.php/131622-Resistor-values-for-64-GreyScale-VGA-output-from-the-Propeller
You can use it with Kye's 160 x 120 driver as is, or other VGA objects, just changing the resistor values. That's why there isn't a separate obex object. I think I did put some comments in the old obex about this but they haven't made the transition to the new obex.
An example here using a line scan (TSL3301) with some fast moving sheet music, and the 160x120 driver
Tubular, thanks for confirming I wasn't loosing my sanity, I was doubting myself when it appeared more difficult to produce a grayscale image than a color one in VGA, but I guess that is just how the standard was designed. That resistor sculpture is crazy!
Thanks again,
Nate
I suspect that the same tweak applies to using an accurate grey scale. Phil had added 100ohm SMD resistors in parallel to the existing configuration on a Propeller Proto board. That fix works, but it not exactly universal.
It might be wise to reopen the discussion here.
You shouldn't need to tweak the greyscale resistors. They take into account the internal prop driving impedance.