ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

add an array with XmlRpc::XmlRpcValue

asked 2019-09-09 10:37:27 -0500

cosmoff gravatar image

Hello everybody,

I would like to add an array in a file thanks to XmlRpc::XmlRpcValue. But in the XmlRpc::XmlRpcValue there is no TypeArray in the constructor. So how can I add my array which a cv::Mat.

for example :

void functionForExample(XmlRpc::XmlRpcValue& xmlRV) { cv::Mat tab; ... xmlRV[ "tab" ] = XmlRpc::XmlRpcValue( ?? ); }

thanks for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-10 06:38:20 -0500

cv::Mat is not an array, it's a very complex class used to describe openCV image matrices. You cannot pass it directly to the XmlRpc functions.

By the looks of it you're trying to send an OpenCV image to an Rpc client or server. This can be done but you'll need to do a bit more work yourself.

There is an XmlRpc constructor which accepts arbitrary length data buffers, it's described here.

You'll need to first serialise your opencv image, effectively writing it to an image file in memory. You will use the imencode function to do this. You can then send the image using the XmlRpc constructor I described above.

The receiving side will need to use the opencv function imdecode to extract the original cv::Mat from the serialised data.

Hope this helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-09-09 10:37:27 -0500

Seen: 365 times

Last updated: Sep 10 '19