camellia 2.7.0-x86-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.
Files changed (136) hide show
  1. data/CamelliaLib-2.7.0.tar.gz +0 -0
  2. data/README +59 -0
  3. data/doc/README +58 -0
  4. data/doc/camellia.dox +205 -0
  5. data/doc/html/annotated.html +52 -0
  6. data/doc/html/camellia_8h-source.html +1618 -0
  7. data/doc/html/camellia_8h.html +4583 -0
  8. data/doc/html/doxygen.css +358 -0
  9. data/doc/html/doxygen.png +0 -0
  10. data/doc/html/files.html +29 -0
  11. data/doc/html/ftv2blank.png +0 -0
  12. data/doc/html/ftv2doc.png +0 -0
  13. data/doc/html/ftv2folderclosed.png +0 -0
  14. data/doc/html/ftv2folderopen.png +0 -0
  15. data/doc/html/ftv2lastnode.png +0 -0
  16. data/doc/html/ftv2link.png +0 -0
  17. data/doc/html/ftv2mlastnode.png +0 -0
  18. data/doc/html/ftv2mnode.png +0 -0
  19. data/doc/html/ftv2node.png +0 -0
  20. data/doc/html/ftv2plastnode.png +0 -0
  21. data/doc/html/ftv2pnode.png +0 -0
  22. data/doc/html/ftv2vertline.png +0 -0
  23. data/doc/html/functions.html +108 -0
  24. data/doc/html/functions_0x62.html +78 -0
  25. data/doc/html/functions_0x63.html +112 -0
  26. data/doc/html/functions_0x64.html +113 -0
  27. data/doc/html/functions_0x65.html +102 -0
  28. data/doc/html/functions_0x66.html +82 -0
  29. data/doc/html/functions_0x67.html +76 -0
  30. data/doc/html/functions_0x68.html +88 -0
  31. data/doc/html/functions_0x69.html +90 -0
  32. data/doc/html/functions_0x6b.html +70 -0
  33. data/doc/html/functions_0x6c.html +88 -0
  34. data/doc/html/functions_0x6d.html +93 -0
  35. data/doc/html/functions_0x6e.html +79 -0
  36. data/doc/html/functions_0x6f.html +74 -0
  37. data/doc/html/functions_0x70.html +72 -0
  38. data/doc/html/functions_0x72.html +73 -0
  39. data/doc/html/functions_0x73.html +130 -0
  40. data/doc/html/functions_0x74.html +82 -0
  41. data/doc/html/functions_0x76.html +74 -0
  42. data/doc/html/functions_0x77.html +75 -0
  43. data/doc/html/functions_0x78.html +72 -0
  44. data/doc/html/functions_0x79.html +77 -0
  45. data/doc/html/functions_0x7e.html +76 -0
  46. data/doc/html/functions_func.html +93 -0
  47. data/doc/html/functions_func_0x62.html +64 -0
  48. data/doc/html/functions_func_0x63.html +83 -0
  49. data/doc/html/functions_func_0x64.html +99 -0
  50. data/doc/html/functions_func_0x65.html +95 -0
  51. data/doc/html/functions_func_0x66.html +74 -0
  52. data/doc/html/functions_func_0x67.html +72 -0
  53. data/doc/html/functions_func_0x68.html +76 -0
  54. data/doc/html/functions_func_0x69.html +70 -0
  55. data/doc/html/functions_func_0x6c.html +76 -0
  56. data/doc/html/functions_func_0x6d.html +78 -0
  57. data/doc/html/functions_func_0x6f.html +65 -0
  58. data/doc/html/functions_func_0x70.html +64 -0
  59. data/doc/html/functions_func_0x72.html +65 -0
  60. data/doc/html/functions_func_0x73.html +113 -0
  61. data/doc/html/functions_func_0x74.html +74 -0
  62. data/doc/html/functions_func_0x76.html +64 -0
  63. data/doc/html/functions_func_0x77.html +64 -0
  64. data/doc/html/functions_func_0x7e.html +72 -0
  65. data/doc/html/functions_vars.html +290 -0
  66. data/doc/html/globals.html +368 -0
  67. data/doc/html/globals_defs.html +41 -0
  68. data/doc/html/globals_func.html +364 -0
  69. data/doc/html/index.html +11 -0
  70. data/doc/html/main.html +22 -0
  71. data/doc/html/pages.html +24 -0
  72. data/doc/html/structCamAffineTransform.html +37 -0
  73. data/doc/html/structCamArithmParams.html +60 -0
  74. data/doc/html/structCamBasin.html +62 -0
  75. data/doc/html/structCamBitmapFont.html +37 -0
  76. data/doc/html/structCamBlobInfo.html +90 -0
  77. data/doc/html/structCamBlobs.html +51 -0
  78. data/doc/html/structCamImage.html +853 -0
  79. data/doc/html/structCamKeypoint.html +79 -0
  80. data/doc/html/structCamKeypoints.html +99 -0
  81. data/doc/html/structCamKeypointsKdTree.html +42 -0
  82. data/doc/html/structCamKeypointsMatches.html +54 -0
  83. data/doc/html/structCamLabelingResults.html +46 -0
  84. data/doc/html/structCamLinearFilterKernel.html +63 -0
  85. data/doc/html/structCamMeasuresResults.html +54 -0
  86. data/doc/html/structCamMorphoMathsKernel.html +81 -0
  87. data/doc/html/structCamPoint.html +46 -0
  88. data/doc/html/structCamRLEImage.html +183 -0
  89. data/doc/html/structCamROI.html +80 -0
  90. data/doc/html/structCamRun.html +56 -0
  91. data/doc/html/structCamSepFilterKernel.html +67 -0
  92. data/doc/html/structCamTable.html +46 -0
  93. data/doc/html/structCamTableOfBasins.html +37 -0
  94. data/doc/html/structCamVolbergFwdParams.html +46 -0
  95. data/doc/html/structCamWarpingParams.html +70 -0
  96. data/doc/html/tab_b.gif +0 -0
  97. data/doc/html/tab_l.gif +0 -0
  98. data/doc/html/tab_r.gif +0 -0
  99. data/doc/html/tabs.css +102 -0
  100. data/doc/html/todo.html +29 -0
  101. data/doc/html/tree.html +106 -0
  102. data/doc/rtf/refman.rtf +7866 -0
  103. data/ext/Makefile +149 -0
  104. data/ext/README +12 -0
  105. data/ext/camellia_ruby.i +493 -0
  106. data/ext/camellia_ruby_wrap.cxx +21103 -0
  107. data/ext/extconf.rb +12 -0
  108. data/ext/install.rb +11 -0
  109. data/ext/swig_ruby.dsp +159 -0
  110. data/ext/swig_ruby.vcproj +290 -0
  111. data/ext/test.rb +31 -0
  112. data/inc/SHLWAPI.H +661 -0
  113. data/inc/cam_capture.h +202 -0
  114. data/inc/camellia.h +2651 -0
  115. data/inc/camellia_internals.h +205 -0
  116. data/inc/config.h +62 -0
  117. data/inc/config.h.in +61 -0
  118. data/inc/stamp-h1 +1 -0
  119. data/lib/camellia-fox.rb +39 -0
  120. data/test/test_arithm.rb +13 -0
  121. data/test/test_capture.rb +15 -0
  122. data/test/test_color_labeling.rb +45 -0
  123. data/test/test_copy.rb +13 -0
  124. data/test/test_draw.rb +15 -0
  125. data/test/test_fixed_filters.rb +23 -0
  126. data/test/test_fox.rb +106 -0
  127. data/test/test_fox2.rb +108 -0
  128. data/test/test_histogram.rb +18 -0
  129. data/test/test_hough.rb +29 -0
  130. data/test/test_keypoints.rb +106 -0
  131. data/test/test_labeling.rb +30 -0
  132. data/test/test_mask.rb +34 -0
  133. data/test/test_warping.rb +46 -0
  134. data/test/test_watershed.rb +35 -0
  135. data/test/ts_camellia.rb +12 -0
  136. metadata +204 -0
@@ -0,0 +1,205 @@
1
+ /** \file camellia_internals.h
2
+ * \brief Camellia Image Processing Library header file
3
+ * \author Bruno STEUX (ENSMP)
4
+ *
5
+ * Camellia Image Processing Library
6
+ *
7
+
8
+ The Camellia Image Processing Library is an open source low-level image processing library.
9
+ As it uses the IplImage structure to describe images, it is a good replacement to the IPL (Intel) library
10
+ and a good complement to the OpenCV library. It includes a lot of functions for image processing
11
+ (filtering, morphological mathematics, labeling, warping, loading/saving images, etc.),
12
+ some of them being highly optimized; It is also cross-platform and robust. It is doxygen-documented
13
+ and examples of use are provided.
14
+
15
+ This software library is an outcome of the Camellia european project (IST-2001-34410).
16
+ It was developped by the Ecole des Mines de Paris (ENSMP), in coordination with
17
+ the other partners of the project.
18
+
19
+ ==========================================================================
20
+
21
+ Copyright (c) 2002-2007, Ecole des Mines de Paris - Centre de Robotique
22
+ All rights reserved.
23
+
24
+ Redistribution and use in source and binary forms, with or without
25
+ modification, are permitted provided that the following conditions are met:
26
+
27
+ * Redistributions of source code must retain the above copyright
28
+ notice, this list of conditions and the following disclaimer.
29
+ * Redistributions in binary form must reproduce the above copyright
30
+ notice, this list of conditions and the following disclaimer
31
+ in the documentation and/or other materials provided with the distribution.
32
+ * Neither the name of the Ecole des Mines de Paris nor the names of
33
+ its contributors may be used to endorse or promote products
34
+ derived from this software without specific prior written permission.
35
+
36
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
38
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
40
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
41
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
42
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
43
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
44
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
45
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
46
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47
+
48
+ ==========================================================================
49
+
50
+ */
51
+
52
+ #ifndef _CAMELLIA_INTERNALS_H_
53
+ #define _CAMELLIA_INTERNALS_H_
54
+
55
+ #ifdef __cplusplus
56
+ extern "C" {
57
+ #endif
58
+
59
+ // Binary images management
60
+ #ifdef CAM_64BITS
61
+ #ifdef _WIN32
62
+ #define CAM_BIT_BLOCK unsigned __int64
63
+ #else
64
+ #define CAM_BIT_BLOCK unsigned long long int
65
+ #endif
66
+ #define CAM_BIT_BLOCK_SIZE_SHIFT 6
67
+ #ifndef CAM_BIG_ENDIAN
68
+ #ifdef _WIN32
69
+ #define CAM_BIT_BLOCK_SWAP(x) ( \
70
+ (((x)&0x00000000000000ffi64)<<56)| \
71
+ (((x)&0x000000000000ff00i64)<<40)| \
72
+ (((x)&0x0000000000ff0000i64)<<24)| \
73
+ (((x)&0x00000000ff000000i64)<< 8)| \
74
+ (((x)&0x000000ff00000000i64)>> 8)| \
75
+ (((x)&0x0000ff0000000000i64)>>24)| \
76
+ (((x)&0x00ff000000000000i64)>>40)| \
77
+ (((x)&0xff00000000000000i64)>>56))
78
+ #else
79
+ #define CAM_BIT_BLOCK_SWAP(x) ( \
80
+ (((x)&0x00000000000000ffull)<<56)| \
81
+ (((x)&0x000000000000ff00ull)<<40)| \
82
+ (((x)&0x0000000000ff0000ull)<<24)| \
83
+ (((x)&0x00000000ff000000ull)<< 8)| \
84
+ (((x)&0x000000ff00000000ull)>> 8)| \
85
+ (((x)&0x0000ff0000000000ull)>>24)| \
86
+ (((x)&0x00ff000000000000ull)>>40)| \
87
+ (((x)&0xff00000000000000ull)>>56))
88
+ #endif //_WIN32
89
+ #else
90
+ #define CAM_BIT_BLOCK_SWAP(x) (x)
91
+ #endif
92
+ #else
93
+ #define CAM_BIT_BLOCK unsigned int
94
+ #define CAM_BIT_BLOCK_SIZE_SHIFT 5
95
+ #ifndef CAM_BIG_ENDIAN
96
+ #define CAM_BIT_BLOCK_SWAP(x) ((((x)&0x000000ff)<<24)|(((x)&0x0000ff00)<<8)|(((x)&0x00ff0000)>>8)|(((x)&0xff000000)>>24))
97
+ #else
98
+ #define CAM_BIT_BLOCK_SWAP(x) (x)
99
+ #endif
100
+ #endif
101
+ #define CAM_BIT_BLOCK_SIZE (sizeof(CAM_BIT_BLOCK)*8)
102
+
103
+ // Internal functions
104
+ typedef struct {
105
+ unsigned char *srcptr;
106
+ unsigned char *dstptr;
107
+ CamROI srcroi; // Source ROI after clipping
108
+ CamROI dstroi; // Dest ROI after clipping
109
+ int srcchoffset; // Channel offset for the source
110
+ int dstchoffset; // Channel offset for the destination image
111
+ int nChannels; // Number of effective channels (considering ROIs)
112
+ int srcinc; // Pixel to pixel increment
113
+ int dstinc; // Pixel to pixel increment
114
+ int srclinc; // Line to line increment
115
+ int dstlinc; // Line to line increment
116
+ int srcpinc; // Plane to plane increment
117
+ int dstpinc; // Plane to plane increment
118
+
119
+ int mask_xOffset;// Offset when mask doesn't fit within image boundaries
120
+ int mask_yOffset;// Offset when mask doesn't fit within image boundaries
121
+ CamRLEImage *mask; // Mask to be applied to the operation
122
+ CamRLEImage auto_mask; // Automatically allocated if provided mask is not RLE
123
+ } CamInternalROIPolicyStruct;
124
+
125
+ #define CAM_MASK_SUPPORT 1
126
+ #define CAM_IGNORE_COI_MISMATCH 2
127
+ #define CAM_NO_ROI_INTERSECTION 4
128
+
129
+ int camInternalROIPolicy(CamImage* src, CamImage *dst, CamInternalROIPolicyStruct *res, int options);
130
+ void camInternalROIPolicyExit(CamInternalROIPolicyStruct *res); // Call to this function is necessary only when the caller manages image bit-masking
131
+
132
+ const char *camGetErrorStr();
133
+ void camSetErrorStr(const char *s);
134
+
135
+ // Check arguments
136
+ #ifndef CAM_OPTIMIZE
137
+ #define CAM_CHECK_ARGS(function, condition) \
138
+ if (!(condition)) {camError(#function, "Bad argument : " #condition);return 0;}
139
+ #else
140
+ #define CAM_CHECK_ARGS(function, condition)
141
+ #endif
142
+
143
+ #ifndef CAM_OPTIMIZE
144
+ #define CAM_CHECK_ARGS2(function, condition, text) \
145
+ if (!(condition)) {camError(#function, "Bad argument : " #text);return 0;}
146
+ #else
147
+ #define CAM_CHECK_ARGS2(function, condition, text)
148
+ #endif
149
+
150
+ #ifndef CAM_OPTIMIZE
151
+ #define CAM_CHECK(function, condition) \
152
+ if (!(condition)) {camError(#function, NULL);return 0;}
153
+ #else
154
+ #define CAM_CHECK(function, condition)
155
+ #endif
156
+
157
+ // Mask management macros
158
+
159
+ #define DECLARE_MASK_MANAGEMENT \
160
+ CamRun *run; \
161
+ int startx,endx
162
+
163
+ #define INIT_MASK_MANAGEMENT \
164
+ if (iROI.mask) { \
165
+ run=iROI.mask->runs+1; \
166
+ while (run->line!=iROI.mask_yOffset) run++; \
167
+ } else { \
168
+ run=NULL; \
169
+ }
170
+
171
+ #define BEGIN_MASK_MANAGEMENT(code) \
172
+ startx=-iROI.mask_xOffset; \
173
+ do { \
174
+ if (!iROI.mask) { \
175
+ endx=width; \
176
+ } else { \
177
+ do { \
178
+ while ((run->value==0)&&(run->line==y+iROI.mask_yOffset)) { \
179
+ startx+=run->length; \
180
+ run++; \
181
+ } \
182
+ if (run->line!=y+iROI.mask_yOffset) break; \
183
+ endx=startx+run->length; \
184
+ } while ((endx<=0)&&(run++)); \
185
+ if (run->line!=y+iROI.mask_yOffset) break; \
186
+ if (startx<0) startx=0; \
187
+ if (startx>width) startx=width; \
188
+ if (endx>width) endx=width; \
189
+ code \
190
+ }
191
+
192
+ #define END_MASK_MANAGEMENT \
193
+ if (iROI.mask) { \
194
+ startx=endx; \
195
+ run++; \
196
+ } \
197
+ } while ((run)&&(run->line==y+iROI.mask_yOffset));
198
+
199
+ #ifdef __cplusplus
200
+ }
201
+ #endif
202
+
203
+
204
+ #endif
205
+
@@ -0,0 +1,62 @@
1
+ /* inc/config.h. Generated from config.h.in by configure. */
2
+ /* inc/config.h.in. Generated from configure.in by autoheader. */
3
+
4
+ /* Define to 1 if you have the <dlfcn.h> header file. */
5
+ #define HAVE_DLFCN_H 1
6
+
7
+ /* Define to 1 if you have the <inttypes.h> header file. */
8
+ #define HAVE_INTTYPES_H 1
9
+
10
+ /* Define to 1 if you have the `m' library (-lm). */
11
+ #define HAVE_LIBM 1
12
+
13
+ /* Define to 1 if you have the <linux/videodev.h> header file. */
14
+ #define HAVE_LINUX_VIDEODEV_H 1
15
+
16
+ /* Define to 1 if you have the <memory.h> header file. */
17
+ #define HAVE_MEMORY_H 1
18
+
19
+ /* Define to 1 if you have the <stdint.h> header file. */
20
+ #define HAVE_STDINT_H 1
21
+
22
+ /* Define to 1 if you have the <stdlib.h> header file. */
23
+ #define HAVE_STDLIB_H 1
24
+
25
+ /* Define to 1 if you have the <strings.h> header file. */
26
+ #define HAVE_STRINGS_H 1
27
+
28
+ /* Define to 1 if you have the <string.h> header file. */
29
+ #define HAVE_STRING_H 1
30
+
31
+ /* Define to 1 if you have the <sys/stat.h> header file. */
32
+ #define HAVE_SYS_STAT_H 1
33
+
34
+ /* Define to 1 if you have the <sys/types.h> header file. */
35
+ #define HAVE_SYS_TYPES_H 1
36
+
37
+ /* Define to 1 if you have the <unistd.h> header file. */
38
+ #define HAVE_UNISTD_H 1
39
+
40
+ /* Name of package */
41
+ #define PACKAGE "CamelliaLib"
42
+
43
+ /* Define to the address where bug reports for this package should be sent. */
44
+ #define PACKAGE_BUGREPORT ""
45
+
46
+ /* Define to the full name of this package. */
47
+ #define PACKAGE_NAME ""
48
+
49
+ /* Define to the full name and version of this package. */
50
+ #define PACKAGE_STRING ""
51
+
52
+ /* Define to the one symbol short name of this package. */
53
+ #define PACKAGE_TARNAME ""
54
+
55
+ /* Define to the version of this package. */
56
+ #define PACKAGE_VERSION ""
57
+
58
+ /* Define to 1 if you have the ANSI C header files. */
59
+ #define STDC_HEADERS 1
60
+
61
+ /* Version number of package */
62
+ #define VERSION "2.7.0"
@@ -0,0 +1,61 @@
1
+ /* inc/config.h.in. Generated from configure.in by autoheader. */
2
+
3
+ /* Define to 1 if you have the <dlfcn.h> header file. */
4
+ #undef HAVE_DLFCN_H
5
+
6
+ /* Define to 1 if you have the <inttypes.h> header file. */
7
+ #undef HAVE_INTTYPES_H
8
+
9
+ /* Define to 1 if you have the `m' library (-lm). */
10
+ #undef HAVE_LIBM
11
+
12
+ /* Define to 1 if you have the <linux/videodev.h> header file. */
13
+ #undef HAVE_LINUX_VIDEODEV_H
14
+
15
+ /* Define to 1 if you have the <memory.h> header file. */
16
+ #undef HAVE_MEMORY_H
17
+
18
+ /* Define to 1 if you have the <stdint.h> header file. */
19
+ #undef HAVE_STDINT_H
20
+
21
+ /* Define to 1 if you have the <stdlib.h> header file. */
22
+ #undef HAVE_STDLIB_H
23
+
24
+ /* Define to 1 if you have the <strings.h> header file. */
25
+ #undef HAVE_STRINGS_H
26
+
27
+ /* Define to 1 if you have the <string.h> header file. */
28
+ #undef HAVE_STRING_H
29
+
30
+ /* Define to 1 if you have the <sys/stat.h> header file. */
31
+ #undef HAVE_SYS_STAT_H
32
+
33
+ /* Define to 1 if you have the <sys/types.h> header file. */
34
+ #undef HAVE_SYS_TYPES_H
35
+
36
+ /* Define to 1 if you have the <unistd.h> header file. */
37
+ #undef HAVE_UNISTD_H
38
+
39
+ /* Name of package */
40
+ #undef PACKAGE
41
+
42
+ /* Define to the address where bug reports for this package should be sent. */
43
+ #undef PACKAGE_BUGREPORT
44
+
45
+ /* Define to the full name of this package. */
46
+ #undef PACKAGE_NAME
47
+
48
+ /* Define to the full name and version of this package. */
49
+ #undef PACKAGE_STRING
50
+
51
+ /* Define to the one symbol short name of this package. */
52
+ #undef PACKAGE_TARNAME
53
+
54
+ /* Define to the version of this package. */
55
+ #undef PACKAGE_VERSION
56
+
57
+ /* Define to 1 if you have the ANSI C header files. */
58
+ #undef STDC_HEADERS
59
+
60
+ /* Version number of package */
61
+ #undef VERSION
@@ -0,0 +1 @@
1
+ timestamp for inc/config.h
@@ -0,0 +1,39 @@
1
+ require 'rubygems'
2
+ require_gem 'fxruby'
3
+
4
+ require 'camellia'
5
+ include Camellia
6
+
7
+ class Fox::FXImage
8
+ def to_camellia
9
+ s=FXStream.new
10
+ mem=" "*(width*height*4)
11
+ s.open(FXStreamSave, width*height*4, mem)
12
+ unbound_savePixels=FXImage.instance_method(:savePixels)
13
+ bound_savePixels=unbound_savePixels.bind(self)
14
+ bound_savePixels.call(s)
15
+ image=CamImage.new(width, height, CAM_DEPTH_8U, CAM_COLORMODEL_RGBA)
16
+ image.set_pixels(mem)
17
+ return image
18
+ end
19
+ end
20
+
21
+ class Camellia::CamImage
22
+ def to_fox(app, picture=nil)
23
+ if picture==nil
24
+ pict=FXImage.new(app, nil, IMAGE_OWNED|IMAGE_KEEP, width, height)
25
+ else
26
+ pict=picture
27
+ end if
28
+ image=CamImage.new(width, height, CAM_DEPTH_8U, CAM_COLORMODEL_RGBA)
29
+ copy(image)
30
+ FXStream.new { |stream|
31
+ stream.open(FXStreamLoad, image.imageSize, image.to_s)
32
+ unbound_loadPixels=FXImage.instance_method(:loadPixels)
33
+ bound_loadPixels=unbound_loadPixels.bind(pict)
34
+ bound_loadPixels.call(stream)
35
+ }
36
+ return pict
37
+ end
38
+ end
39
+
@@ -0,0 +1,13 @@
1
+ require 'test/unit'
2
+ require 'lib/camellia'
3
+ include Camellia
4
+ class TestArithm < Test::Unit::TestCase
5
+ def test_arithm
6
+ source=CamImage.new
7
+ # load picture chess.pgm
8
+ source.load_pgm("resources/chess.pgm")
9
+ n=source.arithm(source,source,CAM_SUB)
10
+ # resulting pixel sum should be 0
11
+ assert_equal(n,0)
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ require 'test/unit'
2
+ require 'lib/camellia'
3
+ include Camellia
4
+
5
+ class TestCapture < Test::Unit::TestCase
6
+ def test_capture
7
+ image=CamImage.new
8
+ camera=CamCapture2.new
9
+ for i in 1..30 do
10
+ camera.capture(image)
11
+ puts "Grabbed image #{i}"
12
+ end
13
+ image.save_bmp('output/capture.bmp')
14
+ end
15
+ end
@@ -0,0 +1,45 @@
1
+ require 'test/unit'
2
+ require 'lib/camellia'
3
+ include Camellia
4
+ class TestLabeling < Test::Unit::TestCase
5
+ def test_labeling
6
+
7
+ # load picture alfa156.bmp
8
+ image=CamImage.new
9
+ image.load_bmp("resources/alfa156.bmp")
10
+ yuv=image.to_yuv
11
+
12
+ # set color clusters
13
+ clusters=CamTable.new
14
+ clusters.set([
15
+ # Ymin Ymax Umin Umax Vmin Vmax
16
+ 0, 60, 0, 255, 0, 255, # Black
17
+ 230, 255, 0, 255, 0, 255, # White
18
+ 0, 255, 0, 255, 140, 255 # Red
19
+ ])
20
+ cluster_colors=[cam_rgb(0,0,0),cam_rgb(255,255,255),cam_rgb(255,0,0)]
21
+
22
+ # threshold and encode
23
+ encoded=yuv.encode_color(clusters)
24
+ puts "Number of runs : #{encoded.nb_runs}"
25
+
26
+ # labeling
27
+ blobs=encoded.labeling!
28
+ puts "#{blobs.nb_blobs} blobs detected"
29
+
30
+ # print and deaw the results
31
+ i=0
32
+ blobs.each {|b|
33
+ puts "Blob #{i} : Val=#{b.value} (#{b.top},#{b.left},#{b.width},#{b.height}) Surface=#{b.surface}"
34
+ image.draw_rectangle(b.left,b.top,b.left+b.width-1,b.top+b.height-1,cluster_colors[b.value-1])
35
+ i=i+1
36
+ }
37
+
38
+ # save the result
39
+ image.save_bmp("output/ruby_alfa156_labeling.bmp")
40
+
41
+ # assertions
42
+ assert_equal(encoded.nb_runs,3026)
43
+ assert_equal(blobs.nb_blobs,190)
44
+ end
45
+ end