Super resolution outputs blank green frames.

asked 2015-11-23 01:10:28 -0600

dufferdev gravatar image

I am trying to do super-resolution using OpenCV 2.4.10. Here are the main steps in the task .

    const int scale = 2;
const int iterations = 5;
const int temporalAreaRadius = 4;
cv::Ptr<cv::superres::DenseOpticalFlowExt> of = cv::superres::createOptFlow_DualTVL1();

cv::Ptr<cv::superres::SuperResolution> super_res=cv::superres::createSuperResolution_BTVL1();
super_res->set("scale", scale);
super_res->set("iterations", iterations);
super_res->set("temporalAreaRadius", temporalAreaRadius);
super_res->set("opticalFlow",of);

 for(int i = 0; i < SKIP; ++i)
{
    frame_source->nextFrame(frame);
}
super_res->setInput(frame_source);
cv::VideoWriter writer;

std::cout<<"starting SR"<<std::endl;
for(int i=0;;++i){
    std::cout<<"processing frame :"<<i<<std::endl;
    cv::Mat result;
    super_res->nextFrame(result);
    if(result.empty())break;
    if (!writer.isOpened())
            writer.open(output_video_name, CV_FOURCC('X', 'V', 'I', 'D'), 25.0, result.size());
    writer << result;    
}

While the program executes error free, in the output all i am getting are blank green frames. Could anybody point me as why that is happening?

edit retag flag offensive close merge delete

Comments

My best guess writer.open(output_video_name, CV_FOURCC('X', 'V', 'I', 'D'), 25.0, result.size()); has a corrupt video codec. Start by replacing it with an imshow and a waitKey and see if that returns useful results.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-23 04:51:59 -0600 )edit