13 using std::const_mem_fun_ref_t;
22 (
"NS", cv::INPAINT_NS)
23 (
"Telea", cv::INPAINT_TELEA);
28 void LogToMATLAB::print(
const char *format, ...)
31 const int BUFSIZE = 255;
32 char buffer[BUFSIZE+1];
36 va_start(args, format);
37 vsnprintf(buffer, BUFSIZE, format, args);
41 buffer[BUFSIZE] =
'\0';
50 arr.
at(
"Size").toInt(),
51 arr.
at(
"Thresh").toFloat(),
52 arr.
at(
"Eps").toFloat(),
53 arr.
at(
"Prob").toFloat());
59 s.
set(
"Size", params.size);
60 s.
set(
"Thresh", params.thresh);
61 s.
set(
"Eps", params.eps);
62 s.
set(
"Prob", params.prob);
73 s.
set(
"TypeId",
string(
typeid(*p).name()));
81 s.
set(
"TypeId",
string(
typeid(*p).name()));
82 Ptr<VideoFileSource> pp = p.dynamicCast<VideoFileSource>();
84 s.
set(
"Width", pp->width());
85 s.
set(
"Height", pp->height());
86 s.
set(
"FPS", pp->fps());
87 s.
set(
"Count", pp->count());
97 s.
set(
"TypeId",
string(
typeid(*p).name()));
98 s.
set(
"Radius", p->radius());
100 Ptr<WeightingDeblurer> pp = p.dynamicCast<WeightingDeblurer>();
102 s.
set(
"Sensitivity", pp->sensitivity());
112 s.
set(
"TypeId",
string(
typeid(*p).name()));
115 Ptr<MotionEstimatorRansacL2> pp = p.dynamicCast<MotionEstimatorRansacL2>();
117 s.
set(
"RansacParams",
toStruct(pp->ransacParams()));
118 s.
set(
"MinInlierRatio", pp->minInlierRatio());
129 s.
set(
"TypeId",
string(
typeid(*p).name()));
139 s.
set(
"TypeId",
string(
typeid(*p).name()));
140 Ptr<SparsePyrLkOptFlowEstimator> pp = p.dynamicCast<SparsePyrLkOptFlowEstimator>();
142 s.
set(
"WinSize", pp->winSize());
143 s.
set(
"MaxLevel", pp->maxLevel());
153 s.
set(
"TypeId",
string(
typeid(*p).name()));
170 s.
set(
"TypeId",
string(
typeid(*p).name()));
171 Ptr<TranslationBasedLocalOutlierRejector> pp = p.dynamicCast<TranslationBasedLocalOutlierRejector>();
173 s.
set(
"CellSize", pp->cellSize());
174 s.
set(
"RansacParams",
toStruct(pp->ransacParams()));
184 s.
set(
"TypeId",
string(
typeid(*p).name()));
186 Ptr<KeypointBasedMotionEstimator> pp = p.dynamicCast<KeypointBasedMotionEstimator>();
189 s.
set(
"OpticalFlowEstimator",
toStruct(pp->opticalFlowEstimator()));
190 s.
set(
"OutlierRejector",
toStruct(pp->outlierRejector()));
200 s.
set(
"TypeId",
string(
typeid(*p).name()));
202 s.
set(
"Radius", p->radius());
205 Ptr<ConsistentMosaicInpainter> pp = p.dynamicCast<ConsistentMosaicInpainter>();
207 s.
set(
"StdevThresh", pp->stdevThresh());
210 Ptr<MotionInpainter> pp = p.dynamicCast<MotionInpainter>();
212 s.
set(
"FlowErrorThreshold", pp->flowErrorThreshold());
213 s.
set(
"DistThresh", pp->distThresh());
215 s.
set(
"OptFlowEstimator",
toStruct(pp->optFlowEstimator()));
219 Ptr<InpaintingPipeline> pp = p.dynamicCast<InpaintingPipeline>();
221 s.
set(
"Empty", pp->empty());
231 s.
set(
"TypeId",
string(
typeid(*p).name()));
232 Ptr<GaussianMotionFilter> pp = p.dynamicCast<GaussianMotionFilter>();
234 s.
set(
"Radius", pp->radius());
235 s.
set(
"Stdev", pp->stdev());
245 s.
set(
"TypeId",
string(
typeid(*p).name()));
247 Ptr<LpMotionStabilizer> pp = p.dynamicCast<LpMotionStabilizer>();
250 s.
set(
"FrameSize", pp->frameSize());
251 s.
set(
"TrimRatio", pp->trimRatio());
252 s.
set(
"Weight1", pp->weight1());
253 s.
set(
"Weight2", pp->weight2());
254 s.
set(
"Weight3", pp->weight3());
255 s.
set(
"Weight4", pp->weight4());
259 Ptr<GaussianMotionFilter> pp = p.dynamicCast<GaussianMotionFilter>();
261 s.
set(
"Radius", pp->radius());
262 s.
set(
"Stdev", pp->stdev());
266 Ptr<MotionStabilizationPipeline> pp = p.dynamicCast<MotionStabilizationPipeline>();
268 s.
set(
"Empty", pp->empty());
278 s.
set(
"TypeId",
string(
typeid(*p).name()));
279 s.
set(
"MotionEstimator",
toStruct(p->motionEstimator()));
281 Ptr<MoreAccurateMotionWobbleSuppressorBase> pp = p.dynamicCast<MoreAccurateMotionWobbleSuppressorBase>();
283 s.
set(
"Period", pp->period());
294 if (type ==
"LogToMATLAB")
295 p = makePtr<LogToMATLAB>();
296 else if (type ==
"LogToStdout")
297 p = makePtr<LogToStdout>();
298 else if (type ==
"NullLog")
299 p = makePtr<NullLog>();
301 mexErrMsgIdAndTxt(
"mexopencv:error",
302 "Unrecognized logger type %s", type.c_str());
304 mexErrMsgIdAndTxt(
"mexopencv:error",
305 "Failed to create ILog");
310 vector<MxArray>::const_iterator first,
311 vector<MxArray>::const_iterator last)
313 ptrdiff_t len = std::distance(first, last);
315 string path(first->toString()); ++first;
316 bool volatileFrame =
false;
317 for (; first != last; first += 2) {
318 string key(first->toString());
319 const MxArray& val = *(first + 1);
320 if (key ==
"VolatileFrame")
321 volatileFrame = val.
toBool();
323 mexErrMsgIdAndTxt(
"mexopencv:error",
324 "Unrecognized option %s", key.c_str());
326 return makePtr<VideoFileSource>(path, volatileFrame);
331 vector<MxArray>::const_iterator first,
332 vector<MxArray>::const_iterator last)
334 ptrdiff_t len = std::distance(first, last);
336 if (type ==
"VideoFileSource")
338 else if (type ==
"NullFrameSource") {
340 p = makePtr<NullFrameSource>();
343 mexErrMsgIdAndTxt(
"mexopencv:error",
344 "Unrecognized frame source %s", type.c_str());
346 mexErrMsgIdAndTxt(
"mexopencv:error",
347 "Failed to create IFrameSource");
352 vector<MxArray>::const_iterator first,
353 vector<MxArray>::const_iterator last)
355 ptrdiff_t len = std::distance(first, last);
357 Ptr<WeightingDeblurer> p = makePtr<WeightingDeblurer>();
359 mexErrMsgIdAndTxt(
"mexopencv:error",
360 "Failed to create WeightingDeblurer");
361 for (; first != last; first += 2) {
362 string key(first->toString());
363 const MxArray& val = *(first + 1);
366 p->setRadius(val.toInt());
367 else if (key ==
"Sensitivity")
368 p->setSensitivity(val.toFloat());
370 mexErrMsgIdAndTxt(
"mexopencv:error",
371 "Unrecognized option %s", key.c_str());
378 vector<MxArray>::const_iterator first,
379 vector<MxArray>::const_iterator last)
381 ptrdiff_t len = std::distance(first, last);
383 if (type ==
"WeightingDeblurer")
385 else if (type ==
"NullDeblurer") {
387 p = makePtr<NullDeblurer>();
390 mexErrMsgIdAndTxt(
"mexopencv:error",
391 "Unrecognized deblurer %s", type.c_str());
393 mexErrMsgIdAndTxt(
"mexopencv:error",
394 "Failed to create DeblurerBase");
399 vector<MxArray>::const_iterator first,
400 vector<MxArray>::const_iterator last)
402 ptrdiff_t len = std::distance(first, last);
404 MotionModel model = cv::videostab::MM_AFFINE;
405 for (; first != last; first += 2) {
406 string key(first->toString());
407 const MxArray& val = *(first + 1);
408 if (key ==
"MotionModel")
411 mexErrMsgIdAndTxt(
"mexopencv:error",
412 "Unrecognized option %s", key.c_str());
414 return makePtr<MotionEstimatorL1>(model);
418 vector<MxArray>::const_iterator first,
419 vector<MxArray>::const_iterator last)
421 ptrdiff_t len = std::distance(first, last);
423 MotionModel model = cv::videostab::MM_AFFINE;
424 RansacParams ransacParams = RansacParams::default2dMotion(model);
425 float minInlierRatio = 0.1f;
426 for (; first != last; first += 2) {
427 string key(first->toString());
428 const MxArray& val = *(first + 1);
429 if (key ==
"MotionModel")
431 else if (key ==
"RansacParams")
434 else if (key ==
"MinInlierRatio")
435 minInlierRatio = val.toFloat();
437 mexErrMsgIdAndTxt(
"mexopencv:error",
438 "Unrecognized option %s", key.c_str());
440 Ptr<MotionEstimatorRansacL2> p = makePtr<MotionEstimatorRansacL2>(model);
442 mexErrMsgIdAndTxt(
"mexopencv:error",
443 "Failed to create MotionEstimatorRansacL2");
444 p->setRansacParams(ransacParams);
445 p->setMinInlierRatio(minInlierRatio);
451 vector<MxArray>::const_iterator first,
452 vector<MxArray>::const_iterator last)
454 Ptr<MotionEstimatorBase> p;
455 if (type ==
"MotionEstimatorL1")
457 else if (type ==
"MotionEstimatorRansacL2")
460 mexErrMsgIdAndTxt(
"mexopencv:error",
461 "Unrecognized motion estimator %s", type.c_str());
463 mexErrMsgIdAndTxt(
"mexopencv:error",
464 "Failed to create MotionEstimatorBase");
469 vector<MxArray>::const_iterator first,
470 vector<MxArray>::const_iterator last)
472 ptrdiff_t len = std::distance(first, last);
474 Ptr<SparsePyrLkOptFlowEstimator> p = makePtr<SparsePyrLkOptFlowEstimator>();
476 mexErrMsgIdAndTxt(
"mexopencv:error",
477 "Failed to create SparsePyrLkOptFlowEstimator");
478 for (; first != last; first += 2) {
479 string key(first->toString());
480 const MxArray& val = *(first + 1);
481 if (key ==
"WinSize")
482 p->setWinSize(val.toSize());
483 else if (key ==
"MaxLevel")
484 p->setMaxLevel(val.toInt());
486 mexErrMsgIdAndTxt(
"mexopencv:error",
487 "Unrecognized option %s", key.c_str());
494 vector<MxArray>::const_iterator first,
495 vector<MxArray>::const_iterator last)
497 Ptr<ISparseOptFlowEstimator> p;
498 if (type ==
"SparsePyrLkOptFlowEstimator")
501 mexErrMsgIdAndTxt(
"mexopencv:error",
502 "Unrecognized sparse optical flow estimator %s", type.c_str());
504 mexErrMsgIdAndTxt(
"mexopencv:error",
505 "Failed to create ISparseOptFlowEstimator");
511 vector<MxArray>::const_iterator ,
512 vector<MxArray>::const_iterator )
514 Ptr<IDenseOptFlowEstimator> p;
515 if (type ==
"DensePyrLkOptFlowEstimatorGpu")
519 mexErrMsgIdAndTxt(
"mexopencv:error",
520 "Unrecognized dense optical flow estimator %s", type.c_str());
522 mexErrMsgIdAndTxt(
"mexopencv:error",
523 "Failed to create IDenseOptFlowEstimator");
528 vector<MxArray>::const_iterator first,
529 vector<MxArray>::const_iterator last)
531 ptrdiff_t len = std::distance(first, last);
533 Ptr<TranslationBasedLocalOutlierRejector> p = makePtr<TranslationBasedLocalOutlierRejector>();
535 mexErrMsgIdAndTxt(
"mexopencv:error",
536 "Failed to create TranslationBasedLocalOutlierRejector");
537 for (; first != last; first += 2) {
538 string key(first->toString());
539 const MxArray& val = *(first + 1);
540 if (key ==
"CellSize")
541 p->setCellSize(val.toSize());
542 else if (key ==
"RansacParams")
546 mexErrMsgIdAndTxt(
"mexopencv:error",
547 "Unrecognized option %s", key.c_str());
554 vector<MxArray>::const_iterator first,
555 vector<MxArray>::const_iterator last)
557 ptrdiff_t len = std::distance(first, last);
558 Ptr<IOutlierRejector> p;
559 if (type ==
"TranslationBasedLocalOutlierRejector")
561 else if (type ==
"NullOutlierRejector") {
563 p = makePtr<NullOutlierRejector>();
566 mexErrMsgIdAndTxt(
"mexopencv:error",
567 "Unrecognized outlier rejector %s", type.c_str());
569 mexErrMsgIdAndTxt(
"mexopencv:error",
570 "Failed to create IOutlierRejector");
575 vector<MxArray>::const_iterator first,
576 vector<MxArray>::const_iterator last)
578 ptrdiff_t len = std::distance(first, last);
580 Ptr<KeypointBasedMotionEstimator> p;
582 vector<MxArray> args(first->toVector<
MxArray>()); ++first;
585 args[0].toString(), args.begin() + 1, args.end());
586 p = makePtr<KeypointBasedMotionEstimator>(estimator);
589 mexErrMsgIdAndTxt(
"mexopencv:error",
590 "Failed to create KeypointBasedMotionEstimator");
591 for (; first != last; first += 2) {
592 string key(first->toString());
593 const MxArray& val = *(first + 1);
594 if (key ==
"MotionModel")
596 else if (key ==
"Detector") {
597 vector<MxArray> args(val.toVector<
MxArray>());
600 args[0].toString(), args.begin() + 1, args.end());
603 else if (key ==
"OpticalFlowEstimator") {
604 vector<MxArray> args(val.toVector<
MxArray>());
607 args[0].toString(), args.begin() + 1, args.end());
608 p->setOpticalFlowEstimator(pp);
610 else if (key ==
"OutlierRejector") {
611 vector<MxArray> args(val.toVector<
MxArray>());
614 args[0].toString(), args.begin() + 1, args.end());
615 p->setOutlierRejector(pp);
618 mexErrMsgIdAndTxt(
"mexopencv:error",
619 "Unrecognized option %s", key.c_str());
625 vector<MxArray>::const_iterator first,
626 vector<MxArray>::const_iterator last)
628 ptrdiff_t len = std::distance(first, last);
630 string path(first->toString()); ++first;
631 Ptr<FromFileMotionReader> p = makePtr<FromFileMotionReader>(path);
633 mexErrMsgIdAndTxt(
"mexopencv:error",
634 "Failed to create FromFileMotionReader");
635 for (; first != last; first += 2) {
636 string key(first->toString());
637 const MxArray& val = *(first + 1);
638 if (key ==
"MotionModel")
641 mexErrMsgIdAndTxt(
"mexopencv:error",
642 "Unrecognized option %s", key.c_str());
648 vector<MxArray>::const_iterator first,
649 vector<MxArray>::const_iterator last)
651 ptrdiff_t len = std::distance(first, last);
653 Ptr<ToFileMotionWriter> p;
655 string path(first->toString()); ++first;
656 vector<MxArray> args(first->toVector<
MxArray>()); ++first;
659 args[0].toString(), args.begin() + 1, args.end());
660 p = makePtr<ToFileMotionWriter>(path, estimator);
663 mexErrMsgIdAndTxt(
"mexopencv:error",
664 "Failed to create ToFileMotionWriter");
665 for (; first != last; first += 2) {
666 string key(first->toString());
667 const MxArray& val = *(first + 1);
668 if (key ==
"MotionModel")
671 mexErrMsgIdAndTxt(
"mexopencv:error",
672 "Unrecognized option %s", key.c_str());
679 vector<MxArray>::const_iterator first,
680 vector<MxArray>::const_iterator last)
682 Ptr<ImageMotionEstimatorBase> p;
683 if (type ==
"KeypointBasedMotionEstimator")
685 else if (type ==
"FromFileMotionReader")
687 else if (type ==
"ToFileMotionWriter")
690 mexErrMsgIdAndTxt(
"mexopencv:error",
691 "Unrecognized image motion estimator %s", type.c_str());
693 mexErrMsgIdAndTxt(
"mexopencv:error",
694 "Failed to create ImageMotionEstimatorBase");
699 vector<MxArray>::const_iterator first,
700 vector<MxArray>::const_iterator last)
702 ptrdiff_t len = std::distance(first, last);
704 int method = cv::INPAINT_TELEA;
705 double radius2 = 2.0;
707 MotionModel model = cv::videostab::MM_UNKNOWN;
708 for (; first != last; first += 2) {
709 string key(first->toString());
710 const MxArray& val = *(first + 1);
713 method = InpaintingAlgMap[val.toString()];
714 else if (key ==
"Radius2")
715 radius2 = val.toDouble();
716 else if (key ==
"MotionModel")
718 else if (key ==
"Radius")
719 radius = val.toInt();
721 mexErrMsgIdAndTxt(
"mexopencv:error",
722 "Unrecognized option %s", key.c_str());
724 Ptr<ColorInpainter> p = makePtr<ColorInpainter>(method, radius2);
726 mexErrMsgIdAndTxt(
"mexopencv:error",
727 "Failed to create ColorInpainter");
728 p->setMotionModel(model);
729 p->setRadius(radius);
734 vector<MxArray>::const_iterator first,
735 vector<MxArray>::const_iterator last)
737 ptrdiff_t len = std::distance(first, last);
739 Ptr<ColorAverageInpainter> p = makePtr<ColorAverageInpainter>();
741 mexErrMsgIdAndTxt(
"mexopencv:error",
742 "Failed to create ColorAverageInpainter");
743 for (; first != last; first += 2) {
744 string key(first->toString());
745 const MxArray& val = *(first + 1);
747 if (key ==
"MotionModel")
749 else if (key ==
"Radius")
750 p->setRadius(val.toInt());
752 mexErrMsgIdAndTxt(
"mexopencv:error",
753 "Unrecognized option %s", key.c_str());
759 vector<MxArray>::const_iterator first,
760 vector<MxArray>::const_iterator last)
762 ptrdiff_t len = std::distance(first, last);
764 Ptr<ConsistentMosaicInpainter> p = makePtr<ConsistentMosaicInpainter>();
766 mexErrMsgIdAndTxt(
"mexopencv:error",
767 "Failed to create ConsistentMosaicInpainter");
768 for (; first != last; first += 2) {
769 string key(first->toString());
770 const MxArray& val = *(first + 1);
772 if (key ==
"MotionModel")
774 else if (key ==
"Radius")
775 p->setRadius(val.toInt());
776 else if (key ==
"StdevThresh")
777 p->setStdevThresh(val.toFloat());
779 mexErrMsgIdAndTxt(
"mexopencv:error",
780 "Unrecognized option %s", key.c_str());
786 vector<MxArray>::const_iterator first,
787 vector<MxArray>::const_iterator last)
789 ptrdiff_t len = std::distance(first, last);
791 Ptr<MotionInpainter> p = makePtr<MotionInpainter>();
793 mexErrMsgIdAndTxt(
"mexopencv:error",
794 "Failed to create MotionInpainter");
795 for (; first != last; first += 2) {
796 string key(first->toString());
797 const MxArray& val = *(first + 1);
799 if (key ==
"MotionModel")
801 else if (key ==
"Radius")
802 p->setRadius(val.toInt());
803 else if (key ==
"FlowErrorThreshold")
804 p->setFlowErrorThreshold(val.toFloat());
805 else if (key ==
"DistThreshold")
806 p->setDistThreshold(val.toFloat());
807 else if (key ==
"BorderMode")
809 else if (key ==
"OptFlowEstimator") {
810 vector<MxArray> args(val.toVector<
MxArray>());
813 args[0].toString(), args.begin() + 1, args.end());
814 p->setOptFlowEstimator(pp);
817 mexErrMsgIdAndTxt(
"mexopencv:error",
818 "Unrecognized option %s", key.c_str());
824 vector<MxArray>::const_iterator first,
825 vector<MxArray>::const_iterator last)
827 ptrdiff_t len = std::distance(first, last);
829 Ptr<InpaintingPipeline> p = makePtr<InpaintingPipeline>();
831 mexErrMsgIdAndTxt(
"mexopencv:error",
832 "Failed to create InpaintingPipeline");
834 vector<vector<MxArray> > inpainters(first->toVector(
835 const_mem_fun_ref_t<vector<MxArray>,
MxArray>(
836 &MxArray::toVector<MxArray>))); ++first;
837 for (vector<vector<MxArray> >::const_iterator it = inpainters.begin(); it != inpainters.end(); ++it) {
840 (*it)[0].toString(), it->begin() + 1, it->end());
841 p->pushBack(inpainter);
844 for (; first != last; first += 2) {
845 string key(first->toString());
846 const MxArray& val = *(first + 1);
848 if (key ==
"MotionModel")
850 else if (key ==
"Radius")
851 p->setRadius(val.toInt());
853 mexErrMsgIdAndTxt(
"mexopencv:error",
854 "Unrecognized option %s", key.c_str());
861 vector<MxArray>::const_iterator first,
862 vector<MxArray>::const_iterator last)
864 ptrdiff_t len = std::distance(first, last);
865 Ptr<InpainterBase> p;
866 if (type ==
"ColorInpainter")
868 else if (type ==
"ColorAverageInpainter")
870 else if (type ==
"ConsistentMosaicInpainter")
872 else if (type ==
"MotionInpainter")
874 else if (type ==
"InpaintingPipeline")
876 else if (type ==
"NullInpainter") {
878 p = makePtr<NullInpainter>();
881 mexErrMsgIdAndTxt(
"mexopencv:error",
882 "Unrecognized inpainter %s", type.c_str());
884 mexErrMsgIdAndTxt(
"mexopencv:error",
885 "Failed to create InpainterBase");
890 vector<MxArray>::const_iterator first,
891 vector<MxArray>::const_iterator last)
893 ptrdiff_t len = std::distance(first, last);
897 for (; first != last; first += 2) {
898 string key(first->toString());
899 const MxArray& val = *(first + 1);
901 radius = val.
toInt();
902 else if (key ==
"Stdev")
903 stdev = val.toFloat();
905 mexErrMsgIdAndTxt(
"mexopencv:error",
906 "Unrecognized option %s", key.c_str());
908 return makePtr<GaussianMotionFilter>(radius, stdev);
913 vector<MxArray>::const_iterator first,
914 vector<MxArray>::const_iterator last)
916 Ptr<MotionFilterBase> p;
917 if (type ==
"GaussianMotionFilter")
920 mexErrMsgIdAndTxt(
"mexopencv:error",
921 "Unrecognized motion filter %s", type.c_str());
923 mexErrMsgIdAndTxt(
"mexopencv:error",
924 "Failed to create MotionFilterBase");
929 vector<MxArray>::const_iterator first,
930 vector<MxArray>::const_iterator last)
932 ptrdiff_t len = std::distance(first, last);
934 Ptr<LpMotionStabilizer> p = makePtr<LpMotionStabilizer>();
936 mexErrMsgIdAndTxt(
"mexopencv:error",
937 "Failed to create LpMotionStabilizer");
938 for (; first != last; first += 2) {
939 string key(first->toString());
940 const MxArray& val = *(first + 1);
941 if (key ==
"MotionModel")
943 else if (key ==
"FrameSize")
944 p->setFrameSize(val.toSize());
945 else if (key ==
"TrimRatio")
946 p->setTrimRatio(val.toFloat());
947 else if (key ==
"Weight1")
948 p->setWeight1(val.toFloat());
949 else if (key ==
"Weight2")
950 p->setWeight2(val.toFloat());
951 else if (key ==
"Weight3")
952 p->setWeight3(val.toFloat());
953 else if (key ==
"Weight4")
954 p->setWeight4(val.toFloat());
956 mexErrMsgIdAndTxt(
"mexopencv:error",
957 "Unrecognized option %s", key.c_str());
963 vector<MxArray>::const_iterator first,
964 vector<MxArray>::const_iterator last)
966 ptrdiff_t len = std::distance(first, last);
968 Ptr<MotionStabilizationPipeline> p = makePtr<MotionStabilizationPipeline>();
970 mexErrMsgIdAndTxt(
"mexopencv:error",
971 "Failed to create MotionStabilizationPipeline");
973 vector<vector<MxArray> > stabilizers(first->toVector(
974 const_mem_fun_ref_t<vector<MxArray>,
MxArray>(
975 &MxArray::toVector<MxArray>))); ++first;
976 for (vector<vector<MxArray> >::const_iterator it = stabilizers.begin(); it != stabilizers.end(); ++it) {
979 (*it)[0].toString(), it->begin() + 1, it->end());
980 p->pushBack(stabilizer);
988 vector<MxArray>::const_iterator first,
989 vector<MxArray>::const_iterator last)
991 Ptr<IMotionStabilizer> p;
992 if (type ==
"LpMotionStabilizer")
994 else if (type ==
"GaussianMotionFilter")
996 else if (type ==
"MotionStabilizationPipeline")
999 mexErrMsgIdAndTxt(
"mexopencv:error",
1000 "Unrecognized motion stabilizer %s", type.c_str());
1002 mexErrMsgIdAndTxt(
"mexopencv:error",
1003 "Failed to create IMotionStabilizer");
1008 vector<MxArray>::const_iterator first,
1009 vector<MxArray>::const_iterator last)
1011 ptrdiff_t len = std::distance(first, last);
1013 Ptr<MoreAccurateMotionWobbleSuppressor> p = makePtr<MoreAccurateMotionWobbleSuppressor>();
1015 mexErrMsgIdAndTxt(
"mexopencv:error",
1016 "Failed to create MoreAccurateMotionWobbleSuppressor");
1017 for (; first != last; first += 2) {
1018 string key(first->toString());
1019 const MxArray& val = *(first + 1);
1021 if (key ==
"MotionEstimator") {
1022 vector<MxArray> args(val.toVector<
MxArray>());
1025 args[0].toString(), args.begin() + 1, args.end());
1026 p->setMotionEstimator(pp);
1028 else if (key ==
"Period")
1029 p->setPeriod(val.toInt());
1031 mexErrMsgIdAndTxt(
"mexopencv:error",
1032 "Unrecognized option %s", key.c_str());
1039 vector<MxArray>::const_iterator first,
1040 vector<MxArray>::const_iterator last)
1042 ptrdiff_t len = std::distance(first, last);
1043 Ptr<WobbleSuppressorBase> p;
1044 if (type ==
"MoreAccurateMotionWobbleSuppressor")
1046 else if (type ==
"NullWobbleSuppressor") {
1048 p = makePtr<NullWobbleSuppressor>();
1051 mexErrMsgIdAndTxt(
"mexopencv:error",
1052 "Unrecognized wobble suppressor %s", type.c_str());
1054 mexErrMsgIdAndTxt(
"mexopencv:error",
1055 "Failed to create WobbleSuppressorBase");
cv::Ptr< cv::videostab::GaussianMotionFilter > createGaussianMotionFilter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of GaussianMotionFilter using options in arguments.
cv::Ptr< cv::videostab::MotionEstimatorRansacL2 > createMotionEstimatorRansacL2(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionEstimatorRansacL2 using options in arguments.
Common definitions for the videostab module.
cv::Ptr< cv::videostab::ConsistentMosaicInpainter > createConsistentMosaicInpainter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ConsistentMosaicInpainter using options in arguments.
cv::Ptr< cv::videostab::MotionEstimatorL1 > createMotionEstimatorL1(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionEstimatorL1 using options in arguments.
cv::Ptr< cv::videostab::IDenseOptFlowEstimator > createIDenseOptFlowEstimator(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IDenseOptFlowEstimator using options in arguments.
cv::Ptr< cv::videostab::DeblurerBase > createDeblurerBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of DeblurerBase using options in arguments.
cv::Ptr< cv::videostab::InpainterBase > createInpainterBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of InpainterBase using options in arguments.
cv::Ptr< cv::videostab::MoreAccurateMotionWobbleSuppressor > createMoreAccurateMotionWobbleSuppressor(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MoreAccurateMotionWobbleSuppressor using options in arguments.
cv::Ptr< cv::videostab::WeightingDeblurer > createWeightingDeblurer(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of WeightingDeblurer using options in arguments.
cv::Ptr< cv::videostab::LpMotionStabilizer > createLpMotionStabilizer(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of LpMotionStabilizer using options in arguments.
cv::Ptr< cv::videostab::KeypointBasedMotionEstimator > createKeypointBasedMotionEstimator(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of KeypointBasedMotionEstimator using options in arguments.
cv::Ptr< cv::videostab::IMotionStabilizer > createIMotionStabilizer(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IMotionStabilizer using options in arguments.
cv::Ptr< cv::videostab::ColorInpainter > createColorInpainter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ColorInpainter using options in arguments.
const ConstMap< string, int > InpaintingAlgMap
inpainting algorithm types for option processing
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
cv::Ptr< cv::videostab::SparsePyrLkOptFlowEstimator > createSparsePyrLkOptFlowEstimator(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of SparsePyrLkOptFlowEstimator using options in arguments.
cv::Ptr< cv::videostab::MotionStabilizationPipeline > createMotionStabilizationPipeline(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionStabilizationPipeline using options in arguments.
cv::Ptr< cv::videostab::ColorAverageInpainter > createColorAverageInpainter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ColorAverageInpainter using options in arguments.
MxArray toStruct(const std::vector< cv::ml::DTrees::Node > &nodes)
Convert tree nodes to struct array.
const ConstMap< int, std::string > BorderTypeInv
Inverse border type map for option processing.
int toInt() const
Convert MxArray to int.
cv::Ptr< cv::videostab::MotionInpainter > createMotionInpainter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionInpainter using options in arguments.
cv::Ptr< cv::videostab::WobbleSuppressorBase > createWobbleSuppressorBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of WobbleSuppressorBase using options in arguments.
const ConstMap< cv::videostab::MotionModel, std::string > MotionModelInvMap
inverse motion model types for option processing
cv::Ptr< cv::videostab::ISparseOptFlowEstimator > createISparseOptFlowEstimator(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ISparseOptFlowEstimator using options in arguments.
cv::Ptr< cv::videostab::FromFileMotionReader > createFromFileMotionReader(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of FromFileMotionReader using options in arguments.
cv::Ptr< cv::FeatureDetector > createFeatureDetector(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Factory function for FeatureDetector creation.
const ConstMap< std::string, int > BorderType
Border type map for option processing.
cv::Ptr< cv::videostab::TranslationBasedLocalOutlierRejector > createTranslationBasedLocalOutlierRejector(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of createTranslationBasedLocalOutlierRejector using options in arguments...
const ConstMap< std::string, cv::videostab::MotionModel > MotionModelMap
motion model types for option processing
cv::Ptr< cv::videostab::IFrameSource > createIFrameSource(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IFrameSource using options in arguments.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
bool toBool() const
Convert MxArray to bool.
cv::Ptr< cv::videostab::IOutlierRejector > createIOutlierRejector(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of IOutlierRejector using options in arguments.
cv::Ptr< cv::videostab::ToFileMotionWriter > createToFileMotionWriter(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ToFileMotionWriter using options in arguments.
cv::Ptr< cv::videostab::VideoFileSource > createVideoFileSource(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of VideoFileSource using options in arguments.
cv::Ptr< cv::videostab::ImageMotionEstimatorBase > createImageMotionEstimator(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of ImageMotionEstimatorBase using options in arguments.
T at(mwIndex index) const
Template for numeric array element accessor.
RansacParams toRansacParams(const MxArray &arr)
Convert MxArray to RansacParams.
std::map wrapper with one-line initialization and lookup method.
cv::Ptr< cv::videostab::MotionFilterBase > createMotionFilterBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionFilterBase using options in arguments.
cv::Ptr< cv::videostab::InpaintingPipeline > createInpaintingPipeline(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of InpaintingPipeline using options in arguments.
cv::Ptr< cv::videostab::ILog > createILog(const std::string &type)
Create an instance of ILog of the specified type.
cv::Ptr< cv::videostab::MotionEstimatorBase > createMotionEstimatorBase(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of MotionEstimatorBase using options in arguments.