Is there a 2.0 series version of the HDR tutorial? Currently broken.

asked 2013-10-27 18:20:28 -0500

Is there a 2.0 series version of the HDR tutorial? Currently it is broken reporting no 'opencv2/photo.hpp' file or directory. Is there an older version of the tutorial somewhere online that could be used instead? The WayBackMachine's first capture is Oct.13,2013.

http://docs.opencv.org/trunk/doc/tutorials/photo/hdr_imaging/hdr_imaging.html#hdrimaging

#include <opencv2/photo.hpp>    /* <- THIS FAILS */
#include <opencv2/highgui.hpp>  /* <- I think this should be "#include <opencv2/highgui/highgui.hpp>" */
#include <vector>
#include <iostream>
#include <fstream>

using namespace cv;
using namespace std;

void loadExposureSeq(String, vector<Mat>&, vector<float>&);

int main(int, char**argv)
{
    vector<Mat> images;
    vector<float> times;
    loadExposureSeq(argv[1], images, times);

    Mat response;
    Ptr<CalibrateDebevec> calibrate = createCalibrateDebevec();
    calibrate->process(images, response, times);

    Mat hdr;
    Ptr<MergeDebevec> merge_debevec = createMergeDebevec();
    merge_debevec->process(images, hdr, times, response);

    Mat ldr;
    Ptr<TonemapDurand> tonemap = createTonemapDurand(2.2f);
    tonemap->process(hdr, ldr);

    Mat fusion;
    Ptr<MergeMertens> merge_mertens = createMergeMertens();
    merge_mertens->process(images, fusion);

    imwrite("fusion.png", fusion * 255);
    imwrite("ldr.png", ldr * 255);
    imwrite("hdr.hdr", hdr);

    return 0;
}

void loadExposureSeq(String path, vector<Mat>& images, vector<float>& times)
{
    path = path + std::string("/");
    ifstream list_file((path + "list.txt").c_str());
    string name;
    float val;
    while(list_file >> name >> val) {
        Mat img = imread(path + name);
        images.push_back(img);
        times.push_back(1 / val);
    }
    list_file.close();
}
edit retag flag offensive close merge delete

Comments

similar question like this one ?

in that case, it seems, it won't work with the 2.4 branch, apart from the headers, there seems to be no CalibrateDebevec in 2.4.

berak gravatar imageberak ( 2013-10-28 04:02:30 -0500 )edit