Ask Your Question

Revision history [back]

Have you solve your problem? It's not really an answer but may be it could help you.

I start working on Superres my program is (very slow) : (using samples/gpu/super_resolution.cpp)

#include <opencv2/opencv.hpp> 
#include "opencv2/superres.hpp"

using namespace cv;
using namespace std;
using namespace cv::superres;


int main(int argc, char** argv)
{

    Ptr<cv::superres::FrameSource> f;
    f = cv::superres::createFrameSource_Camera(0);
    Ptr<cv::superres::SuperResolution >sr;

    VideoCapture vid;
    vid.open(0);

    sr = cv::superres::createSuperResolution_BTVL1();
    Ptr<DenseOpticalFlowExt> of = cv::superres::createOptFlow_Farneback();

    int scale = 2;
    sr->setOpticalFlow(of);
    sr->setScale(scale);
    sr->setTemporalAreaRadius(2);
    sr->setIterations(2);
    Mat frame;
    char c;
    Mat frameZoom;
    Mat mZoom;
    Mat v;
    f->nextFrame(frame);
    sr->setInput(f);
    do{
        //if (vid.grab())
        {
            sr->nextFrame(frame);
            imshow("Video SuperRes", frame);
            if (vid.grab())
            {
                vid >> v;
                resize(v, mZoom, Size(0, 0), scale, scale);
                imshow("Video Scale", mZoom);

            }
                imshow("Video SuperRes", frame);
            c = waitKey(20);
        }

    } while (c != 27);
    return 0;
}

Have you solve your problem? It's not really an answer but may be it could help you.you. After you can change cv::superres::createFrameSource_Camera(0) in createFrameSource_Video(name); where name is pathname to your file. I think that's video format can be any format that opencv (ffmpeg ) can read .

I start working on Superres my program is (very slow) : (using samples/gpu/super_resolution.cpp)

#include <opencv2/opencv.hpp> 
#include "opencv2/superres.hpp"

using namespace cv;
using namespace std;
using namespace cv::superres;


int main(int argc, char** argv)
{

    Ptr<cv::superres::FrameSource> f;
    f = cv::superres::createFrameSource_Camera(0);
    Ptr<cv::superres::SuperResolution >sr;

    VideoCapture vid;
    vid.open(0);

    sr = cv::superres::createSuperResolution_BTVL1();
    Ptr<DenseOpticalFlowExt> of = cv::superres::createOptFlow_Farneback();

    int scale = 2;
    sr->setOpticalFlow(of);
    sr->setScale(scale);
    sr->setTemporalAreaRadius(2);
    sr->setIterations(2);
    Mat frame;
    char c;
    Mat frameZoom;
    Mat mZoom;
    Mat v;
    f->nextFrame(frame);
    sr->setInput(f);
    do{
        //if (vid.grab())
        {
            sr->nextFrame(frame);
            imshow("Video SuperRes", frame);
            if (vid.grab())
            {
                vid >> v;
                resize(v, mZoom, Size(0, 0), scale, scale);
                imshow("Video Scale", mZoom);

            }
                imshow("Video SuperRes", frame);
            c = waitKey(20);
        }

    } while (c != 27);
    return 0;
}

Have you solve your problem? It's not really an answer but may be it could help you. After you can change cv::superres::createFrameSource_Camera(0) in createFrameSource_Video(name); where name is pathname to your file. I think that's video format can be any format that opencv (ffmpeg ) can read .

I start working on Superres my program is (very slow) : (using samples/gpu/super_resolution.cpp)samples/gpu/super_resolution.cpp). Becarefull I use twice usb device 0 (my webcam). It works on windows but I'm not sure that's good on all platform.

#include <opencv2/opencv.hpp> 
#include "opencv2/superres.hpp"

using namespace cv;
using namespace std;
using namespace cv::superres;


int main(int argc, char** argv)
{

    Ptr<cv::superres::FrameSource> f;
    f = cv::superres::createFrameSource_Camera(0);
    Ptr<cv::superres::SuperResolution >sr;

    VideoCapture vid;
    vid.open(0);

    sr = cv::superres::createSuperResolution_BTVL1();
    Ptr<DenseOpticalFlowExt> of = cv::superres::createOptFlow_Farneback();

    int scale = 2;
    sr->setOpticalFlow(of);
    sr->setScale(scale);
    sr->setTemporalAreaRadius(2);
    sr->setIterations(2);
    Mat frame;
    char c;
    Mat frameZoom;
    Mat mZoom;
    Mat v;
    f->nextFrame(frame);
    sr->setInput(f);
    do{
        //if (vid.grab())
        {
            sr->nextFrame(frame);
            imshow("Video SuperRes", frame);
            if (vid.grab())
            {
                vid >> v;
                resize(v, mZoom, Size(0, 0), scale, scale);
                imshow("Video Scale", mZoom);

            }
                imshow("Video SuperRes", frame);
            c = waitKey(20);
        }

    } while (c != 27);
    return 0;
}