$extrastylesheet
Olena
User documentation 2.1
An Image Processing Platform
Scribo
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
to_pgm.cc
1
#include <mln/core/image/image2d.hh>
2
#include <mln/value/int_u8.hh>
3
#include <mln/value/rgb8.hh>
4
#include <mln/io/magick/load.hh>
5
#include <mln/io/pgm/save.hh>
6
7
#include <scribo/debug/usage.hh>
8
9
10
const
char
*args_desc[][2] =
11
{
12
{
"input.*"
,
"A color image."
},
13
{
"output.pgm"
,
"A graylevel image."
},
14
{0, 0}
15
};
16
17
18
19
int
main(
int
argc,
char
*argv[])
20
{
21
using namespace
mln;
22
23
if
(argc != 3)
24
return
scribo::debug::usage
(argv,
25
"Convert a color image using the minimum RGB component value as intensity."
,
26
"input.* output.pgm"
,
27
args_desc);
28
29
30
typedef
image2d<value::rgb8>
I;
31
I ima;
32
io::magick::load
(ima, argv[1]);
33
34
image2d<value::int_u8>
out;
35
initialize
(out, ima);
36
37
value::rgb8 v;
38
mln_piter_(I)
p
(ima.domain());
39
for_all(
p
)
40
{
41
v = ima(p);
42
out(p) =
std::min
(v.red(),
std::min
(v.green(), v.blue()));
43
}
44
45
io::pgm::save
(out, argv[2]);
46
}
scribo
src
preprocessing
to_pgm.cc
Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)