77#include " deinterleaver.h"
88#include " pixelgeolocationcalculator.h"
99
10+ #include < map>
11+ #include < tuple>
1012#include < iostream>
1113#include < fstream>
1214#include < sstream>
@@ -296,7 +298,7 @@ int main(int argc, char *argv[])
296298 cv::Mat thermalImage = ThreatImage::irToTemperature (irImage, thermalRef);
297299 imagesToSpread.push_back (ImageForSpread (thermalImage, " thermal_" ));
298300
299- cv::bitwise_not (irImage, irImage);
301+ irImage = ThreatImage::invertIR ( irImage);
300302 irImage = ThreatImage::gamma (irImage, 1.8 );
301303 imagesToSpread.push_back (ImageForSpread (irImage, " IR_" ));
302304
@@ -351,7 +353,7 @@ int main(int argc, char *argv[])
351353 cv::Mat rainRef = cv::imread (mSettings .getResourcesPath () + " rain.bmp" );
352354 cv::Mat rainOverlay = ThreatImage::irToRain (ch68, rainRef);
353355
354- cv::bitwise_not (ch68, ch68);
356+ ch68 = ThreatImage::invertIR ( ch68);
355357 ch68 = ThreatImage::gamma (ch68, 1.8 );
356358 imagesToSpread.push_back (ImageForSpread (ch68, " IR_" ));
357359
@@ -506,7 +508,7 @@ int main(int argc, char *argv[])
506508 if (images68.size () > 1 && images68.size () == geolocationCalculators68.size ()) {
507509 if (mSettings .compositeEquadistantProjection () || mSettings .compositeMercatorProjection ()) {
508510 for (auto &img : images68) {
509- cv::bitwise_not (img, img);
511+ img = ThreatImage::invertIR ( img);
510512 img = ThreatImage::gamma (img, 1.8 );
511513 }
512514 }
@@ -569,6 +571,7 @@ int main(int argc, char *argv[])
569571void searchForImages (std::list<cv::Mat> &imagesOut, std::list<PixelGeolocationCalculator> &geolocationCalculatorsOut, const std::string &channelName)
570572{
571573 std::time_t now = std::time (nullptr );
574+ std::map<std::time_t , std::tuple<std::string, std::string>> map;
572575
573576 for (const auto & entry : fs::directory_iterator (mSettings .getOutputPath ())) {
574577 auto ftime = fs::last_write_time (entry);
@@ -584,27 +587,29 @@ void searchForImages(std::list<cv::Mat> &imagesOut, std::list<PixelGeolocationCa
584587 fs::path fileJPG (folder + " /" + fileNameBase + " _" + channelName + " .jpg" );
585588
586589 if (fs::exists (fileJPG)) {
587- std::cout << " " << fileJPG << " " << std::endl;
588-
589- imagesOut.emplace_back (cv::imread (fileJPG.generic_string ()));
590- geolocationCalculatorsOut.emplace_back (PixelGeolocationCalculator::load (entry.path ().generic_string ()));
591-
590+ map[cftime] = std::make_tuple (entry.path ().generic_string (), fileJPG);
592591 break ;
593592 }
594593
595594 fs::path fileBMP (folder + " /" + fileNameBase + " _" + channelName + " .bmp" );
596595
597596 if (fs::exists (fileBMP)) {
598- std::cout << " " << fileBMP << " " << std::endl;
599-
600- imagesOut.emplace_back (cv::imread (fileBMP.generic_string ()));
601- geolocationCalculatorsOut.emplace_back (PixelGeolocationCalculator::load (entry.path ().generic_string ()));
597+ map[cftime] = std::make_tuple (entry.path ().generic_string (), fileBMP);
602598
603599 break ;
604600 }
605601 } while (false );
606602 }
607603 }
604+
605+ if (map.size () > 2 ) {
606+ for (auto const &[time, paths] : map) {
607+ std::cout << std::get<1 >(paths) << std::endl;
608+
609+ geolocationCalculatorsOut.emplace_back (PixelGeolocationCalculator::load (std::get<0 >(paths)));
610+ imagesOut.emplace_back (cv::imread (std::get<1 >(paths)));
611+ }
612+ }
608613}
609614
610615void saveImage (const std::string fileName, const cv::Mat &image)
0 commit comments