1 2 Previous Next 21 Replies Latest reply on Oct 8, 2020 9:32 AM by HemanthR_06

Losing values grayscale YUV

Hello,

I'm using an 8bit grayscale scale sensor connected to an FPGA that adds 8bit of U/V values set to 0x80 (no color).

The 16bit from the FPGA is connected to the FX3.

My firmware is based on the AN75779 example and everything works well (with my C# application or VLC player) except for one thing.

The problem is: Every software I found converts the YUV to RGB with a conversion formula like this:

`  Y -= 16;  U -= 128;  V -= 128;  R = 1.164 * Y  + 1.596 * V;  G = 1.164 * Y - 0.392 * U - 0.813 * V;  B = 1.164 * Y + 2.017 * U;`

Because my image is grayscale, U and V are zero so I get Y multiplied be 1.164.

This cases values larger then 255 (?!?!?!) and when I look at the image histogram I see values of 7, 14, 21, 28, .... are at zero in the pixel count. (6 * 1.164 = 6.984 and 7 * 1.164 = 8.148).

I want my camera to be a standard UVC camera.

How can I solve it at the firmware level?

Ofer.

• 1. Re: Losing values grayscale YUV

Hi Ofer,

Since grayscale to RGB conversion requires us to make R, G and B to be same as grayscale value, can you send Y value from the FPGA as ((acual_Y_from_sensor/1.164)+16) while maintaining U and V same as 0x80?

Regards,

Hemanth

• 2. Re: Losing values grayscale YUV

Hi Hemanth,

The problem will be the same but with different values (Y values can only be integers).

Can I change the GUID or some other parameter in the descriptor that will tell the application to use Y values as is?

Thank you,

Ofer.

• 3. Re: Losing values grayscale YUV

Hi Ofer,

I think if the application makes conversion to grayscale(instead of rgb) from yuv2, then it takes y values as grayscale value and ignores U and V. Is this an option?

Regards,

Hemanth

• 4. Re: Losing values grayscale YUV

Hi Hemanth,

The problem is I can't control the application side (like VLC for example).

I can't be the only one facing this problem.

Is there no change I can make in the descriptors that can change it?

Thanks,

Ofer.

• 5. Re: Losing values grayscale YUV

Hi Ofer,

Please check if the conversion formula on the UVC host app changes according to GUID reported by the video device and if there is any suitable UVC driver-supported GUID that can be used such that Y values are taken as is.

Regards,

Hemanth

• 6. Re: Losing values grayscale YUV

Hi Hemanth,

I can't find a GUID that does that.

Any suggestions?

Thanks,
Ofer.

• 7. Re: Losing values grayscale YUV

Hi Ofer,

Can you please try with e-cam view player. I think you should be able to display monochrome image with the yuy2 data sent from the device. So, does monochrome display work for you?

Regards,

Hemanth

• 8. Re: Losing values grayscale YUV

Hi Hemanth,

I can't capture images with the e-cam view player.

• 9. Re: Losing values grayscale YUV

1. In VLC player, try below:

Go to Tools -> Preferences -> Video

Uncheck 'Use hardware YUV -> RGB conversions'

Save

2. Try with MPCHC player.

Regards,

Hemanth

• 10. Re: Losing values grayscale YUV

I was able to solve it by changing to RGB888. I changed the descriptors and the GPIF.

• 11. Re: Losing values grayscale YUV

Hi Ofer,

Good to know that you solved the issue.

Can you please let me know if you are representing 8-bit monochrome data as RGB888? Or you are padding rest two bytes of RGB888 pixel data with something (as it was done with yuv case - adding 0x80 to U and V)

Regards,

Hemanth

• 12. Re: Losing values grayscale YUV

Hi Hemanth,

I duplicate the monochrome value 3 times for the RGB.

When I changed the descriptor I started getting blue screen. I saw that someone posted about it and he say its because of the cyusb.sys (Cyusb/cyusb3 driver crash blue screen on Windows 10 with PSOC1 ) driver that is sometimes loads its self instead of the cyusb3.sys driver. I did what he says and in win10 it looks to stop crashing but on win7 it still happens.

Do you know why?

All the best,

Ofer.

• 13. Re: Losing values grayscale YUV

Hi Ofer,

The driver that you use on the Host PC side will be UVC driver and not cyusb3. So, I am not sure how cyusb3 is related to the problem.

Regards,

Hemanth

• 14. Re: Losing values grayscale YUV

Hi Hemanth,

I know. I use it for the Example device to send vendor commands. But only when I made the change I started getting the blue screen.

1 2 Previous Next