I'm creating an app with Vuforia and ZXing.NET. Now I need the image from the vuforia camera, so I can process it with ZXing.NET.
This should be possible with the following code:
void SomeFunction(){
Image.PIXEL_FORMAT mPixelFormat = Image.PIXEL_FORMAT.RGB565;
CameraDevice mCameraDevice = CameraDevice.Instance;
mCameraDevice.SetFrameFormat(mPixelFormat, true);
Image cameraImage = mCameraDevice.GetCameraImage(mPixelFormat);
}
But for some reason I cannot set the frame format Unity throws the error:
Failed to set frame format
UnityEngine.Debug:LogError(Object)
Vuforia.CameraDevice:SetFrameFormat(PIXEL_FORMAT, Boolean)
Im using Unity 2017.3.1p1
If someone comes across the same problem then here is how I fixed it in my application.
I got it working by not using the RGB565 pixel format, but the GRAYSCALE format. For some reason my webcam and the Hololens (where my application runs on) works with only GRAYSCALE.
I hope I helped somebody with this answer.