0

I have downloaded some .raw file of depth data from this website.

3D Video Download

In order to get a depth data image, I wrote a script in Unity as below: enter image description here

However, this is the texture I got. enter image description here

How can I got the depth data texture as below? enter image description here

Kevin Hsiao
  • 2,281
  • 2
  • 10
  • 18
  • Add your code instead of the screenshot of it – Programmer Nov 23 '18 at 02:06
  • `.raw` is [not a (single) file format](https://en.wikipedia.org/wiki/Raw_image_format#Standardization). Its just an indication that the data was not processed (or compressed) and contains *raw* sensor data. – Draco18s no longer trusts SE Nov 23 '18 at 04:50
  • You could try to use a [`VideoPlayer`](https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html) instead. There on the bottom is also a `Downloading a Movie Example ` – derHugo Nov 23 '18 at 04:59
  • I noted that the file you download is a zip file. If anyhow possible you should try to [unpack](https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.zipfile?view=netframework-4.6) it and than you can use the `UnityWebRequest` also with a local file path starting with `file://` instead of a URL – derHugo Nov 23 '18 at 05:07

1 Answers1

0

RAW is not a standarized format, while most of the variants are pretty easy to read (there's rarely any compression) its might not be just one call to LoadRawTextureData.

I am assuming you have tried other texture formats than PVRTC_RGBA4 and they all failed?

First off, if you have the resolution of your image, and file size, you can try to guess the format, for depth its common to use 8bit or 16bit values, if you need 16 bit you take two bytes and do

a<<8||b  

or

a*256+b

But sometimes there's another operation required (i.e for 18bit formats). Once you have your values, getting the texture is as easy as calling SetPixel enough times

zambari
  • 4,797
  • 1
  • 12
  • 22