Ubuntu/Linux Color Problems

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

michaelukw

  • Posts: 9
  • Joined: Tue Aug 11, 2020 12:01 pm
  • Real Name: Michael Banck

Ubuntu/Linux Color Problems

PostThu Sep 03, 2020 8:16 am

Hi everyone,
I am currently playing with the SDK on Ubuntu and there are some color problems. And it goes even further, Media Express is also displaying them wrong.
So the image I was capturing is this one Image.
I connected my laptop hdim-out to the my desktop pc with this blackmagic grabber https://www.blackmagicdesign.com/de/products/decklink/techspecs/W-DLK-05.
However, you can see the result in the attached image. This result is shown for Media Express and SDK, code below.

Since Media Express was created by Blackmagicdesign I would expect the right result, but you can see it isn't, for some reason. So lets see my code. I basically used the "Capture" sample of the SDK. I added the openCV lib and convert the image from YUV to an openCV RGB/BGR array, which works good so far:

Code: Select all
HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame *videoFrame,
                                                        IDeckLinkAudioInputPacket *audioFrame) {
....
    void *myFrameBytes;
    videoFrame->GetBytes(&myFrameBytes);
    uchar *charColorPointer = (uchar *) myFrameBytes;

    int size = videoFrame->GetRowBytes() * videoFrame->GetHeight();
    uchar dataUYVY[size];

    for (int i = 0; i < size; i++) {
        dataUYVY[i] = *charColorPointer++;
    }

    //opencv turn UYVY array into RGB/GBR array
    Mat matUYVY(height, width, CV_8UC2, dataUYVY);
    Mat matBGR(height, width, CV_8UC3);
    cvtColor(matUYVY, matBGR, COLOR_YUV2BGR_UYVY, 0);
    imwrite("images/out.jpg", matBGR);
....
}


You can see I do it in the "VideoInputFrameArrived" function of the "Capture" sample. The translation from YUV to RGB is done by openCV, the file writer as well.

The card is telling me this values:
Capturing with the following configuration:
- Capture device: DeckLink Mini Recorder
- Video mode: 1080i60
- Pixel format: 8 bit YUV (4:2:2)
- Audio channels: 2
- Audio sample depth: 16 bit

I am using Ubuntu 18.04 and the SDK and drivers of 11.5.1 ()

Can you pls tell me what is going on here? Is there some configuration to fix this?
BR Michael
Attachments
out.jpg
Images shown by Media Express, as well as SDK/OpenCV
out.jpg (169.7 KiB) Viewed 922 times
Offline

michaelukw

  • Posts: 9
  • Joined: Tue Aug 11, 2020 12:01 pm
  • Real Name: Michael Banck

Re: Ubuntu/Linux Color Problems

PostThu Sep 03, 2020 12:17 pm

!!!Solved!!!

The problem here was not the grabber or the software, it was the source.
My notebook was running under Ubuntu as well, and the color problems was made by my notebook.
I restarted my notebook and booted to Windows 10 and the problem was gone, all colors was displayed properly.
Note! I do not say this is an os problem in general, maybe just a problem with the display/gpu drivers.
Hope this helps if anyone else is running is this kind of problem.

BR Michael

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 28 guests