Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
491 stars 193 forks source link

RGB Image over ADS #217

Closed abramrace closed 9 months ago

abramrace commented 9 months ago

Could someone literally give me a hint on sending RGB images over ADS to a TwinCAT? I tried sending 3D uint_8 arrays but it didn't work, so I tried a 2D grayscale image and reformatted it as a 1D array like [c00, c01, ... cnn] and I reformatted it agai nas a 2D grayscale image on TwinCAT and it worked fine. Now, I'm trying to reformat a 3D RGB image as [r00, b00, g00, ..., rnn, gnn, bnn] and do the same thing over TwinCAT but the image gets messed up. Here's the original and received images: imgSrcADS imgDstADs

abramrace commented 9 months ago

Ok, issue is resolved thanks to Oleksandr Golubiev from Beckhoff support team. So instead of declaring the image array in TwinCAT as

aImageData : ARRAY [0..2, 0..479, 0..639] OF USINT;

It has to be declared as:

aImageData : ARRAY [0..479, 0..639, 0..2] OF USINT;