最近我使用 MATLAB 研究 kinect。我采用uint16
格式的深度框架。但是当我分别使用 MATLAB 命令显示或保存它时:imshow
& imwrite
,它显示的图像太暗。但是当设置显示范围或将其转换为uint8
格式时,它会变得更亮。但我想将其保存为更亮的格式,而不需要转换uint8
格式,例如将范围缩放0
到4500
.
vid = videoinput('kinect',1);
vid2 = videoinput('kinect',2);
vid.FramesPerTrigger = 1;
vid2.FramesPerTrigger = 1;
% % Set the trigger repeat for both devices to 200, in order to acquire 201 frames from both the color sensor and the depth sensor.
vid.TriggerRepeat = 200;
vid2.TriggerRepeat = 200;
% % Configure the camera for manual triggering for both sensors.
triggerconfig([vid vid2],'manual');
% % Start both video objects.
start([vid vid2]);
trigger([vid vid2])
[imgDepth, ts_depth, metaData_Depth] = getdata(vid2);
f=imgDepth;
figure,imshow(f);
figure,imshow(f,[0 4500]);
imwrite(f,'C:\Users\sufi\Desktop\matlab_kinect\Data_image\output\depth\fo.tiff');
stop([vid vid2]);
当我设置显示范围时:
不设置显示范围: