我面临以下挑战。我在帧数上绘制了基于摄像机的车辆距离测量。如您在图片中所见(y =距离,x =帧),噪声会导致测量误差。被测车辆理论上可以加速或持续行驶。在这种情况下,它会持续驱动。
有人知道如何在测量过程中减少噪声吗?噪声分布对应于距离几乎是恒定的。我目前正在尝试在Matlab中使用Kalman滤波器找到解决方案。
https://de.mathworks.com/help/vision/ref/vision.kalmanfilter.html https://de.mathworks.com/help/vision/ref/configurekalmanfilter.html
卡尔曼方法如下:
... % DistObj = Distance values from meausurement
if count < 6
HoldD(count) = {DistObj};
count = count +1;
else
HoldD(1) = [];
HoldD(end+1) = {DistObj};
end
kalman = [];
for idx = 1: length(HoldD)
location = HoldD{idx};
if isempty(kalman)
if ~isempty(location)
stateModel = [1 1;0 1];
measurementModel = [1 0];
kalman = vision.KalmanFilter(stateModel,measurementModel,'ProcessNoise',2,'MeasurementNoise',16); %1e-4
kalman.State = [location, 0];
end
else
trackedLocation = predict(kalman);
if ~isempty(location)
d = distance(kalman,location);
trackedLocation = correct(kalman,location);
else
print('Missing detection');
end
plot(fr,trackedLocation,'co');
hold on
% plot(fr,DistObj,'ko');
% hold on
xlim([-1 nFrames])
ylim([0 70])
end
end
有人可以帮我吗?