Ask Your Question

Revision history [back]

create FrameSource for super-res using createFrameSource_Empty

I am looking to perform SuperResolution in OpenCV using an image stack as opposed to a video file. Due to the number of images/file size I would prefer to not have an intermediate step creating a video file from the images. I created a function that calls createFrameSource_Empty and return a pointer to the main super-res code. However, I keep getting seg faults later on. Here is my function. Any help is appreciated.

// Creates a frame source from an image stack Ptr<framesource> createFrameSource_imageStack() { VideoCapture g_cap; Mat frame; int i = 270330; // should include leading zero int d = 1; char filename[1024];

// Generate an empty frame source structure
Ptr<FrameSource> frameSource;
frameSource = createFrameSource_Empty();

// Process 20 frames
    // Get frame from capture
    //cout << "Variable i is " << i << endl;
    sprintf(filename, "/Users/terry/Documents/video_product_20frame/1_1_%07d.tif",i);;
    g_cap >> frame;

    // Check if the frame was retrieved
        cerr << "Could not retrieve frame.";
        exit (-1);

    // quit after the 20th frame
    if (d == 20)
return frameSource;