Support CompressedImage and Stamped types#5
Support CompressedImage and Stamped types#5awesomebytes wants to merge 2 commits intoeric-wieser:masterfrom
Conversation
|
|
||
| @converts_to_numpy(CompressedImage) | ||
| def compressed_image_to_numpy(msg): | ||
| return np.fromstring(msg.data, np.uint8) |
There was a problem hiding this comment.
This should be np.frombuffer - np.fromstring is deprecated in this use (I know this because I deprecated it it!)
There was a problem hiding this comment.
Actually, this just feels like the wrong thing to do in general. If conversion from CompressedImage is going to exist at all, it should do the full png/jpeg/etc decoding using the python imageio module.
That might be a nasty dependency to pull in, so I'd rather not open that can of worms in this PR.
There was a problem hiding this comment.
About frombuffer, done, commited.
About the CompressedImage, the reality of compressed images is not very nice. That transformation works for all jpg. For png one can do exactly the same but must skip the first 12 bits of a header. For CompressedImages that contain a depth image (there is no way to know) there is one step more even... So that would be a bit of a mess to figure out all the cases.
I think this implementation helps, better than none.
There was a problem hiding this comment.
For png one can do exactly the same but must skip the first 12 bits of a header
Huh? What do you mean by this?
So that would be a bit of a mess to figure out all the cases.
Then throw an error in the cases that aren't supported.
I think this implementation helps, better than none.
I disagree - the point of this library was to do the "one obvious thing". The obviously thing for a comrpessed image is to return a 3D RGB array. Returning a 1d sequence of bytes is not what I would expect at all.
|
I don't like At the very least, I would consider |
Following up #3 but only adding CompressedImage and the XXXXStamped types.