1 | initial version |
A simple solution I'm using right now. Extend cv::superres::FrameSource with a setFrame member
class MyFrameSource : public cv::superres::FrameSource cv::Mat origFrame_; void MyFrameSource::setFrame(Mat & frame) { frame.copyTo(origFrame_); } void MyFrameSource::nextFrame(cv::OutputArray frame) { origFrame_.copyTo(frame); }
then cv::Ptr<myframesource> lowresSource(new MyFrameSource(cv::superres::createFrameSource_Empty(), scale)); and superRes->setInput(lowresSource);
then, in a loop, first copy your i-frame to framesource with setFrame(), then call superRes->nextFrame(dest) and you will be using that frame. But you will get a TemporalAreaRadius*2+1 frames latency for superres to begin to work as it should. You can, for example, loop your frameslist to use the first umprocesed frames.
2 | No.2 Revision |
A simple solution I'm using right now. Extend cv::superres::FrameSource with a setFrame member
class MyFrameSource : public cv::superres::FrameSource
{
cv::Mat origFrame_;
void MyFrameSource::setFrame(Mat & frame) { frame.copyTo(origFrame_); }
void MyFrameSource::nextFrame(cv::OutputArray frame) { origFrame_.copyTo(frame); }
} } then cv::Ptr<myframesource> lowresSource(new MyFrameSource(cv::superres::createFrameSource_Empty(), scale)); and superRes->setInput(lowresSource);
then, in a the process loop, first copy your i-frame nput frame to framesource with setFrame(), then call superRes->nextFrame(dest) and you will be using that frame. But you will get a TemporalAreaRadius*2+1 frames latency for superres to begin to work as it should. You can, for example, loop your frameslist to use the first umprocesed frames.frames.
is not the best but it works.