camellia 2.5.10-i486-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +58 -0
- data/doc/README +58 -0
- data/doc/camellia.dox +205 -0
- data/doc/html/annotated.html +46 -0
- data/doc/html/camellia_8h-source.html +1350 -0
- data/doc/html/camellia_8h.html +4873 -0
- data/doc/html/doxygen.css +310 -0
- data/doc/html/doxygen.png +0 -0
- data/doc/html/files.html +27 -0
- data/doc/html/ftv2blank.png +0 -0
- data/doc/html/ftv2doc.png +0 -0
- data/doc/html/ftv2folderclosed.png +0 -0
- data/doc/html/ftv2folderopen.png +0 -0
- data/doc/html/ftv2lastnode.png +0 -0
- data/doc/html/ftv2link.png +0 -0
- data/doc/html/ftv2mlastnode.png +0 -0
- data/doc/html/ftv2mnode.png +0 -0
- data/doc/html/ftv2node.png +0 -0
- data/doc/html/ftv2plastnode.png +0 -0
- data/doc/html/ftv2pnode.png +0 -0
- data/doc/html/ftv2vertline.png +0 -0
- data/doc/html/functions.html +292 -0
- data/doc/html/functions_func.html +204 -0
- data/doc/html/functions_vars.html +177 -0
- data/doc/html/globals.html +172 -0
- data/doc/html/globals_defs.html +37 -0
- data/doc/html/globals_func.html +170 -0
- data/doc/html/hierarchy.html +46 -0
- data/doc/html/index.html +8 -0
- data/doc/html/main.html +21 -0
- data/doc/html/pages.html +23 -0
- data/doc/html/structCamArithmParams.html +61 -0
- data/doc/html/structCamBasin.html +63 -0
- data/doc/html/structCamBitmapFont.html +38 -0
- data/doc/html/structCamBlobInfo.html +91 -0
- data/doc/html/structCamBlobs.html +52 -0
- data/doc/html/structCamImage.html +791 -0
- data/doc/html/structCamLabelingResults.html +47 -0
- data/doc/html/structCamLinearFilterKernel.html +64 -0
- data/doc/html/structCamMeasuresResults.html +55 -0
- data/doc/html/structCamMorphoMathsKernel.html +82 -0
- data/doc/html/structCamPoint.html +47 -0
- data/doc/html/structCamRLEImage.html +184 -0
- data/doc/html/structCamROI.html +89 -0
- data/doc/html/structCamRun.html +57 -0
- data/doc/html/structCamSepFilterKernel.html +68 -0
- data/doc/html/structCamTable.html +47 -0
- data/doc/html/structCamTableOfBasins.html +38 -0
- data/doc/html/structCamVolbergFwdParams.html +47 -0
- data/doc/html/structCamWarpingParams.html +79 -0
- data/doc/html/tab_b.gif +0 -0
- data/doc/html/tab_l.gif +0 -0
- data/doc/html/tab_r.gif +0 -0
- data/doc/html/tabs.css +102 -0
- data/doc/html/todo.html +28 -0
- data/doc/html/tree.html +132 -0
- data/doc/rtf/refman.rtf +38378 -0
- data/ext/INSTALL +9 -0
- data/ext/Makefile +139 -0
- data/ext/camellia_ruby.i +308 -0
- data/ext/camellia_ruby_wrap.cxx +16086 -0
- data/ext/extconf.rb +4 -0
- data/ext/install.rb +11 -0
- data/ext/swig_ruby.dsp +159 -0
- data/inc/camellia.h +2624 -0
- data/inc/camellia_internals.h +192 -0
- data/lib/camellia-fox.rb +39 -0
- data/test/test_arithm.rb +13 -0
- data/test/test_color_labeling.rb +45 -0
- data/test/test_copy.rb +13 -0
- data/test/test_draw.rb +15 -0
- data/test/test_fixed_filters.rb +23 -0
- data/test/test_fox.rb +106 -0
- data/test/test_fox2.rb +108 -0
- data/test/test_histogram.rb +18 -0
- data/test/test_hough.rb +29 -0
- data/test/test_labeling.rb +30 -0
- data/test/test_mask.rb +34 -0
- data/test/test_watershed.rb +35 -0
- data/test/ts_camellia.rb +10 -0
- metadata +138 -0
data/ext/INSTALL
ADDED
data/ext/Makefile
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
|
|
2
|
+
SHELL = /bin/sh
|
|
3
|
+
|
|
4
|
+
#### Start of system configuration section. ####
|
|
5
|
+
|
|
6
|
+
srcdir = .
|
|
7
|
+
topdir = /usr/lib/ruby/1.8/i486-linux
|
|
8
|
+
hdrdir = $(topdir)
|
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
|
10
|
+
prefix = $(DESTDIR)/usr
|
|
11
|
+
exec_prefix = $(prefix)
|
|
12
|
+
sitedir = $(DESTDIR)/usr/local/lib/site_ruby
|
|
13
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
|
14
|
+
archdir = $(rubylibdir)/$(arch)
|
|
15
|
+
sbindir = $(exec_prefix)/sbin
|
|
16
|
+
datadir = $(prefix)/share
|
|
17
|
+
includedir = $(prefix)/include
|
|
18
|
+
infodir = $(prefix)/info
|
|
19
|
+
sysconfdir = $(DESTDIR)/etc
|
|
20
|
+
mandir = $(datadir)/man
|
|
21
|
+
libdir = $(exec_prefix)/lib
|
|
22
|
+
sharedstatedir = $(prefix)/com
|
|
23
|
+
oldincludedir = $(DESTDIR)/usr/include
|
|
24
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
|
25
|
+
bindir = $(exec_prefix)/bin
|
|
26
|
+
localstatedir = $(DESTDIR)/var
|
|
27
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
|
28
|
+
libexecdir = $(exec_prefix)/libexec
|
|
29
|
+
|
|
30
|
+
CC = gcc
|
|
31
|
+
LIBRUBY = $(LIBRUBY_SO)
|
|
32
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
|
33
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
|
34
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
|
35
|
+
|
|
36
|
+
CFLAGS = -fPIC -Wall -g -O2 -fPIC
|
|
37
|
+
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
|
|
38
|
+
CXXFLAGS = $(CFLAGS)
|
|
39
|
+
DLDFLAGS =
|
|
40
|
+
LDSHARED = g++ -shared -lCamellia
|
|
41
|
+
AR = ar
|
|
42
|
+
EXEEXT =
|
|
43
|
+
|
|
44
|
+
RUBY_INSTALL_NAME = ruby1.8
|
|
45
|
+
RUBY_SO_NAME = ruby1.8
|
|
46
|
+
arch = i486-linux
|
|
47
|
+
sitearch = i486-linux
|
|
48
|
+
ruby_version = 1.8
|
|
49
|
+
ruby = /usr/bin/ruby1.8
|
|
50
|
+
RUBY = $(ruby)
|
|
51
|
+
RM = rm -f
|
|
52
|
+
MAKEDIRS = mkdir -p
|
|
53
|
+
INSTALL = /usr/bin/install -c
|
|
54
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
|
55
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
|
56
|
+
COPY = cp
|
|
57
|
+
|
|
58
|
+
#### End of system configuration section. ####
|
|
59
|
+
|
|
60
|
+
preload =
|
|
61
|
+
|
|
62
|
+
libpath = $(libdir)
|
|
63
|
+
LIBPATH = -L"$(libdir)"
|
|
64
|
+
DEFFILE =
|
|
65
|
+
|
|
66
|
+
CLEANFILES =
|
|
67
|
+
DISTCLEANFILES =
|
|
68
|
+
|
|
69
|
+
extout =
|
|
70
|
+
extout_prefix =
|
|
71
|
+
target_prefix =
|
|
72
|
+
LOCAL_LIBS =
|
|
73
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lcrypt -lm -lc
|
|
74
|
+
SRCS = camellia_ruby_wrap.cxx
|
|
75
|
+
OBJS = camellia_ruby_wrap.o
|
|
76
|
+
TARGET = camellia
|
|
77
|
+
DLLIB = $(TARGET).so
|
|
78
|
+
STATIC_LIB =
|
|
79
|
+
|
|
80
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
|
81
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
|
82
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
|
83
|
+
|
|
84
|
+
TARGET_SO = $(DLLIB)
|
|
85
|
+
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
|
86
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
|
87
|
+
|
|
88
|
+
all: $(DLLIB)
|
|
89
|
+
static: $(STATIC_LIB)
|
|
90
|
+
|
|
91
|
+
clean:
|
|
92
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
|
93
|
+
|
|
94
|
+
distclean: clean
|
|
95
|
+
@-$(RM) Makefile extconf.h conftest.* mkmf.log
|
|
96
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
|
97
|
+
|
|
98
|
+
realclean: distclean
|
|
99
|
+
install: install-so install-rb
|
|
100
|
+
|
|
101
|
+
install-so: $(RUBYARCHDIR)
|
|
102
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
|
103
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
|
104
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
|
105
|
+
install-rb: pre-install-rb install-rb-default
|
|
106
|
+
install-rb-default: pre-install-rb-default
|
|
107
|
+
pre-install-rb: Makefile
|
|
108
|
+
pre-install-rb-default: Makefile
|
|
109
|
+
$(RUBYARCHDIR):
|
|
110
|
+
$(MAKEDIRS) $@
|
|
111
|
+
|
|
112
|
+
site-install: site-install-so site-install-rb
|
|
113
|
+
site-install-so: install-so
|
|
114
|
+
site-install-rb: install-rb
|
|
115
|
+
|
|
116
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
|
117
|
+
|
|
118
|
+
.cc.o:
|
|
119
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
|
120
|
+
|
|
121
|
+
.cxx.o:
|
|
122
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
|
123
|
+
|
|
124
|
+
.cpp.o:
|
|
125
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
|
126
|
+
|
|
127
|
+
.C.o:
|
|
128
|
+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
|
129
|
+
|
|
130
|
+
.c.o:
|
|
131
|
+
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
|
132
|
+
|
|
133
|
+
$(DLLIB): $(OBJS)
|
|
134
|
+
@-$(RM) $@
|
|
135
|
+
$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
$(OBJS): ruby.h defines.h
|
data/ext/camellia_ruby.i
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/* File : camellia_ruby.i */
|
|
2
|
+
%module camellia
|
|
3
|
+
|
|
4
|
+
%{
|
|
5
|
+
#include "../inc/camellia.h"
|
|
6
|
+
%}
|
|
7
|
+
|
|
8
|
+
%include "cstring.i"
|
|
9
|
+
|
|
10
|
+
%trackobjects;
|
|
11
|
+
|
|
12
|
+
// Bash
|
|
13
|
+
%rename("dealloc!") CamImage::dealloc();
|
|
14
|
+
|
|
15
|
+
%rename("erode_square3!") CamImage::erode_square3();
|
|
16
|
+
%rename("erode_circle5!") CamImage::erode_circle5();
|
|
17
|
+
%rename("erode_circle7!") CamImage::erode_circle7();
|
|
18
|
+
%rename("dilate_square3!") CamImage::dilate_square3();
|
|
19
|
+
%rename("dilate_circle5!") CamImage::dilate_circle5();
|
|
20
|
+
%rename("dilate_circle7!") CamImage::dilate_circle7();
|
|
21
|
+
%rename("morpho_gradient_square3!") CamImage::morpho_gradient_square3();
|
|
22
|
+
%rename("morpho_gradient_circle5!") CamImage::morpho_gradient_circle5();
|
|
23
|
+
%rename("morpho_gradient_circle7!") CamImage::morpho_gradient_circle7();
|
|
24
|
+
%rename("morpho_maths!") CamImage::morpho_maths(const CamMorphoMathsKernel &ker);
|
|
25
|
+
%rename("erode_3x3!") CamImage::erode_3x3(const CamMorphoMathsKernel &ker);
|
|
26
|
+
%rename("dilate_3x3!") CamImage::dilate_3x3(const CamMorphoMathsKernel &ker);
|
|
27
|
+
%rename("erode_5x5!") CamImage::erode_5x5(const CamMorphoMathsKernel &ker);
|
|
28
|
+
%rename("dilate_5x5!") CamImage::dilate_5x5(const CamMorphoMathsKernel &ker);
|
|
29
|
+
%rename("erode_7x7!") CamImage::erode_7x7(const CamMorphoMathsKernel &ker);
|
|
30
|
+
%rename("dilate_7x7!") CamImage::dilate_7x7(const CamMorphoMathsKernel &ker);
|
|
31
|
+
%rename("threshold!") CamImage::threshold();
|
|
32
|
+
%rename("threshold_inv!") CamImage::threshold_inv();
|
|
33
|
+
%rename("abs!") CamImage::abs();
|
|
34
|
+
%rename("set!") CamImage::set(int color);
|
|
35
|
+
|
|
36
|
+
%rename("linear_filter_3x3!") CamImage::linear_filter_3x3(const CamLinearFilterKernel &ker);
|
|
37
|
+
%rename("linear_filter_5x5!") CamImage::linear_filter_5x5(const CamLinearFilterKernel &ker);
|
|
38
|
+
%rename("linear_filter_abs_3x3!") CamImage::linear_filter_abs_3x3(const CamLinearFilterKernel &ker);
|
|
39
|
+
%rename("linear_filter_abs_5x5!") CamImage::linear_filter_abs_5x5(const CamLinearFilterKernel &ker);
|
|
40
|
+
%rename("sep_filter_3x3!") CamImage::sep_filter_3x3(const CamSepFilterKernel &ker);
|
|
41
|
+
%rename("sep_filter_5x5!") CamImage::sep_filter_5x5(const CamSepFilterKernel &ker);
|
|
42
|
+
%rename("sep_filter_7x7!") CamImage::sep_filter_7x7(const CamSepFilterKernel &ker);
|
|
43
|
+
%rename("sep_filter_abs_3x3!") CamImage::sep_filter_abs_3x3(const CamSepFilterKernel &ker);
|
|
44
|
+
%rename("sep_filter_abs_5x5!") CamImage::sep_filter_abs_5x5(const CamSepFilterKernel &ker);
|
|
45
|
+
%rename("sep_filter_abs_7x7!") CamImage::sep_filter_abs_7x7(const CamSepFilterKernel &ker);
|
|
46
|
+
%rename("sobel_v!") CamImage::sobel_v();
|
|
47
|
+
%rename("sobel_h!") CamImage::sobel_h();
|
|
48
|
+
%rename("sobel_v_abs!") CamImage::sobel_v_abs();
|
|
49
|
+
%rename("sobel_h_abs!") CamImage::sobel_h_abs();
|
|
50
|
+
%rename("fixed_filter!") CamImage::fixed_filter(int filter);
|
|
51
|
+
%rename("hierarchical_watershed_regions!") CamImage::hierarchical_watershed_regions(const CamTableOfBasins &tob);
|
|
52
|
+
|
|
53
|
+
%rename("arithm!") CamImage::arithm(int operation, int c1=0, int c2=0, int c3=0);
|
|
54
|
+
|
|
55
|
+
%rename("apply_lut!") CamImage::apply_lut(const CamTable &LUT);
|
|
56
|
+
%rename("apply_lut!") CamRLEImage::apply_lut(const CamTable &LUT);
|
|
57
|
+
|
|
58
|
+
%rename("inverse!") CamRLEImage::inverse();
|
|
59
|
+
%rename("labeling!") CamRLEImage::labeling();
|
|
60
|
+
%rename("labeling!") CamRLEImage::labeling(CamBlobs &results);
|
|
61
|
+
|
|
62
|
+
// Predicates
|
|
63
|
+
%rename("allocated?") CamImage::allocated() const;
|
|
64
|
+
|
|
65
|
+
// Other renaming
|
|
66
|
+
%rename("cam_rgb") camRGB(int r, int g, int b);
|
|
67
|
+
%rename("cam_rgba") camRGBA(int r, int g, int b);
|
|
68
|
+
%rename("cam_set_viewer") camSetImageViewer;
|
|
69
|
+
%rename("nb_runs") CamRLEImage::nbRuns;
|
|
70
|
+
%rename("nb_blobs") CamBlobs::nbBlobs;
|
|
71
|
+
|
|
72
|
+
// Aliases
|
|
73
|
+
%alias CamRLEImage::labeling "labelling!";
|
|
74
|
+
%alias CamImage::set_mask "mask=";
|
|
75
|
+
|
|
76
|
+
// Ruby idioms
|
|
77
|
+
%alias CamImage::get_pixels "to_s";
|
|
78
|
+
%alias CamImage::clone "dup";
|
|
79
|
+
|
|
80
|
+
%newobject CamImage::clone;
|
|
81
|
+
%newobject CamImage::encode;
|
|
82
|
+
%newobject CamImage::encode_threshold;
|
|
83
|
+
%newobject CamImage::encode_threshold_inv;
|
|
84
|
+
%newobject CamImage::encode_threshold_lut;
|
|
85
|
+
%newobject CamImage::labeling;
|
|
86
|
+
%newobject CamImage::to_yuv;
|
|
87
|
+
%newobject CamImage::to_rgb;
|
|
88
|
+
%newobject CamRLEImage::erode_cross;
|
|
89
|
+
%newobject CamRLEImage::erode_3x3;
|
|
90
|
+
%newobject CamRLEImage::erode_3x2;
|
|
91
|
+
|
|
92
|
+
// Garbage collection
|
|
93
|
+
%markfunc CamImage "mark_CamImage";
|
|
94
|
+
|
|
95
|
+
// Typemaps
|
|
96
|
+
|
|
97
|
+
// Correct string allocation for to_s
|
|
98
|
+
%cstring_output_allocate_size(char **result, int *len, delete[](*$1));
|
|
99
|
+
|
|
100
|
+
%include "typemaps.i"
|
|
101
|
+
%apply int *OUTPUT { int &xc };
|
|
102
|
+
%apply int *OUTPUT { int &yc };
|
|
103
|
+
%apply int *OUTPUT { int &rc };
|
|
104
|
+
|
|
105
|
+
%typemap(in) (const char *pixels, int sz)
|
|
106
|
+
{
|
|
107
|
+
$1=STR2CSTR($input);
|
|
108
|
+
$2=(int)RSTRING($input)->len;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
%typemap(in) (const int* const array, int sz)
|
|
112
|
+
{
|
|
113
|
+
Check_Type($input, T_ARRAY);
|
|
114
|
+
$2=RARRAY($input)->len;
|
|
115
|
+
if ($2) {
|
|
116
|
+
$1=new int[$2];
|
|
117
|
+
for (int i=0;i!=$2;i++) {
|
|
118
|
+
VALUE inst = rb_ary_entry($input, i);
|
|
119
|
+
$1[i]=NUM2INT(inst);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
$1=NULL;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
%typemap(freearg) (const int* const array, int sz)
|
|
127
|
+
{
|
|
128
|
+
if ($1) delete[] $1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Include header
|
|
132
|
+
|
|
133
|
+
%include "../inc/camellia.h"
|
|
134
|
+
|
|
135
|
+
// Additionnal defitions
|
|
136
|
+
|
|
137
|
+
#define CAM_COLORMODEL_GREY 0
|
|
138
|
+
#define CAM_COLORMODEL_RGB 1
|
|
139
|
+
#define CAM_COLORMODEL_RGBA 2
|
|
140
|
+
#define CAM_COLORMODEL_YUV 3
|
|
141
|
+
|
|
142
|
+
%mixin CamTable "Enumerable";
|
|
143
|
+
|
|
144
|
+
struct CamTable {
|
|
145
|
+
int size; ///< Number of valid entries
|
|
146
|
+
CamTable(int s=0);
|
|
147
|
+
bool set(const int* const array, int sz);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
%extend CamTable {
|
|
151
|
+
int __getitem__(int n) {
|
|
152
|
+
if ((n>=0)&&(n<self->size)&&(n<CAM_TABLE_SIZE)) return self->t[n];
|
|
153
|
+
else camError("CamTable","Index out of range");
|
|
154
|
+
return self->t[0];
|
|
155
|
+
};
|
|
156
|
+
void __setitem__(int n, int val) {
|
|
157
|
+
if ((n>=0)&&(n<self->size)&&(n<CAM_TABLE_SIZE)) self->t[n]=val;
|
|
158
|
+
else camError("CamTable","Index out of range");
|
|
159
|
+
};
|
|
160
|
+
void each() {
|
|
161
|
+
for (int i=0;i<self->size;i++) {
|
|
162
|
+
VALUE obj = INT2FIX(self->t[i]);
|
|
163
|
+
if (obj != Qnil) {
|
|
164
|
+
rb_yield(obj);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
struct CamRLEImage {
|
|
171
|
+
int id; ///< Frame id (user dependent)
|
|
172
|
+
%immutable;
|
|
173
|
+
int height; ///< Image height
|
|
174
|
+
int width; ///< Image width
|
|
175
|
+
int nbRuns; ///< The number of runs
|
|
176
|
+
int allocated; ///< Number of runs allocated
|
|
177
|
+
%mutable;
|
|
178
|
+
|
|
179
|
+
CamRLEImage() {allocated=0; runs=NULL; nbRuns=0;} ///< Default constructor
|
|
180
|
+
CamRLEImage(int nbruns); ///< Constructor with max number of runs parameter
|
|
181
|
+
CamRLEImage(const CamRLEImage &image); ///< Copy constructor
|
|
182
|
+
~CamRLEImage(); ///< Default destructor
|
|
183
|
+
|
|
184
|
+
CamRLEImage* clone() const; ///< Clone RLE image (using CamRLEClone() function)
|
|
185
|
+
bool alloc(int nbruns); ///< Allocator (C++ wrapping of CamRLEAllocate() function)
|
|
186
|
+
bool realloc(int nbruns); ///< Reallocator (C++ wrapping of CamRLEReallocate() function)
|
|
187
|
+
|
|
188
|
+
bool encode(const CamImage &image); ///< C++ wrapping for CamRLEEncode() function
|
|
189
|
+
bool encode_lut(const CamImage &image, const CamTable &LUT); ///< C++ wrapping for CamRLEEncodeLUT() function
|
|
190
|
+
bool encode_threshold(const CamImage &image, int threshold); ///< C++ wrapping for CamRLEEncodeThreshold() function
|
|
191
|
+
bool encode_threshold_inv(const CamImage &image, int threshold);///< C++ wrapping for CamRLEEncodeThresholdInv() function
|
|
192
|
+
bool encode_color(const CamImage &image, const CamTable &clusters); ///< C++ wrapping for camCamRLEEncodeColor() function
|
|
193
|
+
CamBlobs* labeling(); ///< C++ wrapping for CamRLELabeling() function
|
|
194
|
+
bool labeling(CamBlobs &results); ///< C++ wrapping for CamRLELabeling() function
|
|
195
|
+
bool blob_analysis(CamBlobs &results) const; ///< C++ wrapping for CamRLEBlobAnalysis() function
|
|
196
|
+
bool apply_lut(const CamTable &LUT); ///< C++ wrapping for CamRLEApplyLUT() function
|
|
197
|
+
bool apply_lut(CamRLEImage &dest, const CamTable &LUT) const; ///< C++ wrapping for CamRLEApplyLUT() function
|
|
198
|
+
bool decode(CamImage &dest) const; ///< C++ wrapping for CamRLEDecode() function
|
|
199
|
+
bool decode(CamImage &dest, const CamTable &LUT) const; ///< C++ wrapping for CamRLEDecode() function
|
|
200
|
+
bool decode_blobs(CamImage &dest) const; ///< C++ wrapping for CamRLEDecodeBlobs() function
|
|
201
|
+
bool decode_blobs(CamImage &dest, const CamTable &LUT) const; ///< C++ wrapping for CamRLEDecodeBlos() function
|
|
202
|
+
bool inverse(); ///< C++ wrapping for CamRLEInverse() function
|
|
203
|
+
bool erode_cross(CamRLEImage &dest) const; ///< C++ wrapping for CamRLEErodeCross() function
|
|
204
|
+
CamRLEImage *erode_cross() const; ///< C++ wrapping for CamRLEErodeCross() function
|
|
205
|
+
bool erode_3x3(CamRLEImage &dest) const; ///< C++ wrapping for CamRLEErode3x3() function
|
|
206
|
+
CamRLEImage *erode_3x3() const; ///< C++ wrapping for CamRLEErode3x3() function
|
|
207
|
+
bool erode_3x2(CamRLEImage &dest) const; ///< C++ wrapping for CamRLEErode3x2() function
|
|
208
|
+
CamRLEImage *erode_3x2() const; ///< C++ wrapping for CamRLEErode3x2() function
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
%immutable;
|
|
212
|
+
typedef struct {
|
|
213
|
+
int id;
|
|
214
|
+
int left; ///< Leftmost coordinate of the blob
|
|
215
|
+
int top; ///< Topmost coordinate of the blob
|
|
216
|
+
int width; ///< Width of the blob
|
|
217
|
+
int height; ///< Height of the blob
|
|
218
|
+
int surface; ///< Number of pixels covered by this blob
|
|
219
|
+
int cx; ///< Center of gravity (x)
|
|
220
|
+
int cy; ///< Center of gravity (y)
|
|
221
|
+
int value; ///< Blob value, or average pixel value in the original image
|
|
222
|
+
int min; ///< Minimum pixel value in the original image
|
|
223
|
+
int max; ///< Maximum pixel value in the original image
|
|
224
|
+
void *misc; ///< Additional user-dependant blob information
|
|
225
|
+
} CamBlobInfo;
|
|
226
|
+
|
|
227
|
+
%mixin CamBlobs "Enumerable";
|
|
228
|
+
|
|
229
|
+
struct CamBlobs {
|
|
230
|
+
int nbBlobs; ///< Number of valid blobs
|
|
231
|
+
CamBlobs() {nbBlobs=0;} ///< Default constructor
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
%extend CamBlobs {
|
|
235
|
+
CamBlobInfo __getitem__(int n) {
|
|
236
|
+
if ((n>=0)&&(n<self->nbBlobs)) return self->blobInfo[n];
|
|
237
|
+
else camError("CamBlobs","Index out of range");
|
|
238
|
+
return self->blobInfo[0];
|
|
239
|
+
};
|
|
240
|
+
void each() {
|
|
241
|
+
for (int i=0;i<self->nbBlobs;i++) {
|
|
242
|
+
VALUE obj = SWIG_NewPointerObj((new CamBlobInfo(self->blobInfo[i])), SWIGTYPE_p_CamBlobInfo, SWIG_POINTER_OWN);
|
|
243
|
+
if (obj != Qnil) {
|
|
244
|
+
rb_yield(obj);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
%mixin CamTableOfBasins "Enumerable";
|
|
251
|
+
|
|
252
|
+
struct CamTableOfBasins
|
|
253
|
+
{
|
|
254
|
+
int nbBasins;
|
|
255
|
+
void get_rid_of(CamBasin &basin) {basin.surface=-1;}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
%extend CamTableOfBasins {
|
|
259
|
+
CamBasin __getitem__(int n) {
|
|
260
|
+
if ((n>=0)&&(n<self->nbBasins)) return self->tab[n];
|
|
261
|
+
else camError("CamTableOfBasins","Index out of range");
|
|
262
|
+
return self->tab[0];
|
|
263
|
+
};
|
|
264
|
+
void each() {
|
|
265
|
+
for (int i=0;i<self->nbBasins;i++) {
|
|
266
|
+
VALUE obj = SWIG_NewPointerObj(&self->tab[i], SWIGTYPE_p_CamBasin, 0 );
|
|
267
|
+
if (obj != Qnil) {
|
|
268
|
+
rb_yield(obj);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
%mutable;
|
|
275
|
+
|
|
276
|
+
// Garbage collection implementation (mark & sweep)
|
|
277
|
+
%header %{
|
|
278
|
+
static void mark_CamImage(void *ptr) {
|
|
279
|
+
CamImage *image=(CamImage*)ptr;
|
|
280
|
+
if (image->roi) {
|
|
281
|
+
VALUE object = SWIG_RubyInstanceFor(image->roi);
|
|
282
|
+
if (object != Qnil) {
|
|
283
|
+
rb_gc_mark(object);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (image->mask) {
|
|
287
|
+
VALUE object = SWIG_RubyInstanceFor(image->mask);
|
|
288
|
+
if (object != Qnil) {
|
|
289
|
+
rb_gc_mark(object);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
%}
|
|
294
|
+
|
|
295
|
+
// Exception handling
|
|
296
|
+
%header %{
|
|
297
|
+
void camErrorRuby(char *module, char *error)
|
|
298
|
+
{
|
|
299
|
+
rb_raise(rb_eRuntimeError,"Error in %s : %s",module,error);
|
|
300
|
+
}
|
|
301
|
+
%}
|
|
302
|
+
|
|
303
|
+
// Set ruby error function
|
|
304
|
+
%init %{
|
|
305
|
+
camSetErrorFunct(camErrorRuby);
|
|
306
|
+
%}
|
|
307
|
+
|
|
308
|
+
|