Page 1 of 1

How to input the data of RGB image gotten by Coppeliasim into Matlab

Posted: 07 Apr 2024, 17:08
by zerobb
In matlab I use
[ImageRGB,resolution] = sim.getVisionSensorImg(Hsensor)
to obtain RGB data from Coppeliasim.

But when I use command in Matlab as follows:
Image = reshape(ImageRGB,[resolution{1} resolution{2} 3]) ;
figure;imshow(double(Image)/255,[]);
The image showed in Matlab is not correct. What's wrong?

Most of examples are in Python with OpenCV. I need the example in Matlab to display the RGB image.

Re: How to input the data of RGB image gotten by Coppeliasim into Matlab

Posted: 08 Apr 2024, 08:11
by fferri
From zmqRemoteApi/clients/matlab/synchronousImageTransmission.m:

Code: Select all

    [img, resX, resY] = sim.getVisionSensorCharImage(visionSensorHandle);
    % display image in MATLAB:
    imshow(flip(permute(reshape(img, 3, resY, resX), [3 2 1]), 1));