I have a sequence of images and I extract a card from it. After this process the card will be correctly aligned and projected back to a plane (warpPerspective
). However the quality is too low to e.g. read text from that card. Thus I tried to use the superres module to increase the resolution, however the documentation is pretty shallow and I have yet to find out how I can pass multiple images to the algorithm.
我有一系列图像,我从中提取一张卡片。在此过程之后,卡将正确对齐并投射回飞机(warpPerspective)。然而,质量太低,例如从该卡读取文本。因此,我尝试使用superres模块来提高分辨率,但文档非常浅,我还没有找到如何将多个图像传递给算法。
I tried to implement a custom FrameSource
which is basically an adapter to a std::vector
but for some reason I get a segfault.
我试图实现一个自定义的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();
}
};
Edit The cv::Mat
are all CPU-only.
编辑cv :: Mat都是仅CPU。
1 个解决方案
#1
1
OK, after two days I finally got it. I needed to inverse the copying logic:
好的,两天后我终于明白了。我需要反转复制逻辑:
virtual void nextFrame(OutputArray _frame)
{
if (iter == frames.end()) return;
iter->copyTo(_frame);
++iter;
}
#1
1
OK, after two days I finally got it. I needed to inverse the copying logic:
好的,两天后我终于明白了。我需要反转复制逻辑:
virtual void nextFrame(OutputArray _frame)
{
if (iter == frames.end()) return;
iter->copyTo(_frame);
++iter;
}