opencv环境下,自己修改封装的视频帧消息队列
转载请注明:http://blog.youkuaiyun.com/forest_world
IMGEQue.cpp
#include "IMGEQue.h"
IMGEQue::IMGEQue()
{
}
IMGEQue::~IMGEQue(void)
{
}
void IMGEQue::AddIMGE(const cv::Mat &frmIMGE)
{
try
{
m_IMGEVector.push_back(frmIMGE);
}
catch (...)
{
}
}
bool IMGEQue::GetIMGE(cv::Mat &frmIMGE)
{
try
{
if (m_IMGEVector.size()>0){
std::list<cv::Mat>::iterator it = m_IMGEVector.begin();
frmIMGE = (*it);
m_IMGEVector.erase(it);
return true;
}
}
catch (...)
{
return false;
}
return false;
}
void IMGEQue::ClearQue()
{
m_IMGEVector.clear();
}
IMGEQue.h
#ifndef IMGE_H
#define IMGE_H
#include <list>
#include "opencv2/core/core.hpp"
#include "opencv2/opencv.hpp"
class IMGEQue
{
public:
IMGEQue();
~IMGEQue(void);
void AddIMGE(const cv::Mat &frmIMGE);
bool GetIMGE(cv::Mat &frmIMGE);
//bool GetIMGE(cv::list<cv::Mat> &IMGEList);
void ClearQue();
private:
std::list<cv::Mat> m_IMGEVector;
};
#endif