Page 1 of 1

Difference in Vision Sensor data in Python & Matlab bindings

Posted: 26 Apr 2016, 23:10
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.

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

Posted: 27 Apr 2016, 07:27
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

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

Posted: 28 Apr 2016, 19:08
by indraforyou
Hi,

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


Regards,
Indranil