Ask Your Question
0

Super-Resolution can't process first frame

asked 2013-09-08 01:21:28 -0600

MH gravatar image

updated 2013-09-08 01:22:41 -0600

Hey,

I am hoping to try out the SuperResolution feature included in OpenCV however i am having a bit of trouble with it. I believe it is the same issue as this question, i just have a few extra questions i'd like answered. I am testing it on the Megamind.avi video located in ..\opencv\samples\cpp\tutorial_code\HighGUI\video-input-psnr-ssim\video It is 720x528, 11seconds long and has a frame rate of 23frames/second.

Basically the issue i am having is when i call nextFrame() the memory usage shoots up 2GB and the CPU usage is at 100%, i have had it running for over an hour now and it is still processing as i type. For an 11second video this seems unreasonable?

Now my questions:

  • Is the code i have posted correct? any tips for improving performance?
  • If the answer to the question i linked to is correct, Is the initialization time static, linear or does it increase exponentially. If it is not static i would find it pretty hard to stomach.
  • Would real time processing be possible with GPUs?(I have tesla cards at work that i can use)
  • If this is the expected result then is this function only really designed for 10-20 frames or something?

My Code:

    Ptr<SuperResolution> superRes;
superRes = createSuperResolution_BTVL1();
Ptr<FrameSource> frameSource;
frameSource = createFrameSource_Video("D:\\Megamind.avi");
Mat frame;
frameSource->nextFrame(frame);
superRes->setInput(frameSource);
for (int i = 0;; ++i)
{
    Mat result;
    //Calling nextFrame() is what is causing me the issue
    superRes->nextFrame(result);
    imshow("Super Resolution", result);
    if (result.empty())
    {
        break;
    }
    waitKey(500);
}

Really appreciate any input you can give.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-09-09 03:45:58 -0600

Vladislav Vinogradov gravatar image

It is the same issue as this question. The BTV SuperResolution algorithm was oriented for small input videos.

As for your questions:

  1. Yes, your code is correct. The only issue - check if (result.empty()) before imshow.

  2. The first call of nextFrame method takes long time, because algorithm initialize inner frame queue. It will process temporalAreaRadius + 1 (5 for default parameters) frames from input source. So, first call is ~5x slower than next calls.

  3. It was oriented for small input size (e.g. video with small resolution or small part from the input video). And real-time processing could be achieved only on small input.

edit flag offensive delete link more

Comments

Thanks for that. Definitely cleared things up :)

MH gravatar imageMH ( 2013-09-09 05:08:19 -0600 )edit

Question Tools

Stats

Asked: 2013-09-08 01:21:28 -0600

Seen: 1,644 times

Last updated: Sep 09 '13