Add exiv2 to extract ISO, white level, black level

main
Haohua-Lyu 3 years ago
parent ca3f40ec74
commit 9912c69c29

@ -33,6 +33,11 @@ find_library(LIBRAW_LIBRARY NAMES raw raw_r)
include_directories( BEFORE "/usr/local/include/") include_directories( BEFORE "/usr/local/include/")
message(STATUS "Found LIBRAW_LIBRARY to be ${LIBRAW_LIBRARY}" ) message(STATUS "Found LIBRAW_LIBRARY to be ${LIBRAW_LIBRARY}" )
# Exiv2
find_package(exiv2 REQUIRED CONFIG NAMES exiv2)
link_libraries(exiv2lib)
message(STATUS "Found Exiv2 and linked")
if(NOT APPLE) if(NOT APPLE)
# The clang compiler (on osx) is somehow much more strict # The clang compiler (on osx) is somehow much more strict
# than the compilers on ubuntu and so this does not seem # than the compilers on ubuntu and so this does not seem

@ -17,12 +17,15 @@ class merge
* @brief Run alignment on burst of images * @brief Run alignment on burst of images
* *
* @param burst_images collection of burst images * @param burst_images collection of burst images
* @param aligements alignment in pixel value pair. * @param alignments alignment in pixel value pair.
* Outer most vector is per alternative image. * Outer most vector is per alternative image.
* Inner most two vector is for horizontle & verticle tiles * Inner most two vector is for horizontal & vertical tiles
*/ */
void process( const hdrplus::burst& burst_images, \ void process( const hdrplus::burst& burst_images, \
std::vector<std::vector<std::vector<std::pair<int, int>>>>& aligements ); std::vector<std::vector<std::vector<std::pair<int, int>>>>& alignments, \
int ISO, \
int white_level, \
double black_level );
}; };
} // namespace hdrplus } // namespace hdrplus

@ -3,6 +3,7 @@
#include <vector> #include <vector>
#include <utility> // std::pair #include <utility> // std::pair
#include <opencv2/opencv.hpp> // all opencv header #include <opencv2/opencv.hpp> // all opencv header
#include <exiv2/exiv2.hpp> // exiv2
#include "hdrplus/hdrplus_pipeline.h" #include "hdrplus/hdrplus_pipeline.h"
#include "hdrplus/burst.h" #include "hdrplus/burst.h"
#include "hdrplus/align.h" #include "hdrplus/align.h"
@ -20,11 +21,25 @@ void hdrplus_pipeline::run_pipeline( \
burst burst_images( burst_path, reference_image_path ); burst burst_images( burst_path, reference_image_path );
std::vector<std::vector<std::vector<std::pair<int, int>>>> alignments; std::vector<std::vector<std::vector<std::pair<int, int>>>> alignments;
// Read exif tags
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(reference_image_path);
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
if (exifData.empty()) {
std::string error(reference_image_path);
error += ": No Exif data found in the file";
std::cout << error << std::endl;
}
int ISO = exifData["Exif.Image.ISOSpeedRatings"].toLong();
int white_level = exifData["Exif.Image.WhiteLevel"].toLong();
double black_level = exifData["Exif.Image.BlackLevel"].toFloat();
// Run align // Run align
align_module.process( burst_images, alignments ); align_module.process( burst_images, alignments );
// Run merging // Run merging
merge_module.process( burst_images, alignments ); merge_module.process( burst_images, alignments, ISO, white_level, black_level );
// Run finishing // Run finishing
} }

@ -7,7 +7,10 @@ namespace hdrplus
{ {
void merge::process( const hdrplus::burst& burst_images, \ void merge::process( const hdrplus::burst& burst_images, \
std::vector<std::vector<std::vector<std::pair<int, int>>>>& aligements ) std::vector<std::vector<std::vector<std::pair<int, int>>>>& alignments, \
int ISO, \
int white_level, \
double black_level )
{ {
} }

Loading…
Cancel
Save