ami-iit / yarp-openmct

Repo for YARP and OpenMCT integration.
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Camera view poor performance: color shift (e.g. red -> blue) #101

Closed nunoguedelha closed 2 years ago

nunoguedelha commented 2 years ago

When visualizing the iCub camera views in the Open-MC based visualizer, we observe a color shift, e.g. blue instead of red. Typically, when visualizing the fake framegrabber through the Open-MC based visualizer, we observe a swiping blue line instead of a red one.

nunoguedelha commented 2 years ago

By using the bouncing ball mode (option --mode ball) and change the code section https://github.com/robotology/yarp/blob/82bcafc792ba9b32aad771f7f5d6f3c52ba5fbbe/src/devices/fakeFrameGrabber/FakeFrameGrabber.cpp#L434-L442 for drawing 3 RGB circles instead of two

    case VOCAB_BALL:
        {
            if (have_bg) {
                image.copy(background);
            } else {
                image.zero();
            }
            addCircle(image,PixelRgb{255,0,0},bx,by,22);
            addCircle(image,PixelRgb{0,255,0},bx,by,15);
            addCircle(image,PixelRgb{0,0,255},bx,by,8);

we can check the color order used on the receiver side to be BGR:

  1. Run the fakeFrameGrabber
    yarpdev --file fakeFrameGrabber_basic.ini --mode ball --name /icubSim/camLeftEye

    fakeFrameGrabber_basic.ini:

    device fakeFrameGrabber
    width 640
    height 480
    period 10
    syncro 1
  2. Connect the the output port to a yarpview device.
  3. Run the Open-MCT visualizer.
image

We need to understand how this order is configured on the Open-MCT API and change it.

nunoguedelha commented 2 years ago

As discussed in the call, Also check that the Open-MCT visualizer checks any present metadata about the RGB information.

nunoguedelha commented 2 years ago

Check https://github.com/robotology/yarp/pull/2061/files regarding how to check the used R, G, B order.

nunoguedelha commented 2 years ago

The color swap was due to an issue in yarp.js module (https://github.com/robotology/yarp.js/issues/41). Fixed by https://github.com/robotology/yarp.js/pull/40 .