After reading depth information video file of Kinect as binary(.dat) file, my resulting frames are not proper
조회 수: 8 (최근 30일)
이전 댓글 표시
I read the file until the end, try to store it frame by frame into array, but somehow I have got no successful representation of the video. I am going to put some screenshots also, if it is not clear.
I could not get it why the video is shaped into this much distorted form. By the way, I do not know what the meaning of pixel precision, and by assigning it into uint8, and I need some more elaborated explanation for struct creation and the definitive meaning for cdata. Thanks in advance, sorry for the confusing explanation, but I myself am unfortunately confused.
P.s.: Here are the screenshots:
[1]:http://i.stack.imgur.com/be8Q5.png
[2]:http://i.stack.imgur.com/3CLVL.png
fid = fopen('depth.dat');
col = 640;
row = 480;
frames = {}; %// Put Frames
numFrames = 0; %// Number of frames
while (true) %// end of file
B = fread(fid, [col row],'uint8=>uint8'); %// Read in one frame at a time
if (isempty(B))
break;
end
frames{end+1} = B.'; %// Transpose
numFrames = numFrames + 1; %// Count frame
%imwrite(frames{numFrames},sprintf('Depth_%03d.png',numFrames));
end
movieFrames(numFrames) = struct('cdata',[],'colormap',[]);
for idx = numFrames: 1
img = frames{idx};
movieFrames(idx) = im2frame(cat(3,img, img, img));
end
figure;
imshow(movieFrames(1).cdata); %// figure size
movie(movieFrames, 1, 30);
fclose(fid);
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Kinect For Windows Sensor에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!