Libmv: Add C-API function to set all markers within AutoTrack structure
[blender.git] / intern / libmv / intern / stub.cc
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2013 Blender Foundation.
19  * All rights reserved.
20  *
21  * Contributor(s): Blender Foundation,
22  *                 Sergey Sharybin
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 #include "libmv-capi.h"
28
29 #include <cstdlib>
30 #include <cstring>
31
32 /* ************ Logging ************ */
33
34 void libmv_initLogging(const char * /*argv0*/) {
35 }
36
37 void libmv_startDebugLogging(void) {
38 }
39
40 void libmv_setLoggingVerbosity(int /*verbosity*/) {
41 }
42
43 /* ************ Planar tracker ************ */
44
45 /* TrackRegion (new planar tracker) */
46 int libmv_trackRegion(const libmv_TrackRegionOptions * /*options*/,
47                       const float * /*image1*/,
48                       int /*image1_width*/,
49                       int /*image1_height*/,
50                       const float * /*image2*/,
51                       int /*image2_width*/,
52                       int /*image2_height*/,
53                       const double *x1,
54                       const double *y1,
55                       libmv_TrackRegionResult *result,
56                       double *x2,
57                       double *y2) {
58   /* Convert to doubles for the libmv api. The four corners and the center. */
59   for (int i = 0; i < 5; ++i) {
60     x2[i] = x1[i];
61     y2[i] = y1[i];
62   }
63
64   result->termination = -1;
65   result->termination_reason = "Built without libmv support";
66   result->correlation = 0.0;
67
68   return false;
69 }
70
71 void libmv_samplePlanarPatchFloat(const float * /*image*/,
72                                   int /*width*/,
73                                   int /*height*/,
74                                   int /*channels*/,
75                                   const double * /*xs*/,
76                                   const double * /*ys*/,
77                                   int /*num_samples_x*/,
78                                   int /*num_samples_y*/,
79                                   const float * /*mask*/,
80                                   float * /*patch*/,
81                                   double * /*warped_position_x*/,
82                                   double * /*warped_position_y*/) {
83   /* TODO(sergey): implement */
84 }
85
86 void libmv_samplePlanarPatchByte(const unsigned char * /*image*/,
87                                  int /*width*/,
88                                  int /*height*/,
89                                  int /*channels*/,
90                                  const double * /*xs*/,
91                                  const double * /*ys*/,
92                                  int /*num_samples_x*/, int /*num_samples_y*/,
93                                  const float * /*mask*/,
94                                  unsigned char * /*patch*/,
95                                  double * /*warped_position_x*/,
96                                  double * /*warped_position_y*/) {
97   /* TODO(sergey): implement */
98 }
99
100 void libmv_floatImageDestroy(libmv_FloatImage* /*image*/)
101 {
102 }
103
104 /* ************ Tracks ************ */
105
106 libmv_Tracks *libmv_tracksNew(void) {
107   return NULL;
108 }
109
110 void libmv_tracksInsert(libmv_Tracks * /*libmv_tracks*/,
111                         int /*image*/,
112                         int /*track*/,
113                         double /*x*/,
114                         double /*y*/,
115                         double /*weight*/) {
116 }
117
118 void libmv_tracksDestroy(libmv_Tracks * /*libmv_tracks*/) {
119 }
120
121 /* ************ Reconstruction solver ************ */
122
123 libmv_Reconstruction *libmv_solveReconstruction(
124     const libmv_Tracks * /*libmv_tracks*/,
125     const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
126     libmv_ReconstructionOptions * /*libmv_reconstruction_options*/,
127     reconstruct_progress_update_cb /*progress_update_callback*/,
128     void * /*callback_customdata*/) {
129   return NULL;
130 }
131
132 libmv_Reconstruction *libmv_solveModal(
133     const libmv_Tracks * /*libmv_tracks*/,
134     const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
135     const libmv_ReconstructionOptions * /*libmv_reconstruction_options*/,
136     reconstruct_progress_update_cb /*progress_update_callback*/,
137     void * /*callback_customdata*/) {
138   return NULL;
139 }
140
141 int libmv_reconstructionIsValid(libmv_Reconstruction * /*libmv_reconstruction*/) {
142   return 0;
143 }
144
145 int libmv_reprojectionPointForTrack(
146     const libmv_Reconstruction * /*libmv_reconstruction*/,
147     int /*track*/,
148     double /*pos*/[3]) {
149   return 0;
150 }
151
152 double libmv_reprojectionErrorForTrack(
153     const libmv_Reconstruction * /*libmv_reconstruction*/,
154     int /*track*/) {
155   return 0.0;
156 }
157
158 double libmv_reprojectionErrorForImage(
159     const libmv_Reconstruction * /*libmv_reconstruction*/,
160     int /*image*/) {
161   return 0.0;
162 }
163
164 int libmv_reprojectionCameraForImage(
165     const libmv_Reconstruction * /*libmv_reconstruction*/,
166     int /*image*/,
167     double /*mat*/[4][4]) {
168   return 0;
169 }
170
171 double libmv_reprojectionError(
172     const libmv_Reconstruction * /*libmv_reconstruction*/) {
173   return 0.0;
174 }
175
176 void libmv_reconstructionDestroy(
177     struct libmv_Reconstruction * /*libmv_reconstruction*/) {
178 }
179
180 /* ************ Feature detector ************ */
181
182 libmv_Features *libmv_detectFeaturesByte(const unsigned char * /*image_buffer*/,
183                                          int /*width*/,
184                                          int /*height*/,
185                                          int /*channels*/,
186                                          libmv_DetectOptions * /*options*/) {
187   return NULL;
188 }
189
190 struct libmv_Features *libmv_detectFeaturesFloat(
191     const float * /*image_buffer*/,
192     int /*width*/,
193     int /*height*/,
194     int /*channels*/,
195     libmv_DetectOptions * /*options*/) {
196   return NULL;
197 }
198
199 int libmv_countFeatures(const libmv_Features * /*libmv_features*/) {
200   return 0;
201 }
202
203 void libmv_getFeature(const libmv_Features * /*libmv_features*/,
204                       int /*number*/,
205                       double *x,
206                       double *y,
207                       double *score,
208                       double *size) {
209   *x = 0.0;
210   *y = 0.0;
211   *score = 0.0;
212   *size = 0.0;
213 }
214
215 void libmv_featuresDestroy(struct libmv_Features * /*libmv_features*/) {
216 }
217
218 /* ************ Camera intrinsics ************ */
219
220 libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(
221     libmv_Reconstruction * /*libmv_reconstruction*/) {
222   return NULL;
223 }
224
225 libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew(
226     const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/) {
227   return NULL;
228 }
229
230 libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(
231     const libmv_CameraIntrinsics * /*libmvIntrinsics*/) {
232   return NULL;
233 }
234
235 void libmv_cameraIntrinsicsDestroy(
236     libmv_CameraIntrinsics * /*libmvIntrinsics*/) {
237 }
238
239 void libmv_cameraIntrinsicsUpdate(
240     const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/,
241     libmv_CameraIntrinsics * /*libmv_intrinsics*/) {
242 }
243
244 void libmv_cameraIntrinsicsSetThreads(
245     libmv_CameraIntrinsics * /*libmv_intrinsics*/,
246     int /*threads*/) {
247 }
248
249 void libmv_cameraIntrinsicsExtractOptions(
250     const libmv_CameraIntrinsics * /*libmv_intrinsics*/,
251     libmv_CameraIntrinsicsOptions *camera_intrinsics_options) {
252   memset(camera_intrinsics_options, 0, sizeof(libmv_CameraIntrinsicsOptions));
253   camera_intrinsics_options->focal_length = 1.0;
254 }
255
256 void libmv_cameraIntrinsicsUndistortByte(
257     const libmv_CameraIntrinsics * /*libmv_intrinsics*/,
258     const unsigned char *source_image,
259     int width, int height,
260     float /*overscan*/,
261     int channels,
262     unsigned char *destination_image) {
263   memcpy(destination_image, source_image,
264          channels * width * height * sizeof(unsigned char));
265 }
266
267 void libmv_cameraIntrinsicsUndistortFloat(
268     const libmv_CameraIntrinsics* /*libmv_intrinsics*/,
269     const float* source_image,
270     int width,
271     int height,
272     float /*overscan*/,
273     int channels,
274     float* destination_image) {
275   memcpy(destination_image, source_image,
276          channels * width * height * sizeof(float));
277 }
278
279 void libmv_cameraIntrinsicsDistortByte(
280     const struct libmv_CameraIntrinsics* /*libmv_intrinsics*/,
281     const unsigned char *source_image,
282     int width,
283     int height,
284     float /*overscan*/,
285     int channels,
286     unsigned char *destination_image) {
287   memcpy(destination_image, source_image,
288          channels * width * height * sizeof(unsigned char));
289 }
290
291 void libmv_cameraIntrinsicsDistortFloat(
292     const libmv_CameraIntrinsics* /*libmv_intrinsics*/,
293     float* source_image,
294     int width,
295     int height,
296     float /*overscan*/,
297     int channels,
298     float* destination_image) {
299   memcpy(destination_image, source_image,
300          channels * width * height * sizeof(float));
301 }
302
303 /* ************ utils ************ */
304
305 void libmv_cameraIntrinsicsApply(
306     const struct libmv_CameraIntrinsics* /*libmv_intrinsics*/,
307     double /*x*/,
308     double /*y*/,
309     double* x1,
310     double* y1) {
311   *x1 = 0.0;
312   *y1 = 0.0;
313 }
314
315 void libmv_cameraIntrinsicsInvert(
316     const struct libmv_CameraIntrinsics* /*libmv_intrinsics*/,
317     double /*x*/,
318     double /*y*/,
319     double* x1,
320     double* y1) {
321   *x1 = 0.0;
322   *y1 = 0.0;
323 }
324
325 void libmv_homography2DFromCorrespondencesEuc(/* const */ double (* /*x1*/)[2],
326                                               /* const */ double (* /*x2*/)[2],
327                                               int /*num_points*/,
328                                               double H[3][3]) {
329   memset(H, 0, sizeof(double[3][3]));
330   H[0][0] = 1.0f;
331   H[1][1] = 1.0f;
332   H[2][2] = 1.0f;
333 }
334
335 /* ************ autotrack ************ */
336
337 libmv_AutoTrack* libmv_autoTrackNew(libmv_FrameAccessor* /*frame_accessor*/)
338 {
339   return NULL;
340 }
341
342 void libmv_autoTrackDestroy(libmv_AutoTrack* /*libmv_autotrack*/)
343 {
344 }
345
346 void libmv_autoTrackSetOptions(libmv_AutoTrack* /*libmv_autotrack*/,
347                                const libmv_AutoTrackOptions* /*options*/)
348 {
349 }
350
351 int libmv_autoTrackMarker(libmv_AutoTrack* /*libmv_autotrack*/,
352                           const libmv_TrackRegionOptions* /*libmv_options*/,
353                           libmv_Marker * /*libmv_tracker_marker*/,
354                           libmv_TrackRegionResult* /*libmv_result*/)
355 {
356   return 0;
357 }
358
359 void libmv_autoTrackAddMarker(libmv_AutoTrack* /*libmv_autotrack*/,
360                               const libmv_Marker* /*libmv_marker*/)
361 {
362 }
363
364 void libmv_autoTrackSetMarkers(libmv_AutoTrack* /*libmv_autotrack*/,
365                                const libmv_Marker* /*libmv_marker-*/,
366                                size_t /*num_markers*/)
367 {
368 }
369
370 int libmv_autoTrackGetMarker(libmv_AutoTrack* /*libmv_autotrack*/,
371                              int /*clip*/,
372                              int /*frame*/,
373                              int /*track*/,
374                              libmv_Marker* /*libmv_marker*/)
375 {
376   return 0;
377 }
378
379 /* ************ frame accessor ************ */
380
381 libmv_FrameAccessor* libmv_FrameAccessorNew(
382     libmv_FrameAccessorUserData* /*user_data**/,
383     libmv_GetImageCallback /*get_image_callback*/,
384     libmv_ReleaseImageCallback /*release_image_callback*/,
385     libmv_GetMaskForTrackCallback /*get_mask_for_track_callback*/,
386     libmv_ReleaseMaskCallback /*release_mask_callback*/)
387 {
388   return NULL;
389 }
390
391 void libmv_FrameAccessorDestroy(libmv_FrameAccessor* /*frame_accessor*/)
392 {
393 }
394
395 int64_t libmv_frameAccessorgetTransformKey(
396     const libmv_FrameTransform * /*transform*/)
397 {
398   return 0;
399 }
400
401 void libmv_frameAccessorgetTransformRun(const libmv_FrameTransform* /*transform*/,
402                                         const libmv_FloatImage* /*input_image*/,
403                                         libmv_FloatImage* /*output_image*/)
404 {
405 }
406