Commit 2510005c authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add new tools in bin sandbox.

	* bin/labeling/colorize.cc,
	* bin/pgm_to_pbm.cc,
	* bin/ppm_negate.cc: New.
parent 304dee05
2010-02-16 Guillaume Lazzara <z@lrde.epita.fr>
Add new tools in bin sandbox.
* bin/labeling/colorize.cc,
* bin/pgm_to_pbm.cc,
* bin/ppm_negate.cc: New.
2009-11-17 Thierry Geraud <thierry.geraud@lrde.epita.fr> 2009-11-17 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Add some bench + canvas + subsampling + browsing code. Add some bench + canvas + subsampling + browsing code.
......
#include <mln/core/concept/function.hh>
#include <mln/core/image/image2d.hh>
#include <mln/value/rgb8.hh>
#include <mln/value/label_8.hh>
#include <mln/io/ppm/save.hh>
#include <mln/io/pgm/load.hh>
#include <mln/labeling/colorize.hh>
int main(int argc, char *argv[])
{
using namespace mln;
if (argc < 3)
std::cout << "Usage : " << argv[0]
<< " input_label_8.pgm out.ppm" << std::endl;
image2d<value::label_8> input;
io::pgm::load(input, argv[1]);
io::ppm::save(labeling::colorize(value::rgb8(), input), argv[2]);
}
#include <mln/core/image/image2d.hh>
#include <mln/core/concept/function.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/pbm/save.hh>
#include <mln/data/transform.hh>
#include <mln/value/int_u8.hh>
namespace mln
{
struct to_bin : public Function_v2v<to_bin>
{
typedef bool result;
bool operator()(const value::int_u8& v) const
{
return v != 0;
}
};
}
int main(int argc, char *argv[])
{
using namespace mln;
if (argc < 3)
{
std::cout << "Usage: " << argv[1] << " input.pgm out.pbm" << std::endl;
return 1;
}
image2d<value::int_u8> input;
io::pgm::load(input, argv[1]);
to_bin f;
io::pbm::save(data::transform(input, f), argv[2]);
}
#include <mln/core/concept/function.hh>
#include <mln/core/image/image2d.hh>
#include <mln/value/rgb8.hh>
#include <mln/io/ppm/all.hh>
#include <mln/arith/revert.hh>
#include <mln/data/transform.hh>
namespace mln
{
struct rgb_negate : Function_v2v<rgb_negate>
{
typedef value::rgb8 result;
result operator()(const value::rgb8& v) const
{
value::rgb8 tmp(255 - v.red(), 255 - v.green(), 255 - v.blue());
return tmp;
}
};
} // end of namespace mln
int main(int argc, char *argv[])
{
using namespace mln;
if (argc < 3)
{
std::cout << "Usage: " << argv[0] << " input.ppm output.ppm"
<< std::endl;
return 1;
}
image2d<value::rgb8> input;
io::ppm::load(input, argv[1]);
io::ppm::save(data::transform(input, rgb_negate()), argv[2]);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment