How do I display grayscale image through the hdmi? Here is a little bit background of my setup. I used the base overlay block diagram with the color format removed in both HDMI in and out IPs. The bit per pixel for pixel_unpack is set to 8. When I write the grayscale image into the vdma memory, I observe that the output on the monitor is blue. I guess somehow the image data that is sent to the monitor is filled with my image data in the blue channel and the red and green channel is zeroed out. How do I fix this so I can observe grayscale image on the monitor. What is the purpose of the color format and pixel_pack and pixel_unpack IPS?
It could be helpful for you to provide more info. See here for guide: Read Me: How to ask a question on the forum, and FAQs
I’m not clear from your post what board/PYNQ version/design you are using. Are you using the standard base Overlay, or did you modify it?
The color format allows you to set the color format of the HDMI input stream. E.g. if you want to use RGB, BGR etc. in your design you can select it here. This operation will cost quite a lot of cycles in software, but can be easily done in hardware.
The pixel pack sets a data width. Again, sometimes you might want 32 bit, sometimes 24 bit. 8-bit sets grayscale. Again this would cost CPU cycles to do this in software, but transferring 32 bit or 24 bit data to CPU to then convert to 8-bit grayscale would also use some memory bandwidth. This may matter if are passing a lot more data back and forth between PS/PL in other parts of your design.
There are versions of both these IP on the input, and output. You can convert the input, process, then convert it back to what you need on output.
More info on this here:
If you convert to grayscale on the input, you can’t then output a colour signal without regenerating it in software somehow.
You are probably setting 8 bit grayscale on input, then setting a colour space on the output. The 8-bit grayscale is probably being copied to blue channel, with no data for red, green. Try set the output to grayscale. (You could also try copy the grayscale to the red and green channels. It should give the same effect, but this would be wasteful.)
From my understanding, the color format does nothing but flipped the order of the RGB
value of a pixel around. What I don’t really understand is the pixel pack and pixel unpack. Does these two IPs modify the data in anyway? What about the mode in vdma?
Yes, color format can flip channel order. This is really useful as some Python packages expect data in different formats.
The default is 24 bit. If you only need say 16 bit/8 bit, you can truncate in hardware.
Not sure what you mean about VDMA mode.
The colour convert is a 3x4 colour correction matrix multiplication unit operating on 3-channel data. The pixel pack/unpack IPs take 1, 2, 3 or 4 channel data from memory and convert into 3 channel data for the colour convert by padding and stripping zeros.
To do greyscale output first the pixel unpacker will turn the 8-bit data into 24-bit pixels with just the blue channel (as you are seeing). Then you can configure the
colorspace property of the colour space converter to replicate the channel across the red and green channels. The matrix to do this is predefined as
I agree with that.
If you convert to grayscale image on the input, you can’t then output a colour signal without regenerating it in software somehow.
You are probably setting 8-bit grayscale on input, then setting a color space on the output. The 8-bit grayscale is probably being copied to the blue channel, with no data for red, green.
To do greyscale image output first the pixel unpacker will turn the 8-bit data into 24-bit pixels with just the blue channel (as you are seeing). Then you can configure the
colorspace property of the color space converter to replicate the channel across the red and green channels.
Thanks for the support!!