Post not yet marked as solved
Post marked as unsolved with 1 replies, 1,179 views
Hi everyone,I'm trying to send over the network the captured image of the frame using ARKit and I'm having performance issues with the following code:CVPixelBufferRef pixelBuffer = frame.capturedImage;
CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
CIContext *temporaryContext = [CIContext contextWithOptions:nil];
CGImageRef videoImage = [temporaryContext
createCGImage:ciImage fromRect:CGRectMake(0, 0, CVPixelBufferGetWidth(pixelBuffer), CVPixelBufferGetHeight(pixelBuffer))];
UIImage *image = [UIImage imageWithCGImage:videoImage];
CGImageRelease(videoImage);
imageBase64 = [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
/
});This is the way I convert from CVPixelBufferRef to a base64 string and it drops down the performance.Does anyone know a way for doing this better?Thanks in advance