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

Put a bug into light in mean_values.hh

	* green/bug/labeling/mean_values: New directory.
	* green/bug/labeling/mean_values/Makefile.am: New makefile.
	* green/bug/labeling/mean_values/mean_values.cc: New test code.
	* green/bug/labeling/mean_values/label.pgm: New resource for testing.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4615 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent cb5d520f
2009-10-07 Yann Jacquelet <jacquelet@lrde.epita.fr>
Put a bug into light in mean_values.hh
* green/bug/labeling/mean_values: New directory.
* green/bug/labeling/mean_values/Makefile.am: New makefile.
* green/bug/labeling/mean_values/mean_values.cc: New test code.
* green/bug/labeling/mean_values/label.pgm: New resource for testing.
2009-10-07 Yann Jacquelet <jacquelet@lrde.epita.fr>
Touch histo3d_rgb.
......
#
# 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/bug
BUILD__PATTERN= green/build/bug
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)
// Put into ligth the bug of mean_values_rgb
#include <mln/value/rgb.hh>
#include <mln/value/rgb8.hh>
#include <mln/value/label_8.hh>
#include <mln/core/image/image2d.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/ppm/save.hh>
#include <mln/data/transform.hh>
#include <mln/data/compute.hh>
#include <mln/accu/math/sup.hh>
#include <mln/fun/v2v/rgb8_to_rgbn.hh>
#include <mln/trace/quiet.hh>
#include <mln/labeling/mean_values.hh>
#include <mln/img_path.hh>
void test_mean_values_rgb()
{
typedef mln::value::rgb8 t_rgb8;
typedef mln::value::rgb<5> t_rgb5;
typedef mln::value::label_8 t_lbl8;
typedef mln::image2d<t_rgb5> t_image2d_rgb5;
typedef mln::image2d<t_rgb8> t_image2d_rgb8;
typedef mln::image2d<t_lbl8> t_image2d_lbl8;
t_image2d_rgb8 input_rgb8;
t_image2d_rgb5 input_rgb5;
t_image2d_lbl8 input_lbl8;
t_image2d_rgb8 output_rgb8;
t_lbl8 sup;
unsigned n_label;
mln::io::ppm::load(input_rgb8, OLENA_IMG_PATH"/house.ppm");
input_rgb5=mln::data::transform(input_rgb8, mln::fun::v2v::rgb8_to_rgbn<5>());
mln::io::pgm::load(input_lbl8, "label.pgm");
sup = mln::data::compute(mln::accu::meta::math::sup(), input_lbl8);
n_label = static_cast<unsigned>(sup) + 1;
output_rgb8 = mln::labeling::mean_values(input_rgb8, input_lbl8, n_label);
mln::io::ppm::save(output_rgb8, "output.ppm");
}
int main()
{
mln::trace::quiet = false;
test_mean_values_rgb();
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