Turning a 2-dimensional array into an Image

asked 2014-04-27 18:36:42 -0500

Gariben gravatar image

Hello, I have created a two-dimensional array, and much like MATLAB or Octave, I would like to turn it into an Image message. I was working to publish the array directory, and perhaps go from there, but that also seems annoying. If perhaps that's necessary, here's what my messages look like:

Image_Matrix.msg Header header uint32 width int32[] degrees

degrees.msg int32 height int32[] lasers

lasers.msg uint32 distance

Basically what I seek there is just an array, image_matrix, of width degrees and height lasers, containing the information distance. I ultimately want this to be a displayable image, but I also understand it might be better to simply advertise the matrix. I'm also aware in order to advertise it as an image, I'll need to scale the information distance from 0 to 256 in order to make it a grayscale image.

Thanks.

edit retag flag offensive close merge delete