Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olena
olena
Commits
2510005c
Commit
2510005c
authored
Feb 16, 2010
by
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
Changes
4
Show whitespace changes
Inline
Side-by-side
milena/sandbox/ChangeLog
View file @
2510005c
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>
Add some bench + canvas + subsampling + browsing code.
...
...
milena/sandbox/bin/labeling/colorize.cc
0 → 100644
View file @
2510005c
#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
]);
}
milena/sandbox/bin/pgm_to_pbm.cc
0 → 100644
View file @
2510005c
#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
]);
}
milena/sandbox/bin/ppm_negate.cc
0 → 100644
View file @
2510005c
#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
]);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment