Repository navigation
Expand file tree
/
Copy pathtest_mot_reader.cpp
More file actions
64 lines (49 loc) · 1.96 KB
/
Copy pathtest_mot_reader.cpp
File metadata and controls
64 lines (49 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @brief Simple test program for MotSequenceReader
*
* This program tests the MOT sequence reader with a small sequence
* to verify that frames can be read correctly.
*/
#include <iostream>
#include "mot/mot_sequence_reader.h"
#include <opencv2/opencv.hpp>
int main(int argc, char** argv) {
std::string sequencePath = std::string(PROJECT_ROOT_DIR) + "/MOT17-Data/MOT17/train/MOT17-02-DPM";
if (argc > 1) {
sequencePath = argv[1];
}
std::cout << "=== MOT Sequence Reader Test ===" << std::endl;
std::cout << "Sequence path: " << sequencePath << std::endl;
try {
MotSequenceReader reader(sequencePath);
std::cout << "\n=== Sequence Information ===" << std::endl;
std::cout << "Name: " << reader.getSequenceName() << std::endl;
std::cout << "Total frames: " << reader.getTotalFrames() << std::endl;
std::cout << "FPS: " << reader.getFPS() << std::endl;
std::cout << "Frame size: " << reader.getFrameSize() << std::endl;
std::cout << "\n=== Reading first 10 frames ===" << std::endl;
cv::Mat frame;
int count = 0;
while (reader.hasNext() && count < 10) {
if (!reader.nextFrame(frame)) {
std::cerr << "Failed to read frame " << count << std::endl;
break;
}
std::cout << "Frame " << count << ": "
<< frame.cols << "x" << frame.rows
<< " (type: " << frame.type() << ")" << std::endl;
// Display frame
cv::imshow("MOT Frame", frame);
cv::waitKey(100); // 100ms delay
count++;
}
std::cout << "\n=== Test Complete ===" << std::endl;
std::cout << "Successfully read " << count << " frames" << std::endl;
cv::waitKey(0);
cv::destroyAllWindows();
return 0;
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return -1;
}
}