From 13fd4101f993e22bc0b51ae9237ee782173f9415 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sat, 1 Apr 2017 21:44:04 +0200
Subject: unsharp-mask
---
unsharp-mask.cc | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 unsharp-mask.cc
diff --git a/unsharp-mask.cc b/unsharp-mask.cc
new file mode 100644
index 0000000..f5cbeb1
--- /dev/null
+++ b/unsharp-mask.cc
@@ -0,0 +1,37 @@
+#include
+#include
+#include "opencv2/opencv.hpp"
+#include "opencv2/photo/photo.hpp"
+#include "cxxopts/src/cxxopts.hpp"
+
+using namespace std;
+using namespace cv;
+
+int
+main (int argc, char** argv)
+{
+ cxxopts::Options opt(argv[0], " - Options");
+ opt.add_options()
+ ("f,file", "file", cxxopts::value())
+ ("s,sigma", "sigma for Gaussian Blur", cxxopts::value()->default_value("3.0"))
+ ("a,alpha", "weight of the first array elements", cxxopts::value()->default_value("1.5"))
+ ("b,beta", "weight of the second array elements", cxxopts::value()->default_value("-0.5"))
+ ("g,gamma", "scalar added to each sum", cxxopts::value()->default_value("0"))
+ ("o,output", "output file", cxxopts::value());
+
+ opt.parse(argc, argv);
+
+ auto& file = opt["f"].as();
+ auto& output = opt["o"].as();
+ float sigma = opt["s"].as();
+ float alpha = opt["a"].as();
+ float beta = opt["b"].as();
+
+ Mat src = imread(file, 1), dst;
+ cv::GaussianBlur(src, dst, cv::Size(0, 0), sigma);
+ cv::addWeighted(src, alpha, dst, beta, 0, dst);
+ imwrite(output, dst);
+
+ return 0;
+}
+
--
cgit v1.2.3