#9 Wrap ImageOf<PixelRGB> in a bottle

open
None
5
2013-01-11
2013-01-11
Anonymous
No

Is there a way to wrap a yarp-image in a bottle ?

Discussion

  • Paul Fitzpatrick

    • assigned_to: nobody --> eshuy
     
  • Paul Fitzpatrick

    Yes, there are several. If this is for transmitting/receiving on the network, there's no need to do any wrapping - Images and Bottles have compatible network representations. Otherwise you should be able to do Bottle::read(Image).

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-01-11

    Hi, thanks very much, read(Image) works, but I cannot figure out how to get the Image out on the other side again, especially without knowing beforehand that an Image will be sent in the bottle..
    From what I see there is no method isImage or something ?

     
  • Paul Fitzpatrick

    Since you are talking about an "other side", are you communicating on the network? If so, you probably don't need to put the image in a bottle, just send it directly - or if you want to add on other data, just use a yarp::os::PortablePair where one part is the image and the other is e.g. a bottle or whatever you like. That would be more efficient.

    If you have a bottle, and want to know if it might be interpretable as an image, you might just check if it starts with vocab item "[mat]" or something like that. Print the bottle out (e.g. with bottle.toString().c_str()) to see what I mean.

    If you are working within a single program, then storing an Image inside a Bottle isn't a great idea. Can you give some detail about what you're trying to do?

    Thanks, Paul

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-01-11

    Hi Paul, thank you very much for your help..

    What we do right now is basically building another layer on top of yarp,
    and we communicate over network. We want to be able to switch communication layers (yarp, mpi, etc.), so we had to abstract the ports.

    I did not want to use different types for the InputPorts, this is why I wanted to wrap the Images in bottles. Now I am able to wrap everything in a bottle, thank you very much !

    I used typeid(b.get(0)) == typeid(yarp::os::impl::StoreVocab) to check if its an image or int/float, etc., that seems to work fine..

    I will try your solution with the vocab item "[mat]" tomorrow.

    Thanks again,
    Tobi

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks