tic; load data45; mkdir('data45'); path = '.\data45\'; n = 20; %% Number of frames in each mat file............. for i=1:n colorImage = squeeze(color(:,:,:,i)); depthImage = depth(:,:,i); infraredImage = infrared(:,:,i); ptCloud_c = pcfromkinect(depthDevice, depthImage, colorImage, 'colorCentric'); ptCloud_d = pcfromkinect(depthDevice, depthImage, colorImage, 'depthCentric'); ptCloud_ci = pcfromkinect(depthDevice, infraredImage, colorImage, 'colorCentric'); img1 = ptCloud_c.Color; depth1 = uint8(ptCloud_c.Location*256); img2 = ptCloud_d.Color; depth2 = uint8(ptCloud_d.Location*256); infra1 = uint8(ptCloud_c.Location*256); file1 = strcat(path,'img',num2str(i),'_cc.png'); file2 = strcat(path,'depth',num2str(i),'_cc.png'); file3 = strcat(path,'img',num2str(i),'_dc.png'); file4 = strcat(path,'depth',num2str(i),'_dc.png'); file5 = strcat(path,'infra',num2str(i),'_cc.png'); imwrite(img1,file1); imwrite(depth1,file2); imwrite(img2,file3); imwrite(depth2,file4); imwrite(infra1, file5); i end toc;