44   std::string 
const input = argc >= 2 ? argv[1] : 
"cameraman256";
 
   45   std::string 
const output = argc == 3 ? argv[2] : 
"none";
 
   47     std::cout << 
"Usage:\n" 
   50               << 
" [input [output]]\n\n" 
   51                  "- input: path to the image to clean (or name of standard SOPT image)\n" 
   52                  "- output: filename pattern for output image\n";
 
   56   auto const seed = std::time(
nullptr);
 
   57   std::srand(
static_cast<unsigned int>(seed));
 
   58   std::mt19937 
mersenne(std::time(
nullptr));
 
   70   auto const psi = sopt::gradient_operator::gradient_operator<Scalar>(image.rows(), image.cols());
 
   73   Vector const y0 = sampling * Vector::Map(image.data(), image.size());
 
   75   auto constexpr snr = 30.0;
 
   76   auto const sigma = y0.stableNorm() / std::sqrt(y0.size()) * std::pow(10.0, -(snr / 20.0));
 
   77   auto const epsilon = std::sqrt(nmeasure + 2 * std::sqrt(y0.size())) * 
sigma;
 
   80   std::normal_distribution<> gaussian_dist(0, 
sigma);
 
   84   if (output != 
"none") {
 
   87                                 "dirty_" + output + 
".tiff");
 
   89   const Vector grad = psi.adjoint() * (sampling.adjoint() * y);
 
   90   const sopt::t_real regulariser_strength = (grad.segment(0, image.size()).array().square() +
 
   91                               grad.segment(image.size(), image.size()).array().square())
 
  100                       .regulariser_strength(regulariser_strength)
 
  101                       .tau(0.5 / (1. + 1.))
 
  102                       .l2ball_proximal_epsilon(
epsilon)
 
  105                       .relative_variation(1e-4)
 
  107                       .positivity_constraint(
true);
 
  112   auto const diagnostic = pd();
 
  118   if (not diagnostic.good) {
 
  119     SOPT_HIGH_LOG(
"SOPT-primal-dual converged in {} iterations", diagnostic.niters);
 
  122   if (output != 
"none")
 
An operator that samples a set of measurements.
 
TVPrimalDual &::type Phi(ARGS &&... args)
 
TVPrimalDual< Scalar > & residual_convergence(Real const &tolerance)
Helper function to set-up default residual convergence function.
 
TVPrimalDual &::type Psi(ARGS &&... args)
 
std::unique_ptr< std::mt19937_64 > mersenne(new std::mt19937_64(0))
 
#define SOPT_HIGH_LOG(...)
High priority message.
 
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)
 
double t_real
Root of the type hierarchy for real numbers.
 
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