Timestamp of frame processing using peopleDetect

时间:2016-04-04 18:09:00

标签: matlab computer-vision video-processing frame-rate

I am using peopleDetect function to detect human object from video. I got the score from the peopleDetect method but now I need the time at which each frame was processed by peopleDetect function, because I need to plot time vs. score. The following code returns the score for each frame:

frameLeft = readerLeft.step();

% Detect people.
[bboxes,scores] = step(peopleDetector, frameLeft);

if ~isempty(bboxes)
    % Find the centroids of detected people.
    centroids = [round(bboxes(:, 1) + bboxes(:, 3) / 2), ...
        round(bboxes(:, 2) + bboxes(:, 4) / 2)];

    dispFrame = insertObjectAnnotation(frameLeft, 'rectangle' ,bboxes,scores);
else
    dispFrame = frameLeft;
end

% Display the frame.
step(player, dispFrame);

Question: how can I edit it to get time at each step as well?

1 个答案:

答案 0 :(得分:0)

在您检测到人员后,立即使用now命令保存时间。

我假设您在以下位置检测到了人员:

% Detect people.
[bboxes,scores] = step(peopleDetector, frameLeft);

if ~isempty(bboxes)
...

然后只需将时间添加为:

% Detect people.
[bboxes,scores] = step(peopleDetector, frameLeft);

if ~isempty(bboxes)
timeStamps(idx) = now;
idx = idx + 1;
...

您在开始时启动timeStamps数组以加快速度。当然,当然也会在开头

启动idx = 1;