Skip to content

[GSoC 2017] Photometric Calibration #8867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/opencv.bib
Original file line number Diff line number Diff line change
Expand Up @@ -904,3 +904,12 @@ @INPROCEEDINGS{Ke17
year = {2017},
organization = {IEEE}
}
@InProceedings{engel2016monodataset,
author = "J. Engel and V. Usenko and D. Cremers",
title = "A Photometrically Calibrated Benchmark For Monocular Visual Odometry",
booktitle = "arXiv:1607.02555",
arXiv = " arXiv:1607.02555",
year = "2016",
month = "July",
keywords={mono-ds,dso}
}
36 changes: 36 additions & 0 deletions modules/calib3d/include/opencv2/calib3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,42 @@ class CV_EXPORTS_W StereoSGBM : public StereoMatcher
int mode = StereoSGBM::MODE_SGBM);
};

/** @brief The class for photometric calibration algorithms.
*/
class CV_EXPORTS_W PhotometricCalibrator : public Algorithm
{

};

/** @brief The class implements the non-parametric photometric calbration algorithm from J. Engel et al. @cite engel2016monodataset

*/
class CV_EXPORTS_W PhotoCalbrNonPara : public PhotometricCalibrator
{
public:
/** @brief Check if the images and corresponding exposure times are valid for response calibration.

@param inputImgs Vector containing all the images used for response calibration.
@param exposureTimes Vector containing all the exposure times for response calibration.
*/
CV_WRAP virtual bool validResponseCalibrImgs(std::vector<Mat> &inputImgs, std::vector<double> &exposureTimes) = 0;

/** @brief Creates PhotoCalbrNonPara object

@param numDisparities the disparity search range. For each pixel algorithm will find the best
disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
shifted by changing the minimum disparity.
@param blockSize the linear size of the blocks compared by the algorithm. The size should be odd
(as the block is centered at the current pixel). Larger block size implies smoother, though less
accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
chance for algorithm to find a wrong correspondence.

The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
a specific stereo pair.
*/
CV_WRAP static Ptr<PhotoCalbrNonPara> create();
};

//! @} calib3d

/** @brief The methods in this namespace use a so-called fisheye camera model.
Expand Down
76 changes: 76 additions & 0 deletions modules/calib3d/src/photo_calbr_nonpara.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

/*
This is an implementation of photometric calibration in
"Stereo Processing by Semiglobal Matching and Mutual Information"
by J. Engel et al.
*/

#include "precomp.hpp"
#include <limits.h>
#include "opencv2/core/hal/intrin.hpp"

namespace cv {

class PhotoCalbrNonParaImpl : public PhotoCalbrNonPara
{
public:
PhotoCalbrNonParaImpl() {}

bool validResponseCalibrImgs(std::vector <Mat> &inputImgs, std::vector<double> &exposureTime)
{
return inputImgs.size() != 0 && inputImgs.size() == exposureTime.size();
}

static const char* name_;
};

const char* PhotoCalbrNonParaImpl::name_ = "PhotometricCalibrator.NonPara";

Ptr <PhotoCalbrNonPara> PhotoCalbrNonPara::create()
{
return Ptr <PhotoCalbrNonPara> (new PhotoCalbrNonParaImpl());
}

}