URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-05-15 Etienne FOLIO <folio(a)lrde.epita.fr>
Small cleanup.
* README: Howto.
* configure: Cleaned.
* morpho.cc: Cleaned.
---
README | 3 +++
configure | 2 +-
morpho.cc | 23 ++++-------------------
3 files changed, 8 insertions(+), 20 deletions(-)
Index: trunk/milena/sandbox/inim/2010/morpho/configure
===================================================================
--- trunk/milena/sandbox/inim/2010/morpho/configure (revision 3847)
+++ trunk/milena/sandbox/inim/2010/morpho/configure (revision 3848)
@@ -31,7 +31,7 @@
echo 'all: morpho' >> Makefile
echo '' >> Makefile
echo 'clean:' >> Makefile
-echo ' rm -f *~ \#*\# *.o morpho' >> Makefile
+echo ' rm -f *~ \#*\# *.o morpho a.out' >> Makefile
echo '' >> Makefile
echo '' >> Makefile
echo '' >> Makefile
Index: trunk/milena/sandbox/inim/2010/morpho/morpho.cc
===================================================================
--- trunk/milena/sandbox/inim/2010/morpho/morpho.cc (revision 3847)
+++ trunk/milena/sandbox/inim/2010/morpho/morpho.cc (revision 3848)
@@ -20,8 +20,7 @@
void
load_img(image2d<int_u8>& ima, const char* filename)
{
- std::cout << " => loadimag " << filename <<
"...";
- std::cout.flush();
+ std::cout << " => loadimag " << filename <<
"..." << std::endl;
// load.
image2d<bool> in;
@@ -31,30 +30,24 @@
int_u8 k = 1;
ima = level::convert(k, in);
ima = level::stretch(k, ima);
-
- std::cout << "................[DONE]" << std::endl;
}
void
revert_img(image2d<int_u8>& ima)
{
- std::cout << " => revert image...";
- std::cout.flush();
+ std::cout << " => revert image..." << std::endl;
// revert.
ima = arith::revert(ima);
- std::cout << "...................[DONE]" << std::endl;
}
void
gaussian_filter(image2d<int_u8>& ima, float gaussian_force)
{
- std::cout << " => applying gaussian filter...";
- std::cout.flush();
+ std::cout << " => applying gaussian filter..." << std::endl;
// gaussian filter.
ima = linear::gaussian(ima, gaussian_force, 1);
- std::cout << ".......[DONE]" << std::endl;
}
void
@@ -63,8 +56,7 @@
const unsigned k,
const unsigned lambda)
{
- std::cout << " => applying rank k filter...";
- std::cout.flush();
+ std::cout << " => applying rank k filter..." << std::endl;
// rank filter.
ima = morpho::rank_filter(ima, it, k);
@@ -75,8 +67,6 @@
ima(p) = mln_min(int_u8);
else
ima(p) = mln_max(int_u8);
-
- std::cout << ".........[DONE]" << std::endl;
}
void
@@ -113,12 +103,9 @@
image2d<int_u8> ima;
load_img(ima, input_filename);
image2d<int_u8> in(ima);
- //revert_img(ima);
- io::pgm::save(ima, "1.pgm");
// apply gaussian filter.
gaussian_filter(ima, gaussian_force);
- io::pgm::save(ima, "2.pgm");
// create window.
window2d window;
@@ -131,12 +118,10 @@
// apply k-rank filter.
rank_filter(ima, window, k, lambda);
- io::pgm::save(ima, "3.pgm");
// labelize.
label_8 nlabels = 0;
image2d<label_8> labels = labeling::regional_maxima(ima, c4(), nlabels);
- io::pgm::save(labels, "4.pgm");
// compute output image.
replace_with_labels(labels, in);
Index: trunk/milena/sandbox/inim/2010/morpho/README
===================================================================
--- trunk/milena/sandbox/inim/2010/morpho/README (revision 3847)
+++ trunk/milena/sandbox/inim/2010/morpho/README (revision 3848)
@@ -13,4 +13,7 @@
- then make
- then ./run.sh <input_image.pbm> <output_image.pgm>
+The input image has to be reverted, meaning that the background has to
+be black and the foreground white.
+
You can customize the input variables by editing the run.sh script.