Skip to content

Commit

Permalink
[fix] 修复在低版本gcc和opencv上的一些兼容性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bismarckkk committed Apr 12, 2023
1 parent fb9db4f commit ad39de7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/md_camera/LockFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LockFrame {
private:
uint8_t *memory = nullptr;
tSdkFrameHead head;
std::atomic<bool> used = false;
std::atomic<bool> used{false};
public:
bool lock();
void release();
Expand Down
4 changes: 3 additions & 1 deletion src/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#endif

#ifdef MJPG
#define FOUR_CC_MJPG cv::VideoWriter::fourcc('M','J','P','G')
#define FOUR_CC cv::VideoWriter::fourcc('M','J','P','G')
#define SUFFIX ".avi"
#endif

Expand Down Expand Up @@ -45,8 +45,10 @@ void Recorder::startRecord(const std::string &resolution, int recordFps, const s
frame_rate = recordFps;
camera_name = _camera_name;
cv::Size size = resolutionSizeCreator(resolution);
// 低版本opencv此处会编译错误,请注释下两行并解除第三行注释
std::vector<int> params{cv::VIDEOWRITER_PROP_HW_ACCELERATION, cv::VIDEO_ACCELERATION_ANY};
videoWriter.open(now_path + "video" + SUFFIX, FOUR_CC, recordFps, size, params);
// videoWriter.open(now_path + "video" + SUFFIX, FOUR_CC, recordFps, size);
auto saveFunc = [this](){
this->saveYaml();
};
Expand Down

0 comments on commit ad39de7

Please sign in to comment.