Difference in Vision Sensor data in Python & Matlab bindings

Report crashes, strange behaviour, or apparent bugs
Post Reply
indraforyou
Posts: 13
Joined: 19 Oct 2015, 04:04

Difference in Vision Sensor data in Python & Matlab bindings

Post by indraforyou »

Hi,

After getting the image data using simxGetVisionSensorImage() to get the image displayed:

For Python:

Code: Select all

            img = np.array(image,dtype=np.uint8)
            img.resize([resolution[1],resolution[0],3])
            cv2.imshow('image',img)
whereas for Matlab:

Code: Select all

        image.setdatatype('uint8Ptr',1,resolution(1)*resolution(2)*3);
        image = reshape(image.value, [3,resolution(2), resolution(1)]);
        image = permute(image,[2 3 1]);
        imshow(image);
Why is there a difference in encoding the channel data? If it intentional or a bug in standardization.

Note: This is the latest V-Rep version on Linux 64. I haven't tested with other combinations or other remote API bindings.

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Difference in Vision Sensor data in Python & Matlab bind

Post by coppelia »

Hello,

not sure I understand what you mean. The data is transported in the same way, and the same data arrives, whether it is Matlab or Python. Then of course, each language has different ways to organize data for displaying it. Are you referring to that?

Cheers

indraforyou
Posts: 13
Joined: 19 Oct 2015, 04:04

Re: Difference in Vision Sensor data in Python & Matlab bind

Post by indraforyou »

Hi,

Ya probably that, I forgot numpy is row-major while matlab is column major.


Regards,
Indranil

Post Reply