我有一系列图像,我从中提取一张卡片。在此过程之后,卡将正确对齐并投射回平面(warpPerspective
)。然而,质量太低,例如从该卡读取文本。因此我尝试使用superres模块来提高分辨率,但文档非常浅,我还没有找到如何将多个图像传递给算法。
我尝试实现自定义FrameSource
,它基本上是std::vector
的适配器,但由于某种原因我得到了段错误。
class InterFrameSource : public superres::FrameSource {
std::vector<cv::Mat> frames;
std::vector<cv::Mat>::iterator iter;
public:
InterFrameSource(std::vector<cv::Mat> _frames) : frames(_frames)
{
reset();
}
virtual void nextFrame(OutputArray _frame)
{
_frame.getMatRef().setTo(*iter);
++iter;
}
virtual void reset() {
iter = frames.begin();
}
};
修改
cv::Mat
都是仅限CPU的。
答案 0 :(得分:1)
virtual void nextFrame(OutputArray _frame)
{
if (iter == frames.end()) return;
iter->copyTo(_frame);
++iter;
}