我使用Kinect v2记录了一系列深度图像。但是背景亮度并不是恒定的。但它不断地从暗到亮,从亮到暗(即)

。
因此,我在考虑使用序列中每个图像的直方图归一化来将背景归一化到相同的水平。有没有人能告诉我该怎么做?
发布于 2015-06-19 02:18:44
Matlab有一个histogram matching函数,他们的网站上也有一些很好的例子。
只需使用任何帧作为参考(我建议使用第一个帧,但没有真正的理由这样做),并为所有剩余的帧保留它。如果你想减少处理时间,你也可以尝试减少垃圾箱的数量。对于uint8图像,通常有256个存储箱,但正如您将在链接中看到的那样,减少它仍然会产生有利的结果
我不知道kinect图像是rgb还是灰度,对于这个例子,我假设它们是灰度的
kinect_images = Depth;
num_frames = size(kinect_images,3); %maybe 4, I don't know if kinect images
%are grayscale(3) or RGB(4)
num_of_bins = 32;
%imhistmatch is a recent addition to matlab, use this variable to
%indicate whether or not you have it
I_have_imhistmatch = true;
%output variable
equalized_images = cast(zeros(size(kinect_images)),class(kinect_images));
%stores first frame as reference
ref_image = kinect_images(:,:,1); %if rgb you may need (:,:,:,1)
ref_hist = imhist(ref_image);
%goes through every frame and matches the histof
for ii=1:1:num_frames
if (I_have_imhistmatch)
%use this with newer versions of matlab
equalized_images(:,:,ii) = imhistmatch(kinect_images(:,:,ii), ref_image, num_of_bins);
else
%use this line with older versions that dont have imhistmatch
equalized_images(:,:,ii) = histeq(kinect_images(:,:,ii), ref_hist);
end
end
implay(equalized_images)https://stackoverflow.com/questions/30908572
复制相似问题