QImage from QDatastream of float values
I am getting image through UDP. In the payload of the frame, first 1 byte is width, and second byte is height and then image float values(32x32). Using QDataStream, I am trying to generate QImage but somehow I am not getting the correct solution. I am just stuck for converting and reading the the float values.
quint8 width, height;
out >> width, height;
int pixel= widthheight;
temp float =new floatpixel;
QImage image(width, height, QImage::Format_RGB32);
for(int i=0; i<=(pixel-1); ++i; ++index)
image.bits() [index] = buffer[i];
Also, I am getting different images from UDP, so the size of the image is not fixed every time.
Hi and welcome to devnet,
QImage doesn't support floating point types. Did you convert it before sending it ?
@SGaist Thanks. I am trying to convert it into quint32 but still not working out for me. I guess, I am getting confused in extracting each float value from datastream. Also readRawdata and readBytes only supports char s it gives me error saying invalid conversion.
What kind of images are that in the first place ?
Where do they come from ?