Frames Captured from Camera are Upside Down

Hello, I made a basic application that collects frames from Camera and write these on Disk as jpg images. My device is Nreal Light DevKit.

Well, I am able to collect and write frames successful but captured images are unfortunately Upside Down :frowning:

In order to collect and write frames, I use the class “CameraCaptureController.cs” shipped with NRSDK v1.8. ( NRSDK > Demos > RGBCamera > Scripts ). The scene that I use was the “RGBCamera” from NRSDK. ( NRSDK > Demos > RGBCamera.unity)

In particolar, I made the following modification into the “Update()” method of the class:


// UnityEngine.Texture2D
Texture2D img = RGBCamTexture.GetTexture();

// UnityEngine.ImageConversion
byte[] jpg_image = ImageConversion.EncodeToJPG( img );

string img_fl_name = “/sdcard/imgs/screen__”+this.RGBCamTexture.CurrentFrame.timeStamp+".jpg";

// System.IO.File
File.WriteAllBytes( img_fl_name , jpg_image );


This one was the only modification I made. (Scene remains in her default settings)

As side note, I specify that Unity Project was configured following Nreal Official Guide (Quickstart for Android - NRSDK Documentation) and Unity version that I use was “Unity 2019.4.26f1”.

Does anyone have any idea about the issue ?

Hello, I also tryed this method to capture image and I had the same problem did you find any solution ?

(Otherwise, another way to capture image is to use the same method as in the demos scene RGBCamera-Capture, with this the capture is not upside down)

Hi developer, the image is reversed because the origin of the pixel is different in Unity and OpenGL, and in the RGBCamera-Capture demo, we use shader to flip it backwards in Y and the image direction looks normal.

Similarly, during your development, you can flip the image carrier like RawImage up and down with shader.