Commit 0b4e1c0a authored by Yann Jacquelet's avatar Yann Jacquelet
Browse files

Plot the red/green histo on every scribo images.

	* green/demo/accu/stat/histo2d: New directory.
	* green/demo/accu/stat/histo2d/Makefile.am: New makefile.
	* green/demo/accu/stat/histo2d/histo2d.cc: New demo executable.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4629 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent fa621a80
2009-10-13 Yann Jacquelet <jacquelet@lrde.epita.fr>
Plot the red/green histo on every scribo images.
* green/demo/accu/stat/histo2d: New directory.
* green/demo/accu/stat/histo2d/Makefile.am: New makefile.
* green/demo/accu/stat/histo2d/histo2d.cc: New demo executable.
2009-10-13 Yann Jacquelet <jacquelet@lrde.epita.fr>
Improve plotting library with a new method.
* green/mln/io/plot/save_image_sh.hh
(save_image_sh_array_array_image1d_vec2): Add new method.
2009-10-13 Yann Jacquelet <jacquelet@lrde.epita.fr>
Add new directory location for ppm scribo image.
* green/mln/img_path.hh: Add SCRIBO_PPM_IMAGE_PATH macro.
2009-10-13 Yann Jacquelet <jacquelet@lrde.epita.fr>
Make the milena image loading example works.
......
#
# Generic Makefile
#
#########
# TOOLS #
#########
INCLUDES= -I$(HOME)/svn/oln/trunk/milena/sandbox/green
CXXFLAGS= -ggdb -O0 -Wall -W -pedantic -ansi -pipe $(INCLUDES)
ECHO= echo
RM= rm
MKDIR= mkdir -p
CP= cp
SOURCE_PATTERN= green/demo
BUILD__PATTERN= green/build/demo
ifeq ($(findstring $(BUILD__PATTERN),$(PWD)), $(BUILD__PATTERN))
# Case where make is done from build directory.
SOURCE_DIR= $(subst $(BUILD__PATTERN),$(SOURCE_PATTERN),$(PWD))
BUILD__DIR= $(PWD)/
else
# Case where make is done from source directory.
SOURCE_DIR= $(PWD)/
BUILD__DIR= $(subst $(SOURCE_PATTERN),$(BUILD__PATTERN),$(PWD))
endif
SRC= $(notdir $(wildcard $(SOURCE_DIR)/*.cc))
OLD= $(notdir $(wildcard $(SOURCE_DIR)/*~))
OBJ= $(patsubst %.cc,%.o,$(SRC))
SOURCE_MAKEFILE=Makefile.am
BUILD__MAKEFILE=Makefile
TARGET_FILE= $(notdir $(PWD))
SOURCE_FILES= $(notdir $(wildcard $(SOURCE_DIR)/*.*))
BUILD__FILES= $(filter-out $(SRC) $(SOURCE_MAKEFILE), $(SOURCE_FILES))
BUILD__F_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__FILES))
SOURCE_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_FILES))
BUILD__M_PATH= $(addprefix $(BUILD__DIR)/,$(BUILD__MAKEFILE))
SOURCE_M_PATH= $(addprefix $(SOURCE_DIR)/,$(SOURCE_MAKEFILE))
TARGET_F_PATH= $(addprefix $(BUILD__DIR)/,$(TARGET_FILE))
OBJ_F_PATH= $(addprefix $(BUILD__DIR)/,$(OBJ))
SRC_F_PATH= $(addprefix $(SOURCE_DIR)/,$(SRC))
OLD_F_PATH= $(addprefix $(SOURCE_DIR)/,$(OLD))
#############
# BOOTSTRAP #
#############
bootstrap: $(BUILD__DIR) $(BUILD__F_PATH) $(BUILD__M_PATH)
# Create, if nessary, the destination directory
$(BUILD__DIR):
$(MKDIR) $(BUILD__DIR)
# Copy, if nessary, all the files, except the Makefile.am
$(BUILD__F_PATH): $(SOURCE_F_PATH)
$(CP) $(addprefix $(SOURCE_DIR),$(@F)) $@
# Copy if nessary, the Makefile.am into Makefile
$(BUILD__M_PATH): $(SOURCE_M_PATH)
$(CP) $(SOURCE_M_PATH) $(BUILD__M_PATH)
#######
# ALL #
#######
# We assume that the call is done from the build directory.
# With the directive vpath, hidden files are found in the source directory.
all: $(TARGET_F_PATH)
$(TARGET_F_PATH): $(OBJ_F_PATH)
$(LINK.cc) $< $(LOADLIBES) $(LDLIBS) -o $@
$(OBJ_F_PATH):$(SRC_F_PATH)
$(COMPILE.cc) $(OUTPUT_OPTION) $<
#########
# CLEAN #
#########
# Force every time the deletion
clean: clean_target clean_obj clean_dst clean_old #clean_make
clean_target:
-@$(RM) $(TARGET_F_PATH) &> /dev/null
clean_obj:
-@$(RM) $(OBJ_F_PATH) &> /dev/null
clean_dst:
-@$(RM) $(BUILD_F_PATH) &> /dev/null
clean_make:
-@$(RM) $(BUILD_M_PATH) &> /dev/null
clean_old:
-@$(RM) $(OLD_F_PATH) &> /dev/null
#########
# PRINT #
#########
print: print_tools print_bootstrap
print_tools:
@$(ECHO) "HOME = $(HOME)"
@$(ECHO) "INCLUDES = $(INCLUDES)"
@$(ECHO) "CXXFLAGS = $(CXXFLAGS)"
@$(ECHO) "ECHO = $(ECHO)"
@$(ECHO) "RM = $(RM)"
@$(ECHO) "MKDIR = $(MKDIR)"
@$(ECHO) "CP = $(CP)"
@$(ECHO)
print_bootstrap:
@$(ECHO) "PWD = $(PWD)"
@$(ECHO) "SOURCE_PATTERN = $(SOURCE_PATTERN)"
@$(ECHO) "BUILD__PATTERN = $(BUILD__PATTERN)"
@$(ECHO) "SOURCE_DIR = $(SOURCE_DIR)"
@$(ECHO) "BUILD__DIR = $(BUILD__DIR)"
@$(ECHO) "SOURCE_MAKEFILE = $(SOURCE_MAKEFILE)"
@$(ECHO) "BUILD__MAKEFILE = $(BUILD__MAKEFILE)"
@$(ECHO) "TARGET_FILE = $(TARGET_FILE)"
@$(ECHO) "SOURCE_FILES = $(SOURCE_FILES)"
@$(ECHO) "SOURCE_F_PATH = $(SOURCE_F_PATH)"
@$(ECHO) "BUILD__FILES = $(BUILD__FILES)"
@$(ECHO) "BUILD__F_PATH = $(BUILD__F_PATH)"
@$(ECHO) "BUILD__M_PATH = $(BUILD__M_PATH)"
@$(ECHO) "SOURCE_M_PATH = $(SOURCE_M_PATH)"
@$(ECHO) "SRC = $(SRC)"
@$(ECHO) "OBJ = $(OBJ)"
@$(ECHO) "OLD = $(OLD)"
@$(ECHO) "SRC_F_PATH = $(SRC_F_PATH)"
@$(ECHO) "OBJ_F_PATH = $(OBJ_F_PATH)"
@$(ECHO) "OLD_F_PATH = $(OLD_F_PATH)"
@$(ECHO)
// DEMO HISTO2D
#include <mln/clustering/kmean2d.hh>
#include <iostream>
#include <sstream>
#include <mln/img_path.hh>
#include <mln/pw/value.hh>
#include <mln/value/int_u8.hh>
#include <mln/value/label_8.hh>
#include <mln/value/rgb8.hh>
#include <mln/value/value_array.hh>
#include <mln/core/macros.hh>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb8_to_rgbn.hh>
#include <mln/fun/v2v/component.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/pgm/save.hh>
#include <mln/io/ppm/save.hh>
#include <mln/io/plot/save_image_sh.hh>
#include <mln/value/rg.hh>
#include <mln/fun/v2v/rgb_to_rg.hh>
#include <mln/fun/v2v/rg_to_rgb.hh>
#include <mln/accu/stat/histo2d.hh>
#include <mln/data/compute.hh>
#include <mln/arith/revert.hh>
#include <mln/morpho/elementary/dilation.hh>
#include <mln/morpho/elementary/opening.hh>
#include <mln/labeling/regional_maxima.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/core/routine/initialize.hh>
#include <mln/literal/colors.hh>
#include <mln/morpho/watershed/flooding.hh>
//
// Test kmean image processing chain.
// Ok pour la convergence.
// demander à Théo pour le temps (45 sec pour chaque launching)
//
std::string get_file_name(std::string fqn)
{
size_t found = fqn.find_last_of("/\\");
return fqn.substr(found+1);
}
void do_demo(const std::string& image)
{
typedef mln::value::rg<8> t_rg8;
typedef mln::value::rgb8 t_rgb8;
typedef mln::image2d<t_rgb8> t_image2d_rgb8;
typedef mln::image2d<t_rg8> t_image2d_rg8;
typedef mln::fun::v2v::rgb_to_rg<8> t_rgb_to_rg;
typedef mln::fun::v2v::rg_to_rgb<8> t_rg_to_rgb;
typedef mln::image2d<unsigned> t_image2d_histo;
t_image2d_rgb8 in_rgb8;
t_image2d_rg8 in_rg8;
t_image2d_histo out;
mln::io::ppm::load(in_rgb8, image.c_str());
in_rg8 = mln::data::transform(in_rgb8, t_rgb_to_rg());
out = mln::data::compute(mln::accu::meta::stat::histo2d(), in_rg8);
std::string saving_file_name = get_file_name(image);
saving_file_name += ".histo.sh";
mln::io::plot::save_image_sh(out, saving_file_name);
}
int main()
{
std::string array[] = {SCRIBO_PPM_IMG_PATH"/mp00032c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00042c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00076c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00082c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00142c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00215c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00228c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00234c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00248c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00252c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00253c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00255c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00259c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00262c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00263c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00271c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00290c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00293c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00304c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00307c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00311c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00319c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00329c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00376c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00319c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00411c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00419c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00440c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00447c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00498c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00510c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00550c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00573c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00589c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00592c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00597c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00599c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00608c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00630c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/mp00631c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00028c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00031c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00034c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00036c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00037c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00039c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00040c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00043c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00046c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00049c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00055c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00057c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00063c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00065c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00068c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00072c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00073c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00081c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00083c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00089c_50p.ppm",
SCRIBO_PPM_IMG_PATH"/ta00090c_50p.ppm"};
for (unsigned i = 0; i < 61; ++i)
do_demo(array[i]);
return 0;
}
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