Hello,
I am string to get an UIImage (iOS )from an Easyar_Image.
As described in the documentation, I can get image data with this code :
easyar_Frame * frame = [streamer peek];
for (easyar_Image * i in [frame images]) {
easyar_Buffer * b = [i buffer];
char * bytes = calloc([b size], 1);
memcpy(bytes, [b data], [b size]);
//TODO: use bytes here
free(bytes);
}
So I tried to create an image like this :
easyar_Frame * frame = [streamer peek];
for (easyar_Image * i in [frame images]) {
easyar_Buffer * b = [i buffer];
char * bytes = calloc([b size], 1);
memcpy(bytes, [b data], [b size]);
NSData *imageData = [NSData dataWithBytes:[b data] length:[b size]];
UIImage *image = [UIImage imageWithData:imageData];
}
But the image is always nil, indicating that the image couldn't be initialised with the specified data.
Any Idea ?
Thanks !