added logger

This commit is contained in:
Phuntsok Drak-pa 2019-03-19 14:22:59 +01:00
parent 069b739174
commit 7018d217f3
2 changed files with 12 additions and 12 deletions

View File

@ -3,7 +3,7 @@ from conans import CMake, ConanFile
class PocoTimerConan(ConanFile): class PocoTimerConan(ConanFile):
settings = "os", "compiler", "build_type", "arch" settings = "os", "compiler", "build_type", "arch"
requires = "opencv/4.0.1@conan/stable", "boost/1.69.0@conan/stable" requires = "opencv/4.0.1@conan/stable", "boost/1.69.0@conan/stable", "spdlog/1.3.1@bincrafters/stable"
generators = "cmake", "gcc", "txt" generators = "cmake", "gcc", "txt"
def imports(self): def imports(self):

View File

@ -1,24 +1,24 @@
#include "parseargs.hh" #include "parseargs.hh"
#include <iostream>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <spdlog/spdlog.h>
#include <string> #include <string>
int main(int ac, char **av) { int main(int ac, char **av) {
const auto [input_file, output_file, video_output] = parse_args(ac, av); const auto [input_file, output_file, video_output, iterations] =
std::cout << "Input file:\t" << input_file parse_args(ac, av);
<< "\nOutput file:\t" << output_file spdlog::info("Input file:\t{}", input_file);
<< "\nVideo output:\t" << ((video_output) ? "yes" : "no") << "\n"; spdlog::info("Output file:\t{}", output_file);
spdlog::info("Video output:\t{}", video_output);
spdlog::info("Iterations:\t{}", iterations);
cv::Mat image = cv::imread(input_file, cv::IMREAD_COLOR); // Read the file cv::Mat image = cv::imread(input_file, cv::IMREAD_COLOR); // Read the file
if (!image.data) { // Check for invalid input if (!image.data) { // Check for invalid input
std::cout << "Could not open or find the image\n"; spdlog::critical("Could not open or find image!\n");
return -1; return -1;
} }
std::cout << "Loaded image!\n"; spdlog::info("Image loaded!");
std::cout << "Width: " << image.size().width spdlog::info("Width:\t{}", image.size().width);
<< "\tHeight: " << image.size().height << '\n'; spdlog::info("Height:\t{}", image.size().height);
return 0; return 0;
} }