Export: Added exposure fusion option

This commit is contained in:
matlabbe
2017-03-31 18:56:52 -04:00
parent f33b838204
commit accbe5a423
4 changed files with 130 additions and 51 deletions
+4
View File
@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/core/core.hpp>
#include <rtabmap/core/Transform.h>
#include <rtabmap/core/Parameters.h>
#include <vector>
namespace rtabmap
{
@@ -148,6 +149,9 @@ cv::Mat RTABMAP_EXP brightnessAndContrastAuto(
float clipLowHistPercent=0,
float clipHighHistPercent=0);
cv::Mat RTABMAP_EXP exposureFusion(
const std::vector<cv::Mat> & images);
} // namespace util3d
} // namespace rtabmap
+24
View File
@@ -41,6 +41,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <Eigen/Core>
#if CV_MAJOR_VERSION >= 3
#include <opencv2/photo/photo.hpp>
#endif
namespace rtabmap
{
@@ -1992,6 +1996,26 @@ cv::Mat brightnessAndContrastAuto(const cv::Mat &src, const cv::Mat & mask, floa
return dst;
}
cv::Mat exposureFusion(const std::vector<cv::Mat> & images)
{
UASSERT(images.size());
cv::Mat fusion;
#if CV_MAJOR_VERSION >= 3
cv::createMergeMertens()->process(images, fusion);
cv::Mat rgb8;
UASSERT(fusion.channels() == 3);
fusion.convertTo(rgb8, CV_8UC3, 255.0);
fusion = rgb8;
#else
UWARN("Exposure fusion is only avaiable when rtabmap is built with OpenCV3.");
if (images.size())
{
fusion = images[0].clone();
}
#endif
return fusion;
}
}
}