hidden text to trigger early load of fonts ПродукцияПродукцияПродукцияПродукция Các sản phẩmCác sản phẩmCác sản phẩmCác sản phẩm المنتجاتالمنتجاتالمنتجاتالمنتجات מוצריםמוצריםמוצריםמוצרים
Items with no label
3337 討論

How can I get the 16 bit depth image from D435?

EAlta
初學者
9,593 檢視

Im adquiring data of a d435 depth camera from the realsense viewer, When I save the snapshot of the depth image, i get an 8 bit (1-256) grayscale image when in the specifications, is said that the camera gives a 16 bit depth image.

Do you know how can i get the 16 bit image?

0 積分
12 回應
MartyG
榮譽貢獻者 III
7,555 檢視

I tried replicating your settings with my D415 but no matter what I did, the bit value of the Z16 PNG depth image snapshot was always 24 bit. I'm sorry that I couldn't recreate your problem.

EAlta
初學者
7,556 檢視

Hi MartyG. You are right, the png is of 24 bits but it has 3 channels (RGB, which are matrices of 240 x424 ) each one of 8 bits (from 0 to 255 per chanel) and as it is a gray scale image R=G=B. so at the end you only have one chanel of 8 bits.

If it were a 16 bits image the range of values would be from 0 to 65535 (2^16).

The value of 240x424 depends on the resolution you specify on the realsense viewer (in my last image it was of 1280x720).

MartyG
榮譽貢獻者 III
7,556 檢視

I did a lengthy further investigation of your issue but was unfortunately unable to develop a solution, so I will have to let someone else have a try at answering it. I do apologize. Good luck!

EAlta
初學者
7,556 檢視

Thanks for your time MartyG.

jb455.

gpapp1
初學者
7,556 檢視

Hi,

According to this https://github.com/IntelRealSense/librealsense/issues/815 Incorrect PNG file format for Viewer? · Issue # 815 · IntelRealSense/librealsense · GitHub, only 24-bit RGB PNG is supported now.

 

I think it saves the colorized depth image. You might be better off with the RAW.

-Gabor

ROhle
新手
7,556 檢視

Depth.Raw is 16 bit grayscale. It can be imported by ImageJ (free/cross-platform from NIH) as 16-bit Signed, using little-endian byte order, with File->Import->Raw.

From there you can export it in whatever format you want.

ASriv7
新貢獻者 I
7,556 檢視

Is it unsigned or signed? Unsigned gives correct depth values for me.

ROhle
新手
7,556 檢視

I have been using signed 16-bit in ImageJ. Tried un-signed today and it gives identical results. My stereo analysis gives 32-bit negative values along the z-axis (in the viewer perspective)... so I end up converting Depth.raw files to 32-bit anyway.

EAlta
初學者
7,555 檢視

Hi @rjo__

I used imageJ to open the .raw file, as you suggested, obtaining the following result:

The obteined image, seems to be duplicated and is not 848x480 (It should be 848x480 because I specified it in the realsense viewer when I obtained the data).

Do you know how can I fix this problem?

idata
員工
7,555 檢視

When you save snapshot of the depth image, you will get 3 files (*.png, *.raw, *.csv)

the png file is *not* the depth image!

The actual depth data you can find in the raw file.

you can load it to Matlab with the following script:

fid = fopen("FilesName.Raw");

Depth = fread(fid, [1280 720], '*uint16')';

fclose(fid);

EAlta
初學者
7,555 檢視

Thank you @RoobiDahan

I implemented the code you suggested on matlab:

I used [848 480] because I used this configuration on the realsense viewer when I obtained the data.

The result I get from the raw file is this:

The image is like "duplicated", and as you can see in the workspace from matlab, its size is 120x848, when it should be 480x848,

The image content seems to be ok, but it is not of the size it should be.

Do you know how can I fix this issue?

idata
員工
7,555 檢視

No I didn't,

but try to use this code to create close image to the png image of the viewer, this way you could now what part of the file is missing or maybe the file is corrupt.

newDepthRaw = double(sort(DepthRaw(:)));

newDepthRaw(newDepthRaw == 0) = [];

newDepthRaw = newDepthRaw(1:round(length(newDepthRaw)*0.95));

Imin = min(newDepthRaw(:));

Imax = max(newDepthRaw(:));

newDepthRaw = (double(DepthRaw) - Imin)/(Imax - Imin);

newDepthRaw(newDepthRaw < 0) = 0;

newDepthRaw(newDepthRaw > 1) = 1;

A = jet; A(1,3) = 0;

figure; imagesc(newDepthRaw); colormap(A);

DepthRaw - is the depth file you load.

回覆