22 #include "tools_for_tests/directories.h"
26 int main(
int argc,
char const **argv) {
39 std::string
const input = argc >= 2 ? argv[1] :
"cameraman256";
40 std::string
const output = argc == 3 ? argv[2] :
"none";
42 std::cout <<
"Usage:\n"
45 <<
" [input [output]]\n\n"
46 "- input: path to the image to clean (or name of standard SOPT image)\n"
47 "- output: filename pattern for output image\n";
51 auto const seed = std::time(
nullptr);
52 std::srand(
static_cast<unsigned int>(seed));
53 std::mt19937
mersenne(std::time(
nullptr));
65 std::make_tuple(std::string{
"DB1"}, 2u),
66 std::make_tuple(std::string{
"DB1"}, 3u)};
67 auto const psi = sopt::linear_transform<Scalar>(sara, image.rows(), image.cols());
70 Vector const y0 = sampling * Vector::Map(image.data(), image.size());
71 auto constexpr snr = 30.0;
72 auto const sigma = y0.stableNorm() / std::sqrt(y0.size()) * std::pow(10.0, -(snr / 20.0));
73 auto const epsilon = std::sqrt(nmeasure + 2 * std::sqrt(y0.size())) *
sigma;
76 std::normal_distribution<> gaussian_dist(0,
sigma);
80 if (output !=
"none") {
83 "dirty_" + output +
".tiff");
89 .regulariser_strength(1e-1)
90 .relative_variation(5e-4)
91 .l2ball_proximal_epsilon(
epsilon)
93 .l1_proximal_tolerance(1e-2)
95 .l1_proximal_itermax(50)
96 .l1_proximal_positivity_constraint(
true)
97 .l1_proximal_real_constraint(
true)
99 .lagrange_update_scale(0.9)
106 auto const min_delta =
sigma * std::sqrt(y.size()) / std::sqrt(8 * image.size());
117 SOPT_MEDIUM_LOG(
"SOPT-proximal-ADMM converged in {} iterations", diagnostic.niters);
118 if (output !=
"none")
An operator that samples a set of measurements.
ImagingProximalADMM< Scalar > & residual_convergence(Real const &tolerance)
Helper function to set-up default residual convergence function.
Sparsity Averaging Reweighted Analysis.
std::unique_ptr< std::mt19937_64 > mersenne(new std::mt19937_64(0))
int main(int argc, char const **argv)
#define SOPT_MEDIUM_LOG(...)
Medium priority message.
Reweighted< ALGORITHM > reweighted(ALGORITHM const &algo, typename Reweighted< ALGORITHM >::t_SetWeights const &set_weights, typename Reweighted< ALGORITHM >::t_Reweightee const &reweightee)
Factory function to create an l0-approximation by reweighting an l1 norm.
void write_tiff(Image<> const &image, std::string const &filename)
Writes a tiff greyscale file.
int t_int
Root of the type hierarchy for signed integers.
Vector< T > dirty(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image, RANDOM &mersenne)
size_t t_uint
Root of the type hierarchy for unsigned integers.
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
real_type< T >::type epsilon(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
real_type< T >::type sigma(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A matrix of a given type.
sopt::Vector< Scalar > Vector
sopt::Matrix< Scalar > Matrix
sopt::Image< Scalar > Image