Merge lp:~joseluis-hidalgo+launchpad/artoolkitplus/ARToolkitPlus-win into lp:artoolkitplus
- ARToolkitPlus-win
- Merge into trunk
Proposed by
Jose L. Hidalgo Valiño
Status: | Merged |
---|---|
Merged at revision: | 97 |
Proposed branch: | lp:~joseluis-hidalgo+launchpad/artoolkitplus/ARToolkitPlus-win |
Merge into: | lp:artoolkitplus |
Diff against target: |
744 lines (+207/-112) 18 files modified
CMakeLists.txt (+45/-0) include/ARToolKitPlus/Camera.h (+3/-4) include/ARToolKitPlus/Tracker.h (+9/-9) include/ARToolKitPlus/TrackerMultiMarker.h (+1/-1) include/ARToolKitPlus/TrackerSingleMarker.h (+2/-2) include/ARToolKitPlus/ar.h (+3/-3) include/ARToolKitPlus/arBitFieldPattern.h (+3/-3) include/ARToolKitPlus/arGetInitRot2Sub.h (+2/-2) include/ARToolKitPlus/arMulti.h (+2/-2) include/ARToolKitPlus/config.h (+32/-0) include/ARToolKitPlus/extra/BCH.h (+3/-1) include/ARToolKitPlus/extra/Hull.h (+14/-12) include/ARToolKitPlus/extra/rpp.h (+3/-1) include/ARToolKitPlus/matrix.h (+9/-9) include/ARToolKitPlus/vector.h (+6/-6) src/Tracker.cpp (+1/-0) src/TrackerSingleMarker.cpp (+2/-2) src/core/arGetCode.cpp (+67/-55) |
To merge this branch: | bzr merge lp:~joseluis-hidalgo+launchpad/artoolkitplus/ARToolkitPlus-win |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Pavel Rojtberg | Approve | ||
Review via email: mp+39896@code.launchpad.net |
Commit message
Description of the change
Added support for Windows+
apart from adding a macro to export symbols in visual studio I changed some code related to some matrix creation on heap, Visual Studio doesn't support C99 VLAs.
Also added a CmakeLists.txt to compile using Cmake, but that's optional.
To post a comment you must log in.
Revision history for this message
Pavel Rojtberg (rojtberg) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
3 | +++ CMakeLists.txt 2010-11-02 21:11:10 +0000 | |||
4 | @@ -0,0 +1,45 @@ | |||
5 | 1 | cmake_minimum_required(VERSION 2.4) | ||
6 | 2 | project( AR ) | ||
7 | 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) | ||
8 | 4 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | ||
9 | 5 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) | ||
10 | 6 | |||
11 | 7 | link_directories( ${LIBRARY_OUTPUT_PATH} ) | ||
12 | 8 | include_directories( "${AR_SOURCE_DIR}/include" ) | ||
13 | 9 | |||
14 | 10 | # ARToolkitPlus core files (headers and sources) | ||
15 | 11 | file(GLOB_RECURSE HEADERS_AR "${AR_SOURCE_DIR}/include/ARToolkitPlus/*.h") | ||
16 | 12 | file(GLOB SOURCES_AR | ||
17 | 13 | "${AR_SOURCE_DIR}/src/*.cpp" | ||
18 | 14 | "${AR_SOURCE_DIR}/src/core/*.cpp" | ||
19 | 15 | "${AR_SOURCE_DIR}/src/extra/*.cpp" | ||
20 | 16 | "${AR_SOURCE_DIR}/src/librpp/*.cpp" | ||
21 | 17 | ) | ||
22 | 18 | |||
23 | 19 | add_library(ARToolkitPlus | ||
24 | 20 | SHARED | ||
25 | 21 | ${HEADERS_AR} | ||
26 | 22 | ${SOURCES_AR} | ||
27 | 23 | ) | ||
28 | 24 | |||
29 | 25 | set_target_properties(ARToolkitPlus PROPERTIES DEBUG_POSTFIX d) | ||
30 | 26 | |||
31 | 27 | if(WIN32) | ||
32 | 28 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) | ||
33 | 29 | add_definitions(-DAR_LIBRARY) | ||
34 | 30 | else(WIN32) | ||
35 | 31 | set(CMAKE_C_FLAGS_DEBUG "-Wall -g ") | ||
36 | 32 | set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g ") | ||
37 | 33 | endif(WIN32) | ||
38 | 34 | |||
39 | 35 | if(SLB_BUILD_TESTS) | ||
40 | 36 | enable_testing() | ||
41 | 37 | add_subdirectory(tests) | ||
42 | 38 | endif(SLB_BUILD_TESTS) | ||
43 | 39 | |||
44 | 40 | if(SLB_BUILD_EXAMPLES) | ||
45 | 41 | file(GLOB ALL_EXAMPLES "${SLB_SOURCE_DIR}/examples/*") | ||
46 | 42 | foreach(example ${ALL_EXAMPLES}) | ||
47 | 43 | add_subdirectory(${example}) | ||
48 | 44 | endforeach(example) | ||
49 | 45 | endif(SLB_BUILD_EXAMPLES) | ||
50 | 0 | 46 | ||
51 | === modified file 'include/ARToolKitPlus/Camera.h' | |||
52 | --- include/ARToolKitPlus/Camera.h 2010-02-09 14:44:21 +0000 | |||
53 | +++ include/ARToolKitPlus/Camera.h 2010-11-02 21:11:10 +0000 | |||
54 | @@ -25,7 +25,6 @@ | |||
55 | 25 | #include <string> | 25 | #include <string> |
56 | 26 | #include <ARToolKitPlus/config.h> | 26 | #include <ARToolKitPlus/config.h> |
57 | 27 | 27 | ||
58 | 28 | using std::string; | ||
59 | 29 | 28 | ||
60 | 30 | namespace ARToolKitPlus { | 29 | namespace ARToolKitPlus { |
61 | 31 | 30 | ||
62 | @@ -36,7 +35,7 @@ | |||
63 | 36 | * this class used to be called ARParam in the classical ARToolkit | 35 | * this class used to be called ARParam in the classical ARToolkit |
64 | 37 | * so do not wonder because of the method names | 36 | * so do not wonder because of the method names |
65 | 38 | */ | 37 | */ |
67 | 39 | class Camera { | 38 | class AR_EXPORT Camera { |
68 | 40 | public: | 39 | public: |
69 | 41 | int xsize, ysize; | 40 | int xsize, ysize; |
70 | 42 | ARFloat mat[3][4]; | 41 | ARFloat mat[3][4]; |
71 | @@ -48,9 +47,9 @@ | |||
72 | 48 | Camera* clone(); | 47 | Camera* clone(); |
73 | 49 | bool changeFrameSize(const int frameWidth, const int frameHeight); | 48 | bool changeFrameSize(const int frameWidth, const int frameHeight); |
74 | 50 | void printSettings(); | 49 | void printSettings(); |
76 | 51 | string getFileName() const; | 50 | std::string getFileName() const; |
77 | 52 | protected: | 51 | protected: |
79 | 53 | string fileName; | 52 | std::string fileName; |
80 | 54 | 53 | ||
81 | 55 | // http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html | 54 | // http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html |
82 | 56 | ARFloat cc[2]; | 55 | ARFloat cc[2]; |
83 | 57 | 56 | ||
84 | === modified file 'include/ARToolKitPlus/Tracker.h' | |||
85 | --- include/ARToolKitPlus/Tracker.h 2010-03-05 14:31:19 +0000 | |||
86 | +++ include/ARToolKitPlus/Tracker.h 2010-11-02 21:11:10 +0000 | |||
87 | @@ -32,7 +32,6 @@ | |||
88 | 32 | 32 | ||
89 | 33 | #include <vector> | 33 | #include <vector> |
90 | 34 | 34 | ||
91 | 35 | using std::vector; | ||
92 | 36 | 35 | ||
93 | 37 | namespace ARToolKitPlus { | 36 | namespace ARToolKitPlus { |
94 | 38 | 37 | ||
95 | @@ -50,7 +49,7 @@ | |||
96 | 50 | * - TrackerSingleMarker | 49 | * - TrackerSingleMarker |
97 | 51 | * - TrackerMultiMarker | 50 | * - TrackerMultiMarker |
98 | 52 | */ | 51 | */ |
100 | 53 | class Tracker { | 52 | class AR_EXPORT Tracker { |
101 | 54 | public: | 53 | public: |
102 | 55 | Tracker(int imWidth, int imHeight, int maxImagePatterns = 8, int pattWidth = 6, int pattHeight = 6, int pattSamples = 6, | 54 | Tracker(int imWidth, int imHeight, int maxImagePatterns = 8, int pattWidth = 6, int pattHeight = 6, int pattSamples = 6, |
103 | 56 | int maxLoadPatterns = 0); | 55 | int maxLoadPatterns = 0); |
104 | @@ -338,7 +337,7 @@ | |||
105 | 338 | int | 337 | int |
106 | 339 | arGetCode(uint8_t *image, int *x_coord, int *y_coord, int *vertex, int *code, int *dir, ARFloat *cf, int thresh); | 338 | arGetCode(uint8_t *image, int *x_coord, int *y_coord, int *vertex, int *code, int *dir, ARFloat *cf, int thresh); |
107 | 340 | 339 | ||
109 | 341 | int arGetPatt(uint8_t *image, int *x_coord, int *y_coord, int *vertex, uint8_t **ext_pat[3]); | 340 | int arGetPatt(uint8_t *image, int *x_coord, int *y_coord, int *vertex, uint8_t *ext_pat); |
110 | 342 | 341 | ||
111 | 343 | int pattern_match(uint8_t *data, int *code, int *dir, ARFloat *cf); | 342 | int pattern_match(uint8_t *data, int *code, int *dir, ARFloat *cf); |
112 | 344 | 343 | ||
113 | @@ -501,7 +500,7 @@ | |||
114 | 501 | arPrevInfo *prev_info; | 500 | arPrevInfo *prev_info; |
115 | 502 | int prev_num; | 501 | int prev_num; |
116 | 503 | 502 | ||
118 | 504 | vector<vector<arPrevInfo> > sprev_info; | 503 | std::vector<std::vector<arPrevInfo> > sprev_info; |
119 | 505 | int sprev_num[2]; | 504 | int sprev_num[2]; |
120 | 506 | 505 | ||
121 | 507 | // arDetectMarker2.cpp | 506 | // arDetectMarker2.cpp |
122 | @@ -514,16 +513,16 @@ | |||
123 | 514 | // arGetCode.cpp | 513 | // arGetCode.cpp |
124 | 515 | int pattern_num; | 514 | int pattern_num; |
125 | 516 | int *patf; | 515 | int *patf; |
127 | 517 | vector<vector<vector<int> > > pat; | 516 | std::vector<std::vector<std::vector<int> > > pat; |
128 | 518 | ARFloat (*patpow)[4]; | 517 | ARFloat (*patpow)[4]; |
130 | 519 | vector<vector<vector<int> > > patBW; | 518 | std::vector<std::vector<std::vector<int> > > patBW; |
131 | 520 | ARFloat (*patpowBW)[4]; | 519 | ARFloat (*patpowBW)[4]; |
132 | 521 | 520 | ||
134 | 522 | vector<vector<ARFloat> > evec; | 521 | std::vector<std::vector<ARFloat> > evec; |
135 | 523 | ARFloat (*epat)[4][EVEC_MAX]; | 522 | ARFloat (*epat)[4][EVEC_MAX]; |
136 | 524 | int evec_dim; | 523 | int evec_dim; |
137 | 525 | int evecf; | 524 | int evecf; |
139 | 526 | vector<vector<ARFloat> > evecBW; | 525 | std::vector<std::vector<ARFloat> > evecBW; |
140 | 527 | ARFloat (*epatBW)[4][EVEC_MAX]; | 526 | ARFloat (*epatBW)[4][EVEC_MAX]; |
141 | 528 | int evec_dimBW; | 527 | int evec_dimBW; |
142 | 529 | int evecBWf; | 528 | int evecBWf; |
143 | @@ -592,7 +591,8 @@ | |||
144 | 592 | 591 | ||
145 | 593 | HULL_TRACKING_MODE hullTrackingMode; | 592 | HULL_TRACKING_MODE hullTrackingMode; |
146 | 594 | 593 | ||
148 | 595 | static int screenWidth, screenHeight; | 594 | static int screenWidth; |
149 | 595 | static int screenHeight; | ||
150 | 596 | int thresh; | 596 | int thresh; |
151 | 597 | 597 | ||
152 | 598 | ARFloat gl_para[16]; | 598 | ARFloat gl_para[16]; |
153 | 599 | 599 | ||
154 | === modified file 'include/ARToolKitPlus/TrackerMultiMarker.h' | |||
155 | --- include/ARToolKitPlus/TrackerMultiMarker.h 2010-03-05 14:31:19 +0000 | |||
156 | +++ include/ARToolKitPlus/TrackerMultiMarker.h 2010-11-02 21:11:10 +0000 | |||
157 | @@ -36,7 +36,7 @@ | |||
158 | 36 | * Furthermore it uses only 4 'good' points of the convex hull to do the pose estimation. | 36 | * Furthermore it uses only 4 'good' points of the convex hull to do the pose estimation. |
159 | 37 | * You can override this using the according methods. | 37 | * You can override this using the according methods. |
160 | 38 | */ | 38 | */ |
162 | 39 | class TrackerMultiMarker: public Tracker { | 39 | class AR_EXPORT TrackerMultiMarker: public Tracker { |
163 | 40 | public: | 40 | public: |
164 | 41 | /** | 41 | /** |
165 | 42 | * These parameters control the way the toolkit warps a found | 42 | * These parameters control the way the toolkit warps a found |
166 | 43 | 43 | ||
167 | === modified file 'include/ARToolKitPlus/TrackerSingleMarker.h' | |||
168 | --- include/ARToolKitPlus/TrackerSingleMarker.h 2010-03-05 14:31:19 +0000 | |||
169 | +++ include/ARToolKitPlus/TrackerSingleMarker.h 2010-11-02 21:11:10 +0000 | |||
170 | @@ -36,7 +36,7 @@ | |||
171 | 36 | * | 36 | * |
172 | 37 | * If you need multi-marker tracking use TrackerMultiMarker. | 37 | * If you need multi-marker tracking use TrackerMultiMarker. |
173 | 38 | */ | 38 | */ |
175 | 39 | class TrackerSingleMarker: public Tracker { | 39 | class AR_EXPORT TrackerSingleMarker: public Tracker { |
176 | 40 | public: | 40 | public: |
177 | 41 | /** | 41 | /** |
178 | 42 | * These parameters control the way the toolkit warps a found | 42 | * These parameters control the way the toolkit warps a found |
179 | @@ -76,7 +76,7 @@ | |||
180 | 76 | * pass the image as RGBX (32-bits) | 76 | * pass the image as RGBX (32-bits) |
181 | 77 | * @return detected markers in image | 77 | * @return detected markers in image |
182 | 78 | */ | 78 | */ |
184 | 79 | virtual vector<int> calc(const uint8_t* nImage, ARMarkerInfo** nMarker_info = NULL, int* nNumMarkers = NULL); | 79 | virtual std::vector<int> calc(const uint8_t* nImage, ARMarkerInfo** nMarker_info = NULL, int* nNumMarkers = NULL); |
185 | 80 | 80 | ||
186 | 81 | /** | 81 | /** |
187 | 82 | * manually select one of the detected markers | 82 | * manually select one of the detected markers |
188 | 83 | 83 | ||
189 | === modified file 'include/ARToolKitPlus/ar.h' | |||
190 | --- include/ARToolKitPlus/ar.h 2010-02-08 14:55:16 +0000 | |||
191 | +++ include/ARToolKitPlus/ar.h 2010-11-02 21:11:10 +0000 | |||
192 | @@ -40,7 +40,7 @@ | |||
193 | 40 | ARFloat pos[2]; | 40 | ARFloat pos[2]; |
194 | 41 | ARFloat line[4][3]; | 41 | ARFloat line[4][3]; |
195 | 42 | ARFloat vertex[4][2]; | 42 | ARFloat vertex[4][2]; |
197 | 43 | } ARMarkerInfo; | 43 | } AR_EXPORT ARMarkerInfo; |
198 | 44 | 44 | ||
199 | 45 | typedef struct { | 45 | typedef struct { |
200 | 46 | int area; | 46 | int area; |
201 | @@ -49,12 +49,12 @@ | |||
202 | 49 | int x_coord[AR_CHAIN_MAX]; | 49 | int x_coord[AR_CHAIN_MAX]; |
203 | 50 | int y_coord[AR_CHAIN_MAX]; | 50 | int y_coord[AR_CHAIN_MAX]; |
204 | 51 | int vertex[5]; | 51 | int vertex[5]; |
206 | 52 | } ARMarkerInfo2; | 52 | } AR_EXPORT ARMarkerInfo2; |
207 | 53 | 53 | ||
208 | 54 | typedef struct { | 54 | typedef struct { |
209 | 55 | ARMarkerInfo marker; | 55 | ARMarkerInfo marker; |
210 | 56 | int count; | 56 | int count; |
212 | 57 | } arPrevInfo; | 57 | } AR_EXPORT arPrevInfo; |
213 | 58 | 58 | ||
214 | 59 | } // namespace ARToolKitPlus | 59 | } // namespace ARToolKitPlus |
215 | 60 | 60 | ||
216 | 61 | 61 | ||
217 | === modified file 'include/ARToolKitPlus/arBitFieldPattern.h' | |||
218 | --- include/ARToolKitPlus/arBitFieldPattern.h 2010-02-12 15:11:58 +0000 | |||
219 | +++ include/ARToolKitPlus/arBitFieldPattern.h 2010-11-02 21:11:10 +0000 | |||
220 | @@ -76,13 +76,13 @@ | |||
221 | 76 | 76 | ||
222 | 77 | // some internal methods. primarily needed for | 77 | // some internal methods. primarily needed for |
223 | 78 | // marker printing, etc. | 78 | // marker printing, etc. |
225 | 79 | void generatePatternSimple(int nID, IDPATTERN& nPattern); | 79 | void AR_EXPORT generatePatternSimple(int nID, IDPATTERN& nPattern); |
226 | 80 | 80 | ||
228 | 81 | void generatePatternBCH(int nID, IDPATTERN& nPattern); | 81 | void AR_EXPORT generatePatternBCH(int nID, IDPATTERN& nPattern); |
229 | 82 | 82 | ||
230 | 83 | // static void setBit(IDPATTERN& pat, int which); | 83 | // static void setBit(IDPATTERN& pat, int which); |
231 | 84 | 84 | ||
233 | 85 | bool isBitSet(IDPATTERN pat, int which); | 85 | bool AR_EXPORT isBitSet(IDPATTERN pat, int which); |
234 | 86 | 86 | ||
235 | 87 | } // namespace ARToolKitPlus | 87 | } // namespace ARToolKitPlus |
236 | 88 | 88 | ||
237 | 89 | 89 | ||
238 | === modified file 'include/ARToolKitPlus/arGetInitRot2Sub.h' | |||
239 | --- include/ARToolKitPlus/arGetInitRot2Sub.h 2010-02-12 15:11:58 +0000 | |||
240 | +++ include/ARToolKitPlus/arGetInitRot2Sub.h 2010-11-02 21:11:10 +0000 | |||
241 | @@ -25,7 +25,7 @@ | |||
242 | 25 | 25 | ||
243 | 26 | namespace rpp { | 26 | namespace rpp { |
244 | 27 | 27 | ||
246 | 28 | void arGetInitRot2_sub(rpp_float &err, rpp_mat &R, rpp_vec &t, const rpp_float cc[2], const rpp_float fc[2], | 28 | void AR_EXPORT arGetInitRot2_sub(rpp_float &err, rpp_mat &R, rpp_vec &t, const rpp_float cc[2], const rpp_float fc[2], |
247 | 29 | const rpp_vec *model, const rpp_vec *iprts, const unsigned int model_iprts_size, const rpp_mat R_init, | 29 | const rpp_vec *model, const rpp_vec *iprts, const unsigned int model_iprts_size, const rpp_mat R_init, |
248 | 30 | const bool estimate_R_init, const rpp_float epsilon, const rpp_float tolerance, | 30 | const bool estimate_R_init, const rpp_float epsilon, const rpp_float tolerance, |
249 | 31 | const unsigned int max_iterations); | 31 | const unsigned int max_iterations); |
250 | @@ -33,4 +33,4 @@ | |||
251 | 33 | } // namespace rpp | 33 | } // namespace rpp |
252 | 34 | 34 | ||
253 | 35 | 35 | ||
255 | 36 | #endif //__ARTOOLKITPLUS_ARGETINITROT2SUB_HEADERFILE__ | 36 | #endif //__ARTOOLKITPLUS_ARGETINITROT2SUB_HEADERFILE__ |
256 | 37 | 37 | ||
257 | === modified file 'include/ARToolKitPlus/arMulti.h' | |||
258 | --- include/ARToolKitPlus/arMulti.h 2010-03-05 14:31:19 +0000 | |||
259 | +++ include/ARToolKitPlus/arMulti.h 2010-11-02 21:11:10 +0000 | |||
260 | @@ -37,7 +37,7 @@ | |||
261 | 37 | int visible; | 37 | int visible; |
262 | 38 | /*---*/ | 38 | /*---*/ |
263 | 39 | int visibleR; | 39 | int visibleR; |
265 | 40 | } ARMultiEachMarkerInfoT; | 40 | } AR_EXPORT ARMultiEachMarkerInfoT; |
266 | 41 | 41 | ||
267 | 42 | typedef struct { | 42 | typedef struct { |
268 | 43 | ARMultiEachMarkerInfoT *marker; | 43 | ARMultiEachMarkerInfoT *marker; |
269 | @@ -46,7 +46,7 @@ | |||
270 | 46 | int prevF; | 46 | int prevF; |
271 | 47 | /*---*/ | 47 | /*---*/ |
272 | 48 | ARFloat transR[3][4]; | 48 | ARFloat transR[3][4]; |
274 | 49 | } ARMultiMarkerInfoT; | 49 | } AR_EXPORT ARMultiMarkerInfoT; |
275 | 50 | 50 | ||
276 | 51 | 51 | ||
277 | 52 | } // namespace ARToolKitPlus | 52 | } // namespace ARToolKitPlus |
278 | 53 | 53 | ||
279 | === modified file 'include/ARToolKitPlus/config.h' (properties changed: -x to +x) | |||
280 | --- include/ARToolKitPlus/config.h 2010-02-12 14:55:53 +0000 | |||
281 | +++ include/ARToolKitPlus/config.h 2010-11-02 21:11:10 +0000 | |||
282 | @@ -96,5 +96,37 @@ | |||
283 | 96 | #define getLUM8_from_RGB565(ptr) RGB565_to_LUM8_LUT[ (*(unsigned short*)(ptr)) ] | 96 | #define getLUM8_from_RGB565(ptr) RGB565_to_LUM8_LUT[ (*(unsigned short*)(ptr)) ] |
284 | 97 | #endif //SMALL_LUM8_TABLE | 97 | #endif //SMALL_LUM8_TABLE |
285 | 98 | 98 | ||
286 | 99 | // disable VisualStudio warnings | ||
287 | 100 | #if defined(_MSC_VER) && !defined(AR_ENABLE_MSVC_WARNINGS) | ||
288 | 101 | #pragma warning( disable : 4244 ) | ||
289 | 102 | #pragma warning( disable : 4251 ) | ||
290 | 103 | #pragma warning( disable : 4275 ) | ||
291 | 104 | #pragma warning( disable : 4512 ) | ||
292 | 105 | #pragma warning( disable : 4267 ) | ||
293 | 106 | #pragma warning( disable : 4702 ) | ||
294 | 107 | #pragma warning( disable : 4511 ) | ||
295 | 108 | #endif | ||
296 | 109 | |||
297 | 110 | // Support for Visual Studio compilation | ||
298 | 111 | #if defined(AR_STATIC) | ||
299 | 112 | #define AR_EXPORT | ||
300 | 113 | #else | ||
301 | 114 | #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__) | ||
302 | 115 | # if defined( AR_LIBRARY ) | ||
303 | 116 | # define AR_EXPORT __declspec(dllexport) | ||
304 | 117 | # else | ||
305 | 118 | # define AR_EXPORT __declspec(dllimport) | ||
306 | 119 | # endif | ||
307 | 120 | #else | ||
308 | 121 | # define AR_EXPORT | ||
309 | 122 | #endif | ||
310 | 123 | #endif | ||
311 | 124 | |||
312 | 125 | #ifdef _MSC_VER | ||
313 | 126 | # if (_MSC_VER >= 1300) | ||
314 | 127 | # define __STL_MEMBER_TEMPLATES | ||
315 | 128 | # endif | ||
316 | 129 | #endif | ||
317 | 130 | |||
318 | 99 | #endif // AR_CONFIG_H | 131 | #endif // AR_CONFIG_H |
319 | 100 | 132 | ||
320 | 101 | 133 | ||
321 | === modified file 'include/ARToolKitPlus/extra/BCH.h' | |||
322 | --- include/ARToolKitPlus/extra/BCH.h 2010-02-12 15:11:58 +0000 | |||
323 | +++ include/ARToolKitPlus/extra/BCH.h 2010-11-02 21:11:10 +0000 | |||
324 | @@ -22,6 +22,8 @@ | |||
325 | 22 | #ifndef __BCH_CODE__H__ | 22 | #ifndef __BCH_CODE__H__ |
326 | 23 | #define __BCH_CODE__H__ | 23 | #define __BCH_CODE__H__ |
327 | 24 | 24 | ||
328 | 25 | #include <ARToolKitPlus/config.h> | ||
329 | 26 | |||
330 | 25 | #include <vector> | 27 | #include <vector> |
331 | 26 | 28 | ||
332 | 27 | namespace ARToolKitPlus { | 29 | namespace ARToolKitPlus { |
333 | @@ -62,7 +64,7 @@ | |||
334 | 62 | // static void printBitPattern(_64bits n, int n_bits); | 64 | // static void printBitPattern(_64bits n, int n_bits); |
335 | 63 | 65 | ||
336 | 64 | 66 | ||
338 | 65 | class BCH | 67 | class AR_EXPORT BCH |
339 | 66 | // this class implements a (36, 12, 9) binary BCH encoder/decoder | 68 | // this class implements a (36, 12, 9) binary BCH encoder/decoder |
340 | 67 | { | 69 | { |
341 | 68 | public: | 70 | public: |
342 | 69 | 71 | ||
343 | === modified file 'include/ARToolKitPlus/extra/Hull.h' | |||
344 | --- include/ARToolKitPlus/extra/Hull.h 2010-02-12 15:11:58 +0000 | |||
345 | +++ include/ARToolKitPlus/extra/Hull.h 2010-11-02 21:11:10 +0000 | |||
346 | @@ -22,12 +22,14 @@ | |||
347 | 22 | #ifndef __ARTOOLKITPLUS_HULL_HEADERFILE__ | 22 | #ifndef __ARTOOLKITPLUS_HULL_HEADERFILE__ |
348 | 23 | #define __ARTOOLKITPLUS_HULL_HEADERFILE__ | 23 | #define __ARTOOLKITPLUS_HULL_HEADERFILE__ |
349 | 24 | 24 | ||
350 | 25 | #include <ARToolKitPlus/config.h> | ||
351 | 26 | |||
352 | 25 | namespace ARToolKitPlus { | 27 | namespace ARToolKitPlus { |
353 | 26 | 28 | ||
354 | 27 | const int MAX_HULL_POINTS = 64; // support up to 16 visible markers | 29 | const int MAX_HULL_POINTS = 64; // support up to 16 visible markers |
355 | 28 | 30 | ||
356 | 29 | 31 | ||
358 | 30 | struct MarkerPoint { | 32 | struct AR_EXPORT MarkerPoint { |
359 | 31 | typedef int coord_type; | 33 | typedef int coord_type; |
360 | 32 | 34 | ||
361 | 33 | coord_type x, y; | 35 | coord_type x, y; |
362 | @@ -38,17 +40,17 @@ | |||
363 | 38 | return nValue >= 0 ? nValue : -nValue; | 40 | return nValue >= 0 ? nValue : -nValue; |
364 | 39 | } | 41 | } |
365 | 40 | 42 | ||
377 | 41 | int nearHull_2D(const MarkerPoint* P, int n, int k, MarkerPoint* H); | 43 | AR_EXPORT int nearHull_2D(const MarkerPoint* P, int n, int k, MarkerPoint* H); |
378 | 42 | 44 | ||
379 | 43 | void findLongestDiameter(const MarkerPoint* nPoints, int nNumPoints, int &nIdx0, int &nIdx1); | 45 | AR_EXPORT void findLongestDiameter(const MarkerPoint* nPoints, int nNumPoints, int &nIdx0, int &nIdx1); |
380 | 44 | 46 | ||
381 | 45 | void findFurthestAway(const MarkerPoint* nPoints, int nNumPoints, int nIdx0, int nIdx1, int& nIdxFarthest); | 47 | AR_EXPORT void findFurthestAway(const MarkerPoint* nPoints, int nNumPoints, int nIdx0, int nIdx1, int& nIdxFarthest); |
382 | 46 | 48 | ||
383 | 47 | void maximizeArea(const MarkerPoint* nPoints, int nNumPoints, int nIdx0, int nIdx1, int nIdx2, int& nIdxMax); | 49 | AR_EXPORT void maximizeArea(const MarkerPoint* nPoints, int nNumPoints, int nIdx0, int nIdx1, int nIdx2, int& nIdxMax); |
384 | 48 | 50 | ||
385 | 49 | void sortIntegers(int& nIdx0, int& nIdx1, int& nIdx2); | 51 | AR_EXPORT void sortIntegers(int& nIdx0, int& nIdx1, int& nIdx2); |
386 | 50 | 52 | ||
387 | 51 | void sortInLastInteger(int& nIdx0, int& nIdx1, int& nIdx2, int &nIdx3); | 53 | AR_EXPORT void sortInLastInteger(int& nIdx0, int& nIdx1, int& nIdx2, int &nIdx3); |
388 | 52 | 54 | ||
389 | 53 | } // namespace ARToolKitPlus | 55 | } // namespace ARToolKitPlus |
390 | 54 | 56 | ||
391 | 55 | 57 | ||
392 | === modified file 'include/ARToolKitPlus/extra/rpp.h' | |||
393 | --- include/ARToolKitPlus/extra/rpp.h 2010-02-12 15:11:58 +0000 | |||
394 | +++ include/ARToolKitPlus/extra/rpp.h 2010-11-02 21:11:10 +0000 | |||
395 | @@ -21,11 +21,13 @@ | |||
396 | 21 | #ifndef __LINK_WITH_RPP__ | 21 | #ifndef __LINK_WITH_RPP__ |
397 | 22 | #define __LINK_WITH_RPP__ | 22 | #define __LINK_WITH_RPP__ |
398 | 23 | 23 | ||
399 | 24 | #include <ARToolKitPlus/config.h> | ||
400 | 25 | |||
401 | 24 | typedef double rpp_float; | 26 | typedef double rpp_float; |
402 | 25 | typedef double rpp_vec[3]; | 27 | typedef double rpp_vec[3]; |
403 | 26 | typedef double rpp_mat[3][3]; | 28 | typedef double rpp_mat[3][3]; |
404 | 27 | 29 | ||
406 | 28 | void robustPlanarPose(rpp_float &err, rpp_mat &R, rpp_vec &t, const rpp_float cc[2], const rpp_float fc[2], | 30 | AR_EXPORT void robustPlanarPose(rpp_float &err, rpp_mat &R, rpp_vec &t, const rpp_float cc[2], const rpp_float fc[2], |
407 | 29 | const rpp_vec *model, const rpp_vec *iprts, const unsigned int model_iprts_size, const rpp_mat R_init, | 31 | const rpp_vec *model, const rpp_vec *iprts, const unsigned int model_iprts_size, const rpp_mat R_init, |
408 | 30 | const bool estimate_R_init, const rpp_float epsilon, const rpp_float tolerance, | 32 | const bool estimate_R_init, const rpp_float epsilon, const rpp_float tolerance, |
409 | 31 | const unsigned int max_iterations); | 33 | const unsigned int max_iterations); |
410 | 32 | 34 | ||
411 | === modified file 'include/ARToolKitPlus/matrix.h' | |||
412 | --- include/ARToolKitPlus/matrix.h 2010-02-12 15:11:58 +0000 | |||
413 | +++ include/ARToolKitPlus/matrix.h 2010-11-02 21:11:10 +0000 | |||
414 | @@ -36,7 +36,7 @@ | |||
415 | 36 | 36 | ||
416 | 37 | namespace ARToolKitPlus { | 37 | namespace ARToolKitPlus { |
417 | 38 | 38 | ||
419 | 39 | struct ARMat { | 39 | struct AR_EXPORT ARMat { |
420 | 40 | ARFloat *m; | 40 | ARFloat *m; |
421 | 41 | int row; | 41 | int row; |
422 | 42 | int clm; | 42 | int clm; |
423 | @@ -49,14 +49,14 @@ | |||
424 | 49 | /* 1 origin */ | 49 | /* 1 origin */ |
425 | 50 | #define ARELEM1(mat,row,clm) ARELEM0(mat,row-1,clm-1) | 50 | #define ARELEM1(mat,row,clm) ARELEM0(mat,row-1,clm-1) |
426 | 51 | 51 | ||
435 | 52 | ARMat *alloc(int row, int clm); | 52 | AR_EXPORT ARMat *alloc(int row, int clm); |
436 | 53 | int free(ARMat *m); | 53 | AR_EXPORT int free(ARMat *m); |
437 | 54 | 54 | ||
438 | 55 | int dup(ARMat *dest, ARMat *source); | 55 | AR_EXPORT int dup(ARMat *dest, ARMat *source); |
439 | 56 | ARMat *allocDup(ARMat *source); | 56 | AR_EXPORT ARMat *allocDup(ARMat *source); |
440 | 57 | 57 | ||
441 | 58 | int mul(ARMat *dest, ARMat *a, ARMat *b); | 58 | AR_EXPORT int mul(ARMat *dest, ARMat *a, ARMat *b); |
442 | 59 | int selfInv(ARMat *m); | 59 | AR_EXPORT int selfInv(ARMat *m); |
443 | 60 | 60 | ||
444 | 61 | } // namespace Matrix | 61 | } // namespace Matrix |
445 | 62 | 62 | ||
446 | 63 | 63 | ||
447 | === modified file 'include/ARToolKitPlus/vector.h' | |||
448 | --- include/ARToolKitPlus/vector.h 2010-02-12 15:11:58 +0000 | |||
449 | +++ include/ARToolKitPlus/vector.h 2010-11-02 21:11:10 +0000 | |||
450 | @@ -27,17 +27,17 @@ | |||
451 | 27 | 27 | ||
452 | 28 | struct ARMat; | 28 | struct ARMat; |
453 | 29 | 29 | ||
455 | 30 | struct ARVec { | 30 | struct AR_EXPORT ARVec { |
456 | 31 | ARFloat *v; | 31 | ARFloat *v; |
457 | 32 | int clm; | 32 | int clm; |
458 | 33 | }; | 33 | }; |
459 | 34 | 34 | ||
460 | 35 | namespace Vector { | 35 | namespace Vector { |
466 | 36 | ARVec *alloc(int clm); | 36 | AR_EXPORT ARVec * alloc(int clm); |
467 | 37 | int free(ARVec *v); | 37 | AR_EXPORT int free(ARVec *v); |
468 | 38 | ARFloat household(ARVec *x); | 38 | AR_EXPORT ARFloat household(ARVec *x); |
469 | 39 | ARFloat innerproduct(ARVec *x, ARVec *y); | 39 | AR_EXPORT ARFloat innerproduct(ARVec *x, ARVec *y); |
470 | 40 | int tridiagonalize(ARMat *a, ARVec *d, ARVec *e); | 40 | AR_EXPORT int tridiagonalize(ARMat *a, ARVec *d, ARVec *e); |
471 | 41 | } | 41 | } |
472 | 42 | 42 | ||
473 | 43 | } // namespace ARToolKitPlus | 43 | } // namespace ARToolKitPlus |
474 | 44 | 44 | ||
475 | === modified file 'src/Tracker.cpp' | |||
476 | --- src/Tracker.cpp 2010-03-05 14:31:19 +0000 | |||
477 | +++ src/Tracker.cpp 2010-11-02 21:11:10 +0000 | |||
478 | @@ -25,6 +25,7 @@ | |||
479 | 25 | 25 | ||
480 | 26 | using std::cerr; | 26 | using std::cerr; |
481 | 27 | using std::endl; | 27 | using std::endl; |
482 | 28 | using std::vector; | ||
483 | 28 | 29 | ||
484 | 29 | namespace ARToolKitPlus { | 30 | namespace ARToolKitPlus { |
485 | 30 | 31 | ||
486 | 31 | 32 | ||
487 | === modified file 'src/TrackerSingleMarker.cpp' | |||
488 | --- src/TrackerSingleMarker.cpp 2010-03-05 14:31:19 +0000 | |||
489 | +++ src/TrackerSingleMarker.cpp 2010-11-02 21:11:10 +0000 | |||
490 | @@ -56,8 +56,8 @@ | |||
491 | 56 | return true; | 56 | return true; |
492 | 57 | } | 57 | } |
493 | 58 | 58 | ||
496 | 59 | vector<int> TrackerSingleMarker::calc(const uint8_t* nImage, ARMarkerInfo** nMarker_info, int* nNumMarkers) { | 59 | std::vector<int> TrackerSingleMarker::calc(const uint8_t* nImage, ARMarkerInfo** nMarker_info, int* nNumMarkers) { |
497 | 60 | vector<int> detected; | 60 | std::vector<int> detected; |
498 | 61 | 61 | ||
499 | 62 | if (nImage == NULL) | 62 | if (nImage == NULL) |
500 | 63 | return detected; | 63 | return detected; |
501 | 64 | 64 | ||
502 | === modified file 'src/core/arGetCode.cpp' | |||
503 | --- src/core/arGetCode.cpp 2010-02-09 12:37:58 +0000 | |||
504 | +++ src/core/arGetCode.cpp 2010-11-02 21:11:10 +0000 | |||
505 | @@ -146,17 +146,23 @@ | |||
506 | 146 | 146 | ||
507 | 147 | int Tracker::arGetCode(uint8_t *image, int *x_coord, int *y_coord, int *vertex, int *code, int *dir, ARFloat *cf, | 147 | int Tracker::arGetCode(uint8_t *image, int *x_coord, int *y_coord, int *vertex, int *code, int *dir, ARFloat *cf, |
508 | 148 | int thresh) { | 148 | int thresh) { |
510 | 149 | uint8_t ext_pat[PATTERN_HEIGHT][PATTERN_WIDTH][3]; | 149 | #define _M(VAR, h,w,c) VAR[(h)*(PATTERN_WIDTH*3) + (w)*3 + (c)] |
511 | 150 | uint8_t *ext_pat = new uint8_t[PATTERN_HEIGHT*PATTERN_WIDTH*3]; | ||
512 | 150 | 151 | ||
514 | 151 | arGetPatt(image, x_coord, y_coord, vertex, (uint8_t***) ext_pat); | 152 | arGetPatt(image, x_coord, y_coord, vertex, ext_pat); |
515 | 152 | 153 | ||
516 | 153 | if (autoThreshold.enable) { | 154 | if (autoThreshold.enable) { |
517 | 154 | int x, y; | 155 | int x, y; |
518 | 155 | 156 | ||
519 | 156 | for (y = 0; y < PATTERN_HEIGHT; y++) | 157 | for (y = 0; y < PATTERN_HEIGHT; y++) |
520 | 157 | for (x = 0; x < PATTERN_WIDTH; x++) | 158 | for (x = 0; x < PATTERN_WIDTH; x++) |
522 | 158 | autoThreshold.addValue(ext_pat[y][x][0], ext_pat[y][x][1], ext_pat[y][x][2], pixelFormat); | 159 | autoThreshold.addValue( |
523 | 160 | _M(ext_pat,y,x,0), | ||
524 | 161 | _M(ext_pat,y,x,1), | ||
525 | 162 | _M(ext_pat,y,x,2), | ||
526 | 163 | pixelFormat); | ||
527 | 159 | } | 164 | } |
528 | 165 | #undef _M | ||
529 | 160 | 166 | ||
530 | 161 | // FILE* fp = fopen("dump.raw", "wb"); | 167 | // FILE* fp = fopen("dump.raw", "wb"); |
531 | 162 | // fwrite(ext_pat, PATTERN_HEIGHT*PATTERN_WIDTH*3, 1, fp); | 168 | // fwrite(ext_pat, PATTERN_HEIGHT*PATTERN_WIDTH*3, 1, fp); |
532 | @@ -186,15 +192,15 @@ | |||
533 | 186 | else | 192 | else |
534 | 187 | pattern_match((uint8_t *)ext_pat, code, dir, cf);*/ | 193 | pattern_match((uint8_t *)ext_pat, code, dir, cf);*/ |
535 | 188 | 194 | ||
536 | 195 | delete[] ext_pat; | ||
537 | 189 | return (0); | 196 | return (0); |
538 | 190 | } | 197 | } |
539 | 191 | 198 | ||
540 | 192 | //#if 1 | 199 | //#if 1 |
544 | 193 | int Tracker::arGetPatt(uint8_t *image, int *x_coord, int *y_coord, int *vertex, uint8_t **pext_pat[3]) { | 200 | int Tracker::arGetPatt(uint8_t *image, int *x_coord, int *y_coord, int *vertex, uint8_t *ext_pat) { |
545 | 194 | uint8_t (*ext_pat)[PATTERN_WIDTH][3]; | 201 | #define _M(VAR, h,w,c) VAR[(h)*(PATTERN_WIDTH*3) + (w)*3 + (c)] |
543 | 195 | ext_pat = (uint8_t(*)[PATTERN_WIDTH][3]) pext_pat; | ||
546 | 196 | 202 | ||
548 | 197 | uint32_t ext_pat2[PATTERN_HEIGHT][PATTERN_WIDTH][3]; | 203 | uint32_t *ext_pat2 = new uint32_t[PATTERN_HEIGHT*PATTERN_WIDTH*3]; |
549 | 198 | ARFloat world[4][2]; | 204 | ARFloat world[4][2]; |
550 | 199 | ARFloat local[4][2]; | 205 | ARFloat local[4][2]; |
551 | 200 | ARFloat para[3][3]; | 206 | ARFloat para[3][3]; |
552 | @@ -264,7 +270,7 @@ | |||
553 | 264 | if (xdiv == 1 && ydiv == 1) { | 270 | if (xdiv == 1 && ydiv == 1) { |
554 | 265 | ARFloat border = relBorderWidth * 10.0f; | 271 | ARFloat border = relBorderWidth * 10.0f; |
555 | 266 | ARFloat xyFrom = 100.0f + border, xyTo = 110.0f - border, xyStep = xyTo - xyFrom; | 272 | ARFloat xyFrom = 100.0f + border, xyTo = 110.0f - border, xyStep = xyTo - xyFrom; |
557 | 267 | ARFloat steps[PATTERN_WIDTH]; | 273 | ARFloat *steps = new ARFloat[PATTERN_WIDTH]; |
558 | 268 | 274 | ||
559 | 269 | for (i = 0; i < xdiv2; i++) | 275 | for (i = 0; i < xdiv2; i++) |
560 | 270 | steps[i] = xyFrom + xyStep * (ARFloat) (i + 0.5f) / (ARFloat) xdiv2; | 276 | steps[i] = xyFrom + xyStep * (ARFloat) (i + 0.5f) / (ARFloat) xdiv2; |
561 | @@ -288,51 +294,54 @@ | |||
562 | 288 | if (xc >= 0 && xc < arImXsize && yc >= 0 && yc < arImYsize) { | 294 | if (xc >= 0 && xc < arImXsize && yc >= 0 && yc < arImYsize) { |
563 | 289 | switch (pixelFormat) { | 295 | switch (pixelFormat) { |
564 | 290 | case PIXEL_FORMAT_ABGR: | 296 | case PIXEL_FORMAT_ABGR: |
568 | 291 | ext_pat[j][i][0] = image[(yc * arImXsize + xc) * 4 + 1]; | 297 | _M(ext_pat,j,i,0) = image[(yc * arImXsize + xc) * 4 + 1]; |
569 | 292 | ext_pat[j][i][1] = image[(yc * arImXsize + xc) * 4 + 2]; | 298 | _M(ext_pat,j,i,1) = image[(yc * arImXsize + xc) * 4 + 2]; |
570 | 293 | ext_pat[j][i][2] = image[(yc * arImXsize + xc) * 4 + 3]; | 299 | _M(ext_pat,j,i,2) = image[(yc * arImXsize + xc) * 4 + 3]; |
571 | 294 | break; | 300 | break; |
572 | 295 | 301 | ||
573 | 296 | case PIXEL_FORMAT_BGRA: | 302 | case PIXEL_FORMAT_BGRA: |
577 | 297 | ext_pat[j][i][0] = image[(yc * arImXsize + xc) * 4 + 0]; | 303 | _M(ext_pat,j,i,0) = image[(yc * arImXsize + xc) * 4 + 0]; |
578 | 298 | ext_pat[j][i][1] = image[(yc * arImXsize + xc) * 4 + 1]; | 304 | _M(ext_pat,j,i,1) = image[(yc * arImXsize + xc) * 4 + 1]; |
579 | 299 | ext_pat[j][i][2] = image[(yc * arImXsize + xc) * 4 + 2]; | 305 | _M(ext_pat,j,i,2) = image[(yc * arImXsize + xc) * 4 + 2]; |
580 | 300 | break; | 306 | break; |
581 | 301 | 307 | ||
582 | 302 | case PIXEL_FORMAT_BGR: | 308 | case PIXEL_FORMAT_BGR: |
586 | 303 | ext_pat[j][i][0] = image[(yc * arImXsize + xc) * 3 + 0]; | 309 | _M(ext_pat,j,i,0) = image[(yc * arImXsize + xc) * 3 + 0]; |
587 | 304 | ext_pat[j][i][1] = image[(yc * arImXsize + xc) * 3 + 1]; | 310 | _M(ext_pat,j,i,1) = image[(yc * arImXsize + xc) * 3 + 1]; |
588 | 305 | ext_pat[j][i][2] = image[(yc * arImXsize + xc) * 3 + 2]; | 311 | _M(ext_pat,j,i,2) = image[(yc * arImXsize + xc) * 3 + 2]; |
589 | 306 | break; | 312 | break; |
590 | 307 | 313 | ||
591 | 308 | case PIXEL_FORMAT_RGBA: | 314 | case PIXEL_FORMAT_RGBA: |
595 | 309 | ext_pat[j][i][0] = image[(yc * arImXsize + xc) * 4 + 2]; | 315 | _M(ext_pat,j,i,0) = image[(yc * arImXsize + xc) * 4 + 2]; |
596 | 310 | ext_pat[j][i][1] = image[(yc * arImXsize + xc) * 4 + 1]; | 316 | _M(ext_pat,j,i,1) = image[(yc * arImXsize + xc) * 4 + 1]; |
597 | 311 | ext_pat[j][i][2] = image[(yc * arImXsize + xc) * 4 + 0]; | 317 | _M(ext_pat,j,i,2) = image[(yc * arImXsize + xc) * 4 + 0]; |
598 | 312 | 318 | ||
599 | 313 | case PIXEL_FORMAT_RGB: | 319 | case PIXEL_FORMAT_RGB: |
603 | 314 | ext_pat[j][i][0] = image[(yc * arImXsize + xc) * 3 + 2]; | 320 | _M(ext_pat,j,i,0) = image[(yc * arImXsize + xc) * 3 + 2]; |
604 | 315 | ext_pat[j][i][1] = image[(yc * arImXsize + xc) * 3 + 1]; | 321 | _M(ext_pat,j,i,1) = image[(yc * arImXsize + xc) * 3 + 1]; |
605 | 316 | ext_pat[j][i][2] = image[(yc * arImXsize + xc) * 3 + 0]; | 322 | _M(ext_pat,j,i,2) = image[(yc * arImXsize + xc) * 3 + 0]; |
606 | 317 | break; | 323 | break; |
607 | 318 | 324 | ||
608 | 319 | case PIXEL_FORMAT_RGB565: | 325 | case PIXEL_FORMAT_RGB565: |
609 | 320 | col8 = getLUM8_from_RGB565(image16+yc*arImXsize+xc); | 326 | col8 = getLUM8_from_RGB565(image16+yc*arImXsize+xc); |
613 | 321 | ext_pat[j][i][0] = col8; | 327 | _M(ext_pat,j,i,0) = col8; |
614 | 322 | ext_pat[j][i][1] = col8; | 328 | _M(ext_pat,j,i,1) = col8; |
615 | 323 | ext_pat[j][i][2] = col8; | 329 | _M(ext_pat,j,i,2) = col8; |
616 | 324 | break; | 330 | break; |
617 | 325 | 331 | ||
618 | 326 | case PIXEL_FORMAT_LUM: | 332 | case PIXEL_FORMAT_LUM: |
619 | 327 | col8 = image[(yc * arImXsize + xc)]; | 333 | col8 = image[(yc * arImXsize + xc)]; |
623 | 328 | ext_pat[j][i][0] = col8; | 334 | _M(ext_pat,j,i,0) = col8; |
624 | 329 | ext_pat[j][i][1] = col8; | 335 | _M(ext_pat,j,i,1) = col8; |
625 | 330 | ext_pat[j][i][2] = col8; | 336 | _M(ext_pat,j,i,2) = col8; |
626 | 331 | break; | 337 | break; |
627 | 332 | } | 338 | } |
628 | 333 | } | 339 | } |
629 | 334 | } | 340 | } |
630 | 335 | } | 341 | } |
631 | 342 | |||
632 | 343 | // free memory | ||
633 | 344 | delete[] steps; | ||
634 | 336 | } else | 345 | } else |
635 | 337 | // general case: xdiv!=1 or ydiv!=1 | 346 | // general case: xdiv!=1 or ydiv!=1 |
636 | 338 | // | 347 | // |
637 | @@ -363,51 +372,51 @@ | |||
638 | 363 | if (xc >= 0 && xc < arImXsize && yc >= 0 && yc < arImYsize) { | 372 | if (xc >= 0 && xc < arImXsize && yc >= 0 && yc < arImYsize) { |
639 | 364 | switch (pixelFormat) { | 373 | switch (pixelFormat) { |
640 | 365 | case PIXEL_FORMAT_ABGR: | 374 | case PIXEL_FORMAT_ABGR: |
644 | 366 | ext_pat2[j / ydiv][i / xdiv][0] += image[(yc * arImXsize + xc) * 4 + 1]; | 375 | _M(ext_pat2,j / ydiv,i / xdiv,0) += image[(yc * arImXsize + xc) * 4 + 1]; |
645 | 367 | ext_pat2[j / ydiv][i / xdiv][1] += image[(yc * arImXsize + xc) * 4 + 2]; | 376 | _M(ext_pat2,j / ydiv,i / xdiv,1) += image[(yc * arImXsize + xc) * 4 + 2]; |
646 | 368 | ext_pat2[j / ydiv][i / xdiv][2] += image[(yc * arImXsize + xc) * 4 + 3]; | 377 | _M(ext_pat2,j / ydiv,i / xdiv,2) += image[(yc * arImXsize + xc) * 4 + 3]; |
647 | 369 | break; | 378 | break; |
648 | 370 | 379 | ||
649 | 371 | case PIXEL_FORMAT_BGRA: | 380 | case PIXEL_FORMAT_BGRA: |
653 | 372 | ext_pat2[j / ydiv][i / xdiv][0] += image[(yc * arImXsize + xc) * 4 + 0]; | 381 | _M(ext_pat2,j / ydiv,i / xdiv,0) += image[(yc * arImXsize + xc) * 4 + 0]; |
654 | 373 | ext_pat2[j / ydiv][i / xdiv][1] += image[(yc * arImXsize + xc) * 4 + 1]; | 382 | _M(ext_pat2,j / ydiv,i / xdiv,1) += image[(yc * arImXsize + xc) * 4 + 1]; |
655 | 374 | ext_pat2[j / ydiv][i / xdiv][2] += image[(yc * arImXsize + xc) * 4 + 2]; | 383 | _M(ext_pat2,j / ydiv,i / xdiv,2) += image[(yc * arImXsize + xc) * 4 + 2]; |
656 | 375 | break; | 384 | break; |
657 | 376 | 385 | ||
658 | 377 | case PIXEL_FORMAT_BGR: | 386 | case PIXEL_FORMAT_BGR: |
662 | 378 | ext_pat2[j / ydiv][i / xdiv][0] += image[(yc * arImXsize + xc) * 3 + 0]; | 387 | _M(ext_pat2,j / ydiv,i / xdiv,0) += image[(yc * arImXsize + xc) * 3 + 0]; |
663 | 379 | ext_pat2[j / ydiv][i / xdiv][1] += image[(yc * arImXsize + xc) * 3 + 1]; | 388 | _M(ext_pat2,j / ydiv,i / xdiv,1) += image[(yc * arImXsize + xc) * 3 + 1]; |
664 | 380 | ext_pat2[j / ydiv][i / xdiv][2] += image[(yc * arImXsize + xc) * 3 + 2]; | 389 | _M(ext_pat2,j / ydiv,i / xdiv,2) += image[(yc * arImXsize + xc) * 3 + 2]; |
665 | 381 | break; | 390 | break; |
666 | 382 | 391 | ||
667 | 383 | case PIXEL_FORMAT_RGBA: | 392 | case PIXEL_FORMAT_RGBA: |
671 | 384 | ext_pat2[j / ydiv][i / xdiv][0] += image[(yc * arImXsize + xc) * 4 + 2]; | 393 | _M(ext_pat2,j / ydiv,i / xdiv,0) += image[(yc * arImXsize + xc) * 4 + 2]; |
672 | 385 | ext_pat2[j / ydiv][i / xdiv][1] += image[(yc * arImXsize + xc) * 4 + 1]; | 394 | _M(ext_pat2,j / ydiv,i / xdiv,1) += image[(yc * arImXsize + xc) * 4 + 1]; |
673 | 386 | ext_pat2[j / ydiv][i / xdiv][2] += image[(yc * arImXsize + xc) * 4 + 0]; | 395 | _M(ext_pat2,j / ydiv,i / xdiv,2) += image[(yc * arImXsize + xc) * 4 + 0]; |
674 | 387 | break; | 396 | break; |
675 | 388 | 397 | ||
676 | 389 | case PIXEL_FORMAT_RGB: | 398 | case PIXEL_FORMAT_RGB: |
680 | 390 | ext_pat2[j / ydiv][i / xdiv][0] += image[(yc * arImXsize + xc) * 3 + 2]; | 399 | _M(ext_pat2,j / ydiv,i / xdiv,0) += image[(yc * arImXsize + xc) * 3 + 2]; |
681 | 391 | ext_pat2[j / ydiv][i / xdiv][1] += image[(yc * arImXsize + xc) * 3 + 1]; | 400 | _M(ext_pat2,j / ydiv,i / xdiv,1) += image[(yc * arImXsize + xc) * 3 + 1]; |
682 | 392 | ext_pat2[j / ydiv][i / xdiv][2] += image[(yc * arImXsize + xc) * 3 + 0]; | 401 | _M(ext_pat2,j / ydiv,i / xdiv,2) += image[(yc * arImXsize + xc) * 3 + 0]; |
683 | 393 | break; | 402 | break; |
684 | 394 | 403 | ||
685 | 395 | case PIXEL_FORMAT_RGB565: | 404 | case PIXEL_FORMAT_RGB565: |
686 | 396 | jy = j / ydiv; | 405 | jy = j / ydiv; |
687 | 397 | ix = i / xdiv; | 406 | ix = i / xdiv; |
688 | 398 | col8 = getLUM8_from_RGB565(image16+yc*arImXsize+xc); | 407 | col8 = getLUM8_from_RGB565(image16+yc*arImXsize+xc); |
692 | 399 | ext_pat2[jy][ix][0] += col8; | 408 | _M(ext_pat2,jy,ix,0) += col8; |
693 | 400 | ext_pat2[jy][ix][1] += col8; | 409 | _M(ext_pat2,jy,ix,1) += col8; |
694 | 401 | ext_pat2[jy][ix][2] += col8; | 410 | _M(ext_pat2,jy,ix,2) += col8; |
695 | 402 | break; | 411 | break; |
696 | 403 | 412 | ||
697 | 404 | case PIXEL_FORMAT_LUM: | 413 | case PIXEL_FORMAT_LUM: |
698 | 405 | jy = j / ydiv; | 414 | jy = j / ydiv; |
699 | 406 | ix = i / xdiv; | 415 | ix = i / xdiv; |
700 | 407 | col8 = image[yc * arImXsize + xc]; | 416 | col8 = image[yc * arImXsize + xc]; |
704 | 408 | ext_pat2[jy][ix][0] += col8; | 417 | _M(ext_pat2,jy,ix,0) += col8; |
705 | 409 | ext_pat2[jy][ix][1] += col8; | 418 | _M(ext_pat2,jy,ix,1) += col8; |
706 | 410 | ext_pat2[jy][ix][2] += col8; | 419 | _M(ext_pat2,jy,ix,2) += col8; |
707 | 411 | break; | 420 | break; |
708 | 412 | } | 421 | } |
709 | 413 | } | 422 | } |
710 | @@ -416,19 +425,21 @@ | |||
711 | 416 | 425 | ||
712 | 417 | for (j = 0; j < PATTERN_HEIGHT; j++) { | 426 | for (j = 0; j < PATTERN_HEIGHT; j++) { |
713 | 418 | for (i = 0; i < PATTERN_HEIGHT; i++) { | 427 | for (i = 0; i < PATTERN_HEIGHT; i++) { |
717 | 419 | ext_pat[j][i][0] = ext_pat2[j][i][0] / (xdiv * ydiv); | 428 | _M(ext_pat,j,i,0) = _M(ext_pat2,j,i,0) / (xdiv * ydiv); |
718 | 420 | ext_pat[j][i][1] = ext_pat2[j][i][1] / (xdiv * ydiv); | 429 | _M(ext_pat,j,i,1) = _M(ext_pat2,j,i,1) / (xdiv * ydiv); |
719 | 421 | ext_pat[j][i][2] = ext_pat2[j][i][2] / (xdiv * ydiv); | 430 | _M(ext_pat,j,i,2) = _M(ext_pat2,j,i,2) / (xdiv * ydiv); |
720 | 422 | } | 431 | } |
721 | 423 | } | 432 | } |
722 | 424 | } | 433 | } |
723 | 425 | 434 | ||
724 | 435 | #undef _M | ||
725 | 436 | delete[] ext_pat2; | ||
726 | 426 | return (0); | 437 | return (0); |
727 | 427 | } | 438 | } |
728 | 428 | 439 | ||
729 | 429 | int Tracker::pattern_match(uint8_t *data, int *code, int *dir, ARFloat *cf) { | 440 | int Tracker::pattern_match(uint8_t *data, int *code, int *dir, ARFloat *cf) { |
730 | 430 | ARFloat invec[EVEC_MAX]; | 441 | ARFloat invec[EVEC_MAX]; |
732 | 431 | int input[PATTERN_HEIGHT * PATTERN_WIDTH * 3]; | 442 | int *input = new int[PATTERN_HEIGHT * PATTERN_WIDTH * 3]; |
733 | 432 | int i, j, l; | 443 | int i, j, l; |
734 | 433 | int k = 0; // fix VC7 compiler warning: uninitialized variable | 444 | int k = 0; // fix VC7 compiler warning: uninitialized variable |
735 | 434 | int ave, sum, res, res2; | 445 | int ave, sum, res, res2; |
736 | @@ -563,7 +574,8 @@ | |||
737 | 563 | #ifdef ARTK_DEBUG | 574 | #ifdef ARTK_DEBUG |
738 | 564 | printf("%d %d %f\n", res2, res, max); | 575 | printf("%d %d %f\n", res2, res, max); |
739 | 565 | #endif | 576 | #endif |
741 | 566 | 577 | ||
742 | 578 | delete[] input; | ||
743 | 567 | return 0; | 579 | return 0; |
744 | 568 | } | 580 | } |
745 | 569 | 581 |