2016-04-04 61 views
-1

我使用peopleDetect函數從視頻中檢測人物。我從peopleDetect方法中得到了分數,但現在我需要每幀處理的時間爲peopleDetect函數,因爲我需要繪製時間與分數的關係。以下代碼返回每幀的分數:使用人物處理幀的時間戳檢測

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); 

問題:如何編輯它以在每一步獲得時間?

+1

@mikkola - 這是非常好的你把這篇文章中的MATLAB中的文章放在這篇文章中供我們閱讀......但你不應該這麼做。 OP告訴我們去一個非現場資源找出問題所在......只是懶惰而已。 OP沒有表現出任何努力,所以你不應該解決這個懶惰。它應該被投票關閉恕我直言。 – rayryeng

回答

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;

+0

它返回我認爲系統的當前時間,我需要視頻的時間,就像是如果有25幀正在處理視頻我需要在視頻處理每幀的時間。 –

+0

哦,我明白了。是否有每幀可用的時間戳?如果是這樣,你不能只保存幀的時間?或者,如果您知道視頻的開始時間和幀速率,則可以計算每個幀的時間戳。 – JCKaz

+0

這是我需要知道如果時間戳可用於每個幀。我有videoFrameRate即25. –