|
|
|
@ -149,7 +149,7 @@ std::vector<bbox_t> get_3d_coordinates(std::vector<bbox_t> bbox_vect, cv::Mat xy |
|
|
|
|
|
|
|
|
|
#include <opencv2/opencv.hpp> // C++ |
|
|
|
|
#include <opencv2/core/version.hpp> |
|
|
|
|
#ifndef CV_VERSION_EPOCH |
|
|
|
|
#ifndef CV_VERSION_EPOCH // OpenCV 3.x and 4.x
|
|
|
|
|
#include <opencv2/videoio/videoio.hpp> |
|
|
|
|
#define OPENCV_VERSION CVAUX_STR(CV_VERSION_MAJOR)"" CVAUX_STR(CV_VERSION_MINOR)"" CVAUX_STR(CV_VERSION_REVISION) |
|
|
|
|
#ifndef USE_CMAKE_LIBS |
|
|
|
@ -162,12 +162,13 @@ std::vector<bbox_t> get_3d_coordinates(std::vector<bbox_t> bbox_vect, cv::Mat xy |
|
|
|
|
#pragma comment(lib, "opencv_highgui" OPENCV_VERSION ".lib") |
|
|
|
|
#endif // TRACK_OPTFLOW
|
|
|
|
|
#endif // USE_CMAKE_LIBS
|
|
|
|
|
#else |
|
|
|
|
#else // OpenCV 2.x
|
|
|
|
|
#define OPENCV_VERSION CVAUX_STR(CV_VERSION_EPOCH)"" CVAUX_STR(CV_VERSION_MAJOR)"" CVAUX_STR(CV_VERSION_MINOR) |
|
|
|
|
#ifndef USE_CMAKE_LIBS |
|
|
|
|
#pragma comment(lib, "opencv_core" OPENCV_VERSION ".lib") |
|
|
|
|
#pragma comment(lib, "opencv_imgproc" OPENCV_VERSION ".lib") |
|
|
|
|
#pragma comment(lib, "opencv_highgui" OPENCV_VERSION ".lib") |
|
|
|
|
#pragma comment(lib, "opencv_video" OPENCV_VERSION ".lib") |
|
|
|
|
#endif // USE_CMAKE_LIBS
|
|
|
|
|
#endif // CV_VERSION_EPOCH
|
|
|
|
|
|
|
|
|
@ -353,20 +354,27 @@ int main(int argc, char *argv[]) |
|
|
|
|
cv::VideoCapture cap; |
|
|
|
|
if (filename == "web_camera") { |
|
|
|
|
cap.open(0); |
|
|
|
|
video_fps = cap.get(CV_CAP_PROP_FPS); |
|
|
|
|
cap >> cur_frame; |
|
|
|
|
} else if (!use_zed_camera) { |
|
|
|
|
cap.open(filename); |
|
|
|
|
video_fps = cap.get(CV_CAP_PROP_FPS); |
|
|
|
|
cap >> cur_frame; |
|
|
|
|
} |
|
|
|
|
#ifdef CV_VERSION_EPOCH // OpenCV 2.x
|
|
|
|
|
video_fps = cap.get(CV_CAP_PROP_FPS); |
|
|
|
|
#else |
|
|
|
|
video_fps = cap.get(cv::CAP_PROP_FPS); |
|
|
|
|
#endif |
|
|
|
|
cv::Size const frame_size = cur_frame.size(); |
|
|
|
|
//cv::Size const frame_size(cap.get(CV_CAP_PROP_FRAME_WIDTH), cap.get(CV_CAP_PROP_FRAME_HEIGHT));
|
|
|
|
|
std::cout << "\n Video size: " << frame_size << std::endl; |
|
|
|
|
|
|
|
|
|
cv::VideoWriter output_video; |
|
|
|
|
if (save_output_videofile) |
|
|
|
|
#ifdef CV_VERSION_EPOCH // OpenCV 2.x
|
|
|
|
|
output_video.open(out_videofile, CV_FOURCC('D', 'I', 'V', 'X'), std::max(35, video_fps), frame_size, true); |
|
|
|
|
#else |
|
|
|
|
output_video.open(out_videofile, cv::VideoWriter::fourcc('D', 'I', 'V', 'X'), std::max(35, video_fps), frame_size, true); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
struct detection_data_t { |
|
|
|
|
cv::Mat cap_frame; |
|
|
|
|