Depth2HHA icon indicating copy to clipboard operation
Depth2HHA copied to clipboard

【Code Share】transfer dataset to depth image and rawdepth image

Open Mayandev opened this issue 6 years ago • 1 comments
trafficstars

I'd like to share some code.

nyufile = fullfile('dataset/', 'nyu_depth_v2_labeled.mat');
outDir = fullfile('output/', 'sgupta', 'datasets', 'nyud2', 'datacopy');
mkdir(fullfile(outDir, 'rawdepth'));
mkdir(fullfile(outDir, 'depth'));
mkdir(fullfile(outDir, 'images'));


dt = load(nyufile, 'rawDepths');
for i = 1:1449, 
  imwrite(uint16(cropIt(dt.rawDepths(:,:,i))*1000), fullfile(outDir, 'rawdepth', sprintf('img_%04d.png', i + 5000))); 
end

dt = load(nyufile, 'depths');
for i = 1:1449, 
  imwrite(uint16(cropIt(dt.depths(:,:,i))*1000), fullfile(outDir, 'depth', sprintf('img_%04d.png', i + 5000))); 
end

dt = load(nyufile, 'images');
for i = 1:1449, 
  imwrite(uint8(cropIt(dt.images(:,:,:,i))), fullfile(outDir, 'images', sprintf('img_%04d.png', i + 5000))); 
end

Mayandev avatar Sep 06 '19 07:09 Mayandev

I'd like to share some code.

nyufile = fullfile('dataset/', 'nyu_depth_v2_labeled.mat');
outDir = fullfile('output/', 'sgupta', 'datasets', 'nyud2', 'datacopy');
mkdir(fullfile(outDir, 'rawdepth'));
mkdir(fullfile(outDir, 'depth'));
mkdir(fullfile(outDir, 'images'));


dt = load(nyufile, 'rawDepths');
for i = 1:1449, 
  imwrite(uint16(cropIt(dt.rawDepths(:,:,i))*1000), fullfile(outDir, 'rawdepth', sprintf('img_%04d.png', i + 5000))); 
end

dt = load(nyufile, 'depths');
for i = 1:1449, 
  imwrite(uint16(cropIt(dt.depths(:,:,i))*1000), fullfile(outDir, 'depth', sprintf('img_%04d.png', i + 5000))); 
end

dt = load(nyufile, 'images');
for i = 1:1449, 
  imwrite(uint8(cropIt(dt.images(:,:,:,i))), fullfile(outDir, 'images', sprintf('img_%04d.png', i + 5000))); 
end

yes,this is better than old.i work it with this code!

DrugD avatar Feb 16 '20 12:02 DrugD