Stub program that can display a jpg passed through cli

This commit is contained in:
King_DuckZ 2021-11-02 23:38:27 +01:00
parent b1c717ceb6
commit 2eaabd7a95
6 changed files with 66 additions and 1 deletions

9
links.txt Normal file
View File

@ -0,0 +1,9 @@
https://www.mtgsalvation.com/forums/magic-fundamentals/other-magic-products/third-party-products/337224-mtg-gatherer-extractor-v7-0-database-pics
https://github.com/devonmurphy/GathererImageGatherer
https://mtgjson.com/
https://gatherer.wizards.com/Pages/Default.aspx
https://www.youtube.com/watch?v=kbYDjBa3Lyk

View File

@ -0,0 +1,3 @@
#pragma once
#define PROGRAM_NAME "@PROGRAM_NAME@"

38
src/flann_maker/main.cpp Normal file
View File

@ -0,0 +1,38 @@
#include "config.h"
#include <opencv2/flann.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <stdexcept>
#include <string>
namespace mgs {
} //namespace mgs
int main (int argc, char* argv[]) {
using std::string;
using std::runtime_error;
if (2 != argc) {
std::cerr << "Wrong argument count " << argc - 1 << '\n';
return 2;
}
try {
cv::Mat image = cv::imread(argv[1]);
if (image.empty())
throw runtime_error(string("Unable to load image \"") + argv[1] + "\"");
cv::String win_name{PROGRAM_NAME};
cv::namedWindow(win_name);
cv::imshow(win_name, image);
cv::waitKey(0);
cv::destroyWindow(win_name);
}
catch (const runtime_error& err) {
std::cerr << "Unhandled exception: " << err.what() << '\n';
return 1;
}
return 0;
}

View File

@ -0,0 +1,15 @@
project_name = fs.name(meson.current_source_dir())
libopencv_dep = dependency('opencv4')
conf = configuration_data()
conf.set('PROGRAM_NAME', project_name)
config_file = configure_file(input: 'config.h.in', output: 'config.h', configuration: conf)
executable(project_name,
'main.cpp',
dependencies: [
libopencv_dep,
],
install: true,
)

View File

@ -1 +1,2 @@
subdir('recognition')
subdir('flann_maker')

View File

@ -20,4 +20,3 @@ executable(project_name,
],
install: true,
)