forked from VisionLabs/torch-opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stitching.cpp
3718 lines (3157 loc) · 103 KB
/
stitching.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <stitching.hpp>
ClassArray::ClassArray(const std::vector<detail::MatchesInfo> & vec)
{
MatchesInfoPtr *temp = static_cast<MatchesInfoPtr *>(malloc(vec.size() * sizeof(MatchesInfoPtr)));
this->size = vec.size();
MatchesInfoPtr class_wrapped;
for (int i = 0; i < vec.size(); i++) {
class_wrapped.ptr = new detail::MatchesInfo(vec[i]);;
temp[i] = class_wrapped;
}
this->data = temp;
}
ClassArray::ClassArray(const std::vector<detail::ImageFeatures> & vec)
{
ImageFeaturesPtr *temp = static_cast<ImageFeaturesPtr *>(malloc(vec.size() * sizeof(ImageFeaturesPtr)));
this->size = vec.size();
ImageFeaturesPtr class_wrapped;
for (int i = 0; i < vec.size(); i++) {
class_wrapped.ptr = new detail::ImageFeatures(vec[i]);;
temp[i] = class_wrapped;
}
this->data = temp;
}
ClassArray::ClassArray(const std::vector<detail::CameraParams> & vec)
{
CameraParamsPtr *temp = static_cast<CameraParamsPtr *>(malloc(vec.size() * sizeof(CameraParamsPtr)));
this->size = vec.size();
CameraParamsPtr class_wrapped;
for (int i = 0; i < vec.size(); i++) {
class_wrapped.ptr = new detail::CameraParams(vec[i]);;
temp[i] = class_wrapped;
}
this->data = temp;
}
ClassArray::operator std::vector<detail::MatchesInfo>()
{
MatchesInfoPtr *temp =
static_cast<MatchesInfoPtr *>(this->data);
std::vector<detail::MatchesInfo> retval(this->size);
for(int i = 0; i < this->size; i++) {
retval[i] = *static_cast<detail::MatchesInfo *>(temp[i].ptr);
//memcpy(retval.data() + i, temp[i].ptr, sizeof(detail::MatchesInfo));
}
return retval;
}
ClassArray::operator std::vector<detail::ImageFeatures>()
{
ImageFeaturesPtr *temp =
static_cast<ImageFeaturesPtr *>(this->data);
std::vector<detail::ImageFeatures> retval(this->size);
for(int i = 0; i < this->size; i++) {
retval[i] = *static_cast<detail::ImageFeatures *>(temp[i].ptr);
//memcpy(retval.data() + i, temp[i].ptr, sizeof(detail::ImageFeatures));
}
return retval;
}
ClassArray::operator std::vector<detail::CameraParams>()
{
CameraParamsPtr *temp =
static_cast<CameraParamsPtr *>(this->data);
std::vector<detail::CameraParams> retval(this->size);
for(int i = 0; i < this->size; i++) {
retval[i] = *static_cast<detail::CameraParams *>(temp[i].ptr);
//memcpy(retval.data() + i, temp[i].ptr, sizeof(detail::CameraParams));
}
return retval;
}
extern "C"
struct RectPlusBool detail_overlapRoi(
struct PointWrapper tl1, struct PointWrapper tl2,
struct SizeWrapper sz1, struct SizeWrapper sz2)
{
struct RectPlusBool result;
cv::Rect roi;
result.val = detail::overlapRoi(tl1, tl2, sz1, sz2, roi);
new(&result.rect) RectWrapper(roi);
return result;
}
extern "C"
struct RectWrapper detail_resultRoi(
struct PointArray corners,
struct SizeArray sizes)
{
return RectWrapper(detail::resultRoi(corners, sizes));
}
extern "C"
struct RectWrapper detail_resultRoi2(
struct PointArray corners,
struct TensorArray images)
{
std::vector<cv::UMat> uvec = get_vec_UMat(images.toMatList());
return RectWrapper(detail::resultRoi(corners, uvec));
}
extern "C"
struct RectWrapper detail_resultRoiIntersection(
struct PointArray corners,
struct SizeArray sizes)
{
return RectWrapper(detail::resultRoiIntersection(corners, sizes));
}
extern "C"
struct PointWrapper detail_resultTl(
struct PointArray corners)
{
return PointWrapper(detail::resultTl(corners));
}
extern "C"
struct TensorWrapper detail_selectRandomSubset(int count, int size)
{
std::vector<int> subset;
detail::selectRandomSubset(count, size, subset);
return TensorWrapper(cv::Mat(subset, true));
}
extern "C"
int detail_stitchingLogLevel()
{
return detail::stitchingLogLevel();
}
/****************** Classes ******************/
//CameraParams
extern "C"
struct CameraParamsPtr CameraParams_ctor()
{
return new detail::CameraParams();
}
extern "C"
struct CameraParamsPtr CameraParams_ctor2(
struct CameraParamsPtr other)
{
detail::CameraParams * instant = static_cast<detail::CameraParams *>(other.ptr);
return new detail::CameraParams(*instant);
}
extern "C"
void CameraParams_dtor(
struct CameraParamsPtr ptr)
{
delete static_cast<detail::CameraParams *>(ptr.ptr);
}
struct TensorWrapper CameraParams_K(
struct CameraParamsPtr ptr)
{
return TensorWrapper(ptr->K());
}
//TODO need to add const CameraParams& detail::CameraParams::operator=(const CameraParams & other)
//DisjointSets
extern "C"
struct DisjointSetsPtr DisjointSets_ctor(
int elem_count)
{
return new detail::DisjointSets(elem_count);
}
extern "C"
void DisjointSets_dtor(
struct DisjointSetsPtr ptr)
{
delete static_cast<detail::DisjointSets *>(ptr.ptr);
}
extern "C"
void DisjointSets_createOneElemSets(
struct DisjointSetsPtr ptr, int elem_count)
{
ptr->createOneElemSets(elem_count);
}
extern "C"
int DisjointSets_findSetByElem(
struct DisjointSetsPtr ptr, int elem)
{
return ptr->findSetByElem(elem);
}
extern "C"
int DisjointSets_mergeSets(
struct DisjointSetsPtr ptr,
int set1, int set2)
{
return ptr->mergeSets(set1, set2);
}
//Graph
extern "C"
struct GraphPtr Graph_ctor(
int num_vertices)
{
return new detail::Graph(num_vertices);
}
extern "C"
void Graph_dtor(
struct GraphPtr ptr)
{
delete static_cast<detail::Graph *>(ptr.ptr);
}
extern "C"
void Graph_addEdge(
struct GraphPtr ptr, int from, int to, float weight)
{
ptr->addEdge(from, to, weight);
}
extern "C"
void Graph_create(
struct GraphPtr ptr, int num_vertices)
{
ptr->create(num_vertices);
}
extern "C"
int Graph_numVertices(
struct GraphPtr ptr)
{
return ptr->numVertices();
}
//GraphEdge
extern "C"
struct GraphEdgePtr GraphEdge_ctor(
int from, int to, float weight)
{
return new detail::GraphEdge(from, to, weight);
}
extern "C"
void GraphEdge_dtor(
struct GraphEdgePtr ptr)
{
delete static_cast<detail::GraphEdge *>(ptr.ptr);
}
//Timelapser
extern "C"
struct TimelapserPtr Timelapser_ctor(
int type)
{
return rescueObjectFromPtr(
detail::Timelapser::createDefault(type));
}
extern "C"
void Timelapser_dtor(
struct TimelapserPtr ptr)
{
delete static_cast<detail::Timelapser *>(ptr.ptr);
}
extern "C"
struct TensorWrapper Timelapser_getDst(
struct TimelapserPtr ptr)
{
cv::UMat umat = ptr->getDst();
return TensorWrapper(MatT(umat.getMat(cv::ACCESS_RW)));
}
extern "C"
void Timelapser_initialize(
struct TimelapserPtr ptr, struct PointArray corners,
struct SizeArray sizes)
{
ptr->initialize(corners, sizes);
}
extern "C"
void Timelapser_process(
struct TimelapserPtr ptr, struct TensorWrapper img,
struct TensorWrapper mask, struct PointWrapper tl)
{
ptr->process(img.toMat(), mask.toMat(), tl);
}
//TimelapserCrop
extern "C"
void TimelapserCrop_initialize(
struct TimelapserCropPtr ptr, struct PointArray corners,
struct SizeArray sizes)
{
ptr->initialize(corners, sizes);
}
//Features Finding and Images Matching
//MatchesInfo
extern "C"
struct MatchesInfoPtr MatchesInfo_ctor()
{
return new detail::MatchesInfo();
}
extern "C"
struct MatchesInfoPtr MatchesInfo_ctor2(
struct MatchesInfoPtr other)
{
return new detail::MatchesInfo(*static_cast<detail::MatchesInfo *>(other.ptr));
}
extern "C"
void MatchesInfo_dtor(
struct MatchesInfoPtr ptr)
{
delete static_cast<detail::MatchesInfo *>(ptr.ptr);
}
//****************Features Finding and Images Matching************
//FeaturesFinder
extern "C"
void FeaturesFinder_dtor(
struct FeaturesFinderPtr ptr)
{
delete static_cast<detail::FeaturesFinder *>(ptr.ptr);
}
extern "C"
void FeaturesFinder_collectGarbage(
struct FeaturesFinderPtr ptr)
{
ptr->collectGarbage();
}
extern "C"
struct ImageFeaturesPtr FeaturesFinder_call(
struct FeaturesFinderPtr ptr, struct TensorWrapper image)
{
detail::ImageFeatures *features = new detail::ImageFeatures();
ptr->operator()(image.toMat(), *features);
return ImageFeaturesPtr(features);
}
extern "C"
struct ImageFeaturesPtr FeaturesFinder_call2(
struct FeaturesFinderPtr ptr, struct TensorWrapper image,
struct RectArray rois)
{
detail::ImageFeatures *features = new detail::ImageFeatures();
ptr->operator()(image.toMat(), *features, rois);
return ImageFeaturesPtr(features);
}
//OrbFeaturesFinder
extern "C"
struct OrbFeaturesFinderPtr OrbFeaturesFinder_ctor(
struct SizeWrapper _grid_size, int nfeatures, float scaleFactor, int nlevels)
{
return new detail::OrbFeaturesFinder(_grid_size, nfeatures, scaleFactor, nlevels);
}
//SurfFeaturesFinder
extern "C"
struct SurfFeaturesFinderPtr SurfFeaturesFinder_ctor(
double hess_thresh, int num_octaves, int num_layers, int num_octaves_descr, int num_layers_descr)
{
return new detail::SurfFeaturesFinder(
hess_thresh, num_octaves, num_layers,
num_octaves_descr, num_layers_descr);
}
//ImageFeatures
extern "C"
struct ImageFeaturesPtr ImageFeatures_ctor()
{
return new detail::ImageFeatures();
}
extern "C"
void ImageFeatures_dtor(
struct ImageFeaturesPtr ptr)
{
delete static_cast<detail::ImageFeatures *>(ptr.ptr);
}
//FeaturesMatcher
extern "C"
void FeaturesMatcher_dtor(
struct FeaturesMatcherPtr ptr)
{
delete static_cast<detail::FeaturesMatcher *>(ptr.ptr);
}
extern "C"
void FeaturesMatcher_collectGarbage(
struct FeaturesMatcherPtr ptr)
{
ptr->collectGarbage();
}
extern "C"
bool FeaturesMatcher_isThreadSafe(
struct FeaturesMatcherPtr ptr)
{
return ptr->isThreadSafe();
}
extern "C"
struct MatchesInfoPtr FeaturesMatcher_call(
struct FeaturesMatcherPtr ptr, struct ImageFeaturesPtr features1,
struct ImageFeaturesPtr features2)
{
detail::MatchesInfo *Mat_inf = new detail::MatchesInfo();
ptr->operator()(*static_cast<detail::ImageFeatures *>(features1.ptr),
*static_cast<detail::ImageFeatures *>(features2.ptr), *Mat_inf);
return Mat_inf;
}
//BestOf2NearestMatcher
extern "C"
struct BestOf2NearestMatcherPtr BestOf2NearestMatcher_ctor(
bool try_use_gpu, float match_conf,
int num_matches_thresh1, int num_matches_thresh2)
{
return new detail::BestOf2NearestMatcher(
try_use_gpu, match_conf, num_matches_thresh1, num_matches_thresh2);
}
extern "C"
void BestOf2NearestMatcher_collectGarbage(
struct BestOf2NearestMatcherPtr ptr)
{
ptr->collectGarbage();
}
//BestOf2NearestRangeMatcher
extern "C"
struct BestOf2NearestRangeMatcherPtr BestOf2NearestRangeMatcher_ctor(
int range_width, bool try_use_gpu, float match_conf,
int num_matches_thresh1, int num_matches_thresh2)
{
return new detail::BestOf2NearestRangeMatcher(range_width, try_use_gpu, match_conf,
num_matches_thresh1, num_matches_thresh2);
}
extern "C"
void BestOf2NearestRangeMatcher_call(
struct BestOf2NearestRangeMatcherPtr ptr, struct ClassArray features,
struct ClassArray pairwise_matches, struct TensorWrapper mask)
{
std::vector<detail::ImageFeatures> features_vec = features;
std::vector<detail::MatchesInfo> pairwise_matches_vec = pairwise_matches;
if(mask.isNull()){
ptr->operator()(features_vec, pairwise_matches_vec);
}
else {
cv::UMat umat = mask.toMat().getUMat(cv::ACCESS_RW);
ptr->operator()(features_vec, pairwise_matches_vec, umat);
}
}
//**********************Rotation Estimation********************************
extern "C"
struct GraphPtrPlusTensor detail_findMaxSpanningTree(
int num_images, struct ClassArray pairwise_matches)
{
GraphPtrPlusTensor result;
detail::Graph *span_tree = new detail::Graph();
std::vector<int> centers;
detail::findMaxSpanningTree(num_images, pairwise_matches, *span_tree, centers);
result.graph.ptr = span_tree;
new (&result.tensor) TensorWrapper(cv::Mat(centers, true));
return result;
}
extern "C"
struct TensorWrapper detail_leaveBiggestComponent(
struct ClassArray features, struct ClassArray pairwise_matches, float conf_threshold)
{
std::vector<detail::ImageFeatures> features_vec = features;
std::vector<detail::MatchesInfo> pairwise_matches_vec = pairwise_matches;
return TensorWrapper(cv::Mat(
detail::leaveBiggestComponent(
features_vec,
pairwise_matches_vec,
conf_threshold), true));
}
extern "C"
struct StringArray detail_matchesGraphAsString(
struct StringArray pathes, struct ClassArray pairwise_matches, float conf_threshold)
{
std::vector<cv::String> pathes_vec = pathes;
std::vector<detail::MatchesInfo> pairwise_matches_vec = pairwise_matches;
// TODO avoid copying (possibly by hacking cv::String)
cv::String result = detail::matchesGraphAsString(
pathes_vec, pairwise_matches_vec, conf_threshold);
StringArray retval(1);
retval.data[0] = static_cast<char *>(malloc(retval.size * sizeof(char)));
strcpy(retval.data[0], result.c_str());
return retval;
}
extern "C"
void detail_waveCorrect(
struct TensorArray rmats, int kind)
{
std::vector<cv::Mat> rmats_vec = rmats.toMatList();
detail::waveCorrect(rmats_vec, static_cast<detail::WaveCorrectKind>(kind));
}
//Estimator
extern "C"
void Estimator_dtor(
struct EstimatorPtr ptr)
{
delete static_cast<detail::Estimator *>(ptr.ptr);
}
extern "C"
struct BoolPlusClassArray Estimator_call(
struct EstimatorPtr ptr, struct ClassArray features, struct ClassArray pairwise_matches)
{
struct BoolPlusClassArray result;
std::vector<detail::CameraParams> cameras;
std::vector<detail::ImageFeatures> features_vec = features;
std::vector<detail::MatchesInfo> pairwise_matches_vec = pairwise_matches;
result.val = ptr->operator()(features_vec, pairwise_matches_vec, cameras);
new(&result.array) ClassArray(cameras);
return result;
}
//HomographyBasedEstimator
extern "C"
struct HomographyBasedEstimatorPtr HomographyBasedEstimator_ctor(
bool is_focals_estimated)
{
return new detail::HomographyBasedEstimator(is_focals_estimated);
}
//BundleAdjusterBase
extern "C"
double BundleAdjusterBase_confThresh(
struct BundleAdjusterBasePtr ptr)
{
return ptr->confThresh();
}
extern "C"
struct TensorWrapper BundleAdjusterBase_refinementMask(
struct BundleAdjusterBasePtr ptr)
{
cv::Mat temp = ptr->refinementMask();
return TensorWrapper(MatT(temp));
}
extern "C"
void BundleAdjusterBase_setConfThresh(
struct BundleAdjusterBasePtr ptr, double conf_thresh)
{
ptr->setConfThresh(conf_thresh);
}
extern "C"
void BundleAdjusterBase_setRefinementMask(
struct BundleAdjusterBasePtr ptr, struct TensorWrapper mask)
{
ptr->setRefinementMask(mask.toMat());
}
extern "C"
void BundleAdjusterBase_setTermCriteria(
struct BundleAdjusterBasePtr ptr, struct TermCriteriaWrapper term_criteria)
{
cv::TermCriteria term(term_criteria.type, term_criteria.maxCount, term_criteria.epsilon);
ptr->setTermCriteria(term);
}
extern "C"
struct TermCriteriaWrapper BundleAdjusterBase_termCriteria(
struct BundleAdjusterBasePtr ptr)
{
struct TermCriteriaWrapper result;
cv::TermCriteria term = ptr->termCriteria();
result.type = term.type;
result.epsilon = term.epsilon;
result.maxCount = term.maxCount;
return result;
}
//BundleAdjusterRay
extern "C"
struct BundleAdjusterRayPtr BundleAdjusterRay_ctor()
{
return new detail::BundleAdjusterRay();
}
//BundleAdjusterReproj
extern "C"
struct BundleAdjusterReprojPtr BundleAdjusterReproj_ctor()
{
return new detail::BundleAdjusterReproj();
}
//************************Autocalibration********************
extern "C"
struct TensorPlusBool detail_calibrateRotatingCamera(
struct TensorArray Hs)
{
struct TensorPlusBool result;
cv::Mat K;
result.val = detail::calibrateRotatingCamera(Hs.toMatList(), K);
new(&result.tensor) TensorWrapper(MatT(K));
return result;
}
extern "C"
struct TensorWrapper detail_estimateFocal(struct ClassArray features, struct ClassArray pairwise_matches)
{
std::vector<double> focals;
std::vector<detail::ImageFeatures> features_vec = features;
std::vector<detail::MatchesInfo> pairwise_matches_vec = pairwise_matches;
detail::estimateFocal(features_vec, pairwise_matches_vec, focals);
return TensorWrapper(cv::Mat(focals, true));
}
extern "C"
struct focalsFromHomographyRetval detail_focalsFromHomography(
struct TensorWrapper H)
{
struct focalsFromHomographyRetval result;
double f0, f1;
bool f0_ok, f1_ok;
detail::focalsFromHomography(H.toMat(), f0, f1, f0_ok, f1_ok);
result.f0 = f0;
result.f1 = f1;
result.f0_ok = f0_ok;
result.f1_ok = f1_ok;
return result;
}
//***********************Images Warping***********************
//ProjectorBase
extern "C"
struct ProjectorBasePtr ProjectorBase_ctor()
{
return new detail::ProjectorBase;
}
extern "C"
void ProjectorBase_dtor(
struct ProjectorBasePtr ptr)
{
delete static_cast<detail::ProjectorBase *>(ptr.ptr);
}
extern "C"
void ProjectorBase_setCameraParams(
struct ProjectorBasePtr ptr, struct TensorWrapper K,
struct TensorWrapper R, struct TensorWrapper T)
{
ptr->setCameraParams(K.toMat(), R.toMat(), T.toMat());
}
////CompressedRectilinearPortraitProjector
extern "C"
struct CompressedRectilinearPortraitProjectorPtr CompressedRectilinearPortraitProjector_ctor()
{
return new detail::CompressedRectilinearPortraitProjector;
}
extern "C"
void CompressedRectilinearPortraitProjector_dtor(
struct CompressedRectilinearPortraitProjectorPtr ptr)
{
delete static_cast<detail::CompressedRectilinearPortraitProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray CompressedRectilinearPortraitProjector_mapBackward(
struct CompressedRectilinearPortraitProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray CompressedRectilinearPortraitProjector_mapForward(
struct CompressedRectilinearPortraitProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//CompressedRectilinearProjector
extern "C"
struct CompressedRectilinearProjectorPtr CompressedRectilinearProjector_ctor()
{
return new detail::CompressedRectilinearProjector;
}
extern "C"
void CompressedRectilinearProjector_dtor(
struct CompressedRectilinearProjectorPtr ptr)
{
delete static_cast<detail::CompressedRectilinearProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray CompressedRectilinearProjector_mapBackward(
struct CompressedRectilinearProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray CompressedRectilinearProjector_mapForward(
struct CompressedRectilinearProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//CylindricalPortraitProjector
extern "C"
struct CylindricalPortraitProjectorPtr CylindricalPortraitProjector_ctor()
{
return new detail::CylindricalPortraitProjector;
}
extern "C"
void CylindricalPortraitProjector_dtor(
struct CylindricalPortraitProjectorPtr ptr)
{
delete static_cast<detail::CylindricalPortraitProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray CylindricalPortraitProjector_mapBackward(
struct CylindricalPortraitProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray CylindricalPortraitProjector_mapForward(
struct CylindricalPortraitProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//CylindricalProjector
extern "C"
struct CylindricalProjectorPtr CylindricalProjector_ctor()
{
return new detail::CylindricalProjector;
}
extern "C"
void CylindricalProjector_dtor(
struct CylindricalProjectorPtr ptr)
{
delete static_cast<detail::CylindricalProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray CylindricalProjector_mapBackward(
struct CylindricalProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray CylindricalProjector_mapForward(
struct CylindricalProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//FisheyeProjector
extern "C"
void FisheyeProjector_dtor(
struct FisheyeProjectorPtr ptr)
{
delete static_cast<detail::FisheyeProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray FisheyeProjector_mapBackward(
struct FisheyeProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray FisheyeProjector_mapForward(
struct FisheyeProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//MercatorProjector
extern "C"
void MercatorProjector_dtor(
struct MercatorProjectorPtr ptr)
{
delete static_cast<detail::MercatorProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray MercatorProjector_mapBackward(
struct MercatorProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray MercatorProjector_mapForward(
struct MercatorProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//PaniniPortraitProjector
extern "C"
void PaniniPortraitProjector_dtor(
struct PaniniPortraitProjectorPtr ptr)
{
delete static_cast<detail::PaniniPortraitProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray PaniniPortraitProjector_mapBackward(
struct PaniniPortraitProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray PaniniPortraitProjector_mapForward(
struct PaniniPortraitProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//PaniniProjector
extern "C"
void PaniniProjector_dtor(
struct PaniniProjectorPtr ptr)
{
delete static_cast<detail::PaniniProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray PaniniProjector_mapBackward(
struct PaniniProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray PaniniProjector_mapForward(
struct PaniniProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//PlanePortraitProjector
extern "C"
void PlanePortraitProjector_dtor(
struct PlanePortraitProjectorPtr ptr)
{
delete static_cast<detail::PlanePortraitProjector *>(ptr.ptr);
}
extern "C"
struct FloatArray PlanePortraitProjector_mapBackward(
struct PlanePortraitProjectorPtr ptr, float u, float v)
{
std::vector<float> vec(2);
ptr->mapBackward(u, v, vec[0], vec[0]);
return FloatArray(vec);
}
extern "C"
struct FloatArray PlanePortraitProjector_mapForward(
struct PlanePortraitProjectorPtr ptr, float x, float y)
{
std::vector<float> vec(2);
ptr->mapBackward(x, y, vec[0], vec[0]);
return FloatArray(vec);
}
//PlaneProjector
extern "C"
void PlaneProjector_dtor(
struct PlaneProjectorPtr ptr)
{
delete static_cast<detail::PlaneProjector *>(ptr.ptr);
}
extern "C"