Calib3d.h 576 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/calib3d.hpp"
  8. #else
  9. #define CV_EXPORTS
  10. #endif
  11. #import <Foundation/Foundation.h>
  12. @class CirclesGridFinderParameters;
  13. @class Double3;
  14. @class Mat;
  15. @class Point2d;
  16. @class Rect2i;
  17. @class Scalar;
  18. @class Size2i;
  19. @class TermCriteria;
  20. @class UsacParams;
  21. // C++: enum HandEyeCalibrationMethod (cv.HandEyeCalibrationMethod)
  22. typedef NS_ENUM(int, HandEyeCalibrationMethod) {
  23. CALIB_HAND_EYE_TSAI = 0,
  24. CALIB_HAND_EYE_PARK = 1,
  25. CALIB_HAND_EYE_HORAUD = 2,
  26. CALIB_HAND_EYE_ANDREFF = 3,
  27. CALIB_HAND_EYE_DANIILIDIS = 4
  28. };
  29. // C++: enum LocalOptimMethod (cv.LocalOptimMethod)
  30. typedef NS_ENUM(int, LocalOptimMethod) {
  31. LOCAL_OPTIM_NULL = 0,
  32. LOCAL_OPTIM_INNER_LO = 1,
  33. LOCAL_OPTIM_INNER_AND_ITER_LO = 2,
  34. LOCAL_OPTIM_GC = 3,
  35. LOCAL_OPTIM_SIGMA = 4
  36. };
  37. // C++: enum NeighborSearchMethod (cv.NeighborSearchMethod)
  38. typedef NS_ENUM(int, NeighborSearchMethod) {
  39. NEIGH_FLANN_KNN = 0,
  40. NEIGH_GRID = 1,
  41. NEIGH_FLANN_RADIUS = 2
  42. };
  43. // C++: enum PolishingMethod (cv.PolishingMethod)
  44. typedef NS_ENUM(int, PolishingMethod) {
  45. NONE_POLISHER = 0,
  46. LSQ_POLISHER = 1,
  47. MAGSAC = 2,
  48. COV_POLISHER = 3
  49. };
  50. // C++: enum RobotWorldHandEyeCalibrationMethod (cv.RobotWorldHandEyeCalibrationMethod)
  51. typedef NS_ENUM(int, RobotWorldHandEyeCalibrationMethod) {
  52. CALIB_ROBOT_WORLD_HAND_EYE_SHAH = 0,
  53. CALIB_ROBOT_WORLD_HAND_EYE_LI = 1
  54. };
  55. // C++: enum SamplingMethod (cv.SamplingMethod)
  56. typedef NS_ENUM(int, SamplingMethod) {
  57. SAMPLING_UNIFORM = 0,
  58. SAMPLING_PROGRESSIVE_NAPSAC = 1,
  59. SAMPLING_NAPSAC = 2,
  60. SAMPLING_PROSAC = 3
  61. };
  62. // C++: enum ScoreMethod (cv.ScoreMethod)
  63. typedef NS_ENUM(int, ScoreMethod) {
  64. SCORE_METHOD_RANSAC = 0,
  65. SCORE_METHOD_MSAC = 1,
  66. SCORE_METHOD_MAGSAC = 2,
  67. SCORE_METHOD_LMEDS = 3
  68. };
  69. // C++: enum SolvePnPMethod (cv.SolvePnPMethod)
  70. typedef NS_ENUM(int, SolvePnPMethod) {
  71. SOLVEPNP_ITERATIVE = 0,
  72. SOLVEPNP_EPNP = 1,
  73. SOLVEPNP_P3P = 2,
  74. SOLVEPNP_DLS = 3,
  75. SOLVEPNP_UPNP = 4,
  76. SOLVEPNP_AP3P = 5,
  77. SOLVEPNP_IPPE = 6,
  78. SOLVEPNP_IPPE_SQUARE = 7,
  79. SOLVEPNP_SQPNP = 8,
  80. SOLVEPNP_MAX_COUNT = 8+1
  81. };
  82. // C++: enum UndistortTypes (cv.UndistortTypes)
  83. typedef NS_ENUM(int, UndistortTypes) {
  84. PROJ_SPHERICAL_ORTHO = 0,
  85. PROJ_SPHERICAL_EQRECT = 1
  86. };
  87. NS_ASSUME_NONNULL_BEGIN
  88. // C++: class Calib3d
  89. /**
  90. * The Calib3d module
  91. *
  92. * Member classes: `UsacParams`, `CirclesGridFinderParameters`, `StereoMatcher`, `StereoBM`, `StereoSGBM`
  93. *
  94. * Member enums: `SolvePnPMethod`, `HandEyeCalibrationMethod`, `RobotWorldHandEyeCalibrationMethod`, `SamplingMethod`, `LocalOptimMethod`, `ScoreMethod`, `NeighborSearchMethod`, `PolishingMethod`, `GridType`, `UndistortTypes`
  95. */
  96. CV_EXPORTS @interface Calib3d : NSObject
  97. #pragma mark - Class Constants
  98. @property (class, readonly) int CV_ITERATIVE NS_SWIFT_NAME(CV_ITERATIVE);
  99. @property (class, readonly) int CV_EPNP NS_SWIFT_NAME(CV_EPNP);
  100. @property (class, readonly) int CV_P3P NS_SWIFT_NAME(CV_P3P);
  101. @property (class, readonly) int CV_DLS NS_SWIFT_NAME(CV_DLS);
  102. @property (class, readonly) int CvLevMarq_DONE NS_SWIFT_NAME(CvLevMarq_DONE);
  103. @property (class, readonly) int CvLevMarq_STARTED NS_SWIFT_NAME(CvLevMarq_STARTED);
  104. @property (class, readonly) int CvLevMarq_CALC_J NS_SWIFT_NAME(CvLevMarq_CALC_J);
  105. @property (class, readonly) int CvLevMarq_CHECK_ERR NS_SWIFT_NAME(CvLevMarq_CHECK_ERR);
  106. @property (class, readonly) int LMEDS NS_SWIFT_NAME(LMEDS);
  107. @property (class, readonly) int RANSAC NS_SWIFT_NAME(RANSAC);
  108. @property (class, readonly) int RHO NS_SWIFT_NAME(RHO);
  109. @property (class, readonly) int USAC_DEFAULT NS_SWIFT_NAME(USAC_DEFAULT);
  110. @property (class, readonly) int USAC_PARALLEL NS_SWIFT_NAME(USAC_PARALLEL);
  111. @property (class, readonly) int USAC_FM_8PTS NS_SWIFT_NAME(USAC_FM_8PTS);
  112. @property (class, readonly) int USAC_FAST NS_SWIFT_NAME(USAC_FAST);
  113. @property (class, readonly) int USAC_ACCURATE NS_SWIFT_NAME(USAC_ACCURATE);
  114. @property (class, readonly) int USAC_PROSAC NS_SWIFT_NAME(USAC_PROSAC);
  115. @property (class, readonly) int USAC_MAGSAC NS_SWIFT_NAME(USAC_MAGSAC);
  116. @property (class, readonly) int CALIB_CB_ADAPTIVE_THRESH NS_SWIFT_NAME(CALIB_CB_ADAPTIVE_THRESH);
  117. @property (class, readonly) int CALIB_CB_NORMALIZE_IMAGE NS_SWIFT_NAME(CALIB_CB_NORMALIZE_IMAGE);
  118. @property (class, readonly) int CALIB_CB_FILTER_QUADS NS_SWIFT_NAME(CALIB_CB_FILTER_QUADS);
  119. @property (class, readonly) int CALIB_CB_FAST_CHECK NS_SWIFT_NAME(CALIB_CB_FAST_CHECK);
  120. @property (class, readonly) int CALIB_CB_EXHAUSTIVE NS_SWIFT_NAME(CALIB_CB_EXHAUSTIVE);
  121. @property (class, readonly) int CALIB_CB_ACCURACY NS_SWIFT_NAME(CALIB_CB_ACCURACY);
  122. @property (class, readonly) int CALIB_CB_LARGER NS_SWIFT_NAME(CALIB_CB_LARGER);
  123. @property (class, readonly) int CALIB_CB_MARKER NS_SWIFT_NAME(CALIB_CB_MARKER);
  124. @property (class, readonly) int CALIB_CB_SYMMETRIC_GRID NS_SWIFT_NAME(CALIB_CB_SYMMETRIC_GRID);
  125. @property (class, readonly) int CALIB_CB_ASYMMETRIC_GRID NS_SWIFT_NAME(CALIB_CB_ASYMMETRIC_GRID);
  126. @property (class, readonly) int CALIB_CB_CLUSTERING NS_SWIFT_NAME(CALIB_CB_CLUSTERING);
  127. @property (class, readonly) int CALIB_NINTRINSIC NS_SWIFT_NAME(CALIB_NINTRINSIC);
  128. @property (class, readonly) int CALIB_USE_INTRINSIC_GUESS NS_SWIFT_NAME(CALIB_USE_INTRINSIC_GUESS);
  129. @property (class, readonly) int CALIB_FIX_ASPECT_RATIO NS_SWIFT_NAME(CALIB_FIX_ASPECT_RATIO);
  130. @property (class, readonly) int CALIB_FIX_PRINCIPAL_POINT NS_SWIFT_NAME(CALIB_FIX_PRINCIPAL_POINT);
  131. @property (class, readonly) int CALIB_ZERO_TANGENT_DIST NS_SWIFT_NAME(CALIB_ZERO_TANGENT_DIST);
  132. @property (class, readonly) int CALIB_FIX_FOCAL_LENGTH NS_SWIFT_NAME(CALIB_FIX_FOCAL_LENGTH);
  133. @property (class, readonly) int CALIB_FIX_K1 NS_SWIFT_NAME(CALIB_FIX_K1);
  134. @property (class, readonly) int CALIB_FIX_K2 NS_SWIFT_NAME(CALIB_FIX_K2);
  135. @property (class, readonly) int CALIB_FIX_K3 NS_SWIFT_NAME(CALIB_FIX_K3);
  136. @property (class, readonly) int CALIB_FIX_K4 NS_SWIFT_NAME(CALIB_FIX_K4);
  137. @property (class, readonly) int CALIB_FIX_K5 NS_SWIFT_NAME(CALIB_FIX_K5);
  138. @property (class, readonly) int CALIB_FIX_K6 NS_SWIFT_NAME(CALIB_FIX_K6);
  139. @property (class, readonly) int CALIB_RATIONAL_MODEL NS_SWIFT_NAME(CALIB_RATIONAL_MODEL);
  140. @property (class, readonly) int CALIB_THIN_PRISM_MODEL NS_SWIFT_NAME(CALIB_THIN_PRISM_MODEL);
  141. @property (class, readonly) int CALIB_FIX_S1_S2_S3_S4 NS_SWIFT_NAME(CALIB_FIX_S1_S2_S3_S4);
  142. @property (class, readonly) int CALIB_TILTED_MODEL NS_SWIFT_NAME(CALIB_TILTED_MODEL);
  143. @property (class, readonly) int CALIB_FIX_TAUX_TAUY NS_SWIFT_NAME(CALIB_FIX_TAUX_TAUY);
  144. @property (class, readonly) int CALIB_USE_QR NS_SWIFT_NAME(CALIB_USE_QR);
  145. @property (class, readonly) int CALIB_FIX_TANGENT_DIST NS_SWIFT_NAME(CALIB_FIX_TANGENT_DIST);
  146. @property (class, readonly) int CALIB_FIX_INTRINSIC NS_SWIFT_NAME(CALIB_FIX_INTRINSIC);
  147. @property (class, readonly) int CALIB_SAME_FOCAL_LENGTH NS_SWIFT_NAME(CALIB_SAME_FOCAL_LENGTH);
  148. @property (class, readonly) int CALIB_ZERO_DISPARITY NS_SWIFT_NAME(CALIB_ZERO_DISPARITY);
  149. @property (class, readonly) int CALIB_USE_LU NS_SWIFT_NAME(CALIB_USE_LU);
  150. @property (class, readonly) int CALIB_USE_EXTRINSIC_GUESS NS_SWIFT_NAME(CALIB_USE_EXTRINSIC_GUESS);
  151. @property (class, readonly) int FM_7POINT NS_SWIFT_NAME(FM_7POINT);
  152. @property (class, readonly) int FM_8POINT NS_SWIFT_NAME(FM_8POINT);
  153. @property (class, readonly) int FM_LMEDS NS_SWIFT_NAME(FM_LMEDS);
  154. @property (class, readonly) int FM_RANSAC NS_SWIFT_NAME(FM_RANSAC);
  155. @property (class, readonly) int CALIB_RECOMPUTE_EXTRINSIC NS_SWIFT_NAME(CALIB_RECOMPUTE_EXTRINSIC);
  156. @property (class, readonly) int CALIB_CHECK_COND NS_SWIFT_NAME(CALIB_CHECK_COND);
  157. @property (class, readonly) int CALIB_FIX_SKEW NS_SWIFT_NAME(CALIB_FIX_SKEW);
  158. #pragma mark - Methods
  159. //
  160. // void cv::Rodrigues(Mat src, Mat& dst, Mat& jacobian = Mat())
  161. //
  162. /**
  163. * Converts a rotation matrix to a rotation vector or vice versa.
  164. *
  165. * @param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
  166. * @param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
  167. * @param jacobian Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial
  168. * derivatives of the output array components with respect to the input array components.
  169. *
  170. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}$$`
  171. *
  172. * Inverse transformation can be also done easily, since
  173. *
  174. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}$$`
  175. *
  176. * A rotation vector is a convenient and most compact representation of a rotation matrix (since any
  177. * rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
  178. * optimization procedures like REF: calibrateCamera, REF: stereoCalibrate, or REF: solvePnP .
  179. *
  180. * NOTE: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate
  181. * can be found in:
  182. * - A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi CITE: Gallego2014ACF
  183. *
  184. * NOTE: Useful information on SE(3) and Lie Groups can be found in:
  185. * - A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco CITE: blanco2010tutorial
  186. * - Lie Groups for 2D and 3D Transformation, Ethan Eade CITE: Eade17
  187. * - A micro Lie theory for state estimation in robotics, Joan Solà, Jérémie Deray, Dinesh Atchuthan CITE: Sol2018AML
  188. */
  189. + (void)Rodrigues:(Mat*)src dst:(Mat*)dst jacobian:(Mat*)jacobian NS_SWIFT_NAME(Rodrigues(src:dst:jacobian:));
  190. /**
  191. * Converts a rotation matrix to a rotation vector or vice versa.
  192. *
  193. * @param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
  194. * @param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
  195. * derivatives of the output array components with respect to the input array components.
  196. *
  197. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \begin{array}{l} \theta \leftarrow norm(r) \\ r \leftarrow r/ \theta \\ R = \cos(\theta) I + (1- \cos{\theta} ) r r^T + \sin(\theta) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}$$`
  198. *
  199. * Inverse transformation can be also done easily, since
  200. *
  201. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}$$`
  202. *
  203. * A rotation vector is a convenient and most compact representation of a rotation matrix (since any
  204. * rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
  205. * optimization procedures like REF: calibrateCamera, REF: stereoCalibrate, or REF: solvePnP .
  206. *
  207. * NOTE: More information about the computation of the derivative of a 3D rotation matrix with respect to its exponential coordinate
  208. * can be found in:
  209. * - A Compact Formula for the Derivative of a 3-D Rotation in Exponential Coordinates, Guillermo Gallego, Anthony J. Yezzi CITE: Gallego2014ACF
  210. *
  211. * NOTE: Useful information on SE(3) and Lie Groups can be found in:
  212. * - A tutorial on SE(3) transformation parameterizations and on-manifold optimization, Jose-Luis Blanco CITE: blanco2010tutorial
  213. * - Lie Groups for 2D and 3D Transformation, Ethan Eade CITE: Eade17
  214. * - A micro Lie theory for state estimation in robotics, Joan Solà, Jérémie Deray, Dinesh Atchuthan CITE: Sol2018AML
  215. */
  216. + (void)Rodrigues:(Mat*)src dst:(Mat*)dst NS_SWIFT_NAME(Rodrigues(src:dst:));
  217. //
  218. // Mat cv::findHomography(Mat srcPoints, Mat dstPoints, int method = 0, double ransacReprojThreshold = 3, Mat& mask = Mat(), int maxIters = 2000, double confidence = 0.995)
  219. //
  220. /**
  221. * Finds a perspective transformation between two planes.
  222. *
  223. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  224. * or vector\<Point2f\> .
  225. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  226. * a vector\<Point2f\> .
  227. * @param method Method used to compute a homography matrix. The following methods are possible:
  228. * - **0** - a regular method using all the points, i.e., the least squares method
  229. * - REF: RANSAC - RANSAC-based robust method
  230. * - REF: LMEDS - Least-Median robust method
  231. * - REF: RHO - PROSAC-based robust method
  232. * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
  233. * (used in the RANSAC and RHO methods only). That is, if
  234. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  235. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  236. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  237. * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
  238. * mask values are ignored.
  239. * @param maxIters The maximum number of RANSAC iterations.
  240. * @param confidence Confidence level, between 0 and 1.
  241. *
  242. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  243. * destination planes:
  244. *
  245. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  246. *
  247. * so that the back-projection error
  248. *
  249. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  250. *
  251. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  252. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  253. *
  254. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  255. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  256. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  257. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  258. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  259. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  260. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  261. * the mask of inliers/outliers.
  262. *
  263. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  264. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  265. * re-projection error even more.
  266. *
  267. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  268. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  269. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  270. * noise is rather small, use the default method (method=0).
  271. *
  272. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  273. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  274. * cannot be estimated, an empty one will be returned.
  275. *
  276. * @sa
  277. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  278. * perspectiveTransform
  279. */
  280. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold mask:(Mat*)mask maxIters:(int)maxIters confidence:(double)confidence NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:method:ransacReprojThreshold:mask:maxIters:confidence:));
  281. /**
  282. * Finds a perspective transformation between two planes.
  283. *
  284. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  285. * or vector\<Point2f\> .
  286. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  287. * a vector\<Point2f\> .
  288. * @param method Method used to compute a homography matrix. The following methods are possible:
  289. * - **0** - a regular method using all the points, i.e., the least squares method
  290. * - REF: RANSAC - RANSAC-based robust method
  291. * - REF: LMEDS - Least-Median robust method
  292. * - REF: RHO - PROSAC-based robust method
  293. * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
  294. * (used in the RANSAC and RHO methods only). That is, if
  295. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  296. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  297. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  298. * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
  299. * mask values are ignored.
  300. * @param maxIters The maximum number of RANSAC iterations.
  301. *
  302. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  303. * destination planes:
  304. *
  305. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  306. *
  307. * so that the back-projection error
  308. *
  309. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  310. *
  311. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  312. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  313. *
  314. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  315. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  316. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  317. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  318. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  319. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  320. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  321. * the mask of inliers/outliers.
  322. *
  323. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  324. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  325. * re-projection error even more.
  326. *
  327. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  328. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  329. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  330. * noise is rather small, use the default method (method=0).
  331. *
  332. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  333. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  334. * cannot be estimated, an empty one will be returned.
  335. *
  336. * @sa
  337. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  338. * perspectiveTransform
  339. */
  340. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold mask:(Mat*)mask maxIters:(int)maxIters NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:method:ransacReprojThreshold:mask:maxIters:));
  341. /**
  342. * Finds a perspective transformation between two planes.
  343. *
  344. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  345. * or vector\<Point2f\> .
  346. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  347. * a vector\<Point2f\> .
  348. * @param method Method used to compute a homography matrix. The following methods are possible:
  349. * - **0** - a regular method using all the points, i.e., the least squares method
  350. * - REF: RANSAC - RANSAC-based robust method
  351. * - REF: LMEDS - Least-Median robust method
  352. * - REF: RHO - PROSAC-based robust method
  353. * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
  354. * (used in the RANSAC and RHO methods only). That is, if
  355. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  356. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  357. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  358. * @param mask Optional output mask set by a robust method ( RANSAC or LMeDS ). Note that the input
  359. * mask values are ignored.
  360. *
  361. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  362. * destination planes:
  363. *
  364. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  365. *
  366. * so that the back-projection error
  367. *
  368. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  369. *
  370. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  371. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  372. *
  373. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  374. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  375. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  376. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  377. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  378. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  379. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  380. * the mask of inliers/outliers.
  381. *
  382. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  383. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  384. * re-projection error even more.
  385. *
  386. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  387. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  388. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  389. * noise is rather small, use the default method (method=0).
  390. *
  391. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  392. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  393. * cannot be estimated, an empty one will be returned.
  394. *
  395. * @sa
  396. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  397. * perspectiveTransform
  398. */
  399. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold mask:(Mat*)mask NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:method:ransacReprojThreshold:mask:));
  400. /**
  401. * Finds a perspective transformation between two planes.
  402. *
  403. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  404. * or vector\<Point2f\> .
  405. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  406. * a vector\<Point2f\> .
  407. * @param method Method used to compute a homography matrix. The following methods are possible:
  408. * - **0** - a regular method using all the points, i.e., the least squares method
  409. * - REF: RANSAC - RANSAC-based robust method
  410. * - REF: LMEDS - Least-Median robust method
  411. * - REF: RHO - PROSAC-based robust method
  412. * @param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
  413. * (used in the RANSAC and RHO methods only). That is, if
  414. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  415. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  416. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  417. * mask values are ignored.
  418. *
  419. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  420. * destination planes:
  421. *
  422. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  423. *
  424. * so that the back-projection error
  425. *
  426. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  427. *
  428. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  429. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  430. *
  431. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  432. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  433. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  434. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  435. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  436. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  437. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  438. * the mask of inliers/outliers.
  439. *
  440. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  441. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  442. * re-projection error even more.
  443. *
  444. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  445. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  446. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  447. * noise is rather small, use the default method (method=0).
  448. *
  449. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  450. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  451. * cannot be estimated, an empty one will be returned.
  452. *
  453. * @sa
  454. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  455. * perspectiveTransform
  456. */
  457. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:method:ransacReprojThreshold:));
  458. /**
  459. * Finds a perspective transformation between two planes.
  460. *
  461. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  462. * or vector\<Point2f\> .
  463. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  464. * a vector\<Point2f\> .
  465. * @param method Method used to compute a homography matrix. The following methods are possible:
  466. * - **0** - a regular method using all the points, i.e., the least squares method
  467. * - REF: RANSAC - RANSAC-based robust method
  468. * - REF: LMEDS - Least-Median robust method
  469. * - REF: RHO - PROSAC-based robust method
  470. * (used in the RANSAC and RHO methods only). That is, if
  471. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  472. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  473. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  474. * mask values are ignored.
  475. *
  476. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  477. * destination planes:
  478. *
  479. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  480. *
  481. * so that the back-projection error
  482. *
  483. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  484. *
  485. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  486. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  487. *
  488. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  489. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  490. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  491. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  492. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  493. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  494. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  495. * the mask of inliers/outliers.
  496. *
  497. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  498. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  499. * re-projection error even more.
  500. *
  501. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  502. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  503. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  504. * noise is rather small, use the default method (method=0).
  505. *
  506. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  507. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  508. * cannot be estimated, an empty one will be returned.
  509. *
  510. * @sa
  511. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  512. * perspectiveTransform
  513. */
  514. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints method:(int)method NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:method:));
  515. /**
  516. * Finds a perspective transformation between two planes.
  517. *
  518. * @param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
  519. * or vector\<Point2f\> .
  520. * @param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
  521. * a vector\<Point2f\> .
  522. * - **0** - a regular method using all the points, i.e., the least squares method
  523. * - REF: RANSAC - RANSAC-based robust method
  524. * - REF: LMEDS - Least-Median robust method
  525. * - REF: RHO - PROSAC-based robust method
  526. * (used in the RANSAC and RHO methods only). That is, if
  527. * `$$\| \texttt{dstPoints} _i - \texttt{convertPointsHomogeneous} ( \texttt{H} \cdot \texttt{srcPoints} _i) \|_2 > \texttt{ransacReprojThreshold}$$`
  528. * then the point `$$i$$` is considered as an outlier. If srcPoints and dstPoints are measured in pixels,
  529. * it usually makes sense to set this parameter somewhere in the range of 1 to 10.
  530. * mask values are ignored.
  531. *
  532. * The function finds and returns the perspective transformation `$$H$$` between the source and the
  533. * destination planes:
  534. *
  535. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$`
  536. *
  537. * so that the back-projection error
  538. *
  539. * `$$\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2$$`
  540. *
  541. * is minimized. If the parameter method is set to the default value 0, the function uses all the point
  542. * pairs to compute an initial homography estimate with a simple least-squares scheme.
  543. *
  544. * However, if not all of the point pairs ( `$$srcPoints_i$$`, `$$dstPoints_i$$` ) fit the rigid perspective
  545. * transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
  546. * you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
  547. * random subsets of the corresponding point pairs (of four pairs each, collinear pairs are discarded), estimate the homography matrix
  548. * using this subset and a simple least-squares algorithm, and then compute the quality/goodness of the
  549. * computed homography (which is the number of inliers for RANSAC or the least median re-projection error for
  550. * LMeDS). The best subset is then used to produce the initial estimate of the homography matrix and
  551. * the mask of inliers/outliers.
  552. *
  553. * Regardless of the method, robust or not, the computed homography matrix is refined further (using
  554. * inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
  555. * re-projection error even more.
  556. *
  557. * The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
  558. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  559. * correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
  560. * noise is rather small, use the default method (method=0).
  561. *
  562. * The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
  563. * determined up to a scale. Thus, it is normalized so that `$$h_{33}=1$$`. Note that whenever an `$$H$$` matrix
  564. * cannot be estimated, an empty one will be returned.
  565. *
  566. * @sa
  567. * getAffineTransform, estimateAffine2D, estimateAffinePartial2D, getPerspectiveTransform, warpPerspective,
  568. * perspectiveTransform
  569. */
  570. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:));
  571. //
  572. // Mat cv::findHomography(Mat srcPoints, Mat dstPoints, Mat& mask, UsacParams params)
  573. //
  574. + (Mat*)findHomography:(Mat*)srcPoints dstPoints:(Mat*)dstPoints mask:(Mat*)mask params:(UsacParams*)params NS_SWIFT_NAME(findHomography(srcPoints:dstPoints:mask:params:));
  575. //
  576. // Vec3d cv::RQDecomp3x3(Mat src, Mat& mtxR, Mat& mtxQ, Mat& Qx = Mat(), Mat& Qy = Mat(), Mat& Qz = Mat())
  577. //
  578. /**
  579. * Computes an RQ decomposition of 3x3 matrices.
  580. *
  581. * @param src 3x3 input matrix.
  582. * @param mtxR Output 3x3 upper-triangular matrix.
  583. * @param mtxQ Output 3x3 orthogonal matrix.
  584. * @param Qx Optional output 3x3 rotation matrix around x-axis.
  585. * @param Qy Optional output 3x3 rotation matrix around y-axis.
  586. * @param Qz Optional output 3x3 rotation matrix around z-axis.
  587. *
  588. * The function computes a RQ decomposition using the given rotations. This function is used in
  589. * #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
  590. * and a rotation matrix.
  591. *
  592. * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
  593. * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
  594. * sequence of rotations about the three principal axes that results in the same orientation of an
  595. * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
  596. * are only one of the possible solutions.
  597. */
  598. + (Double3*)RQDecomp3x3:(Mat*)src mtxR:(Mat*)mtxR mtxQ:(Mat*)mtxQ Qx:(Mat*)Qx Qy:(Mat*)Qy Qz:(Mat*)Qz NS_SWIFT_NAME(RQDecomp3x3(src:mtxR:mtxQ:Qx:Qy:Qz:));
  599. /**
  600. * Computes an RQ decomposition of 3x3 matrices.
  601. *
  602. * @param src 3x3 input matrix.
  603. * @param mtxR Output 3x3 upper-triangular matrix.
  604. * @param mtxQ Output 3x3 orthogonal matrix.
  605. * @param Qx Optional output 3x3 rotation matrix around x-axis.
  606. * @param Qy Optional output 3x3 rotation matrix around y-axis.
  607. *
  608. * The function computes a RQ decomposition using the given rotations. This function is used in
  609. * #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
  610. * and a rotation matrix.
  611. *
  612. * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
  613. * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
  614. * sequence of rotations about the three principal axes that results in the same orientation of an
  615. * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
  616. * are only one of the possible solutions.
  617. */
  618. + (Double3*)RQDecomp3x3:(Mat*)src mtxR:(Mat*)mtxR mtxQ:(Mat*)mtxQ Qx:(Mat*)Qx Qy:(Mat*)Qy NS_SWIFT_NAME(RQDecomp3x3(src:mtxR:mtxQ:Qx:Qy:));
  619. /**
  620. * Computes an RQ decomposition of 3x3 matrices.
  621. *
  622. * @param src 3x3 input matrix.
  623. * @param mtxR Output 3x3 upper-triangular matrix.
  624. * @param mtxQ Output 3x3 orthogonal matrix.
  625. * @param Qx Optional output 3x3 rotation matrix around x-axis.
  626. *
  627. * The function computes a RQ decomposition using the given rotations. This function is used in
  628. * #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
  629. * and a rotation matrix.
  630. *
  631. * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
  632. * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
  633. * sequence of rotations about the three principal axes that results in the same orientation of an
  634. * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
  635. * are only one of the possible solutions.
  636. */
  637. + (Double3*)RQDecomp3x3:(Mat*)src mtxR:(Mat*)mtxR mtxQ:(Mat*)mtxQ Qx:(Mat*)Qx NS_SWIFT_NAME(RQDecomp3x3(src:mtxR:mtxQ:Qx:));
  638. /**
  639. * Computes an RQ decomposition of 3x3 matrices.
  640. *
  641. * @param src 3x3 input matrix.
  642. * @param mtxR Output 3x3 upper-triangular matrix.
  643. * @param mtxQ Output 3x3 orthogonal matrix.
  644. *
  645. * The function computes a RQ decomposition using the given rotations. This function is used in
  646. * #decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
  647. * and a rotation matrix.
  648. *
  649. * It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
  650. * degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
  651. * sequence of rotations about the three principal axes that results in the same orientation of an
  652. * object, e.g. see CITE: Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
  653. * are only one of the possible solutions.
  654. */
  655. + (Double3*)RQDecomp3x3:(Mat*)src mtxR:(Mat*)mtxR mtxQ:(Mat*)mtxQ NS_SWIFT_NAME(RQDecomp3x3(src:mtxR:mtxQ:));
  656. //
  657. // void cv::decomposeProjectionMatrix(Mat projMatrix, Mat& cameraMatrix, Mat& rotMatrix, Mat& transVect, Mat& rotMatrixX = Mat(), Mat& rotMatrixY = Mat(), Mat& rotMatrixZ = Mat(), Mat& eulerAngles = Mat())
  658. //
  659. /**
  660. * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
  661. *
  662. * @param projMatrix 3x4 input projection matrix P.
  663. * @param cameraMatrix Output 3x3 camera intrinsic matrix `$$\cameramatrix{A}$$`.
  664. * @param rotMatrix Output 3x3 external rotation matrix R.
  665. * @param transVect Output 4x1 translation vector T.
  666. * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
  667. * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
  668. * @param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
  669. * @param eulerAngles Optional three-element vector containing three Euler angles of rotation in
  670. * degrees.
  671. *
  672. * The function computes a decomposition of a projection matrix into a calibration and a rotation
  673. * matrix and the position of a camera.
  674. *
  675. * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
  676. * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
  677. * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
  678. * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
  679. *
  680. * The function is based on #RQDecomp3x3 .
  681. */
  682. + (void)decomposeProjectionMatrix:(Mat*)projMatrix cameraMatrix:(Mat*)cameraMatrix rotMatrix:(Mat*)rotMatrix transVect:(Mat*)transVect rotMatrixX:(Mat*)rotMatrixX rotMatrixY:(Mat*)rotMatrixY rotMatrixZ:(Mat*)rotMatrixZ eulerAngles:(Mat*)eulerAngles NS_SWIFT_NAME(decomposeProjectionMatrix(projMatrix:cameraMatrix:rotMatrix:transVect:rotMatrixX:rotMatrixY:rotMatrixZ:eulerAngles:));
  683. /**
  684. * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
  685. *
  686. * @param projMatrix 3x4 input projection matrix P.
  687. * @param cameraMatrix Output 3x3 camera intrinsic matrix `$$\cameramatrix{A}$$`.
  688. * @param rotMatrix Output 3x3 external rotation matrix R.
  689. * @param transVect Output 4x1 translation vector T.
  690. * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
  691. * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
  692. * @param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
  693. * degrees.
  694. *
  695. * The function computes a decomposition of a projection matrix into a calibration and a rotation
  696. * matrix and the position of a camera.
  697. *
  698. * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
  699. * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
  700. * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
  701. * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
  702. *
  703. * The function is based on #RQDecomp3x3 .
  704. */
  705. + (void)decomposeProjectionMatrix:(Mat*)projMatrix cameraMatrix:(Mat*)cameraMatrix rotMatrix:(Mat*)rotMatrix transVect:(Mat*)transVect rotMatrixX:(Mat*)rotMatrixX rotMatrixY:(Mat*)rotMatrixY rotMatrixZ:(Mat*)rotMatrixZ NS_SWIFT_NAME(decomposeProjectionMatrix(projMatrix:cameraMatrix:rotMatrix:transVect:rotMatrixX:rotMatrixY:rotMatrixZ:));
  706. /**
  707. * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
  708. *
  709. * @param projMatrix 3x4 input projection matrix P.
  710. * @param cameraMatrix Output 3x3 camera intrinsic matrix `$$\cameramatrix{A}$$`.
  711. * @param rotMatrix Output 3x3 external rotation matrix R.
  712. * @param transVect Output 4x1 translation vector T.
  713. * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
  714. * @param rotMatrixY Optional 3x3 rotation matrix around y-axis.
  715. * degrees.
  716. *
  717. * The function computes a decomposition of a projection matrix into a calibration and a rotation
  718. * matrix and the position of a camera.
  719. *
  720. * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
  721. * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
  722. * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
  723. * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
  724. *
  725. * The function is based on #RQDecomp3x3 .
  726. */
  727. + (void)decomposeProjectionMatrix:(Mat*)projMatrix cameraMatrix:(Mat*)cameraMatrix rotMatrix:(Mat*)rotMatrix transVect:(Mat*)transVect rotMatrixX:(Mat*)rotMatrixX rotMatrixY:(Mat*)rotMatrixY NS_SWIFT_NAME(decomposeProjectionMatrix(projMatrix:cameraMatrix:rotMatrix:transVect:rotMatrixX:rotMatrixY:));
  728. /**
  729. * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
  730. *
  731. * @param projMatrix 3x4 input projection matrix P.
  732. * @param cameraMatrix Output 3x3 camera intrinsic matrix `$$\cameramatrix{A}$$`.
  733. * @param rotMatrix Output 3x3 external rotation matrix R.
  734. * @param transVect Output 4x1 translation vector T.
  735. * @param rotMatrixX Optional 3x3 rotation matrix around x-axis.
  736. * degrees.
  737. *
  738. * The function computes a decomposition of a projection matrix into a calibration and a rotation
  739. * matrix and the position of a camera.
  740. *
  741. * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
  742. * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
  743. * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
  744. * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
  745. *
  746. * The function is based on #RQDecomp3x3 .
  747. */
  748. + (void)decomposeProjectionMatrix:(Mat*)projMatrix cameraMatrix:(Mat*)cameraMatrix rotMatrix:(Mat*)rotMatrix transVect:(Mat*)transVect rotMatrixX:(Mat*)rotMatrixX NS_SWIFT_NAME(decomposeProjectionMatrix(projMatrix:cameraMatrix:rotMatrix:transVect:rotMatrixX:));
  749. /**
  750. * Decomposes a projection matrix into a rotation matrix and a camera intrinsic matrix.
  751. *
  752. * @param projMatrix 3x4 input projection matrix P.
  753. * @param cameraMatrix Output 3x3 camera intrinsic matrix `$$\cameramatrix{A}$$`.
  754. * @param rotMatrix Output 3x3 external rotation matrix R.
  755. * @param transVect Output 4x1 translation vector T.
  756. * degrees.
  757. *
  758. * The function computes a decomposition of a projection matrix into a calibration and a rotation
  759. * matrix and the position of a camera.
  760. *
  761. * It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
  762. * be used in OpenGL. Note, there is always more than one sequence of rotations about the three
  763. * principal axes that results in the same orientation of an object, e.g. see CITE: Slabaugh . Returned
  764. * tree rotation matrices and corresponding three Euler angles are only one of the possible solutions.
  765. *
  766. * The function is based on #RQDecomp3x3 .
  767. */
  768. + (void)decomposeProjectionMatrix:(Mat*)projMatrix cameraMatrix:(Mat*)cameraMatrix rotMatrix:(Mat*)rotMatrix transVect:(Mat*)transVect NS_SWIFT_NAME(decomposeProjectionMatrix(projMatrix:cameraMatrix:rotMatrix:transVect:));
  769. //
  770. // void cv::matMulDeriv(Mat A, Mat B, Mat& dABdA, Mat& dABdB)
  771. //
  772. /**
  773. * Computes partial derivatives of the matrix product for each multiplied matrix.
  774. *
  775. * @param A First multiplied matrix.
  776. * @param B Second multiplied matrix.
  777. * @param dABdA First output derivative matrix d(A\*B)/dA of size
  778. * `$$\texttt{A.rows*B.cols} \times {A.rows*A.cols}$$` .
  779. * @param dABdB Second output derivative matrix d(A\*B)/dB of size
  780. * `$$\texttt{A.rows*B.cols} \times {B.rows*B.cols}$$` .
  781. *
  782. * The function computes partial derivatives of the elements of the matrix product `$$A*B$$` with regard to
  783. * the elements of each of the two input matrices. The function is used to compute the Jacobian
  784. * matrices in #stereoCalibrate but can also be used in any other similar optimization function.
  785. */
  786. + (void)matMulDeriv:(Mat*)A B:(Mat*)B dABdA:(Mat*)dABdA dABdB:(Mat*)dABdB NS_SWIFT_NAME(matMulDeriv(A:B:dABdA:dABdB:));
  787. //
  788. // void cv::composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat& rvec3, Mat& tvec3, Mat& dr3dr1 = Mat(), Mat& dr3dt1 = Mat(), Mat& dr3dr2 = Mat(), Mat& dr3dt2 = Mat(), Mat& dt3dr1 = Mat(), Mat& dt3dt1 = Mat(), Mat& dt3dr2 = Mat(), Mat& dt3dt2 = Mat())
  789. //
  790. /**
  791. * Combines two rotation-and-shift transformations.
  792. *
  793. * @param rvec1 First rotation vector.
  794. * @param tvec1 First translation vector.
  795. * @param rvec2 Second rotation vector.
  796. * @param tvec2 Second translation vector.
  797. * @param rvec3 Output rotation vector of the superposition.
  798. * @param tvec3 Output translation vector of the superposition.
  799. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  800. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  801. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  802. * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
  803. * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
  804. * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
  805. * @param dt3dr2 Optional output derivative of tvec3 with regard to rvec2
  806. * @param dt3dt2 Optional output derivative of tvec3 with regard to tvec2
  807. *
  808. * The functions compute:
  809. *
  810. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  811. *
  812. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  813. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  814. *
  815. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  816. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  817. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  818. * function that contains a matrix multiplication.
  819. */
  820. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 dr3dt2:(Mat*)dr3dt2 dt3dr1:(Mat*)dt3dr1 dt3dt1:(Mat*)dt3dt1 dt3dr2:(Mat*)dt3dr2 dt3dt2:(Mat*)dt3dt2 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:dr3dt2:dt3dr1:dt3dt1:dt3dr2:dt3dt2:));
  821. /**
  822. * Combines two rotation-and-shift transformations.
  823. *
  824. * @param rvec1 First rotation vector.
  825. * @param tvec1 First translation vector.
  826. * @param rvec2 Second rotation vector.
  827. * @param tvec2 Second translation vector.
  828. * @param rvec3 Output rotation vector of the superposition.
  829. * @param tvec3 Output translation vector of the superposition.
  830. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  831. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  832. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  833. * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
  834. * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
  835. * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
  836. * @param dt3dr2 Optional output derivative of tvec3 with regard to rvec2
  837. *
  838. * The functions compute:
  839. *
  840. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  841. *
  842. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  843. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  844. *
  845. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  846. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  847. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  848. * function that contains a matrix multiplication.
  849. */
  850. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 dr3dt2:(Mat*)dr3dt2 dt3dr1:(Mat*)dt3dr1 dt3dt1:(Mat*)dt3dt1 dt3dr2:(Mat*)dt3dr2 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:dr3dt2:dt3dr1:dt3dt1:dt3dr2:));
  851. /**
  852. * Combines two rotation-and-shift transformations.
  853. *
  854. * @param rvec1 First rotation vector.
  855. * @param tvec1 First translation vector.
  856. * @param rvec2 Second rotation vector.
  857. * @param tvec2 Second translation vector.
  858. * @param rvec3 Output rotation vector of the superposition.
  859. * @param tvec3 Output translation vector of the superposition.
  860. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  861. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  862. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  863. * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
  864. * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
  865. * @param dt3dt1 Optional output derivative of tvec3 with regard to tvec1
  866. *
  867. * The functions compute:
  868. *
  869. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  870. *
  871. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  872. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  873. *
  874. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  875. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  876. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  877. * function that contains a matrix multiplication.
  878. */
  879. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 dr3dt2:(Mat*)dr3dt2 dt3dr1:(Mat*)dt3dr1 dt3dt1:(Mat*)dt3dt1 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:dr3dt2:dt3dr1:dt3dt1:));
  880. /**
  881. * Combines two rotation-and-shift transformations.
  882. *
  883. * @param rvec1 First rotation vector.
  884. * @param tvec1 First translation vector.
  885. * @param rvec2 Second rotation vector.
  886. * @param tvec2 Second translation vector.
  887. * @param rvec3 Output rotation vector of the superposition.
  888. * @param tvec3 Output translation vector of the superposition.
  889. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  890. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  891. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  892. * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
  893. * @param dt3dr1 Optional output derivative of tvec3 with regard to rvec1
  894. *
  895. * The functions compute:
  896. *
  897. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  898. *
  899. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  900. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  901. *
  902. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  903. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  904. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  905. * function that contains a matrix multiplication.
  906. */
  907. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 dr3dt2:(Mat*)dr3dt2 dt3dr1:(Mat*)dt3dr1 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:dr3dt2:dt3dr1:));
  908. /**
  909. * Combines two rotation-and-shift transformations.
  910. *
  911. * @param rvec1 First rotation vector.
  912. * @param tvec1 First translation vector.
  913. * @param rvec2 Second rotation vector.
  914. * @param tvec2 Second translation vector.
  915. * @param rvec3 Output rotation vector of the superposition.
  916. * @param tvec3 Output translation vector of the superposition.
  917. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  918. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  919. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  920. * @param dr3dt2 Optional output derivative of rvec3 with regard to tvec2
  921. *
  922. * The functions compute:
  923. *
  924. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  925. *
  926. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  927. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  928. *
  929. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  930. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  931. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  932. * function that contains a matrix multiplication.
  933. */
  934. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 dr3dt2:(Mat*)dr3dt2 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:dr3dt2:));
  935. /**
  936. * Combines two rotation-and-shift transformations.
  937. *
  938. * @param rvec1 First rotation vector.
  939. * @param tvec1 First translation vector.
  940. * @param rvec2 Second rotation vector.
  941. * @param tvec2 Second translation vector.
  942. * @param rvec3 Output rotation vector of the superposition.
  943. * @param tvec3 Output translation vector of the superposition.
  944. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  945. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  946. * @param dr3dr2 Optional output derivative of rvec3 with regard to rvec2
  947. *
  948. * The functions compute:
  949. *
  950. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  951. *
  952. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  953. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  954. *
  955. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  956. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  957. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  958. * function that contains a matrix multiplication.
  959. */
  960. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 dr3dr2:(Mat*)dr3dr2 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:dr3dr2:));
  961. /**
  962. * Combines two rotation-and-shift transformations.
  963. *
  964. * @param rvec1 First rotation vector.
  965. * @param tvec1 First translation vector.
  966. * @param rvec2 Second rotation vector.
  967. * @param tvec2 Second translation vector.
  968. * @param rvec3 Output rotation vector of the superposition.
  969. * @param tvec3 Output translation vector of the superposition.
  970. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  971. * @param dr3dt1 Optional output derivative of rvec3 with regard to tvec1
  972. *
  973. * The functions compute:
  974. *
  975. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  976. *
  977. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  978. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  979. *
  980. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  981. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  982. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  983. * function that contains a matrix multiplication.
  984. */
  985. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 dr3dt1:(Mat*)dr3dt1 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:dr3dt1:));
  986. /**
  987. * Combines two rotation-and-shift transformations.
  988. *
  989. * @param rvec1 First rotation vector.
  990. * @param tvec1 First translation vector.
  991. * @param rvec2 Second rotation vector.
  992. * @param tvec2 Second translation vector.
  993. * @param rvec3 Output rotation vector of the superposition.
  994. * @param tvec3 Output translation vector of the superposition.
  995. * @param dr3dr1 Optional output derivative of rvec3 with regard to rvec1
  996. *
  997. * The functions compute:
  998. *
  999. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  1000. *
  1001. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  1002. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  1003. *
  1004. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  1005. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  1006. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  1007. * function that contains a matrix multiplication.
  1008. */
  1009. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 dr3dr1:(Mat*)dr3dr1 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:dr3dr1:));
  1010. /**
  1011. * Combines two rotation-and-shift transformations.
  1012. *
  1013. * @param rvec1 First rotation vector.
  1014. * @param tvec1 First translation vector.
  1015. * @param rvec2 Second rotation vector.
  1016. * @param tvec2 Second translation vector.
  1017. * @param rvec3 Output rotation vector of the superposition.
  1018. * @param tvec3 Output translation vector of the superposition.
  1019. *
  1020. * The functions compute:
  1021. *
  1022. * `$$\begin{array}{l} \texttt{rvec3} = \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right ) \\ \texttt{tvec3} = \mathrm{rodrigues} ( \texttt{rvec2} ) \cdot \texttt{tvec1} + \texttt{tvec2} \end{array} ,$$`
  1023. *
  1024. * where `$$\mathrm{rodrigues}$$` denotes a rotation vector to a rotation matrix transformation, and
  1025. * `$$\mathrm{rodrigues}^{-1}$$` denotes the inverse transformation. See #Rodrigues for details.
  1026. *
  1027. * Also, the functions can compute the derivatives of the output vectors with regards to the input
  1028. * vectors (see #matMulDeriv ). The functions are used inside #stereoCalibrate but can also be used in
  1029. * your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
  1030. * function that contains a matrix multiplication.
  1031. */
  1032. + (void)composeRT:(Mat*)rvec1 tvec1:(Mat*)tvec1 rvec2:(Mat*)rvec2 tvec2:(Mat*)tvec2 rvec3:(Mat*)rvec3 tvec3:(Mat*)tvec3 NS_SWIFT_NAME(composeRT(rvec1:tvec1:rvec2:tvec2:rvec3:tvec3:));
  1033. //
  1034. // void cv::projectPoints(Mat objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, Mat distCoeffs, Mat& imagePoints, Mat& jacobian = Mat(), double aspectRatio = 0)
  1035. //
  1036. /**
  1037. * Projects 3D points to an image plane.
  1038. *
  1039. * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
  1040. * 1-channel or 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is the number of points in the view.
  1041. * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
  1042. * basis from world to camera coordinate system, see REF: calibrateCamera for details.
  1043. * @param tvec The translation vector, see parameter description above.
  1044. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1045. * @param distCoeffs Input vector of distortion coefficients
  1046. * `$$\distcoeffs$$` . If the vector is empty, the zero distortion coefficients are assumed.
  1047. * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
  1048. * vector\<Point2f\> .
  1049. * @param jacobian Optional output 2Nx(10+\<numDistCoeffs\>) jacobian matrix of derivatives of image
  1050. * points with respect to components of the rotation vector, translation vector, focal lengths,
  1051. * coordinates of the principal point and the distortion coefficients. In the old interface different
  1052. * components of the jacobian are returned via different output parameters.
  1053. * @param aspectRatio Optional "fixed aspect ratio" parameter. If the parameter is not 0, the
  1054. * function assumes that the aspect ratio (`$$f_x / f_y$$`) is fixed and correspondingly adjusts the
  1055. * jacobian matrix.
  1056. *
  1057. * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
  1058. * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
  1059. * derivatives of image points coordinates (as functions of all the input parameters) with respect to
  1060. * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
  1061. * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
  1062. * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
  1063. * parameters.
  1064. *
  1065. * NOTE: By setting rvec = tvec = `$$[0, 0, 0]$$`, or by setting cameraMatrix to a 3x3 identity matrix,
  1066. * or by passing zero distortion coefficients, one can get various useful partial cases of the
  1067. * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
  1068. * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
  1069. */
  1070. + (void)projectPoints:(Mat*)objectPoints rvec:(Mat*)rvec tvec:(Mat*)tvec cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imagePoints:(Mat*)imagePoints jacobian:(Mat*)jacobian aspectRatio:(double)aspectRatio NS_SWIFT_NAME(projectPoints(objectPoints:rvec:tvec:cameraMatrix:distCoeffs:imagePoints:jacobian:aspectRatio:));
  1071. /**
  1072. * Projects 3D points to an image plane.
  1073. *
  1074. * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
  1075. * 1-channel or 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is the number of points in the view.
  1076. * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
  1077. * basis from world to camera coordinate system, see REF: calibrateCamera for details.
  1078. * @param tvec The translation vector, see parameter description above.
  1079. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1080. * @param distCoeffs Input vector of distortion coefficients
  1081. * `$$\distcoeffs$$` . If the vector is empty, the zero distortion coefficients are assumed.
  1082. * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
  1083. * vector\<Point2f\> .
  1084. * @param jacobian Optional output 2Nx(10+\<numDistCoeffs\>) jacobian matrix of derivatives of image
  1085. * points with respect to components of the rotation vector, translation vector, focal lengths,
  1086. * coordinates of the principal point and the distortion coefficients. In the old interface different
  1087. * components of the jacobian are returned via different output parameters.
  1088. * function assumes that the aspect ratio (`$$f_x / f_y$$`) is fixed and correspondingly adjusts the
  1089. * jacobian matrix.
  1090. *
  1091. * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
  1092. * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
  1093. * derivatives of image points coordinates (as functions of all the input parameters) with respect to
  1094. * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
  1095. * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
  1096. * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
  1097. * parameters.
  1098. *
  1099. * NOTE: By setting rvec = tvec = `$$[0, 0, 0]$$`, or by setting cameraMatrix to a 3x3 identity matrix,
  1100. * or by passing zero distortion coefficients, one can get various useful partial cases of the
  1101. * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
  1102. * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
  1103. */
  1104. + (void)projectPoints:(Mat*)objectPoints rvec:(Mat*)rvec tvec:(Mat*)tvec cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imagePoints:(Mat*)imagePoints jacobian:(Mat*)jacobian NS_SWIFT_NAME(projectPoints(objectPoints:rvec:tvec:cameraMatrix:distCoeffs:imagePoints:jacobian:));
  1105. /**
  1106. * Projects 3D points to an image plane.
  1107. *
  1108. * @param objectPoints Array of object points expressed wrt. the world coordinate frame. A 3xN/Nx3
  1109. * 1-channel or 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is the number of points in the view.
  1110. * @param rvec The rotation vector (REF: Rodrigues) that, together with tvec, performs a change of
  1111. * basis from world to camera coordinate system, see REF: calibrateCamera for details.
  1112. * @param tvec The translation vector, see parameter description above.
  1113. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1114. * @param distCoeffs Input vector of distortion coefficients
  1115. * `$$\distcoeffs$$` . If the vector is empty, the zero distortion coefficients are assumed.
  1116. * @param imagePoints Output array of image points, 1xN/Nx1 2-channel, or
  1117. * vector\<Point2f\> .
  1118. * points with respect to components of the rotation vector, translation vector, focal lengths,
  1119. * coordinates of the principal point and the distortion coefficients. In the old interface different
  1120. * components of the jacobian are returned via different output parameters.
  1121. * function assumes that the aspect ratio (`$$f_x / f_y$$`) is fixed and correspondingly adjusts the
  1122. * jacobian matrix.
  1123. *
  1124. * The function computes the 2D projections of 3D points to the image plane, given intrinsic and
  1125. * extrinsic camera parameters. Optionally, the function computes Jacobians -matrices of partial
  1126. * derivatives of image points coordinates (as functions of all the input parameters) with respect to
  1127. * the particular parameters, intrinsic and/or extrinsic. The Jacobians are used during the global
  1128. * optimization in REF: calibrateCamera, REF: solvePnP, and REF: stereoCalibrate. The function itself
  1129. * can also be used to compute a re-projection error, given the current intrinsic and extrinsic
  1130. * parameters.
  1131. *
  1132. * NOTE: By setting rvec = tvec = `$$[0, 0, 0]$$`, or by setting cameraMatrix to a 3x3 identity matrix,
  1133. * or by passing zero distortion coefficients, one can get various useful partial cases of the
  1134. * function. This means, one can compute the distorted coordinates for a sparse set of points or apply
  1135. * a perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
  1136. */
  1137. + (void)projectPoints:(Mat*)objectPoints rvec:(Mat*)rvec tvec:(Mat*)tvec cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imagePoints:(Mat*)imagePoints NS_SWIFT_NAME(projectPoints(objectPoints:rvec:tvec:cameraMatrix:distCoeffs:imagePoints:));
  1138. //
  1139. // bool cv::solvePnP(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE)
  1140. //
  1141. /**
  1142. * Finds an object pose from 3D-2D point correspondences.
  1143. *
  1144. * @see `REF: calib3d_solvePnP`
  1145. *
  1146. * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
  1147. * coordinate frame to the camera coordinate frame, using different methods:
  1148. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  1149. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  1150. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1151. * Number of input points must be 4. Object points must be defined in the following order:
  1152. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1153. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1154. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1155. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1156. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1157. *
  1158. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1159. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1160. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1161. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1162. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1163. * @param distCoeffs Input vector of distortion coefficients
  1164. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1165. * assumed.
  1166. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1167. * the model coordinate system to the camera coordinate system.
  1168. * @param tvec Output translation vector.
  1169. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  1170. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1171. * vectors, respectively, and further optimizes them.
  1172. * @param flags Method for solving a PnP problem: see REF: calib3d_solvePnP_flags
  1173. *
  1174. * More information about Perspective-n-Points is described in REF: calib3d_solvePnP
  1175. *
  1176. * NOTE:
  1177. * - An example of how to use solvePnP for planar augmented reality can be found at
  1178. * opencv_source_code/samples/python/plane_ar.py
  1179. * - If you are using Python:
  1180. * - Numpy array slices won't work as input because solvePnP requires contiguous
  1181. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  1182. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1183. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  1184. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1185. * which requires 2-channel information.
  1186. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  1187. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  1188. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  1189. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  1190. * unstable and sometimes give completely wrong results. If you pass one of these two
  1191. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  1192. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  1193. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  1194. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  1195. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  1196. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  1197. * global solution to converge.
  1198. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  1199. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  1200. * Number of input points must be 4. Object points must be defined in the following order:
  1201. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1202. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1203. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1204. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1205. * - With REF: SOLVEPNP_SQPNP input points must be >= 3
  1206. */
  1207. + (BOOL)solvePnP:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess flags:(int)flags NS_SWIFT_NAME(solvePnP(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:flags:));
  1208. /**
  1209. * Finds an object pose from 3D-2D point correspondences.
  1210. *
  1211. * @see `REF: calib3d_solvePnP`
  1212. *
  1213. * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
  1214. * coordinate frame to the camera coordinate frame, using different methods:
  1215. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  1216. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  1217. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1218. * Number of input points must be 4. Object points must be defined in the following order:
  1219. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1220. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1221. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1222. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1223. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1224. *
  1225. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1226. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1227. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1228. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1229. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1230. * @param distCoeffs Input vector of distortion coefficients
  1231. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1232. * assumed.
  1233. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1234. * the model coordinate system to the camera coordinate system.
  1235. * @param tvec Output translation vector.
  1236. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  1237. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1238. * vectors, respectively, and further optimizes them.
  1239. *
  1240. * More information about Perspective-n-Points is described in REF: calib3d_solvePnP
  1241. *
  1242. * NOTE:
  1243. * - An example of how to use solvePnP for planar augmented reality can be found at
  1244. * opencv_source_code/samples/python/plane_ar.py
  1245. * - If you are using Python:
  1246. * - Numpy array slices won't work as input because solvePnP requires contiguous
  1247. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  1248. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1249. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  1250. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1251. * which requires 2-channel information.
  1252. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  1253. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  1254. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  1255. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  1256. * unstable and sometimes give completely wrong results. If you pass one of these two
  1257. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  1258. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  1259. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  1260. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  1261. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  1262. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  1263. * global solution to converge.
  1264. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  1265. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  1266. * Number of input points must be 4. Object points must be defined in the following order:
  1267. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1268. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1269. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1270. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1271. * - With REF: SOLVEPNP_SQPNP input points must be >= 3
  1272. */
  1273. + (BOOL)solvePnP:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess NS_SWIFT_NAME(solvePnP(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:));
  1274. /**
  1275. * Finds an object pose from 3D-2D point correspondences.
  1276. *
  1277. * @see `REF: calib3d_solvePnP`
  1278. *
  1279. * This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
  1280. * coordinate frame to the camera coordinate frame, using different methods:
  1281. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): need 4 input points to return a unique solution.
  1282. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
  1283. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1284. * Number of input points must be 4. Object points must be defined in the following order:
  1285. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1286. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1287. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1288. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1289. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1290. *
  1291. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1292. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1293. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1294. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1295. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1296. * @param distCoeffs Input vector of distortion coefficients
  1297. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1298. * assumed.
  1299. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1300. * the model coordinate system to the camera coordinate system.
  1301. * @param tvec Output translation vector.
  1302. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1303. * vectors, respectively, and further optimizes them.
  1304. *
  1305. * More information about Perspective-n-Points is described in REF: calib3d_solvePnP
  1306. *
  1307. * NOTE:
  1308. * - An example of how to use solvePnP for planar augmented reality can be found at
  1309. * opencv_source_code/samples/python/plane_ar.py
  1310. * - If you are using Python:
  1311. * - Numpy array slices won't work as input because solvePnP requires contiguous
  1312. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  1313. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1314. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  1315. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1316. * which requires 2-channel information.
  1317. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  1318. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  1319. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  1320. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  1321. * unstable and sometimes give completely wrong results. If you pass one of these two
  1322. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  1323. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  1324. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  1325. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  1326. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  1327. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  1328. * global solution to converge.
  1329. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  1330. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  1331. * Number of input points must be 4. Object points must be defined in the following order:
  1332. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1333. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1334. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1335. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1336. * - With REF: SOLVEPNP_SQPNP input points must be >= 3
  1337. */
  1338. + (BOOL)solvePnP:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec NS_SWIFT_NAME(solvePnP(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:));
  1339. //
  1340. // bool cv::solvePnPRansac(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, double confidence = 0.99, Mat& inliers = Mat(), int flags = SOLVEPNP_ITERATIVE)
  1341. //
  1342. /**
  1343. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1344. *
  1345. * @see `REF: calib3d_solvePnP`
  1346. *
  1347. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1348. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1349. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1350. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1351. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1352. * @param distCoeffs Input vector of distortion coefficients
  1353. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1354. * assumed.
  1355. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1356. * the model coordinate system to the camera coordinate system.
  1357. * @param tvec Output translation vector.
  1358. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1359. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1360. * vectors, respectively, and further optimizes them.
  1361. * @param iterationsCount Number of iterations.
  1362. * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
  1363. * is the maximum allowed distance between the observed and computed point projections to consider it
  1364. * an inlier.
  1365. * @param confidence The probability that the algorithm produces a useful result.
  1366. * @param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
  1367. * @param flags Method for solving a PnP problem (see REF: solvePnP ).
  1368. *
  1369. * The function estimates an object pose given a set of object points, their corresponding image
  1370. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1371. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1372. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1373. * makes the function resistant to outliers.
  1374. *
  1375. * NOTE:
  1376. * - An example of how to use solvePNPRansac for object detection can be found at
  1377. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1378. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1379. * is #SOLVEPNP_EPNP. Exceptions are:
  1380. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1381. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1382. * - The method used to estimate the camera pose using all the inliers is defined by the
  1383. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1384. * the method #SOLVEPNP_EPNP will be used instead.
  1385. */
  1386. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess iterationsCount:(int)iterationsCount reprojectionError:(float)reprojectionError confidence:(double)confidence inliers:(Mat*)inliers flags:(int)flags NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:iterationsCount:reprojectionError:confidence:inliers:flags:));
  1387. /**
  1388. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1389. *
  1390. * @see `REF: calib3d_solvePnP`
  1391. *
  1392. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1393. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1394. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1395. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1396. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1397. * @param distCoeffs Input vector of distortion coefficients
  1398. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1399. * assumed.
  1400. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1401. * the model coordinate system to the camera coordinate system.
  1402. * @param tvec Output translation vector.
  1403. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1404. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1405. * vectors, respectively, and further optimizes them.
  1406. * @param iterationsCount Number of iterations.
  1407. * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
  1408. * is the maximum allowed distance between the observed and computed point projections to consider it
  1409. * an inlier.
  1410. * @param confidence The probability that the algorithm produces a useful result.
  1411. * @param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
  1412. *
  1413. * The function estimates an object pose given a set of object points, their corresponding image
  1414. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1415. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1416. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1417. * makes the function resistant to outliers.
  1418. *
  1419. * NOTE:
  1420. * - An example of how to use solvePNPRansac for object detection can be found at
  1421. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1422. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1423. * is #SOLVEPNP_EPNP. Exceptions are:
  1424. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1425. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1426. * - The method used to estimate the camera pose using all the inliers is defined by the
  1427. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1428. * the method #SOLVEPNP_EPNP will be used instead.
  1429. */
  1430. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess iterationsCount:(int)iterationsCount reprojectionError:(float)reprojectionError confidence:(double)confidence inliers:(Mat*)inliers NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:iterationsCount:reprojectionError:confidence:inliers:));
  1431. /**
  1432. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1433. *
  1434. * @see `REF: calib3d_solvePnP`
  1435. *
  1436. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1437. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1438. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1439. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1440. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1441. * @param distCoeffs Input vector of distortion coefficients
  1442. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1443. * assumed.
  1444. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1445. * the model coordinate system to the camera coordinate system.
  1446. * @param tvec Output translation vector.
  1447. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1448. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1449. * vectors, respectively, and further optimizes them.
  1450. * @param iterationsCount Number of iterations.
  1451. * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
  1452. * is the maximum allowed distance between the observed and computed point projections to consider it
  1453. * an inlier.
  1454. * @param confidence The probability that the algorithm produces a useful result.
  1455. *
  1456. * The function estimates an object pose given a set of object points, their corresponding image
  1457. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1458. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1459. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1460. * makes the function resistant to outliers.
  1461. *
  1462. * NOTE:
  1463. * - An example of how to use solvePNPRansac for object detection can be found at
  1464. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1465. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1466. * is #SOLVEPNP_EPNP. Exceptions are:
  1467. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1468. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1469. * - The method used to estimate the camera pose using all the inliers is defined by the
  1470. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1471. * the method #SOLVEPNP_EPNP will be used instead.
  1472. */
  1473. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess iterationsCount:(int)iterationsCount reprojectionError:(float)reprojectionError confidence:(double)confidence NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:iterationsCount:reprojectionError:confidence:));
  1474. /**
  1475. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1476. *
  1477. * @see `REF: calib3d_solvePnP`
  1478. *
  1479. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1480. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1481. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1482. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1483. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1484. * @param distCoeffs Input vector of distortion coefficients
  1485. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1486. * assumed.
  1487. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1488. * the model coordinate system to the camera coordinate system.
  1489. * @param tvec Output translation vector.
  1490. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1491. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1492. * vectors, respectively, and further optimizes them.
  1493. * @param iterationsCount Number of iterations.
  1494. * @param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
  1495. * is the maximum allowed distance between the observed and computed point projections to consider it
  1496. * an inlier.
  1497. *
  1498. * The function estimates an object pose given a set of object points, their corresponding image
  1499. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1500. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1501. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1502. * makes the function resistant to outliers.
  1503. *
  1504. * NOTE:
  1505. * - An example of how to use solvePNPRansac for object detection can be found at
  1506. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1507. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1508. * is #SOLVEPNP_EPNP. Exceptions are:
  1509. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1510. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1511. * - The method used to estimate the camera pose using all the inliers is defined by the
  1512. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1513. * the method #SOLVEPNP_EPNP will be used instead.
  1514. */
  1515. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess iterationsCount:(int)iterationsCount reprojectionError:(float)reprojectionError NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:iterationsCount:reprojectionError:));
  1516. /**
  1517. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1518. *
  1519. * @see `REF: calib3d_solvePnP`
  1520. *
  1521. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1522. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1523. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1524. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1525. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1526. * @param distCoeffs Input vector of distortion coefficients
  1527. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1528. * assumed.
  1529. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1530. * the model coordinate system to the camera coordinate system.
  1531. * @param tvec Output translation vector.
  1532. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1533. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1534. * vectors, respectively, and further optimizes them.
  1535. * @param iterationsCount Number of iterations.
  1536. * is the maximum allowed distance between the observed and computed point projections to consider it
  1537. * an inlier.
  1538. *
  1539. * The function estimates an object pose given a set of object points, their corresponding image
  1540. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1541. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1542. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1543. * makes the function resistant to outliers.
  1544. *
  1545. * NOTE:
  1546. * - An example of how to use solvePNPRansac for object detection can be found at
  1547. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1548. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1549. * is #SOLVEPNP_EPNP. Exceptions are:
  1550. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1551. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1552. * - The method used to estimate the camera pose using all the inliers is defined by the
  1553. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1554. * the method #SOLVEPNP_EPNP will be used instead.
  1555. */
  1556. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess iterationsCount:(int)iterationsCount NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:iterationsCount:));
  1557. /**
  1558. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1559. *
  1560. * @see `REF: calib3d_solvePnP`
  1561. *
  1562. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1563. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1564. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1565. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1566. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1567. * @param distCoeffs Input vector of distortion coefficients
  1568. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1569. * assumed.
  1570. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1571. * the model coordinate system to the camera coordinate system.
  1572. * @param tvec Output translation vector.
  1573. * @param useExtrinsicGuess Parameter used for REF: SOLVEPNP_ITERATIVE. If true (1), the function uses
  1574. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1575. * vectors, respectively, and further optimizes them.
  1576. * is the maximum allowed distance between the observed and computed point projections to consider it
  1577. * an inlier.
  1578. *
  1579. * The function estimates an object pose given a set of object points, their corresponding image
  1580. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1581. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1582. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1583. * makes the function resistant to outliers.
  1584. *
  1585. * NOTE:
  1586. * - An example of how to use solvePNPRansac for object detection can be found at
  1587. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1588. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1589. * is #SOLVEPNP_EPNP. Exceptions are:
  1590. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1591. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1592. * - The method used to estimate the camera pose using all the inliers is defined by the
  1593. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1594. * the method #SOLVEPNP_EPNP will be used instead.
  1595. */
  1596. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec useExtrinsicGuess:(BOOL)useExtrinsicGuess NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:));
  1597. /**
  1598. * Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
  1599. *
  1600. * @see `REF: calib3d_solvePnP`
  1601. *
  1602. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1603. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1604. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1605. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1606. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1607. * @param distCoeffs Input vector of distortion coefficients
  1608. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1609. * assumed.
  1610. * @param rvec Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1611. * the model coordinate system to the camera coordinate system.
  1612. * @param tvec Output translation vector.
  1613. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1614. * vectors, respectively, and further optimizes them.
  1615. * is the maximum allowed distance between the observed and computed point projections to consider it
  1616. * an inlier.
  1617. *
  1618. * The function estimates an object pose given a set of object points, their corresponding image
  1619. * projections, as well as the camera intrinsic matrix and the distortion coefficients. This function finds such
  1620. * a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
  1621. * projections imagePoints and the projected (using REF: projectPoints ) objectPoints. The use of RANSAC
  1622. * makes the function resistant to outliers.
  1623. *
  1624. * NOTE:
  1625. * - An example of how to use solvePNPRansac for object detection can be found at
  1626. * opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
  1627. * - The default method used to estimate the camera pose for the Minimal Sample Sets step
  1628. * is #SOLVEPNP_EPNP. Exceptions are:
  1629. * - if you choose #SOLVEPNP_P3P or #SOLVEPNP_AP3P, these methods will be used.
  1630. * - if the number of input points is equal to 4, #SOLVEPNP_P3P is used.
  1631. * - The method used to estimate the camera pose using all the inliers is defined by the
  1632. * flags parameters unless it is equal to #SOLVEPNP_P3P or #SOLVEPNP_AP3P. In this case,
  1633. * the method #SOLVEPNP_EPNP will be used instead.
  1634. */
  1635. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:));
  1636. //
  1637. // bool cv::solvePnPRansac(Mat objectPoints, Mat imagePoints, Mat& cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, Mat& inliers, UsacParams params = UsacParams())
  1638. //
  1639. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec inliers:(Mat*)inliers params:(UsacParams*)params NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:inliers:params:));
  1640. + (BOOL)solvePnPRansac:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec inliers:(Mat*)inliers NS_SWIFT_NAME(solvePnPRansac(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:inliers:));
  1641. //
  1642. // int cv::solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags)
  1643. //
  1644. /**
  1645. * Finds an object pose from 3 3D-2D point correspondences.
  1646. *
  1647. * @see `REF: calib3d_solvePnP`
  1648. *
  1649. * @param objectPoints Array of object points in the object coordinate space, 3x3 1-channel or
  1650. * 1x3/3x1 3-channel. vector\<Point3f\> can be also passed here.
  1651. * @param imagePoints Array of corresponding image points, 3x2 1-channel or 1x3/3x1 2-channel.
  1652. * vector\<Point2f\> can be also passed here.
  1653. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1654. * @param distCoeffs Input vector of distortion coefficients
  1655. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1656. * assumed.
  1657. * @param rvecs Output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  1658. * the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.
  1659. * @param tvecs Output translation vectors.
  1660. * @param flags Method for solving a P3P problem:
  1661. * - REF: SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
  1662. * "Complete Solution Classification for the Perspective-Three-Point Problem" (CITE: gao2003complete).
  1663. * - REF: SOLVEPNP_AP3P Method is based on the paper of T. Ke and S. Roumeliotis.
  1664. * "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (CITE: Ke17).
  1665. *
  1666. * The function estimates the object pose given 3 object points, their corresponding image
  1667. * projections, as well as the camera intrinsic matrix and the distortion coefficients.
  1668. *
  1669. * NOTE:
  1670. * The solutions are sorted by reprojection errors (lowest to highest).
  1671. */
  1672. + (int)solveP3P:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags NS_SWIFT_NAME(solveP3P(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:flags:));
  1673. //
  1674. // void cv::solvePnPRefineLM(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON))
  1675. //
  1676. /**
  1677. * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
  1678. * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
  1679. *
  1680. * @see `REF: calib3d_solvePnP`
  1681. *
  1682. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
  1683. * where N is the number of points. vector\<Point3d\> can also be passed here.
  1684. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1685. * where N is the number of points. vector\<Point2d\> can also be passed here.
  1686. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1687. * @param distCoeffs Input vector of distortion coefficients
  1688. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1689. * assumed.
  1690. * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1691. * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
  1692. * @param tvec Input/Output translation vector. Input values are used as an initial solution.
  1693. * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
  1694. *
  1695. * The function refines the object pose given at least 3 object points, their corresponding image
  1696. * projections, an initial solution for the rotation and translation vector,
  1697. * as well as the camera intrinsic matrix and the distortion coefficients.
  1698. * The function minimizes the projection error with respect to the rotation and the translation vectors, according
  1699. * to a Levenberg-Marquardt iterative minimization CITE: Madsen04 CITE: Eade13 process.
  1700. */
  1701. + (void)solvePnPRefineLM:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec criteria:(TermCriteria*)criteria NS_SWIFT_NAME(solvePnPRefineLM(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:criteria:));
  1702. /**
  1703. * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
  1704. * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
  1705. *
  1706. * @see `REF: calib3d_solvePnP`
  1707. *
  1708. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
  1709. * where N is the number of points. vector\<Point3d\> can also be passed here.
  1710. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1711. * where N is the number of points. vector\<Point2d\> can also be passed here.
  1712. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1713. * @param distCoeffs Input vector of distortion coefficients
  1714. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1715. * assumed.
  1716. * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1717. * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
  1718. * @param tvec Input/Output translation vector. Input values are used as an initial solution.
  1719. *
  1720. * The function refines the object pose given at least 3 object points, their corresponding image
  1721. * projections, an initial solution for the rotation and translation vector,
  1722. * as well as the camera intrinsic matrix and the distortion coefficients.
  1723. * The function minimizes the projection error with respect to the rotation and the translation vectors, according
  1724. * to a Levenberg-Marquardt iterative minimization CITE: Madsen04 CITE: Eade13 process.
  1725. */
  1726. + (void)solvePnPRefineLM:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec NS_SWIFT_NAME(solvePnPRefineLM(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:));
  1727. //
  1728. // void cv::solvePnPRefineVVS(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, Mat& rvec, Mat& tvec, TermCriteria criteria = TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 20, FLT_EPSILON), double VVSlambda = 1)
  1729. //
  1730. /**
  1731. * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
  1732. * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
  1733. *
  1734. * @see `REF: calib3d_solvePnP`
  1735. *
  1736. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
  1737. * where N is the number of points. vector\<Point3d\> can also be passed here.
  1738. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1739. * where N is the number of points. vector\<Point2d\> can also be passed here.
  1740. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1741. * @param distCoeffs Input vector of distortion coefficients
  1742. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1743. * assumed.
  1744. * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1745. * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
  1746. * @param tvec Input/Output translation vector. Input values are used as an initial solution.
  1747. * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
  1748. * @param VVSlambda Gain for the virtual visual servoing control law, equivalent to the `$$\alpha$$`
  1749. * gain in the Damped Gauss-Newton formulation.
  1750. *
  1751. * The function refines the object pose given at least 3 object points, their corresponding image
  1752. * projections, an initial solution for the rotation and translation vector,
  1753. * as well as the camera intrinsic matrix and the distortion coefficients.
  1754. * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
  1755. * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
  1756. */
  1757. + (void)solvePnPRefineVVS:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec criteria:(TermCriteria*)criteria VVSlambda:(double)VVSlambda NS_SWIFT_NAME(solvePnPRefineVVS(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:criteria:VVSlambda:));
  1758. /**
  1759. * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
  1760. * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
  1761. *
  1762. * @see `REF: calib3d_solvePnP`
  1763. *
  1764. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
  1765. * where N is the number of points. vector\<Point3d\> can also be passed here.
  1766. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1767. * where N is the number of points. vector\<Point2d\> can also be passed here.
  1768. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1769. * @param distCoeffs Input vector of distortion coefficients
  1770. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1771. * assumed.
  1772. * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1773. * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
  1774. * @param tvec Input/Output translation vector. Input values are used as an initial solution.
  1775. * @param criteria Criteria when to stop the Levenberg-Marquard iterative algorithm.
  1776. * gain in the Damped Gauss-Newton formulation.
  1777. *
  1778. * The function refines the object pose given at least 3 object points, their corresponding image
  1779. * projections, an initial solution for the rotation and translation vector,
  1780. * as well as the camera intrinsic matrix and the distortion coefficients.
  1781. * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
  1782. * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
  1783. */
  1784. + (void)solvePnPRefineVVS:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec criteria:(TermCriteria*)criteria NS_SWIFT_NAME(solvePnPRefineVVS(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:criteria:));
  1785. /**
  1786. * Refine a pose (the translation and the rotation that transform a 3D point expressed in the object coordinate frame
  1787. * to the camera coordinate frame) from a 3D-2D point correspondences and starting from an initial solution.
  1788. *
  1789. * @see `REF: calib3d_solvePnP`
  1790. *
  1791. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or 1xN/Nx1 3-channel,
  1792. * where N is the number of points. vector\<Point3d\> can also be passed here.
  1793. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1794. * where N is the number of points. vector\<Point2d\> can also be passed here.
  1795. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1796. * @param distCoeffs Input vector of distortion coefficients
  1797. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1798. * assumed.
  1799. * @param rvec Input/Output rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  1800. * the model coordinate system to the camera coordinate system. Input values are used as an initial solution.
  1801. * @param tvec Input/Output translation vector. Input values are used as an initial solution.
  1802. * gain in the Damped Gauss-Newton formulation.
  1803. *
  1804. * The function refines the object pose given at least 3 object points, their corresponding image
  1805. * projections, an initial solution for the rotation and translation vector,
  1806. * as well as the camera intrinsic matrix and the distortion coefficients.
  1807. * The function minimizes the projection error with respect to the rotation and the translation vectors, using a
  1808. * virtual visual servoing (VVS) CITE: Chaumette06 CITE: Marchand16 scheme.
  1809. */
  1810. + (void)solvePnPRefineVVS:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec NS_SWIFT_NAME(solvePnPRefineVVS(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:));
  1811. //
  1812. // int cv::solvePnPGeneric(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, bool useExtrinsicGuess = false, SolvePnPMethod flags = SOLVEPNP_ITERATIVE, Mat rvec = Mat(), Mat tvec = Mat(), Mat& reprojectionError = Mat())
  1813. //
  1814. /**
  1815. * Finds an object pose from 3D-2D point correspondences.
  1816. *
  1817. * @see `REF: calib3d_solvePnP`
  1818. *
  1819. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  1820. * couple), depending on the number of input points and the chosen method:
  1821. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  1822. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  1823. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1824. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  1825. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1826. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1827. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1828. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1829. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1830. * Only 1 solution is returned.
  1831. *
  1832. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1833. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1834. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1835. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1836. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1837. * @param distCoeffs Input vector of distortion coefficients
  1838. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1839. * assumed.
  1840. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  1841. * the model coordinate system to the camera coordinate system.
  1842. * @param tvecs Vector of output translation vectors.
  1843. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  1844. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1845. * vectors, respectively, and further optimizes them.
  1846. * @param flags Method for solving a PnP problem: see REF: calib3d_solvePnP_flags
  1847. * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
  1848. * and useExtrinsicGuess is set to true.
  1849. * @param tvec Translation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
  1850. * and useExtrinsicGuess is set to true.
  1851. * @param reprojectionError Optional vector of reprojection error, that is the RMS error
  1852. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  1853. * and the 3D object points projected with the estimated pose.
  1854. *
  1855. * More information is described in REF: calib3d_solvePnP
  1856. *
  1857. * NOTE:
  1858. * - An example of how to use solvePnP for planar augmented reality can be found at
  1859. * opencv_source_code/samples/python/plane_ar.py
  1860. * - If you are using Python:
  1861. * - Numpy array slices won't work as input because solvePnP requires contiguous
  1862. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  1863. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1864. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  1865. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1866. * which requires 2-channel information.
  1867. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  1868. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  1869. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  1870. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  1871. * unstable and sometimes give completely wrong results. If you pass one of these two
  1872. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  1873. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  1874. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  1875. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  1876. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  1877. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  1878. * global solution to converge.
  1879. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  1880. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  1881. * Number of input points must be 4. Object points must be defined in the following order:
  1882. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1883. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1884. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1885. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1886. */
  1887. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs useExtrinsicGuess:(BOOL)useExtrinsicGuess flags:(SolvePnPMethod)flags rvec:(Mat*)rvec tvec:(Mat*)tvec reprojectionError:(Mat*)reprojectionError NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:useExtrinsicGuess:flags:rvec:tvec:reprojectionError:));
  1888. /**
  1889. * Finds an object pose from 3D-2D point correspondences.
  1890. *
  1891. * @see `REF: calib3d_solvePnP`
  1892. *
  1893. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  1894. * couple), depending on the number of input points and the chosen method:
  1895. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  1896. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  1897. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1898. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  1899. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1900. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1901. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1902. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1903. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1904. * Only 1 solution is returned.
  1905. *
  1906. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1907. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1908. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1909. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1910. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1911. * @param distCoeffs Input vector of distortion coefficients
  1912. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1913. * assumed.
  1914. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  1915. * the model coordinate system to the camera coordinate system.
  1916. * @param tvecs Vector of output translation vectors.
  1917. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  1918. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1919. * vectors, respectively, and further optimizes them.
  1920. * @param flags Method for solving a PnP problem: see REF: calib3d_solvePnP_flags
  1921. * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
  1922. * and useExtrinsicGuess is set to true.
  1923. * @param tvec Translation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
  1924. * and useExtrinsicGuess is set to true.
  1925. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  1926. * and the 3D object points projected with the estimated pose.
  1927. *
  1928. * More information is described in REF: calib3d_solvePnP
  1929. *
  1930. * NOTE:
  1931. * - An example of how to use solvePnP for planar augmented reality can be found at
  1932. * opencv_source_code/samples/python/plane_ar.py
  1933. * - If you are using Python:
  1934. * - Numpy array slices won't work as input because solvePnP requires contiguous
  1935. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  1936. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1937. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  1938. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  1939. * which requires 2-channel information.
  1940. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  1941. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  1942. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  1943. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  1944. * unstable and sometimes give completely wrong results. If you pass one of these two
  1945. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  1946. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  1947. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  1948. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  1949. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  1950. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  1951. * global solution to converge.
  1952. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  1953. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  1954. * Number of input points must be 4. Object points must be defined in the following order:
  1955. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1956. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1957. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1958. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1959. */
  1960. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs useExtrinsicGuess:(BOOL)useExtrinsicGuess flags:(SolvePnPMethod)flags rvec:(Mat*)rvec tvec:(Mat*)tvec NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:useExtrinsicGuess:flags:rvec:tvec:));
  1961. /**
  1962. * Finds an object pose from 3D-2D point correspondences.
  1963. *
  1964. * @see `REF: calib3d_solvePnP`
  1965. *
  1966. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  1967. * couple), depending on the number of input points and the chosen method:
  1968. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  1969. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  1970. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  1971. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  1972. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  1973. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  1974. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  1975. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  1976. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  1977. * Only 1 solution is returned.
  1978. *
  1979. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  1980. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  1981. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  1982. * where N is the number of points. vector\<Point2d\> can be also passed here.
  1983. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  1984. * @param distCoeffs Input vector of distortion coefficients
  1985. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  1986. * assumed.
  1987. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  1988. * the model coordinate system to the camera coordinate system.
  1989. * @param tvecs Vector of output translation vectors.
  1990. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  1991. * the provided rvec and tvec values as initial approximations of the rotation and translation
  1992. * vectors, respectively, and further optimizes them.
  1993. * @param flags Method for solving a PnP problem: see REF: calib3d_solvePnP_flags
  1994. * @param rvec Rotation vector used to initialize an iterative PnP refinement algorithm, when flag is REF: SOLVEPNP_ITERATIVE
  1995. * and useExtrinsicGuess is set to true.
  1996. * and useExtrinsicGuess is set to true.
  1997. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  1998. * and the 3D object points projected with the estimated pose.
  1999. *
  2000. * More information is described in REF: calib3d_solvePnP
  2001. *
  2002. * NOTE:
  2003. * - An example of how to use solvePnP for planar augmented reality can be found at
  2004. * opencv_source_code/samples/python/plane_ar.py
  2005. * - If you are using Python:
  2006. * - Numpy array slices won't work as input because solvePnP requires contiguous
  2007. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  2008. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2009. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  2010. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2011. * which requires 2-channel information.
  2012. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  2013. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  2014. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  2015. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  2016. * unstable and sometimes give completely wrong results. If you pass one of these two
  2017. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  2018. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  2019. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  2020. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  2021. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  2022. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  2023. * global solution to converge.
  2024. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  2025. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  2026. * Number of input points must be 4. Object points must be defined in the following order:
  2027. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2028. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2029. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2030. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2031. */
  2032. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs useExtrinsicGuess:(BOOL)useExtrinsicGuess flags:(SolvePnPMethod)flags rvec:(Mat*)rvec NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:useExtrinsicGuess:flags:rvec:));
  2033. /**
  2034. * Finds an object pose from 3D-2D point correspondences.
  2035. *
  2036. * @see `REF: calib3d_solvePnP`
  2037. *
  2038. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  2039. * couple), depending on the number of input points and the chosen method:
  2040. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  2041. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  2042. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  2043. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  2044. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2045. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2046. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2047. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2048. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  2049. * Only 1 solution is returned.
  2050. *
  2051. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  2052. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  2053. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  2054. * where N is the number of points. vector\<Point2d\> can be also passed here.
  2055. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  2056. * @param distCoeffs Input vector of distortion coefficients
  2057. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  2058. * assumed.
  2059. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  2060. * the model coordinate system to the camera coordinate system.
  2061. * @param tvecs Vector of output translation vectors.
  2062. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  2063. * the provided rvec and tvec values as initial approximations of the rotation and translation
  2064. * vectors, respectively, and further optimizes them.
  2065. * @param flags Method for solving a PnP problem: see REF: calib3d_solvePnP_flags
  2066. * and useExtrinsicGuess is set to true.
  2067. * and useExtrinsicGuess is set to true.
  2068. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  2069. * and the 3D object points projected with the estimated pose.
  2070. *
  2071. * More information is described in REF: calib3d_solvePnP
  2072. *
  2073. * NOTE:
  2074. * - An example of how to use solvePnP for planar augmented reality can be found at
  2075. * opencv_source_code/samples/python/plane_ar.py
  2076. * - If you are using Python:
  2077. * - Numpy array slices won't work as input because solvePnP requires contiguous
  2078. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  2079. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2080. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  2081. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2082. * which requires 2-channel information.
  2083. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  2084. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  2085. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  2086. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  2087. * unstable and sometimes give completely wrong results. If you pass one of these two
  2088. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  2089. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  2090. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  2091. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  2092. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  2093. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  2094. * global solution to converge.
  2095. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  2096. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  2097. * Number of input points must be 4. Object points must be defined in the following order:
  2098. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2099. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2100. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2101. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2102. */
  2103. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs useExtrinsicGuess:(BOOL)useExtrinsicGuess flags:(SolvePnPMethod)flags NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:useExtrinsicGuess:flags:));
  2104. /**
  2105. * Finds an object pose from 3D-2D point correspondences.
  2106. *
  2107. * @see `REF: calib3d_solvePnP`
  2108. *
  2109. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  2110. * couple), depending on the number of input points and the chosen method:
  2111. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  2112. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  2113. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  2114. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  2115. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2116. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2117. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2118. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2119. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  2120. * Only 1 solution is returned.
  2121. *
  2122. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  2123. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  2124. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  2125. * where N is the number of points. vector\<Point2d\> can be also passed here.
  2126. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  2127. * @param distCoeffs Input vector of distortion coefficients
  2128. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  2129. * assumed.
  2130. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  2131. * the model coordinate system to the camera coordinate system.
  2132. * @param tvecs Vector of output translation vectors.
  2133. * @param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
  2134. * the provided rvec and tvec values as initial approximations of the rotation and translation
  2135. * vectors, respectively, and further optimizes them.
  2136. * and useExtrinsicGuess is set to true.
  2137. * and useExtrinsicGuess is set to true.
  2138. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  2139. * and the 3D object points projected with the estimated pose.
  2140. *
  2141. * More information is described in REF: calib3d_solvePnP
  2142. *
  2143. * NOTE:
  2144. * - An example of how to use solvePnP for planar augmented reality can be found at
  2145. * opencv_source_code/samples/python/plane_ar.py
  2146. * - If you are using Python:
  2147. * - Numpy array slices won't work as input because solvePnP requires contiguous
  2148. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  2149. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2150. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  2151. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2152. * which requires 2-channel information.
  2153. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  2154. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  2155. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  2156. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  2157. * unstable and sometimes give completely wrong results. If you pass one of these two
  2158. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  2159. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  2160. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  2161. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  2162. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  2163. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  2164. * global solution to converge.
  2165. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  2166. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  2167. * Number of input points must be 4. Object points must be defined in the following order:
  2168. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2169. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2170. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2171. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2172. */
  2173. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs useExtrinsicGuess:(BOOL)useExtrinsicGuess NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:useExtrinsicGuess:));
  2174. /**
  2175. * Finds an object pose from 3D-2D point correspondences.
  2176. *
  2177. * @see `REF: calib3d_solvePnP`
  2178. *
  2179. * This function returns a list of all the possible solutions (a solution is a <rotation vector, translation vector>
  2180. * couple), depending on the number of input points and the chosen method:
  2181. * - P3P methods (REF: SOLVEPNP_P3P, REF: SOLVEPNP_AP3P): 3 or 4 input points. Number of returned solutions can be between 0 and 4 with 3 input points.
  2182. * - REF: SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar. Returns 2 solutions.
  2183. * - REF: SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
  2184. * Number of input points must be 4 and 2 solutions are returned. Object points must be defined in the following order:
  2185. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2186. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2187. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2188. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2189. * - for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
  2190. * Only 1 solution is returned.
  2191. *
  2192. * @param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
  2193. * 1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
  2194. * @param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
  2195. * where N is the number of points. vector\<Point2d\> can be also passed here.
  2196. * @param cameraMatrix Input camera intrinsic matrix `$$\cameramatrix{A}$$` .
  2197. * @param distCoeffs Input vector of distortion coefficients
  2198. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  2199. * assumed.
  2200. * @param rvecs Vector of output rotation vectors (see REF: Rodrigues ) that, together with tvecs, brings points from
  2201. * the model coordinate system to the camera coordinate system.
  2202. * @param tvecs Vector of output translation vectors.
  2203. * the provided rvec and tvec values as initial approximations of the rotation and translation
  2204. * vectors, respectively, and further optimizes them.
  2205. * and useExtrinsicGuess is set to true.
  2206. * and useExtrinsicGuess is set to true.
  2207. * (`$$ \text{RMSE} = \sqrt{\frac{\sum_{i}^{N} \left ( \hat{y_i} - y_i \right )^2}{N}} $$`) between the input image points
  2208. * and the 3D object points projected with the estimated pose.
  2209. *
  2210. * More information is described in REF: calib3d_solvePnP
  2211. *
  2212. * NOTE:
  2213. * - An example of how to use solvePnP for planar augmented reality can be found at
  2214. * opencv_source_code/samples/python/plane_ar.py
  2215. * - If you are using Python:
  2216. * - Numpy array slices won't work as input because solvePnP requires contiguous
  2217. * arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
  2218. * modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2219. * - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
  2220. * to its calling of #undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
  2221. * which requires 2-channel information.
  2222. * - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
  2223. * it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
  2224. * np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
  2225. * - The methods REF: SOLVEPNP_DLS and REF: SOLVEPNP_UPNP cannot be used as the current implementations are
  2226. * unstable and sometimes give completely wrong results. If you pass one of these two
  2227. * flags, REF: SOLVEPNP_EPNP method will be used instead.
  2228. * - The minimum number of points is 4 in the general case. In the case of REF: SOLVEPNP_P3P and REF: SOLVEPNP_AP3P
  2229. * methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
  2230. * of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
  2231. * - With REF: SOLVEPNP_ITERATIVE method and `useExtrinsicGuess=true`, the minimum number of points is 3 (3 points
  2232. * are sufficient to compute a pose but there are up to 4 solutions). The initial solution should be close to the
  2233. * global solution to converge.
  2234. * - With REF: SOLVEPNP_IPPE input points must be >= 4 and object points must be coplanar.
  2235. * - With REF: SOLVEPNP_IPPE_SQUARE this is a special case suitable for marker pose estimation.
  2236. * Number of input points must be 4. Object points must be defined in the following order:
  2237. * - point 0: [-squareLength / 2, squareLength / 2, 0]
  2238. * - point 1: [ squareLength / 2, squareLength / 2, 0]
  2239. * - point 2: [ squareLength / 2, -squareLength / 2, 0]
  2240. * - point 3: [-squareLength / 2, -squareLength / 2, 0]
  2241. */
  2242. + (int)solvePnPGeneric:(Mat*)objectPoints imagePoints:(Mat*)imagePoints cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs NS_SWIFT_NAME(solvePnPGeneric(objectPoints:imagePoints:cameraMatrix:distCoeffs:rvecs:tvecs:));
  2243. //
  2244. // Mat cv::initCameraMatrix2D(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, double aspectRatio = 1.0)
  2245. //
  2246. /**
  2247. * Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
  2248. *
  2249. * @param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
  2250. * coordinate space. In the old interface all the per-view vectors are concatenated. See
  2251. * #calibrateCamera for details.
  2252. * @param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
  2253. * old interface all the per-view vectors are concatenated.
  2254. * @param imageSize Image size in pixels used to initialize the principal point.
  2255. * @param aspectRatio If it is zero or negative, both `$$f_x$$` and `$$f_y$$` are estimated independently.
  2256. * Otherwise, `$$f_x = f_y \cdot \texttt{aspectRatio}$$` .
  2257. *
  2258. * The function estimates and returns an initial camera intrinsic matrix for the camera calibration process.
  2259. * Currently, the function only supports planar calibration patterns, which are patterns where each
  2260. * object point has z-coordinate =0.
  2261. */
  2262. + (Mat*)initCameraMatrix2D:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize aspectRatio:(double)aspectRatio NS_SWIFT_NAME(initCameraMatrix2D(objectPoints:imagePoints:imageSize:aspectRatio:));
  2263. /**
  2264. * Finds an initial camera intrinsic matrix from 3D-2D point correspondences.
  2265. *
  2266. * @param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
  2267. * coordinate space. In the old interface all the per-view vectors are concatenated. See
  2268. * #calibrateCamera for details.
  2269. * @param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
  2270. * old interface all the per-view vectors are concatenated.
  2271. * @param imageSize Image size in pixels used to initialize the principal point.
  2272. * Otherwise, `$$f_x = f_y \cdot \texttt{aspectRatio}$$` .
  2273. *
  2274. * The function estimates and returns an initial camera intrinsic matrix for the camera calibration process.
  2275. * Currently, the function only supports planar calibration patterns, which are patterns where each
  2276. * object point has z-coordinate =0.
  2277. */
  2278. + (Mat*)initCameraMatrix2D:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize NS_SWIFT_NAME(initCameraMatrix2D(objectPoints:imagePoints:imageSize:));
  2279. //
  2280. // bool cv::findChessboardCorners(Mat image, Size patternSize, Mat& corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE)
  2281. //
  2282. /**
  2283. * Finds the positions of internal corners of the chessboard.
  2284. *
  2285. * @param image Source chessboard view. It must be an 8-bit grayscale or color image.
  2286. * @param patternSize Number of inner corners per a chessboard row and column
  2287. * ( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
  2288. * @param corners Output array of detected corners.
  2289. * @param flags Various operation flags that can be zero or a combination of the following values:
  2290. * - REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
  2291. * and white, rather than a fixed threshold level (computed from the average image brightness).
  2292. * - REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with #equalizeHist before
  2293. * applying fixed or adaptive thresholding.
  2294. * - REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
  2295. * square-like shape) to filter out false quads extracted at the contour retrieval stage.
  2296. * - REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
  2297. * and shortcut the call if none is found. This can drastically speed up the call in the
  2298. * degenerate condition when no chessboard is observed.
  2299. *
  2300. * The function attempts to determine whether the input image is a view of the chessboard pattern and
  2301. * locate the internal chessboard corners. The function returns a non-zero value if all of the corners
  2302. * are found and they are placed in a certain order (row by row, left to right in every row).
  2303. * Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
  2304. * a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
  2305. * squares touch each other. The detected coordinates are approximate, and to determine their positions
  2306. * more accurately, the function calls #cornerSubPix. You also may use the function #cornerSubPix with
  2307. * different parameters if returned coordinates are not accurate enough.
  2308. *
  2309. * Sample usage of detecting and drawing chessboard corners: :
  2310. *
  2311. * Size patternsize(8,6); //interior number of corners
  2312. * Mat gray = ....; //source image
  2313. * vector<Point2f> corners; //this will be filled by the detected corners
  2314. *
  2315. * //CALIB_CB_FAST_CHECK saves a lot of time on images
  2316. * //that do not contain any chessboard corners
  2317. * bool patternfound = findChessboardCorners(gray, patternsize, corners,
  2318. * CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
  2319. * + CALIB_CB_FAST_CHECK);
  2320. *
  2321. * if(patternfound)
  2322. * cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
  2323. * TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
  2324. *
  2325. * drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
  2326. *
  2327. * NOTE: The function requires white space (like a square-thick border, the wider the better) around
  2328. * the board to make the detection more robust in various environments. Otherwise, if there is no
  2329. * border and the background is dark, the outer black squares cannot be segmented properly and so the
  2330. * square grouping and ordering algorithm fails.
  2331. *
  2332. * Use gen_pattern.py (REF: tutorial_camera_calibration_pattern) to create checkerboard.
  2333. */
  2334. + (BOOL)findChessboardCorners:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners flags:(int)flags NS_SWIFT_NAME(findChessboardCorners(image:patternSize:corners:flags:));
  2335. /**
  2336. * Finds the positions of internal corners of the chessboard.
  2337. *
  2338. * @param image Source chessboard view. It must be an 8-bit grayscale or color image.
  2339. * @param patternSize Number of inner corners per a chessboard row and column
  2340. * ( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
  2341. * @param corners Output array of detected corners.
  2342. * - REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black
  2343. * and white, rather than a fixed threshold level (computed from the average image brightness).
  2344. * - REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with #equalizeHist before
  2345. * applying fixed or adaptive thresholding.
  2346. * - REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter,
  2347. * square-like shape) to filter out false quads extracted at the contour retrieval stage.
  2348. * - REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners,
  2349. * and shortcut the call if none is found. This can drastically speed up the call in the
  2350. * degenerate condition when no chessboard is observed.
  2351. *
  2352. * The function attempts to determine whether the input image is a view of the chessboard pattern and
  2353. * locate the internal chessboard corners. The function returns a non-zero value if all of the corners
  2354. * are found and they are placed in a certain order (row by row, left to right in every row).
  2355. * Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
  2356. * a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
  2357. * squares touch each other. The detected coordinates are approximate, and to determine their positions
  2358. * more accurately, the function calls #cornerSubPix. You also may use the function #cornerSubPix with
  2359. * different parameters if returned coordinates are not accurate enough.
  2360. *
  2361. * Sample usage of detecting and drawing chessboard corners: :
  2362. *
  2363. * Size patternsize(8,6); //interior number of corners
  2364. * Mat gray = ....; //source image
  2365. * vector<Point2f> corners; //this will be filled by the detected corners
  2366. *
  2367. * //CALIB_CB_FAST_CHECK saves a lot of time on images
  2368. * //that do not contain any chessboard corners
  2369. * bool patternfound = findChessboardCorners(gray, patternsize, corners,
  2370. * CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
  2371. * + CALIB_CB_FAST_CHECK);
  2372. *
  2373. * if(patternfound)
  2374. * cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
  2375. * TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
  2376. *
  2377. * drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
  2378. *
  2379. * NOTE: The function requires white space (like a square-thick border, the wider the better) around
  2380. * the board to make the detection more robust in various environments. Otherwise, if there is no
  2381. * border and the background is dark, the outer black squares cannot be segmented properly and so the
  2382. * square grouping and ordering algorithm fails.
  2383. *
  2384. * Use gen_pattern.py (REF: tutorial_camera_calibration_pattern) to create checkerboard.
  2385. */
  2386. + (BOOL)findChessboardCorners:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners NS_SWIFT_NAME(findChessboardCorners(image:patternSize:corners:));
  2387. //
  2388. // bool cv::checkChessboard(Mat img, Size size)
  2389. //
  2390. + (BOOL)checkChessboard:(Mat*)img size:(Size2i*)size NS_SWIFT_NAME(checkChessboard(img:size:));
  2391. //
  2392. // bool cv::findChessboardCornersSB(Mat image, Size patternSize, Mat& corners, int flags, Mat& meta)
  2393. //
  2394. /**
  2395. * Finds the positions of internal corners of the chessboard using a sector based approach.
  2396. *
  2397. * @param image Source chessboard view. It must be an 8-bit grayscale or color image.
  2398. * @param patternSize Number of inner corners per a chessboard row and column
  2399. * ( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).
  2400. * @param corners Output array of detected corners.
  2401. * @param flags Various operation flags that can be zero or a combination of the following values:
  2402. * - REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before detection.
  2403. * - REF: CALIB_CB_EXHAUSTIVE Run an exhaustive search to improve detection rate.
  2404. * - REF: CALIB_CB_ACCURACY Up sample input image to improve sub-pixel accuracy due to aliasing effects.
  2405. * - REF: CALIB_CB_LARGER The detected pattern is allowed to be larger than patternSize (see description).
  2406. * - REF: CALIB_CB_MARKER The detected pattern must have a marker (see description).
  2407. * This should be used if an accurate camera calibration is required.
  2408. * @param meta Optional output arrray of detected corners (CV_8UC1 and size = cv::Size(columns,rows)).
  2409. * Each entry stands for one corner of the pattern and can have one of the following values:
  2410. * - 0 = no meta data attached
  2411. * - 1 = left-top corner of a black cell
  2412. * - 2 = left-top corner of a white cell
  2413. * - 3 = left-top corner of a black cell with a white marker dot
  2414. * - 4 = left-top corner of a white cell with a black marker dot (pattern origin in case of markers otherwise first corner)
  2415. *
  2416. * The function is analog to #findChessboardCorners but uses a localized radon
  2417. * transformation approximated by box filters being more robust to all sort of
  2418. * noise, faster on larger images and is able to directly return the sub-pixel
  2419. * position of the internal chessboard corners. The Method is based on the paper
  2420. * CITE: duda2018 "Accurate Detection and Localization of Checkerboard Corners for
  2421. * Calibration" demonstrating that the returned sub-pixel positions are more
  2422. * accurate than the one returned by cornerSubPix allowing a precise camera
  2423. * calibration for demanding applications.
  2424. *
  2425. * In the case, the flags REF: CALIB_CB_LARGER or REF: CALIB_CB_MARKER are given,
  2426. * the result can be recovered from the optional meta array. Both flags are
  2427. * helpful to use calibration patterns exceeding the field of view of the camera.
  2428. * These oversized patterns allow more accurate calibrations as corners can be
  2429. * utilized, which are as close as possible to the image borders. For a
  2430. * consistent coordinate system across all images, the optional marker (see image
  2431. * below) can be used to move the origin of the board to the location where the
  2432. * black circle is located.
  2433. *
  2434. * NOTE: The function requires a white boarder with roughly the same width as one
  2435. * of the checkerboard fields around the whole board to improve the detection in
  2436. * various environments. In addition, because of the localized radon
  2437. * transformation it is beneficial to use round corners for the field corners
  2438. * which are located on the outside of the board. The following figure illustrates
  2439. * a sample checkerboard optimized for the detection. However, any other checkerboard
  2440. * can be used as well.
  2441. *
  2442. * Use gen_pattern.py (REF: tutorial_camera_calibration_pattern) to create checkerboard.
  2443. * ![Checkerboard](pics/checkerboard_radon.png)
  2444. */
  2445. + (BOOL)findChessboardCornersSBWithMeta:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners flags:(int)flags meta:(Mat*)meta NS_SWIFT_NAME(findChessboardCornersSB(image:patternSize:corners:flags:meta:));
  2446. //
  2447. // bool cv::findChessboardCornersSB(Mat image, Size patternSize, Mat& corners, int flags = 0)
  2448. //
  2449. + (BOOL)findChessboardCornersSB:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners flags:(int)flags NS_SWIFT_NAME(findChessboardCornersSB(image:patternSize:corners:flags:));
  2450. + (BOOL)findChessboardCornersSB:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners NS_SWIFT_NAME(findChessboardCornersSB(image:patternSize:corners:));
  2451. //
  2452. // Scalar cv::estimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance = 0.8F, bool vertical = false, Mat& sharpness = Mat())
  2453. //
  2454. /**
  2455. * Estimates the sharpness of a detected chessboard.
  2456. *
  2457. * Image sharpness, as well as brightness, are a critical parameter for accuracte
  2458. * camera calibration. For accessing these parameters for filtering out
  2459. * problematic calibraiton images, this method calculates edge profiles by traveling from
  2460. * black to white chessboard cell centers. Based on this, the number of pixels is
  2461. * calculated required to transit from black to white. This width of the
  2462. * transition area is a good indication of how sharp the chessboard is imaged
  2463. * and should be below ~3.0 pixels.
  2464. *
  2465. * @param image Gray image used to find chessboard corners
  2466. * @param patternSize Size of a found chessboard pattern
  2467. * @param corners Corners found by #findChessboardCornersSB
  2468. * @param rise_distance Rise distance 0.8 means 10% ... 90% of the final signal strength
  2469. * @param vertical By default edge responses for horizontal lines are calculated
  2470. * @param sharpness Optional output array with a sharpness value for calculated edge responses (see description)
  2471. *
  2472. * The optional sharpness array is of type CV_32FC1 and has for each calculated
  2473. * profile one row with the following five entries:
  2474. * 0 = x coordinate of the underlying edge in the image
  2475. * 1 = y coordinate of the underlying edge in the image
  2476. * 2 = width of the transition area (sharpness)
  2477. * 3 = signal strength in the black cell (min brightness)
  2478. * 4 = signal strength in the white cell (max brightness)
  2479. *
  2480. * @return Scalar(average sharpness, average min brightness, average max brightness,0)
  2481. */
  2482. + (Scalar*)estimateChessboardSharpness:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners rise_distance:(float)rise_distance vertical:(BOOL)vertical sharpness:(Mat*)sharpness NS_SWIFT_NAME(estimateChessboardSharpness(image:patternSize:corners:rise_distance:vertical:sharpness:));
  2483. /**
  2484. * Estimates the sharpness of a detected chessboard.
  2485. *
  2486. * Image sharpness, as well as brightness, are a critical parameter for accuracte
  2487. * camera calibration. For accessing these parameters for filtering out
  2488. * problematic calibraiton images, this method calculates edge profiles by traveling from
  2489. * black to white chessboard cell centers. Based on this, the number of pixels is
  2490. * calculated required to transit from black to white. This width of the
  2491. * transition area is a good indication of how sharp the chessboard is imaged
  2492. * and should be below ~3.0 pixels.
  2493. *
  2494. * @param image Gray image used to find chessboard corners
  2495. * @param patternSize Size of a found chessboard pattern
  2496. * @param corners Corners found by #findChessboardCornersSB
  2497. * @param rise_distance Rise distance 0.8 means 10% ... 90% of the final signal strength
  2498. * @param vertical By default edge responses for horizontal lines are calculated
  2499. *
  2500. * The optional sharpness array is of type CV_32FC1 and has for each calculated
  2501. * profile one row with the following five entries:
  2502. * 0 = x coordinate of the underlying edge in the image
  2503. * 1 = y coordinate of the underlying edge in the image
  2504. * 2 = width of the transition area (sharpness)
  2505. * 3 = signal strength in the black cell (min brightness)
  2506. * 4 = signal strength in the white cell (max brightness)
  2507. *
  2508. * @return Scalar(average sharpness, average min brightness, average max brightness,0)
  2509. */
  2510. + (Scalar*)estimateChessboardSharpness:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners rise_distance:(float)rise_distance vertical:(BOOL)vertical NS_SWIFT_NAME(estimateChessboardSharpness(image:patternSize:corners:rise_distance:vertical:));
  2511. /**
  2512. * Estimates the sharpness of a detected chessboard.
  2513. *
  2514. * Image sharpness, as well as brightness, are a critical parameter for accuracte
  2515. * camera calibration. For accessing these parameters for filtering out
  2516. * problematic calibraiton images, this method calculates edge profiles by traveling from
  2517. * black to white chessboard cell centers. Based on this, the number of pixels is
  2518. * calculated required to transit from black to white. This width of the
  2519. * transition area is a good indication of how sharp the chessboard is imaged
  2520. * and should be below ~3.0 pixels.
  2521. *
  2522. * @param image Gray image used to find chessboard corners
  2523. * @param patternSize Size of a found chessboard pattern
  2524. * @param corners Corners found by #findChessboardCornersSB
  2525. * @param rise_distance Rise distance 0.8 means 10% ... 90% of the final signal strength
  2526. *
  2527. * The optional sharpness array is of type CV_32FC1 and has for each calculated
  2528. * profile one row with the following five entries:
  2529. * 0 = x coordinate of the underlying edge in the image
  2530. * 1 = y coordinate of the underlying edge in the image
  2531. * 2 = width of the transition area (sharpness)
  2532. * 3 = signal strength in the black cell (min brightness)
  2533. * 4 = signal strength in the white cell (max brightness)
  2534. *
  2535. * @return Scalar(average sharpness, average min brightness, average max brightness,0)
  2536. */
  2537. + (Scalar*)estimateChessboardSharpness:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners rise_distance:(float)rise_distance NS_SWIFT_NAME(estimateChessboardSharpness(image:patternSize:corners:rise_distance:));
  2538. /**
  2539. * Estimates the sharpness of a detected chessboard.
  2540. *
  2541. * Image sharpness, as well as brightness, are a critical parameter for accuracte
  2542. * camera calibration. For accessing these parameters for filtering out
  2543. * problematic calibraiton images, this method calculates edge profiles by traveling from
  2544. * black to white chessboard cell centers. Based on this, the number of pixels is
  2545. * calculated required to transit from black to white. This width of the
  2546. * transition area is a good indication of how sharp the chessboard is imaged
  2547. * and should be below ~3.0 pixels.
  2548. *
  2549. * @param image Gray image used to find chessboard corners
  2550. * @param patternSize Size of a found chessboard pattern
  2551. * @param corners Corners found by #findChessboardCornersSB
  2552. *
  2553. * The optional sharpness array is of type CV_32FC1 and has for each calculated
  2554. * profile one row with the following five entries:
  2555. * 0 = x coordinate of the underlying edge in the image
  2556. * 1 = y coordinate of the underlying edge in the image
  2557. * 2 = width of the transition area (sharpness)
  2558. * 3 = signal strength in the black cell (min brightness)
  2559. * 4 = signal strength in the white cell (max brightness)
  2560. *
  2561. * @return Scalar(average sharpness, average min brightness, average max brightness,0)
  2562. */
  2563. + (Scalar*)estimateChessboardSharpness:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners NS_SWIFT_NAME(estimateChessboardSharpness(image:patternSize:corners:));
  2564. //
  2565. // bool cv::find4QuadCornerSubpix(Mat img, Mat& corners, Size region_size)
  2566. //
  2567. + (BOOL)find4QuadCornerSubpix:(Mat*)img corners:(Mat*)corners region_size:(Size2i*)region_size NS_SWIFT_NAME(find4QuadCornerSubpix(img:corners:region_size:));
  2568. //
  2569. // void cv::drawChessboardCorners(Mat& image, Size patternSize, Mat corners, bool patternWasFound)
  2570. //
  2571. /**
  2572. * Renders the detected chessboard corners.
  2573. *
  2574. * @param image Destination image. It must be an 8-bit color image.
  2575. * @param patternSize Number of inner corners per a chessboard row and column
  2576. * (patternSize = cv::Size(points_per_row,points_per_column)).
  2577. * @param corners Array of detected corners, the output of #findChessboardCorners.
  2578. * @param patternWasFound Parameter indicating whether the complete board was found or not. The
  2579. * return value of #findChessboardCorners should be passed here.
  2580. *
  2581. * The function draws individual chessboard corners detected either as red circles if the board was not
  2582. * found, or as colored corners connected with lines if the board was found.
  2583. */
  2584. + (void)drawChessboardCorners:(Mat*)image patternSize:(Size2i*)patternSize corners:(Mat*)corners patternWasFound:(BOOL)patternWasFound NS_SWIFT_NAME(drawChessboardCorners(image:patternSize:corners:patternWasFound:));
  2585. //
  2586. // void cv::drawFrameAxes(Mat& image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length, int thickness = 3)
  2587. //
  2588. /**
  2589. * Draw axes of the world/object coordinate system from pose estimation. @see `+solvePnP:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:flags:`
  2590. *
  2591. * @param image Input/output image. It must have 1 or 3 channels. The number of channels is not altered.
  2592. * @param cameraMatrix Input 3x3 floating-point matrix of camera intrinsic parameters.
  2593. * `$$\cameramatrix{A}$$`
  2594. * @param distCoeffs Input vector of distortion coefficients
  2595. * `$$\distcoeffs$$`. If the vector is empty, the zero distortion coefficients are assumed.
  2596. * @param rvec Rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  2597. * the model coordinate system to the camera coordinate system.
  2598. * @param tvec Translation vector.
  2599. * @param length Length of the painted axes in the same unit than tvec (usually in meters).
  2600. * @param thickness Line thickness of the painted axes.
  2601. *
  2602. * This function draws the axes of the world/object coordinate system w.r.t. to the camera frame.
  2603. * OX is drawn in red, OY in green and OZ in blue.
  2604. */
  2605. + (void)drawFrameAxes:(Mat*)image cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec length:(float)length thickness:(int)thickness NS_SWIFT_NAME(drawFrameAxes(image:cameraMatrix:distCoeffs:rvec:tvec:length:thickness:));
  2606. /**
  2607. * Draw axes of the world/object coordinate system from pose estimation. @see `+solvePnP:imagePoints:cameraMatrix:distCoeffs:rvec:tvec:useExtrinsicGuess:flags:`
  2608. *
  2609. * @param image Input/output image. It must have 1 or 3 channels. The number of channels is not altered.
  2610. * @param cameraMatrix Input 3x3 floating-point matrix of camera intrinsic parameters.
  2611. * `$$\cameramatrix{A}$$`
  2612. * @param distCoeffs Input vector of distortion coefficients
  2613. * `$$\distcoeffs$$`. If the vector is empty, the zero distortion coefficients are assumed.
  2614. * @param rvec Rotation vector (see REF: Rodrigues ) that, together with tvec, brings points from
  2615. * the model coordinate system to the camera coordinate system.
  2616. * @param tvec Translation vector.
  2617. * @param length Length of the painted axes in the same unit than tvec (usually in meters).
  2618. *
  2619. * This function draws the axes of the world/object coordinate system w.r.t. to the camera frame.
  2620. * OX is drawn in red, OY in green and OZ in blue.
  2621. */
  2622. + (void)drawFrameAxes:(Mat*)image cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvec:(Mat*)rvec tvec:(Mat*)tvec length:(float)length NS_SWIFT_NAME(drawFrameAxes(image:cameraMatrix:distCoeffs:rvec:tvec:length:));
  2623. //
  2624. // bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags, _hidden_ blobDetector = cv::SimpleBlobDetector::create(), CirclesGridFinderParameters parameters)
  2625. //
  2626. /**
  2627. * Finds centers in the grid of circles.
  2628. *
  2629. * @param image grid view of input circles; it must be an 8-bit grayscale or color image.
  2630. * @param patternSize number of circles per row and column
  2631. * ( patternSize = Size(points_per_row, points_per_colum) ).
  2632. * @param centers output array of detected centers.
  2633. * @param flags various operation flags that can be one of the following values:
  2634. * - REF: CALIB_CB_SYMMETRIC_GRID uses symmetric pattern of circles.
  2635. * - REF: CALIB_CB_ASYMMETRIC_GRID uses asymmetric pattern of circles.
  2636. * - REF: CALIB_CB_CLUSTERING uses a special algorithm for grid detection. It is more robust to
  2637. * perspective distortions but much more sensitive to background clutter.
  2638. * @param blobDetector feature detector that finds blobs like dark circles on light background.
  2639. * If `blobDetector` is NULL then `image` represents Point2f array of candidates.
  2640. * @param parameters struct for finding circles in a grid pattern.
  2641. *
  2642. * The function attempts to determine whether the input image contains a grid of circles. If it is, the
  2643. * function locates centers of the circles. The function returns a non-zero value if all of the centers
  2644. * have been found and they have been placed in a certain order (row by row, left to right in every
  2645. * row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0.
  2646. *
  2647. * Sample usage of detecting and drawing the centers of circles: :
  2648. *
  2649. * Size patternsize(7,7); //number of centers
  2650. * Mat gray = ...; //source image
  2651. * vector<Point2f> centers; //this will be filled by the detected centers
  2652. *
  2653. * bool patternfound = findCirclesGrid(gray, patternsize, centers);
  2654. *
  2655. * drawChessboardCorners(img, patternsize, Mat(centers), patternfound);
  2656. *
  2657. * NOTE: The function requires white space (like a square-thick border, the wider the better) around
  2658. * the board to make the detection more robust in various environments.
  2659. */
  2660. + (BOOL)findCirclesGrid:(Mat*)image patternSize:(Size2i*)patternSize centers:(Mat*)centers flags:(int)flags parameters:(CirclesGridFinderParameters*)parameters NS_SWIFT_NAME(findCirclesGrid(image:patternSize:centers:flags:parameters:));
  2661. //
  2662. // bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags = CALIB_CB_SYMMETRIC_GRID, _hidden_ blobDetector = cv::SimpleBlobDetector::create())
  2663. //
  2664. + (BOOL)findCirclesGrid:(Mat*)image patternSize:(Size2i*)patternSize centers:(Mat*)centers flags:(int)flags NS_SWIFT_NAME(findCirclesGrid(image:patternSize:centers:flags:));
  2665. + (BOOL)findCirclesGrid:(Mat*)image patternSize:(Size2i*)patternSize centers:(Mat*)centers NS_SWIFT_NAME(findCirclesGrid(image:patternSize:centers:));
  2666. //
  2667. // double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
  2668. //
  2669. /**
  2670. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
  2671. * pattern.
  2672. *
  2673. * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
  2674. * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
  2675. * vector contains as many elements as the number of pattern views. If the same calibration pattern
  2676. * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
  2677. * possible to use partially occluded patterns or even different patterns in different views. Then,
  2678. * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
  2679. * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
  2680. * In the old interface all the vectors of object points from different views are concatenated
  2681. * together.
  2682. * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
  2683. * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
  2684. * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
  2685. * respectively. In the old interface all the vectors of object points from different views are
  2686. * concatenated together.
  2687. * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
  2688. * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
  2689. * `$$\cameramatrix{A}$$` . If REF: CALIB_USE_INTRINSIC_GUESS
  2690. * and/or REF: CALIB_FIX_ASPECT_RATIO, REF: CALIB_FIX_PRINCIPAL_POINT or REF: CALIB_FIX_FOCAL_LENGTH
  2691. * are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
  2692. * @param distCoeffs Input/output vector of distortion coefficients
  2693. * `$$\distcoeffs$$`.
  2694. * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
  2695. * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
  2696. * i-th translation vector (see the next output parameter description) brings the calibration pattern
  2697. * from the object coordinate space (in which object points are specified) to the camera coordinate
  2698. * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
  2699. * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
  2700. * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
  2701. * space.
  2702. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
  2703. * describtion above.
  2704. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
  2705. * parameters. Order of deviations values:
  2706. * `$$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
  2707. * s_4, \tau_x, \tau_y)$$` If one of parameters is not estimated, it's deviation is equals to zero.
  2708. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
  2709. * parameters. Order of deviations values: `$$(R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})$$` where M is
  2710. * the number of pattern views. `$$R_i, T_i$$` are concatenated 1x3 vectors.
  2711. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  2712. * @param flags Different flags that may be zero or a combination of the following values:
  2713. * - REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  2714. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  2715. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  2716. * Note, that if intrinsic parameters are known, there is no need to use this function just to
  2717. * estimate extrinsic parameters. Use REF: solvePnP instead.
  2718. * - REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  2719. * optimization. It stays at the center or at a different location specified when
  2720. * REF: CALIB_USE_INTRINSIC_GUESS is set too.
  2721. * - REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
  2722. * ratio fx/fy stays the same as in the input cameraMatrix . When
  2723. * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
  2724. * ignored, only their ratio is computed and used further.
  2725. * - REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients `$$(p_1, p_2)$$` are set
  2726. * to zeros and stay zero.
  2727. * - REF: CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if
  2728. * REF: CALIB_USE_INTRINSIC_GUESS is set.
  2729. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
  2730. * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
  2731. * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2732. * - REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
  2733. * backward compatibility, this extra flag should be explicitly specified to make the
  2734. * calibration function use the rational model and return 8 coefficients or more.
  2735. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  2736. * backward compatibility, this extra flag should be explicitly specified to make the
  2737. * calibration function use the thin prism model and return 12 coefficients or more.
  2738. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  2739. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2740. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2741. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  2742. * backward compatibility, this extra flag should be explicitly specified to make the
  2743. * calibration function use the tilted sensor model and return 14 coefficients.
  2744. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  2745. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2746. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2747. * @param criteria Termination criteria for the iterative optimization algorithm.
  2748. *
  2749. * @return the overall RMS re-projection error.
  2750. *
  2751. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  2752. * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
  2753. * points and their corresponding 2D projections in each view must be specified. That may be achieved
  2754. * by using an object with known geometry and easily detectable feature points. Such an object is
  2755. * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
  2756. * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
  2757. * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
  2758. * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
  2759. * be used as long as initial cameraMatrix is provided.
  2760. *
  2761. * The algorithm performs the following steps:
  2762. *
  2763. * - Compute the initial intrinsic parameters (the option only available for planar calibration
  2764. * patterns) or read them from the input parameters. The distortion coefficients are all set to
  2765. * zeros initially unless some of CALIB_FIX_K? are specified.
  2766. *
  2767. * - Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
  2768. * done using REF: solvePnP .
  2769. *
  2770. * - Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
  2771. * that is, the total sum of squared distances between the observed feature points imagePoints and
  2772. * the projected (using the current estimates for camera parameters and the poses) object points
  2773. * objectPoints. See REF: projectPoints for details.
  2774. *
  2775. * NOTE:
  2776. * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
  2777. * and REF: calibrateCamera returns bad values (zero distortion coefficients, `$$c_x$$` and
  2778. * `$$c_y$$` very far from the image center, and/or large differences between `$$f_x$$` and
  2779. * `$$f_y$$` (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
  2780. * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
  2781. *
  2782. * @sa
  2783. * calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate,
  2784. * undistort
  2785. */
  2786. + (double)calibrateCameraExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics perViewErrors:(Mat*)perViewErrors flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:stdDeviationsIntrinsics:stdDeviationsExtrinsics:perViewErrors:flags:criteria:));
  2787. /**
  2788. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
  2789. * pattern.
  2790. *
  2791. * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
  2792. * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
  2793. * vector contains as many elements as the number of pattern views. If the same calibration pattern
  2794. * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
  2795. * possible to use partially occluded patterns or even different patterns in different views. Then,
  2796. * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
  2797. * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
  2798. * In the old interface all the vectors of object points from different views are concatenated
  2799. * together.
  2800. * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
  2801. * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
  2802. * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
  2803. * respectively. In the old interface all the vectors of object points from different views are
  2804. * concatenated together.
  2805. * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
  2806. * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
  2807. * `$$\cameramatrix{A}$$` . If REF: CALIB_USE_INTRINSIC_GUESS
  2808. * and/or REF: CALIB_FIX_ASPECT_RATIO, REF: CALIB_FIX_PRINCIPAL_POINT or REF: CALIB_FIX_FOCAL_LENGTH
  2809. * are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
  2810. * @param distCoeffs Input/output vector of distortion coefficients
  2811. * `$$\distcoeffs$$`.
  2812. * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
  2813. * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
  2814. * i-th translation vector (see the next output parameter description) brings the calibration pattern
  2815. * from the object coordinate space (in which object points are specified) to the camera coordinate
  2816. * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
  2817. * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
  2818. * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
  2819. * space.
  2820. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
  2821. * describtion above.
  2822. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
  2823. * parameters. Order of deviations values:
  2824. * `$$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
  2825. * s_4, \tau_x, \tau_y)$$` If one of parameters is not estimated, it's deviation is equals to zero.
  2826. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
  2827. * parameters. Order of deviations values: `$$(R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})$$` where M is
  2828. * the number of pattern views. `$$R_i, T_i$$` are concatenated 1x3 vectors.
  2829. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  2830. * @param flags Different flags that may be zero or a combination of the following values:
  2831. * - REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  2832. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  2833. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  2834. * Note, that if intrinsic parameters are known, there is no need to use this function just to
  2835. * estimate extrinsic parameters. Use REF: solvePnP instead.
  2836. * - REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  2837. * optimization. It stays at the center or at a different location specified when
  2838. * REF: CALIB_USE_INTRINSIC_GUESS is set too.
  2839. * - REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
  2840. * ratio fx/fy stays the same as in the input cameraMatrix . When
  2841. * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
  2842. * ignored, only their ratio is computed and used further.
  2843. * - REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients `$$(p_1, p_2)$$` are set
  2844. * to zeros and stay zero.
  2845. * - REF: CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if
  2846. * REF: CALIB_USE_INTRINSIC_GUESS is set.
  2847. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
  2848. * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
  2849. * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2850. * - REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
  2851. * backward compatibility, this extra flag should be explicitly specified to make the
  2852. * calibration function use the rational model and return 8 coefficients or more.
  2853. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  2854. * backward compatibility, this extra flag should be explicitly specified to make the
  2855. * calibration function use the thin prism model and return 12 coefficients or more.
  2856. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  2857. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2858. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2859. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  2860. * backward compatibility, this extra flag should be explicitly specified to make the
  2861. * calibration function use the tilted sensor model and return 14 coefficients.
  2862. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  2863. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2864. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2865. *
  2866. * @return the overall RMS re-projection error.
  2867. *
  2868. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  2869. * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
  2870. * points and their corresponding 2D projections in each view must be specified. That may be achieved
  2871. * by using an object with known geometry and easily detectable feature points. Such an object is
  2872. * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
  2873. * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
  2874. * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
  2875. * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
  2876. * be used as long as initial cameraMatrix is provided.
  2877. *
  2878. * The algorithm performs the following steps:
  2879. *
  2880. * - Compute the initial intrinsic parameters (the option only available for planar calibration
  2881. * patterns) or read them from the input parameters. The distortion coefficients are all set to
  2882. * zeros initially unless some of CALIB_FIX_K? are specified.
  2883. *
  2884. * - Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
  2885. * done using REF: solvePnP .
  2886. *
  2887. * - Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
  2888. * that is, the total sum of squared distances between the observed feature points imagePoints and
  2889. * the projected (using the current estimates for camera parameters and the poses) object points
  2890. * objectPoints. See REF: projectPoints for details.
  2891. *
  2892. * NOTE:
  2893. * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
  2894. * and REF: calibrateCamera returns bad values (zero distortion coefficients, `$$c_x$$` and
  2895. * `$$c_y$$` very far from the image center, and/or large differences between `$$f_x$$` and
  2896. * `$$f_y$$` (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
  2897. * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
  2898. *
  2899. * @sa
  2900. * calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate,
  2901. * undistort
  2902. */
  2903. + (double)calibrateCameraExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics perViewErrors:(Mat*)perViewErrors flags:(int)flags NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:stdDeviationsIntrinsics:stdDeviationsExtrinsics:perViewErrors:flags:));
  2904. /**
  2905. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration
  2906. * pattern.
  2907. *
  2908. * @param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
  2909. * the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
  2910. * vector contains as many elements as the number of pattern views. If the same calibration pattern
  2911. * is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
  2912. * possible to use partially occluded patterns or even different patterns in different views. Then,
  2913. * the vectors will be different. Although the points are 3D, they all lie in the calibration pattern's
  2914. * XY coordinate plane (thus 0 in the Z-coordinate), if the used calibration pattern is a planar rig.
  2915. * In the old interface all the vectors of object points from different views are concatenated
  2916. * together.
  2917. * @param imagePoints In the new interface it is a vector of vectors of the projections of calibration
  2918. * pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
  2919. * objectPoints.size(), and imagePoints[i].size() and objectPoints[i].size() for each i, must be equal,
  2920. * respectively. In the old interface all the vectors of object points from different views are
  2921. * concatenated together.
  2922. * @param imageSize Size of the image used only to initialize the camera intrinsic matrix.
  2923. * @param cameraMatrix Input/output 3x3 floating-point camera intrinsic matrix
  2924. * `$$\cameramatrix{A}$$` . If REF: CALIB_USE_INTRINSIC_GUESS
  2925. * and/or REF: CALIB_FIX_ASPECT_RATIO, REF: CALIB_FIX_PRINCIPAL_POINT or REF: CALIB_FIX_FOCAL_LENGTH
  2926. * are specified, some or all of fx, fy, cx, cy must be initialized before calling the function.
  2927. * @param distCoeffs Input/output vector of distortion coefficients
  2928. * `$$\distcoeffs$$`.
  2929. * @param rvecs Output vector of rotation vectors (REF: Rodrigues ) estimated for each pattern view
  2930. * (e.g. std::vector<cv::Mat>>). That is, each i-th rotation vector together with the corresponding
  2931. * i-th translation vector (see the next output parameter description) brings the calibration pattern
  2932. * from the object coordinate space (in which object points are specified) to the camera coordinate
  2933. * space. In more technical terms, the tuple of the i-th rotation and translation vector performs
  2934. * a change of basis from object coordinate space to camera coordinate space. Due to its duality, this
  2935. * tuple is equivalent to the position of the calibration pattern with respect to the camera coordinate
  2936. * space.
  2937. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter
  2938. * describtion above.
  2939. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic
  2940. * parameters. Order of deviations values:
  2941. * `$$(f_x, f_y, c_x, c_y, k_1, k_2, p_1, p_2, k_3, k_4, k_5, k_6 , s_1, s_2, s_3,
  2942. * s_4, \tau_x, \tau_y)$$` If one of parameters is not estimated, it's deviation is equals to zero.
  2943. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic
  2944. * parameters. Order of deviations values: `$$(R_0, T_0, \dotsc , R_{M - 1}, T_{M - 1})$$` where M is
  2945. * the number of pattern views. `$$R_i, T_i$$` are concatenated 1x3 vectors.
  2946. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  2947. * - REF: CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  2948. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  2949. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  2950. * Note, that if intrinsic parameters are known, there is no need to use this function just to
  2951. * estimate extrinsic parameters. Use REF: solvePnP instead.
  2952. * - REF: CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  2953. * optimization. It stays at the center or at a different location specified when
  2954. * REF: CALIB_USE_INTRINSIC_GUESS is set too.
  2955. * - REF: CALIB_FIX_ASPECT_RATIO The functions consider only fy as a free parameter. The
  2956. * ratio fx/fy stays the same as in the input cameraMatrix . When
  2957. * REF: CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
  2958. * ignored, only their ratio is computed and used further.
  2959. * - REF: CALIB_ZERO_TANGENT_DIST Tangential distortion coefficients `$$(p_1, p_2)$$` are set
  2960. * to zeros and stay zero.
  2961. * - REF: CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global optimization if
  2962. * REF: CALIB_USE_INTRINSIC_GUESS is set.
  2963. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 The corresponding radial distortion
  2964. * coefficient is not changed during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is
  2965. * set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2966. * - REF: CALIB_RATIONAL_MODEL Coefficients k4, k5, and k6 are enabled. To provide the
  2967. * backward compatibility, this extra flag should be explicitly specified to make the
  2968. * calibration function use the rational model and return 8 coefficients or more.
  2969. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  2970. * backward compatibility, this extra flag should be explicitly specified to make the
  2971. * calibration function use the thin prism model and return 12 coefficients or more.
  2972. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  2973. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2974. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2975. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  2976. * backward compatibility, this extra flag should be explicitly specified to make the
  2977. * calibration function use the tilted sensor model and return 14 coefficients.
  2978. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  2979. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  2980. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  2981. *
  2982. * @return the overall RMS re-projection error.
  2983. *
  2984. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  2985. * views. The algorithm is based on CITE: Zhang2000 and CITE: BouguetMCT . The coordinates of 3D object
  2986. * points and their corresponding 2D projections in each view must be specified. That may be achieved
  2987. * by using an object with known geometry and easily detectable feature points. Such an object is
  2988. * called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
  2989. * a calibration rig (see REF: findChessboardCorners). Currently, initialization of intrinsic
  2990. * parameters (when REF: CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
  2991. * patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
  2992. * be used as long as initial cameraMatrix is provided.
  2993. *
  2994. * The algorithm performs the following steps:
  2995. *
  2996. * - Compute the initial intrinsic parameters (the option only available for planar calibration
  2997. * patterns) or read them from the input parameters. The distortion coefficients are all set to
  2998. * zeros initially unless some of CALIB_FIX_K? are specified.
  2999. *
  3000. * - Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
  3001. * done using REF: solvePnP .
  3002. *
  3003. * - Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
  3004. * that is, the total sum of squared distances between the observed feature points imagePoints and
  3005. * the projected (using the current estimates for camera parameters and the poses) object points
  3006. * objectPoints. See REF: projectPoints for details.
  3007. *
  3008. * NOTE:
  3009. * If you use a non-square (i.e. non-N-by-N) grid and REF: findChessboardCorners for calibration,
  3010. * and REF: calibrateCamera returns bad values (zero distortion coefficients, `$$c_x$$` and
  3011. * `$$c_y$$` very far from the image center, and/or large differences between `$$f_x$$` and
  3012. * `$$f_y$$` (ratios of 10:1 or more)), then you are probably using patternSize=cvSize(rows,cols)
  3013. * instead of using patternSize=cvSize(cols,rows) in REF: findChessboardCorners.
  3014. *
  3015. * @sa
  3016. * calibrateCameraRO, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate,
  3017. * undistort
  3018. */
  3019. + (double)calibrateCameraExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics perViewErrors:(Mat*)perViewErrors NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:stdDeviationsIntrinsics:stdDeviationsExtrinsics:perViewErrors:));
  3020. //
  3021. // double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
  3022. //
  3023. + (double)calibrateCamera:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:flags:criteria:));
  3024. + (double)calibrateCamera:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:flags:));
  3025. + (double)calibrateCamera:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs NS_SWIFT_NAME(calibrateCamera(objectPoints:imagePoints:imageSize:cameraMatrix:distCoeffs:rvecs:tvecs:));
  3026. //
  3027. // double cv::calibrateCameraRO(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, int iFixedPoint, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& newObjPoints, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& stdDeviationsObjPoints, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
  3028. //
  3029. /**
  3030. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
  3031. *
  3032. * This function is an extension of #calibrateCamera with the method of releasing object which was
  3033. * proposed in CITE: strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar
  3034. * targets (calibration plates), this method can dramatically improve the precision of the estimated
  3035. * camera parameters. Both the object-releasing method and standard method are supported by this
  3036. * function. Use the parameter **iFixedPoint** for method selection. In the internal implementation,
  3037. * #calibrateCamera is a wrapper for this function.
  3038. *
  3039. * @param objectPoints Vector of vectors of calibration pattern points in the calibration pattern
  3040. * coordinate space. See #calibrateCamera for details. If the method of releasing object to be used,
  3041. * the identical calibration board must be used in each view and it must be fully visible, and all
  3042. * objectPoints[i] must be the same and all points should be roughly close to a plane. **The calibration
  3043. * target has to be rigid, or at least static if the camera (rather than the calibration target) is
  3044. * shifted for grabbing images.**
  3045. * @param imagePoints Vector of vectors of the projections of calibration pattern points. See
  3046. * #calibrateCamera for details.
  3047. * @param imageSize Size of the image used only to initialize the intrinsic camera matrix.
  3048. * @param iFixedPoint The index of the 3D object point in objectPoints[0] to be fixed. It also acts as
  3049. * a switch for calibration method selection. If object-releasing method to be used, pass in the
  3050. * parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will
  3051. * make standard calibration method selected. Usually the top-right corner point of the calibration
  3052. * board grid is recommended to be fixed when object-releasing method being utilized. According to
  3053. * \cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front
  3054. * and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and
  3055. * newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
  3056. * @param cameraMatrix Output 3x3 floating-point camera matrix. See #calibrateCamera for details.
  3057. * @param distCoeffs Output vector of distortion coefficients. See #calibrateCamera for details.
  3058. * @param rvecs Output vector of rotation vectors estimated for each pattern view. See #calibrateCamera
  3059. * for details.
  3060. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  3061. * @param newObjPoints The updated output vector of calibration pattern points. The coordinates might
  3062. * be scaled based on three fixed points. The returned coordinates are accurate only if the above
  3063. * mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter
  3064. * is ignored with standard calibration method.
  3065. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
  3066. * See #calibrateCamera for details.
  3067. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
  3068. * See #calibrateCamera for details.
  3069. * @param stdDeviationsObjPoints Output vector of standard deviations estimated for refined coordinates
  3070. * of calibration pattern points. It has the same size and order as objectPoints[0] vector. This
  3071. * parameter is ignored with standard calibration method.
  3072. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3073. * @param flags Different flags that may be zero or a combination of some predefined values. See
  3074. * #calibrateCamera for details. If the method of releasing object is used, the calibration time may
  3075. * be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially
  3076. * less precise and less stable in some rare cases.
  3077. * @param criteria Termination criteria for the iterative optimization algorithm.
  3078. *
  3079. * @return the overall RMS re-projection error.
  3080. *
  3081. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  3082. * views. The algorithm is based on CITE: Zhang2000, CITE: BouguetMCT and CITE: strobl2011iccv. See
  3083. * #calibrateCamera for other detailed explanations.
  3084. * @sa
  3085. * calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
  3086. */
  3087. + (double)calibrateCameraROExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics stdDeviationsObjPoints:(Mat*)stdDeviationsObjPoints perViewErrors:(Mat*)perViewErrors flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:stdDeviationsIntrinsics:stdDeviationsExtrinsics:stdDeviationsObjPoints:perViewErrors:flags:criteria:));
  3088. /**
  3089. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
  3090. *
  3091. * This function is an extension of #calibrateCamera with the method of releasing object which was
  3092. * proposed in CITE: strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar
  3093. * targets (calibration plates), this method can dramatically improve the precision of the estimated
  3094. * camera parameters. Both the object-releasing method and standard method are supported by this
  3095. * function. Use the parameter **iFixedPoint** for method selection. In the internal implementation,
  3096. * #calibrateCamera is a wrapper for this function.
  3097. *
  3098. * @param objectPoints Vector of vectors of calibration pattern points in the calibration pattern
  3099. * coordinate space. See #calibrateCamera for details. If the method of releasing object to be used,
  3100. * the identical calibration board must be used in each view and it must be fully visible, and all
  3101. * objectPoints[i] must be the same and all points should be roughly close to a plane. **The calibration
  3102. * target has to be rigid, or at least static if the camera (rather than the calibration target) is
  3103. * shifted for grabbing images.**
  3104. * @param imagePoints Vector of vectors of the projections of calibration pattern points. See
  3105. * #calibrateCamera for details.
  3106. * @param imageSize Size of the image used only to initialize the intrinsic camera matrix.
  3107. * @param iFixedPoint The index of the 3D object point in objectPoints[0] to be fixed. It also acts as
  3108. * a switch for calibration method selection. If object-releasing method to be used, pass in the
  3109. * parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will
  3110. * make standard calibration method selected. Usually the top-right corner point of the calibration
  3111. * board grid is recommended to be fixed when object-releasing method being utilized. According to
  3112. * \cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front
  3113. * and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and
  3114. * newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
  3115. * @param cameraMatrix Output 3x3 floating-point camera matrix. See #calibrateCamera for details.
  3116. * @param distCoeffs Output vector of distortion coefficients. See #calibrateCamera for details.
  3117. * @param rvecs Output vector of rotation vectors estimated for each pattern view. See #calibrateCamera
  3118. * for details.
  3119. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  3120. * @param newObjPoints The updated output vector of calibration pattern points. The coordinates might
  3121. * be scaled based on three fixed points. The returned coordinates are accurate only if the above
  3122. * mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter
  3123. * is ignored with standard calibration method.
  3124. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
  3125. * See #calibrateCamera for details.
  3126. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
  3127. * See #calibrateCamera for details.
  3128. * @param stdDeviationsObjPoints Output vector of standard deviations estimated for refined coordinates
  3129. * of calibration pattern points. It has the same size and order as objectPoints[0] vector. This
  3130. * parameter is ignored with standard calibration method.
  3131. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3132. * @param flags Different flags that may be zero or a combination of some predefined values. See
  3133. * #calibrateCamera for details. If the method of releasing object is used, the calibration time may
  3134. * be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially
  3135. * less precise and less stable in some rare cases.
  3136. *
  3137. * @return the overall RMS re-projection error.
  3138. *
  3139. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  3140. * views. The algorithm is based on CITE: Zhang2000, CITE: BouguetMCT and CITE: strobl2011iccv. See
  3141. * #calibrateCamera for other detailed explanations.
  3142. * @sa
  3143. * calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
  3144. */
  3145. + (double)calibrateCameraROExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics stdDeviationsObjPoints:(Mat*)stdDeviationsObjPoints perViewErrors:(Mat*)perViewErrors flags:(int)flags NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:stdDeviationsIntrinsics:stdDeviationsExtrinsics:stdDeviationsObjPoints:perViewErrors:flags:));
  3146. /**
  3147. * Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
  3148. *
  3149. * This function is an extension of #calibrateCamera with the method of releasing object which was
  3150. * proposed in CITE: strobl2011iccv. In many common cases with inaccurate, unmeasured, roughly planar
  3151. * targets (calibration plates), this method can dramatically improve the precision of the estimated
  3152. * camera parameters. Both the object-releasing method and standard method are supported by this
  3153. * function. Use the parameter **iFixedPoint** for method selection. In the internal implementation,
  3154. * #calibrateCamera is a wrapper for this function.
  3155. *
  3156. * @param objectPoints Vector of vectors of calibration pattern points in the calibration pattern
  3157. * coordinate space. See #calibrateCamera for details. If the method of releasing object to be used,
  3158. * the identical calibration board must be used in each view and it must be fully visible, and all
  3159. * objectPoints[i] must be the same and all points should be roughly close to a plane. **The calibration
  3160. * target has to be rigid, or at least static if the camera (rather than the calibration target) is
  3161. * shifted for grabbing images.**
  3162. * @param imagePoints Vector of vectors of the projections of calibration pattern points. See
  3163. * #calibrateCamera for details.
  3164. * @param imageSize Size of the image used only to initialize the intrinsic camera matrix.
  3165. * @param iFixedPoint The index of the 3D object point in objectPoints[0] to be fixed. It also acts as
  3166. * a switch for calibration method selection. If object-releasing method to be used, pass in the
  3167. * parameter in the range of [1, objectPoints[0].size()-2], otherwise a value out of this range will
  3168. * make standard calibration method selected. Usually the top-right corner point of the calibration
  3169. * board grid is recommended to be fixed when object-releasing method being utilized. According to
  3170. * \cite strobl2011iccv, two other points are also fixed. In this implementation, objectPoints[0].front
  3171. * and objectPoints[0].back.z are used. With object-releasing method, accurate rvecs, tvecs and
  3172. * newObjPoints are only possible if coordinates of these three fixed points are accurate enough.
  3173. * @param cameraMatrix Output 3x3 floating-point camera matrix. See #calibrateCamera for details.
  3174. * @param distCoeffs Output vector of distortion coefficients. See #calibrateCamera for details.
  3175. * @param rvecs Output vector of rotation vectors estimated for each pattern view. See #calibrateCamera
  3176. * for details.
  3177. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  3178. * @param newObjPoints The updated output vector of calibration pattern points. The coordinates might
  3179. * be scaled based on three fixed points. The returned coordinates are accurate only if the above
  3180. * mentioned three fixed points are accurate. If not needed, noArray() can be passed in. This parameter
  3181. * is ignored with standard calibration method.
  3182. * @param stdDeviationsIntrinsics Output vector of standard deviations estimated for intrinsic parameters.
  3183. * See #calibrateCamera for details.
  3184. * @param stdDeviationsExtrinsics Output vector of standard deviations estimated for extrinsic parameters.
  3185. * See #calibrateCamera for details.
  3186. * @param stdDeviationsObjPoints Output vector of standard deviations estimated for refined coordinates
  3187. * of calibration pattern points. It has the same size and order as objectPoints[0] vector. This
  3188. * parameter is ignored with standard calibration method.
  3189. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3190. * #calibrateCamera for details. If the method of releasing object is used, the calibration time may
  3191. * be much longer. CALIB_USE_QR or CALIB_USE_LU could be used for faster calibration with potentially
  3192. * less precise and less stable in some rare cases.
  3193. *
  3194. * @return the overall RMS re-projection error.
  3195. *
  3196. * The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
  3197. * views. The algorithm is based on CITE: Zhang2000, CITE: BouguetMCT and CITE: strobl2011iccv. See
  3198. * #calibrateCamera for other detailed explanations.
  3199. * @sa
  3200. * calibrateCamera, findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
  3201. */
  3202. + (double)calibrateCameraROExtended:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints stdDeviationsIntrinsics:(Mat*)stdDeviationsIntrinsics stdDeviationsExtrinsics:(Mat*)stdDeviationsExtrinsics stdDeviationsObjPoints:(Mat*)stdDeviationsObjPoints perViewErrors:(Mat*)perViewErrors NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:stdDeviationsIntrinsics:stdDeviationsExtrinsics:stdDeviationsObjPoints:perViewErrors:));
  3203. //
  3204. // double cv::calibrateCameraRO(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, int iFixedPoint, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& newObjPoints, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
  3205. //
  3206. + (double)calibrateCameraRO:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:flags:criteria:));
  3207. + (double)calibrateCameraRO:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints flags:(int)flags NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:flags:));
  3208. + (double)calibrateCameraRO:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints imageSize:(Size2i*)imageSize iFixedPoint:(int)iFixedPoint cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs newObjPoints:(Mat*)newObjPoints NS_SWIFT_NAME(calibrateCameraRO(objectPoints:imagePoints:imageSize:iFixedPoint:cameraMatrix:distCoeffs:rvecs:tvecs:newObjPoints:));
  3209. //
  3210. // void cv::calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio)
  3211. //
  3212. /**
  3213. * Computes useful camera characteristics from the camera intrinsic matrix.
  3214. *
  3215. * @param cameraMatrix Input camera intrinsic matrix that can be estimated by #calibrateCamera or
  3216. * #stereoCalibrate .
  3217. * @param imageSize Input image size in pixels.
  3218. * @param apertureWidth Physical width in mm of the sensor.
  3219. * @param apertureHeight Physical height in mm of the sensor.
  3220. * @param fovx Output field of view in degrees along the horizontal sensor axis.
  3221. * @param fovy Output field of view in degrees along the vertical sensor axis.
  3222. * @param focalLength Focal length of the lens in mm.
  3223. * @param principalPoint Principal point in mm.
  3224. * @param aspectRatio `$$f_y/f_x$$`
  3225. *
  3226. * The function computes various useful camera characteristics from the previously estimated camera
  3227. * matrix.
  3228. *
  3229. * NOTE:
  3230. * Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
  3231. * the chessboard pitch (it can thus be any value).
  3232. */
  3233. + (void)calibrationMatrixValues:(Mat*)cameraMatrix imageSize:(Size2i*)imageSize apertureWidth:(double)apertureWidth apertureHeight:(double)apertureHeight fovx:(double*)fovx fovy:(double*)fovy focalLength:(double*)focalLength principalPoint:(Point2d*)principalPoint aspectRatio:(double*)aspectRatio NS_SWIFT_NAME(calibrationMatrixValues(cameraMatrix:imageSize:apertureWidth:apertureHeight:fovx:fovy:focalLength:principalPoint:aspectRatio:));
  3234. //
  3235. // double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, vector_Mat& rvecs, vector_Mat& tvecs, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
  3236. //
  3237. /**
  3238. * Calibrates a stereo camera set up. This function finds the intrinsic parameters
  3239. * for each of the two cameras and the extrinsic parameters between the two cameras.
  3240. *
  3241. * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
  3242. * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
  3243. * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
  3244. * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
  3245. * be equal for each i.
  3246. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  3247. * observed by the first camera. The same structure as in REF: calibrateCamera.
  3248. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  3249. * observed by the second camera. The same structure as in REF: calibrateCamera.
  3250. * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
  3251. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  3252. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  3253. * REF: calibrateCamera.
  3254. * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
  3255. * cameraMatrix1.
  3256. * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
  3257. * description for distCoeffs1.
  3258. * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
  3259. * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
  3260. * points given in the first camera's coordinate system to points in the second camera's
  3261. * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
  3262. * from the first camera's coordinate system to the second camera's coordinate system. Due to its
  3263. * duality, this tuple is equivalent to the position of the first camera with respect to the
  3264. * second camera coordinate system.
  3265. * @param T Output translation vector, see description above.
  3266. * @param E Output essential matrix.
  3267. * @param F Output fundamental matrix.
  3268. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  3269. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  3270. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  3271. * description) brings the calibration pattern from the object coordinate space (in which object points are
  3272. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  3273. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  3274. * to camera coordinate space of the first camera of the stereo pair.
  3275. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  3276. * of previous output parameter ( rvecs ).
  3277. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3278. * @param flags Different flags that may be zero or a combination of the following values:
  3279. * - REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
  3280. * matrices are estimated.
  3281. * - REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
  3282. * according to the specified flags. Initial values are provided by the user.
  3283. * - REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
  3284. * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
  3285. * - REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
  3286. * - REF: CALIB_FIX_FOCAL_LENGTH Fix `$$f^{(j)}_x$$` and `$$f^{(j)}_y$$` .
  3287. * - REF: CALIB_FIX_ASPECT_RATIO Optimize `$$f^{(j)}_y$$` . Fix the ratio `$$f^{(j)}_x/f^{(j)}_y$$`
  3288. * .
  3289. * - REF: CALIB_SAME_FOCAL_LENGTH Enforce `$$f^{(0)}_x=f^{(1)}_x$$` and `$$f^{(0)}_y=f^{(1)}_y$$` .
  3290. * - REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
  3291. * zeros and fix there.
  3292. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
  3293. * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
  3294. * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3295. * - REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
  3296. * compatibility, this extra flag should be explicitly specified to make the calibration
  3297. * function use the rational model and return 8 coefficients. If the flag is not set, the
  3298. * function computes and returns only 5 distortion coefficients.
  3299. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  3300. * backward compatibility, this extra flag should be explicitly specified to make the
  3301. * calibration function use the thin prism model and return 12 coefficients. If the flag is not
  3302. * set, the function computes and returns only 5 distortion coefficients.
  3303. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  3304. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3305. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3306. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  3307. * backward compatibility, this extra flag should be explicitly specified to make the
  3308. * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
  3309. * set, the function computes and returns only 5 distortion coefficients.
  3310. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  3311. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3312. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3313. * @param criteria Termination criteria for the iterative optimization algorithm.
  3314. *
  3315. * The function estimates the transformation between two cameras making a stereo pair. If one computes
  3316. * the poses of an object relative to the first camera and to the second camera,
  3317. * ( `$$R_1$$`,`$$T_1$$` ) and (`$$R_2$$`,`$$T_2$$`), respectively, for a stereo camera where the
  3318. * relative position and orientation between the two cameras are fixed, then those poses definitely
  3319. * relate to each other. This means, if the relative position and orientation (`$$R$$`,`$$T$$`) of the
  3320. * two cameras is known, it is possible to compute (`$$R_2$$`,`$$T_2$$`) when (`$$R_1$$`,`$$T_1$$`) is
  3321. * given. This is what the described function does. It computes (`$$R$$`,`$$T$$`) such that:
  3322. *
  3323. * `$$R_2=R R_1$$`
  3324. * `$$T_2=R T_1 + T.$$`
  3325. *
  3326. * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
  3327. * coordinate system when given the point's coordinate representation in the first camera's coordinate
  3328. * system:
  3329. *
  3330. * `$$\begin{bmatrix}
  3331. * X_2 \\
  3332. * Y_2 \\
  3333. * Z_2 \\
  3334. * 1
  3335. * \end{bmatrix} = \begin{bmatrix}
  3336. * R & T \\
  3337. * 0 & 1
  3338. * \end{bmatrix} \begin{bmatrix}
  3339. * X_1 \\
  3340. * Y_1 \\
  3341. * Z_1 \\
  3342. * 1
  3343. * \end{bmatrix}.$$`
  3344. *
  3345. *
  3346. * Optionally, it computes the essential matrix E:
  3347. *
  3348. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R$$`
  3349. *
  3350. * where `$$T_i$$` are components of the translation vector `$$T$$` : `$$T=[T_0, T_1, T_2]^T$$` .
  3351. * And the function can also compute the fundamental matrix F:
  3352. *
  3353. * `$$F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}$$`
  3354. *
  3355. * Besides the stereo-related information, the function can also perform a full calibration of each of
  3356. * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
  3357. * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
  3358. * estimated with high accuracy for each of the cameras individually (for example, using
  3359. * #calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
  3360. * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
  3361. * estimated at once, it makes sense to restrict some parameters, for example, pass
  3362. * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
  3363. * reasonable assumption.
  3364. *
  3365. * Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the
  3366. * points in all the available views from both cameras. The function returns the final value of the
  3367. * re-projection error.
  3368. */
  3369. + (double)stereoCalibrateExtended:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs perViewErrors:(Mat*)perViewErrors flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:rvecs:tvecs:perViewErrors:flags:criteria:));
  3370. /**
  3371. * Calibrates a stereo camera set up. This function finds the intrinsic parameters
  3372. * for each of the two cameras and the extrinsic parameters between the two cameras.
  3373. *
  3374. * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
  3375. * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
  3376. * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
  3377. * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
  3378. * be equal for each i.
  3379. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  3380. * observed by the first camera. The same structure as in REF: calibrateCamera.
  3381. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  3382. * observed by the second camera. The same structure as in REF: calibrateCamera.
  3383. * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
  3384. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  3385. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  3386. * REF: calibrateCamera.
  3387. * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
  3388. * cameraMatrix1.
  3389. * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
  3390. * description for distCoeffs1.
  3391. * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
  3392. * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
  3393. * points given in the first camera's coordinate system to points in the second camera's
  3394. * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
  3395. * from the first camera's coordinate system to the second camera's coordinate system. Due to its
  3396. * duality, this tuple is equivalent to the position of the first camera with respect to the
  3397. * second camera coordinate system.
  3398. * @param T Output translation vector, see description above.
  3399. * @param E Output essential matrix.
  3400. * @param F Output fundamental matrix.
  3401. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  3402. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  3403. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  3404. * description) brings the calibration pattern from the object coordinate space (in which object points are
  3405. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  3406. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  3407. * to camera coordinate space of the first camera of the stereo pair.
  3408. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  3409. * of previous output parameter ( rvecs ).
  3410. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3411. * @param flags Different flags that may be zero or a combination of the following values:
  3412. * - REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
  3413. * matrices are estimated.
  3414. * - REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
  3415. * according to the specified flags. Initial values are provided by the user.
  3416. * - REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
  3417. * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
  3418. * - REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
  3419. * - REF: CALIB_FIX_FOCAL_LENGTH Fix `$$f^{(j)}_x$$` and `$$f^{(j)}_y$$` .
  3420. * - REF: CALIB_FIX_ASPECT_RATIO Optimize `$$f^{(j)}_y$$` . Fix the ratio `$$f^{(j)}_x/f^{(j)}_y$$`
  3421. * .
  3422. * - REF: CALIB_SAME_FOCAL_LENGTH Enforce `$$f^{(0)}_x=f^{(1)}_x$$` and `$$f^{(0)}_y=f^{(1)}_y$$` .
  3423. * - REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
  3424. * zeros and fix there.
  3425. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
  3426. * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
  3427. * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3428. * - REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
  3429. * compatibility, this extra flag should be explicitly specified to make the calibration
  3430. * function use the rational model and return 8 coefficients. If the flag is not set, the
  3431. * function computes and returns only 5 distortion coefficients.
  3432. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  3433. * backward compatibility, this extra flag should be explicitly specified to make the
  3434. * calibration function use the thin prism model and return 12 coefficients. If the flag is not
  3435. * set, the function computes and returns only 5 distortion coefficients.
  3436. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  3437. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3438. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3439. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  3440. * backward compatibility, this extra flag should be explicitly specified to make the
  3441. * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
  3442. * set, the function computes and returns only 5 distortion coefficients.
  3443. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  3444. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3445. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3446. *
  3447. * The function estimates the transformation between two cameras making a stereo pair. If one computes
  3448. * the poses of an object relative to the first camera and to the second camera,
  3449. * ( `$$R_1$$`,`$$T_1$$` ) and (`$$R_2$$`,`$$T_2$$`), respectively, for a stereo camera where the
  3450. * relative position and orientation between the two cameras are fixed, then those poses definitely
  3451. * relate to each other. This means, if the relative position and orientation (`$$R$$`,`$$T$$`) of the
  3452. * two cameras is known, it is possible to compute (`$$R_2$$`,`$$T_2$$`) when (`$$R_1$$`,`$$T_1$$`) is
  3453. * given. This is what the described function does. It computes (`$$R$$`,`$$T$$`) such that:
  3454. *
  3455. * `$$R_2=R R_1$$`
  3456. * `$$T_2=R T_1 + T.$$`
  3457. *
  3458. * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
  3459. * coordinate system when given the point's coordinate representation in the first camera's coordinate
  3460. * system:
  3461. *
  3462. * `$$\begin{bmatrix}
  3463. * X_2 \\
  3464. * Y_2 \\
  3465. * Z_2 \\
  3466. * 1
  3467. * \end{bmatrix} = \begin{bmatrix}
  3468. * R & T \\
  3469. * 0 & 1
  3470. * \end{bmatrix} \begin{bmatrix}
  3471. * X_1 \\
  3472. * Y_1 \\
  3473. * Z_1 \\
  3474. * 1
  3475. * \end{bmatrix}.$$`
  3476. *
  3477. *
  3478. * Optionally, it computes the essential matrix E:
  3479. *
  3480. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R$$`
  3481. *
  3482. * where `$$T_i$$` are components of the translation vector `$$T$$` : `$$T=[T_0, T_1, T_2]^T$$` .
  3483. * And the function can also compute the fundamental matrix F:
  3484. *
  3485. * `$$F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}$$`
  3486. *
  3487. * Besides the stereo-related information, the function can also perform a full calibration of each of
  3488. * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
  3489. * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
  3490. * estimated with high accuracy for each of the cameras individually (for example, using
  3491. * #calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
  3492. * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
  3493. * estimated at once, it makes sense to restrict some parameters, for example, pass
  3494. * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
  3495. * reasonable assumption.
  3496. *
  3497. * Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the
  3498. * points in all the available views from both cameras. The function returns the final value of the
  3499. * re-projection error.
  3500. */
  3501. + (double)stereoCalibrateExtended:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs perViewErrors:(Mat*)perViewErrors flags:(int)flags NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:rvecs:tvecs:perViewErrors:flags:));
  3502. /**
  3503. * Calibrates a stereo camera set up. This function finds the intrinsic parameters
  3504. * for each of the two cameras and the extrinsic parameters between the two cameras.
  3505. *
  3506. * @param objectPoints Vector of vectors of the calibration pattern points. The same structure as
  3507. * in REF: calibrateCamera. For each pattern view, both cameras need to see the same object
  3508. * points. Therefore, objectPoints.size(), imagePoints1.size(), and imagePoints2.size() need to be
  3509. * equal as well as objectPoints[i].size(), imagePoints1[i].size(), and imagePoints2[i].size() need to
  3510. * be equal for each i.
  3511. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  3512. * observed by the first camera. The same structure as in REF: calibrateCamera.
  3513. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  3514. * observed by the second camera. The same structure as in REF: calibrateCamera.
  3515. * @param cameraMatrix1 Input/output camera intrinsic matrix for the first camera, the same as in
  3516. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  3517. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  3518. * REF: calibrateCamera.
  3519. * @param cameraMatrix2 Input/output second camera intrinsic matrix for the second camera. See description for
  3520. * cameraMatrix1.
  3521. * @param distCoeffs2 Input/output lens distortion coefficients for the second camera. See
  3522. * description for distCoeffs1.
  3523. * @param imageSize Size of the image used only to initialize the camera intrinsic matrices.
  3524. * @param R Output rotation matrix. Together with the translation vector T, this matrix brings
  3525. * points given in the first camera's coordinate system to points in the second camera's
  3526. * coordinate system. In more technical terms, the tuple of R and T performs a change of basis
  3527. * from the first camera's coordinate system to the second camera's coordinate system. Due to its
  3528. * duality, this tuple is equivalent to the position of the first camera with respect to the
  3529. * second camera coordinate system.
  3530. * @param T Output translation vector, see description above.
  3531. * @param E Output essential matrix.
  3532. * @param F Output fundamental matrix.
  3533. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  3534. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  3535. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  3536. * description) brings the calibration pattern from the object coordinate space (in which object points are
  3537. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  3538. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  3539. * to camera coordinate space of the first camera of the stereo pair.
  3540. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  3541. * of previous output parameter ( rvecs ).
  3542. * @param perViewErrors Output vector of the RMS re-projection error estimated for each pattern view.
  3543. * - REF: CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E, and F
  3544. * matrices are estimated.
  3545. * - REF: CALIB_USE_INTRINSIC_GUESS Optimize some or all of the intrinsic parameters
  3546. * according to the specified flags. Initial values are provided by the user.
  3547. * - REF: CALIB_USE_EXTRINSIC_GUESS R and T contain valid initial values that are optimized further.
  3548. * Otherwise R and T are initialized to the median value of the pattern views (each dimension separately).
  3549. * - REF: CALIB_FIX_PRINCIPAL_POINT Fix the principal points during the optimization.
  3550. * - REF: CALIB_FIX_FOCAL_LENGTH Fix `$$f^{(j)}_x$$` and `$$f^{(j)}_y$$` .
  3551. * - REF: CALIB_FIX_ASPECT_RATIO Optimize `$$f^{(j)}_y$$` . Fix the ratio `$$f^{(j)}_x/f^{(j)}_y$$`
  3552. * .
  3553. * - REF: CALIB_SAME_FOCAL_LENGTH Enforce `$$f^{(0)}_x=f^{(1)}_x$$` and `$$f^{(0)}_y=f^{(1)}_y$$` .
  3554. * - REF: CALIB_ZERO_TANGENT_DIST Set tangential distortion coefficients for each camera to
  3555. * zeros and fix there.
  3556. * - REF: CALIB_FIX_K1,..., REF: CALIB_FIX_K6 Do not change the corresponding radial
  3557. * distortion coefficient during the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set,
  3558. * the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3559. * - REF: CALIB_RATIONAL_MODEL Enable coefficients k4, k5, and k6. To provide the backward
  3560. * compatibility, this extra flag should be explicitly specified to make the calibration
  3561. * function use the rational model and return 8 coefficients. If the flag is not set, the
  3562. * function computes and returns only 5 distortion coefficients.
  3563. * - REF: CALIB_THIN_PRISM_MODEL Coefficients s1, s2, s3 and s4 are enabled. To provide the
  3564. * backward compatibility, this extra flag should be explicitly specified to make the
  3565. * calibration function use the thin prism model and return 12 coefficients. If the flag is not
  3566. * set, the function computes and returns only 5 distortion coefficients.
  3567. * - REF: CALIB_FIX_S1_S2_S3_S4 The thin prism distortion coefficients are not changed during
  3568. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3569. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3570. * - REF: CALIB_TILTED_MODEL Coefficients tauX and tauY are enabled. To provide the
  3571. * backward compatibility, this extra flag should be explicitly specified to make the
  3572. * calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
  3573. * set, the function computes and returns only 5 distortion coefficients.
  3574. * - REF: CALIB_FIX_TAUX_TAUY The coefficients of the tilted sensor model are not changed during
  3575. * the optimization. If REF: CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
  3576. * supplied distCoeffs matrix is used. Otherwise, it is set to 0.
  3577. *
  3578. * The function estimates the transformation between two cameras making a stereo pair. If one computes
  3579. * the poses of an object relative to the first camera and to the second camera,
  3580. * ( `$$R_1$$`,`$$T_1$$` ) and (`$$R_2$$`,`$$T_2$$`), respectively, for a stereo camera where the
  3581. * relative position and orientation between the two cameras are fixed, then those poses definitely
  3582. * relate to each other. This means, if the relative position and orientation (`$$R$$`,`$$T$$`) of the
  3583. * two cameras is known, it is possible to compute (`$$R_2$$`,`$$T_2$$`) when (`$$R_1$$`,`$$T_1$$`) is
  3584. * given. This is what the described function does. It computes (`$$R$$`,`$$T$$`) such that:
  3585. *
  3586. * `$$R_2=R R_1$$`
  3587. * `$$T_2=R T_1 + T.$$`
  3588. *
  3589. * Therefore, one can compute the coordinate representation of a 3D point for the second camera's
  3590. * coordinate system when given the point's coordinate representation in the first camera's coordinate
  3591. * system:
  3592. *
  3593. * `$$\begin{bmatrix}
  3594. * X_2 \\
  3595. * Y_2 \\
  3596. * Z_2 \\
  3597. * 1
  3598. * \end{bmatrix} = \begin{bmatrix}
  3599. * R & T \\
  3600. * 0 & 1
  3601. * \end{bmatrix} \begin{bmatrix}
  3602. * X_1 \\
  3603. * Y_1 \\
  3604. * Z_1 \\
  3605. * 1
  3606. * \end{bmatrix}.$$`
  3607. *
  3608. *
  3609. * Optionally, it computes the essential matrix E:
  3610. *
  3611. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} R$$`
  3612. *
  3613. * where `$$T_i$$` are components of the translation vector `$$T$$` : `$$T=[T_0, T_1, T_2]^T$$` .
  3614. * And the function can also compute the fundamental matrix F:
  3615. *
  3616. * `$$F = cameraMatrix2^{-T}\cdot E \cdot cameraMatrix1^{-1}$$`
  3617. *
  3618. * Besides the stereo-related information, the function can also perform a full calibration of each of
  3619. * the two cameras. However, due to the high dimensionality of the parameter space and noise in the
  3620. * input data, the function can diverge from the correct solution. If the intrinsic parameters can be
  3621. * estimated with high accuracy for each of the cameras individually (for example, using
  3622. * #calibrateCamera ), you are recommended to do so and then pass REF: CALIB_FIX_INTRINSIC flag to the
  3623. * function along with the computed intrinsic parameters. Otherwise, if all the parameters are
  3624. * estimated at once, it makes sense to restrict some parameters, for example, pass
  3625. * REF: CALIB_SAME_FOCAL_LENGTH and REF: CALIB_ZERO_TANGENT_DIST flags, which is usually a
  3626. * reasonable assumption.
  3627. *
  3628. * Similarly to #calibrateCamera, the function minimizes the total re-projection error for all the
  3629. * points in all the available views from both cameras. The function returns the final value of the
  3630. * re-projection error.
  3631. */
  3632. + (double)stereoCalibrateExtended:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs perViewErrors:(Mat*)perViewErrors NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:rvecs:tvecs:perViewErrors:));
  3633. //
  3634. // double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
  3635. //
  3636. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:flags:criteria:));
  3637. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F flags:(int)flags NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:flags:));
  3638. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:));
  3639. //
  3640. // double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
  3641. //
  3642. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F perViewErrors:(Mat*)perViewErrors flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:perViewErrors:flags:criteria:));
  3643. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F perViewErrors:(Mat*)perViewErrors flags:(int)flags NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:perViewErrors:flags:));
  3644. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T E:(Mat*)E F:(Mat*)F perViewErrors:(Mat*)perViewErrors NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:E:F:perViewErrors:));
  3645. //
  3646. // void cv::stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags = CALIB_ZERO_DISPARITY, double alpha = -1, Size newImageSize = Size(), Rect* validPixROI1 = 0, Rect* validPixROI2 = 0)
  3647. //
  3648. /**
  3649. * Computes rectification transforms for each head of a calibrated stereo camera.
  3650. *
  3651. * @param cameraMatrix1 First camera intrinsic matrix.
  3652. * @param distCoeffs1 First camera distortion parameters.
  3653. * @param cameraMatrix2 Second camera intrinsic matrix.
  3654. * @param distCoeffs2 Second camera distortion parameters.
  3655. * @param imageSize Size of the image used for stereo calibration.
  3656. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  3657. * see REF: stereoCalibrate.
  3658. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  3659. * see REF: stereoCalibrate.
  3660. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  3661. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  3662. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  3663. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  3664. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  3665. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  3666. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  3667. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  3668. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  3669. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3670. * rectified first camera's image.
  3671. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  3672. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3673. * rectified second camera's image.
  3674. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  3675. * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
  3676. * the function makes the principal points of each camera have the same pixel coordinates in the
  3677. * rectified views. And if the flag is not set, the function may still shift the images in the
  3678. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  3679. * useful image area.
  3680. * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
  3681. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  3682. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  3683. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  3684. * pixels from the original images from the cameras are retained in the rectified images (no source
  3685. * image pixels are lost). Any intermediate value yields an intermediate result between
  3686. * those two extreme cases.
  3687. * @param newImageSize New image resolution after rectification. The same size should be passed to
  3688. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  3689. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  3690. * preserve details in the original image, especially when there is a big radial distortion.
  3691. * @param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
  3692. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3693. * (see the picture below).
  3694. * @param validPixROI2 Optional output rectangles inside the rectified images where all the pixels
  3695. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3696. * (see the picture below).
  3697. *
  3698. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  3699. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  3700. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  3701. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  3702. * coordinates. The function distinguishes the following two cases:
  3703. *
  3704. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  3705. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  3706. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  3707. * y-coordinate. P1 and P2 look like:
  3708. *
  3709. * `$$\texttt{P1} = \begin{bmatrix}
  3710. * f & 0 & cx_1 & 0 \\
  3711. * 0 & f & cy & 0 \\
  3712. * 0 & 0 & 1 & 0
  3713. * \end{bmatrix}$$`
  3714. *
  3715. * `$$\texttt{P2} = \begin{bmatrix}
  3716. * f & 0 & cx_2 & T_x \cdot f \\
  3717. * 0 & f & cy & 0 \\
  3718. * 0 & 0 & 1 & 0
  3719. * \end{bmatrix} ,$$`
  3720. *
  3721. * `$$\texttt{Q} = \begin{bmatrix}
  3722. * 1 & 0 & 0 & -cx_1 \\
  3723. * 0 & 1 & 0 & -cy \\
  3724. * 0 & 0 & 0 & f \\
  3725. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  3726. * \end{bmatrix} $$`
  3727. *
  3728. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  3729. * REF: CALIB_ZERO_DISPARITY is set.
  3730. *
  3731. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  3732. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  3733. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  3734. *
  3735. * `$$\texttt{P1} = \begin{bmatrix}
  3736. * f & 0 & cx & 0 \\
  3737. * 0 & f & cy_1 & 0 \\
  3738. * 0 & 0 & 1 & 0
  3739. * \end{bmatrix}$$`
  3740. *
  3741. * `$$\texttt{P2} = \begin{bmatrix}
  3742. * f & 0 & cx & 0 \\
  3743. * 0 & f & cy_2 & T_y \cdot f \\
  3744. * 0 & 0 & 1 & 0
  3745. * \end{bmatrix},$$`
  3746. *
  3747. * `$$\texttt{Q} = \begin{bmatrix}
  3748. * 1 & 0 & 0 & -cx \\
  3749. * 0 & 1 & 0 & -cy_1 \\
  3750. * 0 & 0 & 0 & f \\
  3751. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  3752. * \end{bmatrix} $$`
  3753. *
  3754. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  3755. * REF: CALIB_ZERO_DISPARITY is set.
  3756. *
  3757. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  3758. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  3759. * initialize the rectification map for each camera.
  3760. *
  3761. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  3762. * the corresponding image regions. This means that the images are well rectified, which is what most
  3763. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  3764. * their interiors are all valid pixels.
  3765. *
  3766. * ![image](pics/stereo_undistort.jpg)
  3767. */
  3768. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags alpha:(double)alpha newImageSize:(Size2i*)newImageSize validPixROI1:(Rect2i*)validPixROI1 validPixROI2:(Rect2i*)validPixROI2 NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:flags:alpha:newImageSize:validPixROI1:validPixROI2:));
  3769. /**
  3770. * Computes rectification transforms for each head of a calibrated stereo camera.
  3771. *
  3772. * @param cameraMatrix1 First camera intrinsic matrix.
  3773. * @param distCoeffs1 First camera distortion parameters.
  3774. * @param cameraMatrix2 Second camera intrinsic matrix.
  3775. * @param distCoeffs2 Second camera distortion parameters.
  3776. * @param imageSize Size of the image used for stereo calibration.
  3777. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  3778. * see REF: stereoCalibrate.
  3779. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  3780. * see REF: stereoCalibrate.
  3781. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  3782. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  3783. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  3784. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  3785. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  3786. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  3787. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  3788. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  3789. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  3790. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3791. * rectified first camera's image.
  3792. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  3793. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3794. * rectified second camera's image.
  3795. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  3796. * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
  3797. * the function makes the principal points of each camera have the same pixel coordinates in the
  3798. * rectified views. And if the flag is not set, the function may still shift the images in the
  3799. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  3800. * useful image area.
  3801. * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
  3802. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  3803. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  3804. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  3805. * pixels from the original images from the cameras are retained in the rectified images (no source
  3806. * image pixels are lost). Any intermediate value yields an intermediate result between
  3807. * those two extreme cases.
  3808. * @param newImageSize New image resolution after rectification. The same size should be passed to
  3809. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  3810. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  3811. * preserve details in the original image, especially when there is a big radial distortion.
  3812. * @param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
  3813. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3814. * (see the picture below).
  3815. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3816. * (see the picture below).
  3817. *
  3818. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  3819. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  3820. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  3821. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  3822. * coordinates. The function distinguishes the following two cases:
  3823. *
  3824. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  3825. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  3826. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  3827. * y-coordinate. P1 and P2 look like:
  3828. *
  3829. * `$$\texttt{P1} = \begin{bmatrix}
  3830. * f & 0 & cx_1 & 0 \\
  3831. * 0 & f & cy & 0 \\
  3832. * 0 & 0 & 1 & 0
  3833. * \end{bmatrix}$$`
  3834. *
  3835. * `$$\texttt{P2} = \begin{bmatrix}
  3836. * f & 0 & cx_2 & T_x \cdot f \\
  3837. * 0 & f & cy & 0 \\
  3838. * 0 & 0 & 1 & 0
  3839. * \end{bmatrix} ,$$`
  3840. *
  3841. * `$$\texttt{Q} = \begin{bmatrix}
  3842. * 1 & 0 & 0 & -cx_1 \\
  3843. * 0 & 1 & 0 & -cy \\
  3844. * 0 & 0 & 0 & f \\
  3845. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  3846. * \end{bmatrix} $$`
  3847. *
  3848. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  3849. * REF: CALIB_ZERO_DISPARITY is set.
  3850. *
  3851. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  3852. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  3853. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  3854. *
  3855. * `$$\texttt{P1} = \begin{bmatrix}
  3856. * f & 0 & cx & 0 \\
  3857. * 0 & f & cy_1 & 0 \\
  3858. * 0 & 0 & 1 & 0
  3859. * \end{bmatrix}$$`
  3860. *
  3861. * `$$\texttt{P2} = \begin{bmatrix}
  3862. * f & 0 & cx & 0 \\
  3863. * 0 & f & cy_2 & T_y \cdot f \\
  3864. * 0 & 0 & 1 & 0
  3865. * \end{bmatrix},$$`
  3866. *
  3867. * `$$\texttt{Q} = \begin{bmatrix}
  3868. * 1 & 0 & 0 & -cx \\
  3869. * 0 & 1 & 0 & -cy_1 \\
  3870. * 0 & 0 & 0 & f \\
  3871. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  3872. * \end{bmatrix} $$`
  3873. *
  3874. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  3875. * REF: CALIB_ZERO_DISPARITY is set.
  3876. *
  3877. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  3878. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  3879. * initialize the rectification map for each camera.
  3880. *
  3881. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  3882. * the corresponding image regions. This means that the images are well rectified, which is what most
  3883. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  3884. * their interiors are all valid pixels.
  3885. *
  3886. * ![image](pics/stereo_undistort.jpg)
  3887. */
  3888. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags alpha:(double)alpha newImageSize:(Size2i*)newImageSize validPixROI1:(Rect2i*)validPixROI1 NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:flags:alpha:newImageSize:validPixROI1:));
  3889. /**
  3890. * Computes rectification transforms for each head of a calibrated stereo camera.
  3891. *
  3892. * @param cameraMatrix1 First camera intrinsic matrix.
  3893. * @param distCoeffs1 First camera distortion parameters.
  3894. * @param cameraMatrix2 Second camera intrinsic matrix.
  3895. * @param distCoeffs2 Second camera distortion parameters.
  3896. * @param imageSize Size of the image used for stereo calibration.
  3897. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  3898. * see REF: stereoCalibrate.
  3899. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  3900. * see REF: stereoCalibrate.
  3901. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  3902. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  3903. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  3904. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  3905. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  3906. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  3907. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  3908. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  3909. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  3910. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3911. * rectified first camera's image.
  3912. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  3913. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  3914. * rectified second camera's image.
  3915. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  3916. * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
  3917. * the function makes the principal points of each camera have the same pixel coordinates in the
  3918. * rectified views. And if the flag is not set, the function may still shift the images in the
  3919. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  3920. * useful image area.
  3921. * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
  3922. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  3923. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  3924. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  3925. * pixels from the original images from the cameras are retained in the rectified images (no source
  3926. * image pixels are lost). Any intermediate value yields an intermediate result between
  3927. * those two extreme cases.
  3928. * @param newImageSize New image resolution after rectification. The same size should be passed to
  3929. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  3930. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  3931. * preserve details in the original image, especially when there is a big radial distortion.
  3932. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3933. * (see the picture below).
  3934. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  3935. * (see the picture below).
  3936. *
  3937. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  3938. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  3939. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  3940. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  3941. * coordinates. The function distinguishes the following two cases:
  3942. *
  3943. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  3944. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  3945. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  3946. * y-coordinate. P1 and P2 look like:
  3947. *
  3948. * `$$\texttt{P1} = \begin{bmatrix}
  3949. * f & 0 & cx_1 & 0 \\
  3950. * 0 & f & cy & 0 \\
  3951. * 0 & 0 & 1 & 0
  3952. * \end{bmatrix}$$`
  3953. *
  3954. * `$$\texttt{P2} = \begin{bmatrix}
  3955. * f & 0 & cx_2 & T_x \cdot f \\
  3956. * 0 & f & cy & 0 \\
  3957. * 0 & 0 & 1 & 0
  3958. * \end{bmatrix} ,$$`
  3959. *
  3960. * `$$\texttt{Q} = \begin{bmatrix}
  3961. * 1 & 0 & 0 & -cx_1 \\
  3962. * 0 & 1 & 0 & -cy \\
  3963. * 0 & 0 & 0 & f \\
  3964. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  3965. * \end{bmatrix} $$`
  3966. *
  3967. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  3968. * REF: CALIB_ZERO_DISPARITY is set.
  3969. *
  3970. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  3971. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  3972. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  3973. *
  3974. * `$$\texttt{P1} = \begin{bmatrix}
  3975. * f & 0 & cx & 0 \\
  3976. * 0 & f & cy_1 & 0 \\
  3977. * 0 & 0 & 1 & 0
  3978. * \end{bmatrix}$$`
  3979. *
  3980. * `$$\texttt{P2} = \begin{bmatrix}
  3981. * f & 0 & cx & 0 \\
  3982. * 0 & f & cy_2 & T_y \cdot f \\
  3983. * 0 & 0 & 1 & 0
  3984. * \end{bmatrix},$$`
  3985. *
  3986. * `$$\texttt{Q} = \begin{bmatrix}
  3987. * 1 & 0 & 0 & -cx \\
  3988. * 0 & 1 & 0 & -cy_1 \\
  3989. * 0 & 0 & 0 & f \\
  3990. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  3991. * \end{bmatrix} $$`
  3992. *
  3993. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  3994. * REF: CALIB_ZERO_DISPARITY is set.
  3995. *
  3996. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  3997. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  3998. * initialize the rectification map for each camera.
  3999. *
  4000. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  4001. * the corresponding image regions. This means that the images are well rectified, which is what most
  4002. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  4003. * their interiors are all valid pixels.
  4004. *
  4005. * ![image](pics/stereo_undistort.jpg)
  4006. */
  4007. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags alpha:(double)alpha newImageSize:(Size2i*)newImageSize NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:flags:alpha:newImageSize:));
  4008. /**
  4009. * Computes rectification transforms for each head of a calibrated stereo camera.
  4010. *
  4011. * @param cameraMatrix1 First camera intrinsic matrix.
  4012. * @param distCoeffs1 First camera distortion parameters.
  4013. * @param cameraMatrix2 Second camera intrinsic matrix.
  4014. * @param distCoeffs2 Second camera distortion parameters.
  4015. * @param imageSize Size of the image used for stereo calibration.
  4016. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  4017. * see REF: stereoCalibrate.
  4018. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  4019. * see REF: stereoCalibrate.
  4020. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  4021. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  4022. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  4023. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  4024. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  4025. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  4026. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  4027. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  4028. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  4029. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4030. * rectified first camera's image.
  4031. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  4032. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4033. * rectified second camera's image.
  4034. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  4035. * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
  4036. * the function makes the principal points of each camera have the same pixel coordinates in the
  4037. * rectified views. And if the flag is not set, the function may still shift the images in the
  4038. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  4039. * useful image area.
  4040. * @param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
  4041. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  4042. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  4043. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  4044. * pixels from the original images from the cameras are retained in the rectified images (no source
  4045. * image pixels are lost). Any intermediate value yields an intermediate result between
  4046. * those two extreme cases.
  4047. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  4048. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  4049. * preserve details in the original image, especially when there is a big radial distortion.
  4050. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4051. * (see the picture below).
  4052. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4053. * (see the picture below).
  4054. *
  4055. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  4056. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  4057. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  4058. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  4059. * coordinates. The function distinguishes the following two cases:
  4060. *
  4061. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  4062. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  4063. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  4064. * y-coordinate. P1 and P2 look like:
  4065. *
  4066. * `$$\texttt{P1} = \begin{bmatrix}
  4067. * f & 0 & cx_1 & 0 \\
  4068. * 0 & f & cy & 0 \\
  4069. * 0 & 0 & 1 & 0
  4070. * \end{bmatrix}$$`
  4071. *
  4072. * `$$\texttt{P2} = \begin{bmatrix}
  4073. * f & 0 & cx_2 & T_x \cdot f \\
  4074. * 0 & f & cy & 0 \\
  4075. * 0 & 0 & 1 & 0
  4076. * \end{bmatrix} ,$$`
  4077. *
  4078. * `$$\texttt{Q} = \begin{bmatrix}
  4079. * 1 & 0 & 0 & -cx_1 \\
  4080. * 0 & 1 & 0 & -cy \\
  4081. * 0 & 0 & 0 & f \\
  4082. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  4083. * \end{bmatrix} $$`
  4084. *
  4085. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  4086. * REF: CALIB_ZERO_DISPARITY is set.
  4087. *
  4088. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  4089. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  4090. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  4091. *
  4092. * `$$\texttt{P1} = \begin{bmatrix}
  4093. * f & 0 & cx & 0 \\
  4094. * 0 & f & cy_1 & 0 \\
  4095. * 0 & 0 & 1 & 0
  4096. * \end{bmatrix}$$`
  4097. *
  4098. * `$$\texttt{P2} = \begin{bmatrix}
  4099. * f & 0 & cx & 0 \\
  4100. * 0 & f & cy_2 & T_y \cdot f \\
  4101. * 0 & 0 & 1 & 0
  4102. * \end{bmatrix},$$`
  4103. *
  4104. * `$$\texttt{Q} = \begin{bmatrix}
  4105. * 1 & 0 & 0 & -cx \\
  4106. * 0 & 1 & 0 & -cy_1 \\
  4107. * 0 & 0 & 0 & f \\
  4108. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  4109. * \end{bmatrix} $$`
  4110. *
  4111. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  4112. * REF: CALIB_ZERO_DISPARITY is set.
  4113. *
  4114. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  4115. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  4116. * initialize the rectification map for each camera.
  4117. *
  4118. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  4119. * the corresponding image regions. This means that the images are well rectified, which is what most
  4120. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  4121. * their interiors are all valid pixels.
  4122. *
  4123. * ![image](pics/stereo_undistort.jpg)
  4124. */
  4125. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags alpha:(double)alpha NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:flags:alpha:));
  4126. /**
  4127. * Computes rectification transforms for each head of a calibrated stereo camera.
  4128. *
  4129. * @param cameraMatrix1 First camera intrinsic matrix.
  4130. * @param distCoeffs1 First camera distortion parameters.
  4131. * @param cameraMatrix2 Second camera intrinsic matrix.
  4132. * @param distCoeffs2 Second camera distortion parameters.
  4133. * @param imageSize Size of the image used for stereo calibration.
  4134. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  4135. * see REF: stereoCalibrate.
  4136. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  4137. * see REF: stereoCalibrate.
  4138. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  4139. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  4140. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  4141. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  4142. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  4143. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  4144. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  4145. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  4146. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  4147. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4148. * rectified first camera's image.
  4149. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  4150. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4151. * rectified second camera's image.
  4152. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  4153. * @param flags Operation flags that may be zero or REF: CALIB_ZERO_DISPARITY . If the flag is set,
  4154. * the function makes the principal points of each camera have the same pixel coordinates in the
  4155. * rectified views. And if the flag is not set, the function may still shift the images in the
  4156. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  4157. * useful image area.
  4158. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  4159. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  4160. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  4161. * pixels from the original images from the cameras are retained in the rectified images (no source
  4162. * image pixels are lost). Any intermediate value yields an intermediate result between
  4163. * those two extreme cases.
  4164. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  4165. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  4166. * preserve details in the original image, especially when there is a big radial distortion.
  4167. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4168. * (see the picture below).
  4169. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4170. * (see the picture below).
  4171. *
  4172. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  4173. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  4174. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  4175. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  4176. * coordinates. The function distinguishes the following two cases:
  4177. *
  4178. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  4179. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  4180. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  4181. * y-coordinate. P1 and P2 look like:
  4182. *
  4183. * `$$\texttt{P1} = \begin{bmatrix}
  4184. * f & 0 & cx_1 & 0 \\
  4185. * 0 & f & cy & 0 \\
  4186. * 0 & 0 & 1 & 0
  4187. * \end{bmatrix}$$`
  4188. *
  4189. * `$$\texttt{P2} = \begin{bmatrix}
  4190. * f & 0 & cx_2 & T_x \cdot f \\
  4191. * 0 & f & cy & 0 \\
  4192. * 0 & 0 & 1 & 0
  4193. * \end{bmatrix} ,$$`
  4194. *
  4195. * `$$\texttt{Q} = \begin{bmatrix}
  4196. * 1 & 0 & 0 & -cx_1 \\
  4197. * 0 & 1 & 0 & -cy \\
  4198. * 0 & 0 & 0 & f \\
  4199. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  4200. * \end{bmatrix} $$`
  4201. *
  4202. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  4203. * REF: CALIB_ZERO_DISPARITY is set.
  4204. *
  4205. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  4206. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  4207. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  4208. *
  4209. * `$$\texttt{P1} = \begin{bmatrix}
  4210. * f & 0 & cx & 0 \\
  4211. * 0 & f & cy_1 & 0 \\
  4212. * 0 & 0 & 1 & 0
  4213. * \end{bmatrix}$$`
  4214. *
  4215. * `$$\texttt{P2} = \begin{bmatrix}
  4216. * f & 0 & cx & 0 \\
  4217. * 0 & f & cy_2 & T_y \cdot f \\
  4218. * 0 & 0 & 1 & 0
  4219. * \end{bmatrix},$$`
  4220. *
  4221. * `$$\texttt{Q} = \begin{bmatrix}
  4222. * 1 & 0 & 0 & -cx \\
  4223. * 0 & 1 & 0 & -cy_1 \\
  4224. * 0 & 0 & 0 & f \\
  4225. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  4226. * \end{bmatrix} $$`
  4227. *
  4228. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  4229. * REF: CALIB_ZERO_DISPARITY is set.
  4230. *
  4231. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  4232. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  4233. * initialize the rectification map for each camera.
  4234. *
  4235. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  4236. * the corresponding image regions. This means that the images are well rectified, which is what most
  4237. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  4238. * their interiors are all valid pixels.
  4239. *
  4240. * ![image](pics/stereo_undistort.jpg)
  4241. */
  4242. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:flags:));
  4243. /**
  4244. * Computes rectification transforms for each head of a calibrated stereo camera.
  4245. *
  4246. * @param cameraMatrix1 First camera intrinsic matrix.
  4247. * @param distCoeffs1 First camera distortion parameters.
  4248. * @param cameraMatrix2 Second camera intrinsic matrix.
  4249. * @param distCoeffs2 Second camera distortion parameters.
  4250. * @param imageSize Size of the image used for stereo calibration.
  4251. * @param R Rotation matrix from the coordinate system of the first camera to the second camera,
  4252. * see REF: stereoCalibrate.
  4253. * @param T Translation vector from the coordinate system of the first camera to the second camera,
  4254. * see REF: stereoCalibrate.
  4255. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix
  4256. * brings points given in the unrectified first camera's coordinate system to points in the rectified
  4257. * first camera's coordinate system. In more technical terms, it performs a change of basis from the
  4258. * unrectified first camera's coordinate system to the rectified first camera's coordinate system.
  4259. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix
  4260. * brings points given in the unrectified second camera's coordinate system to points in the rectified
  4261. * second camera's coordinate system. In more technical terms, it performs a change of basis from the
  4262. * unrectified second camera's coordinate system to the rectified second camera's coordinate system.
  4263. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  4264. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4265. * rectified first camera's image.
  4266. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  4267. * camera, i.e. it projects points given in the rectified first camera coordinate system into the
  4268. * rectified second camera's image.
  4269. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see REF: reprojectImageTo3D).
  4270. * the function makes the principal points of each camera have the same pixel coordinates in the
  4271. * rectified views. And if the flag is not set, the function may still shift the images in the
  4272. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  4273. * useful image area.
  4274. * scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
  4275. * images are zoomed and shifted so that only valid pixels are visible (no black areas after
  4276. * rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
  4277. * pixels from the original images from the cameras are retained in the rectified images (no source
  4278. * image pixels are lost). Any intermediate value yields an intermediate result between
  4279. * those two extreme cases.
  4280. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  4281. * is passed (default), it is set to the original imageSize . Setting it to a larger value can help you
  4282. * preserve details in the original image, especially when there is a big radial distortion.
  4283. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4284. * (see the picture below).
  4285. * are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
  4286. * (see the picture below).
  4287. *
  4288. * The function computes the rotation matrices for each camera that (virtually) make both camera image
  4289. * planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
  4290. * the dense stereo correspondence problem. The function takes the matrices computed by #stereoCalibrate
  4291. * as input. As output, it provides two rotation matrices and also two projection matrices in the new
  4292. * coordinates. The function distinguishes the following two cases:
  4293. *
  4294. * - **Horizontal stereo**: the first and the second camera views are shifted relative to each other
  4295. * mainly along the x-axis (with possible small vertical shift). In the rectified images, the
  4296. * corresponding epipolar lines in the left and right cameras are horizontal and have the same
  4297. * y-coordinate. P1 and P2 look like:
  4298. *
  4299. * `$$\texttt{P1} = \begin{bmatrix}
  4300. * f & 0 & cx_1 & 0 \\
  4301. * 0 & f & cy & 0 \\
  4302. * 0 & 0 & 1 & 0
  4303. * \end{bmatrix}$$`
  4304. *
  4305. * `$$\texttt{P2} = \begin{bmatrix}
  4306. * f & 0 & cx_2 & T_x \cdot f \\
  4307. * 0 & f & cy & 0 \\
  4308. * 0 & 0 & 1 & 0
  4309. * \end{bmatrix} ,$$`
  4310. *
  4311. * `$$\texttt{Q} = \begin{bmatrix}
  4312. * 1 & 0 & 0 & -cx_1 \\
  4313. * 0 & 1 & 0 & -cy \\
  4314. * 0 & 0 & 0 & f \\
  4315. * 0 & 0 & -\frac{1}{T_x} & \frac{cx_1 - cx_2}{T_x}
  4316. * \end{bmatrix} $$`
  4317. *
  4318. * where `$$T_x$$` is a horizontal shift between the cameras and `$$cx_1=cx_2$$` if
  4319. * REF: CALIB_ZERO_DISPARITY is set.
  4320. *
  4321. * - **Vertical stereo**: the first and the second camera views are shifted relative to each other
  4322. * mainly in the vertical direction (and probably a bit in the horizontal direction too). The epipolar
  4323. * lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
  4324. *
  4325. * `$$\texttt{P1} = \begin{bmatrix}
  4326. * f & 0 & cx & 0 \\
  4327. * 0 & f & cy_1 & 0 \\
  4328. * 0 & 0 & 1 & 0
  4329. * \end{bmatrix}$$`
  4330. *
  4331. * `$$\texttt{P2} = \begin{bmatrix}
  4332. * f & 0 & cx & 0 \\
  4333. * 0 & f & cy_2 & T_y \cdot f \\
  4334. * 0 & 0 & 1 & 0
  4335. * \end{bmatrix},$$`
  4336. *
  4337. * `$$\texttt{Q} = \begin{bmatrix}
  4338. * 1 & 0 & 0 & -cx \\
  4339. * 0 & 1 & 0 & -cy_1 \\
  4340. * 0 & 0 & 0 & f \\
  4341. * 0 & 0 & -\frac{1}{T_y} & \frac{cy_1 - cy_2}{T_y}
  4342. * \end{bmatrix} $$`
  4343. *
  4344. * where `$$T_y$$` is a vertical shift between the cameras and `$$cy_1=cy_2$$` if
  4345. * REF: CALIB_ZERO_DISPARITY is set.
  4346. *
  4347. * As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
  4348. * matrices. The matrices, together with R1 and R2 , can then be passed to #initUndistortRectifyMap to
  4349. * initialize the rectification map for each camera.
  4350. *
  4351. * See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
  4352. * the corresponding image regions. This means that the images are well rectified, which is what most
  4353. * stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
  4354. * their interiors are all valid pixels.
  4355. *
  4356. * ![image](pics/stereo_undistort.jpg)
  4357. */
  4358. + (void)stereoRectify:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q NS_SWIFT_NAME(stereoRectify(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:imageSize:R:T:R1:R2:P1:P2:Q:));
  4359. //
  4360. // bool cv::stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat& H1, Mat& H2, double threshold = 5)
  4361. //
  4362. /**
  4363. * Computes a rectification transform for an uncalibrated stereo camera.
  4364. *
  4365. * @param points1 Array of feature points in the first image.
  4366. * @param points2 The corresponding points in the second image. The same formats as in
  4367. * #findFundamentalMat are supported.
  4368. * @param F Input fundamental matrix. It can be computed from the same set of point pairs using
  4369. * #findFundamentalMat .
  4370. * @param imgSize Size of the image.
  4371. * @param H1 Output rectification homography matrix for the first image.
  4372. * @param H2 Output rectification homography matrix for the second image.
  4373. * @param threshold Optional threshold used to filter out the outliers. If the parameter is greater
  4374. * than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
  4375. * for which `$$|\texttt{points2[i]}^T \cdot \texttt{F} \cdot \texttt{points1[i]}|>\texttt{threshold}$$` )
  4376. * are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
  4377. *
  4378. * The function computes the rectification transformations without knowing intrinsic parameters of the
  4379. * cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
  4380. * related difference from #stereoRectify is that the function outputs not the rectification
  4381. * transformations in the object (3D) space, but the planar perspective transformations encoded by the
  4382. * homography matrices H1 and H2 . The function implements the algorithm CITE: Hartley99 .
  4383. *
  4384. * NOTE:
  4385. * While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
  4386. * depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
  4387. * it would be better to correct it before computing the fundamental matrix and calling this
  4388. * function. For example, distortion coefficients can be estimated for each head of stereo camera
  4389. * separately by using #calibrateCamera . Then, the images can be corrected using #undistort , or
  4390. * just the point coordinates can be corrected with #undistortPoints .
  4391. */
  4392. + (BOOL)stereoRectifyUncalibrated:(Mat*)points1 points2:(Mat*)points2 F:(Mat*)F imgSize:(Size2i*)imgSize H1:(Mat*)H1 H2:(Mat*)H2 threshold:(double)threshold NS_SWIFT_NAME(stereoRectifyUncalibrated(points1:points2:F:imgSize:H1:H2:threshold:));
  4393. /**
  4394. * Computes a rectification transform for an uncalibrated stereo camera.
  4395. *
  4396. * @param points1 Array of feature points in the first image.
  4397. * @param points2 The corresponding points in the second image. The same formats as in
  4398. * #findFundamentalMat are supported.
  4399. * @param F Input fundamental matrix. It can be computed from the same set of point pairs using
  4400. * #findFundamentalMat .
  4401. * @param imgSize Size of the image.
  4402. * @param H1 Output rectification homography matrix for the first image.
  4403. * @param H2 Output rectification homography matrix for the second image.
  4404. * than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
  4405. * for which `$$|\texttt{points2[i]}^T \cdot \texttt{F} \cdot \texttt{points1[i]}|>\texttt{threshold}$$` )
  4406. * are rejected prior to computing the homographies. Otherwise, all the points are considered inliers.
  4407. *
  4408. * The function computes the rectification transformations without knowing intrinsic parameters of the
  4409. * cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
  4410. * related difference from #stereoRectify is that the function outputs not the rectification
  4411. * transformations in the object (3D) space, but the planar perspective transformations encoded by the
  4412. * homography matrices H1 and H2 . The function implements the algorithm CITE: Hartley99 .
  4413. *
  4414. * NOTE:
  4415. * While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
  4416. * depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
  4417. * it would be better to correct it before computing the fundamental matrix and calling this
  4418. * function. For example, distortion coefficients can be estimated for each head of stereo camera
  4419. * separately by using #calibrateCamera . Then, the images can be corrected using #undistort , or
  4420. * just the point coordinates can be corrected with #undistortPoints .
  4421. */
  4422. + (BOOL)stereoRectifyUncalibrated:(Mat*)points1 points2:(Mat*)points2 F:(Mat*)F imgSize:(Size2i*)imgSize H1:(Mat*)H1 H2:(Mat*)H2 NS_SWIFT_NAME(stereoRectifyUncalibrated(points1:points2:F:imgSize:H1:H2:));
  4423. //
  4424. // float cv::rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, vector_Mat imgpt1, vector_Mat imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q, double alpha, Size newImgSize, Rect* roi1, Rect* roi2, int flags)
  4425. //
  4426. + (float)rectify3Collinear:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 cameraMatrix3:(Mat*)cameraMatrix3 distCoeffs3:(Mat*)distCoeffs3 imgpt1:(NSArray<Mat*>*)imgpt1 imgpt3:(NSArray<Mat*>*)imgpt3 imageSize:(Size2i*)imageSize R12:(Mat*)R12 T12:(Mat*)T12 R13:(Mat*)R13 T13:(Mat*)T13 R1:(Mat*)R1 R2:(Mat*)R2 R3:(Mat*)R3 P1:(Mat*)P1 P2:(Mat*)P2 P3:(Mat*)P3 Q:(Mat*)Q alpha:(double)alpha newImgSize:(Size2i*)newImgSize roi1:(Rect2i*)roi1 roi2:(Rect2i*)roi2 flags:(int)flags NS_SWIFT_NAME(rectify3Collinear(cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:cameraMatrix3:distCoeffs3:imgpt1:imgpt3:imageSize:R12:T12:R13:T13:R1:R2:R3:P1:P2:P3:Q:alpha:newImgSize:roi1:roi2:flags:));
  4427. //
  4428. // Mat cv::getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize = Size(), Rect* validPixROI = 0, bool centerPrincipalPoint = false)
  4429. //
  4430. /**
  4431. * Returns the new camera intrinsic matrix based on the free scaling parameter.
  4432. *
  4433. * @param cameraMatrix Input camera intrinsic matrix.
  4434. * @param distCoeffs Input vector of distortion coefficients
  4435. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  4436. * assumed.
  4437. * @param imageSize Original image size.
  4438. * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
  4439. * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
  4440. * #stereoRectify for details.
  4441. * @param newImgSize Image size after rectification. By default, it is set to imageSize .
  4442. * @param validPixROI Optional output rectangle that outlines all-good-pixels region in the
  4443. * undistorted image. See roi1, roi2 description in #stereoRectify .
  4444. * @param centerPrincipalPoint Optional flag that indicates whether in the new camera intrinsic matrix the
  4445. * principal point should be at the image center or not. By default, the principal point is chosen to
  4446. * best fit a subset of the source image (determined by alpha) to the corrected image.
  4447. * @return new_camera_matrix Output new camera intrinsic matrix.
  4448. *
  4449. * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
  4450. * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
  4451. * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
  4452. * When alpha\>0 , the undistorted result is likely to have some black pixels corresponding to
  4453. * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
  4454. * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
  4455. * #initUndistortRectifyMap to produce the maps for #remap .
  4456. */
  4457. + (Mat*)getOptimalNewCameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imageSize:(Size2i*)imageSize alpha:(double)alpha newImgSize:(Size2i*)newImgSize validPixROI:(Rect2i*)validPixROI centerPrincipalPoint:(BOOL)centerPrincipalPoint NS_SWIFT_NAME(getOptimalNewCameraMatrix(cameraMatrix:distCoeffs:imageSize:alpha:newImgSize:validPixROI:centerPrincipalPoint:));
  4458. /**
  4459. * Returns the new camera intrinsic matrix based on the free scaling parameter.
  4460. *
  4461. * @param cameraMatrix Input camera intrinsic matrix.
  4462. * @param distCoeffs Input vector of distortion coefficients
  4463. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  4464. * assumed.
  4465. * @param imageSize Original image size.
  4466. * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
  4467. * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
  4468. * #stereoRectify for details.
  4469. * @param newImgSize Image size after rectification. By default, it is set to imageSize .
  4470. * @param validPixROI Optional output rectangle that outlines all-good-pixels region in the
  4471. * undistorted image. See roi1, roi2 description in #stereoRectify .
  4472. * principal point should be at the image center or not. By default, the principal point is chosen to
  4473. * best fit a subset of the source image (determined by alpha) to the corrected image.
  4474. * @return new_camera_matrix Output new camera intrinsic matrix.
  4475. *
  4476. * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
  4477. * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
  4478. * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
  4479. * When alpha\>0 , the undistorted result is likely to have some black pixels corresponding to
  4480. * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
  4481. * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
  4482. * #initUndistortRectifyMap to produce the maps for #remap .
  4483. */
  4484. + (Mat*)getOptimalNewCameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imageSize:(Size2i*)imageSize alpha:(double)alpha newImgSize:(Size2i*)newImgSize validPixROI:(Rect2i*)validPixROI NS_SWIFT_NAME(getOptimalNewCameraMatrix(cameraMatrix:distCoeffs:imageSize:alpha:newImgSize:validPixROI:));
  4485. /**
  4486. * Returns the new camera intrinsic matrix based on the free scaling parameter.
  4487. *
  4488. * @param cameraMatrix Input camera intrinsic matrix.
  4489. * @param distCoeffs Input vector of distortion coefficients
  4490. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  4491. * assumed.
  4492. * @param imageSize Original image size.
  4493. * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
  4494. * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
  4495. * #stereoRectify for details.
  4496. * @param newImgSize Image size after rectification. By default, it is set to imageSize .
  4497. * undistorted image. See roi1, roi2 description in #stereoRectify .
  4498. * principal point should be at the image center or not. By default, the principal point is chosen to
  4499. * best fit a subset of the source image (determined by alpha) to the corrected image.
  4500. * @return new_camera_matrix Output new camera intrinsic matrix.
  4501. *
  4502. * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
  4503. * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
  4504. * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
  4505. * When alpha\>0 , the undistorted result is likely to have some black pixels corresponding to
  4506. * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
  4507. * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
  4508. * #initUndistortRectifyMap to produce the maps for #remap .
  4509. */
  4510. + (Mat*)getOptimalNewCameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imageSize:(Size2i*)imageSize alpha:(double)alpha newImgSize:(Size2i*)newImgSize NS_SWIFT_NAME(getOptimalNewCameraMatrix(cameraMatrix:distCoeffs:imageSize:alpha:newImgSize:));
  4511. /**
  4512. * Returns the new camera intrinsic matrix based on the free scaling parameter.
  4513. *
  4514. * @param cameraMatrix Input camera intrinsic matrix.
  4515. * @param distCoeffs Input vector of distortion coefficients
  4516. * `$$\distcoeffs$$`. If the vector is NULL/empty, the zero distortion coefficients are
  4517. * assumed.
  4518. * @param imageSize Original image size.
  4519. * @param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
  4520. * valid) and 1 (when all the source image pixels are retained in the undistorted image). See
  4521. * #stereoRectify for details.
  4522. * undistorted image. See roi1, roi2 description in #stereoRectify .
  4523. * principal point should be at the image center or not. By default, the principal point is chosen to
  4524. * best fit a subset of the source image (determined by alpha) to the corrected image.
  4525. * @return new_camera_matrix Output new camera intrinsic matrix.
  4526. *
  4527. * The function computes and returns the optimal new camera intrinsic matrix based on the free scaling parameter.
  4528. * By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
  4529. * image pixels if there is valuable information in the corners alpha=1 , or get something in between.
  4530. * When alpha\>0 , the undistorted result is likely to have some black pixels corresponding to
  4531. * "virtual" pixels outside of the captured distorted image. The original camera intrinsic matrix, distortion
  4532. * coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to
  4533. * #initUndistortRectifyMap to produce the maps for #remap .
  4534. */
  4535. + (Mat*)getOptimalNewCameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs imageSize:(Size2i*)imageSize alpha:(double)alpha NS_SWIFT_NAME(getOptimalNewCameraMatrix(cameraMatrix:distCoeffs:imageSize:alpha:));
  4536. //
  4537. // void cv::calibrateHandEye(vector_Mat R_gripper2base, vector_Mat t_gripper2base, vector_Mat R_target2cam, vector_Mat t_target2cam, Mat& R_cam2gripper, Mat& t_cam2gripper, HandEyeCalibrationMethod method = CALIB_HAND_EYE_TSAI)
  4538. //
  4539. /**
  4540. * Computes Hand-Eye calibration: `$$_{}^{g}\textrm{T}_c$$`
  4541. *
  4542. * @param R_gripper2base Rotation part extracted from the homogeneous matrix that transforms a point
  4543. * expressed in the gripper frame to the robot base frame (`$$_{}^{b}\textrm{T}_g$$`).
  4544. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4545. * for all the transformations from gripper frame to robot base frame.
  4546. * @param t_gripper2base Translation part extracted from the homogeneous matrix that transforms a point
  4547. * expressed in the gripper frame to the robot base frame (`$$_{}^{b}\textrm{T}_g$$`).
  4548. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4549. * from gripper frame to robot base frame.
  4550. * @param R_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4551. * expressed in the target frame to the camera frame (`$$_{}^{c}\textrm{T}_t$$`).
  4552. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4553. * for all the transformations from calibration target frame to camera frame.
  4554. * @param t_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4555. * expressed in the target frame to the camera frame (`$$_{}^{c}\textrm{T}_t$$`).
  4556. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4557. * from calibration target frame to camera frame.
  4558. * @param R_cam2gripper Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4559. * expressed in the camera frame to the gripper frame (`$$_{}^{g}\textrm{T}_c$$`).
  4560. * @param t_cam2gripper Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  4561. * expressed in the camera frame to the gripper frame (`$$_{}^{g}\textrm{T}_c$$`).
  4562. * @param method One of the implemented Hand-Eye calibration method, see cv::HandEyeCalibrationMethod
  4563. *
  4564. * The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the
  4565. * rotation then the translation (separable solutions) and the following methods are implemented:
  4566. * - R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
  4567. * - F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
  4568. * - R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
  4569. *
  4570. * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
  4571. * with the following implemented methods:
  4572. * - N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
  4573. * - K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
  4574. *
  4575. * The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye")
  4576. * mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand.
  4577. *
  4578. * The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot
  4579. * end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting
  4580. * the suitable transformations to the function, see below.
  4581. *
  4582. * ![](pics/hand-eye_figure.png)
  4583. *
  4584. * The calibration procedure is the following:
  4585. * - a static calibration pattern is used to estimate the transformation between the target frame
  4586. * and the camera frame
  4587. * - the robot gripper is moved in order to acquire several poses
  4588. * - for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
  4589. * instance the robot kinematics
  4590. * `$$
  4591. * \begin{bmatrix}
  4592. * X_b\\
  4593. * Y_b\\
  4594. * Z_b\\
  4595. * 1
  4596. * \end{bmatrix}
  4597. * =
  4598. * \begin{bmatrix}
  4599. * _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\
  4600. * 0_{1 \times 3} & 1
  4601. * \end{bmatrix}
  4602. * \begin{bmatrix}
  4603. * X_g\\
  4604. * Y_g\\
  4605. * Z_g\\
  4606. * 1
  4607. * \end{bmatrix}
  4608. * $$`
  4609. * - for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using
  4610. * for instance a pose estimation method (PnP) from 2D-3D point correspondences
  4611. * `$$
  4612. * \begin{bmatrix}
  4613. * X_c\\
  4614. * Y_c\\
  4615. * Z_c\\
  4616. * 1
  4617. * \end{bmatrix}
  4618. * =
  4619. * \begin{bmatrix}
  4620. * _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\
  4621. * 0_{1 \times 3} & 1
  4622. * \end{bmatrix}
  4623. * \begin{bmatrix}
  4624. * X_t\\
  4625. * Y_t\\
  4626. * Z_t\\
  4627. * 1
  4628. * \end{bmatrix}
  4629. * $$`
  4630. *
  4631. * The Hand-Eye calibration procedure returns the following homogeneous transformation
  4632. * `$$
  4633. * \begin{bmatrix}
  4634. * X_g\\
  4635. * Y_g\\
  4636. * Z_g\\
  4637. * 1
  4638. * \end{bmatrix}
  4639. * =
  4640. * \begin{bmatrix}
  4641. * _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\
  4642. * 0_{1 \times 3} & 1
  4643. * \end{bmatrix}
  4644. * \begin{bmatrix}
  4645. * X_c\\
  4646. * Y_c\\
  4647. * Z_c\\
  4648. * 1
  4649. * \end{bmatrix}
  4650. * $$`
  4651. *
  4652. * This problem is also known as solving the `$$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}$$` equation:
  4653. * - for an eye-in-hand configuration
  4654. * `$$
  4655. * \begin{align*}
  4656. * ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
  4657. * \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
  4658. *
  4659. * (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &=
  4660. * \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
  4661. *
  4662. * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
  4663. * \end{align*}
  4664. * $$`
  4665. *
  4666. * - for an eye-to-hand configuration
  4667. * `$$
  4668. * \begin{align*}
  4669. * ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
  4670. * \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
  4671. *
  4672. * (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &=
  4673. * \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
  4674. *
  4675. * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
  4676. * \end{align*}
  4677. * $$`
  4678. *
  4679. * \note
  4680. * Additional information can be found on this [website](http://campar.in.tum.de/Chair/HandEyeCalibration).
  4681. * \note
  4682. * A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation.
  4683. * So at least 3 different poses are required, but it is strongly recommended to use many more poses.
  4684. */
  4685. + (void)calibrateHandEye:(NSArray<Mat*>*)R_gripper2base t_gripper2base:(NSArray<Mat*>*)t_gripper2base R_target2cam:(NSArray<Mat*>*)R_target2cam t_target2cam:(NSArray<Mat*>*)t_target2cam R_cam2gripper:(Mat*)R_cam2gripper t_cam2gripper:(Mat*)t_cam2gripper method:(HandEyeCalibrationMethod)method NS_SWIFT_NAME(calibrateHandEye(R_gripper2base:t_gripper2base:R_target2cam:t_target2cam:R_cam2gripper:t_cam2gripper:method:));
  4686. /**
  4687. * Computes Hand-Eye calibration: `$$_{}^{g}\textrm{T}_c$$`
  4688. *
  4689. * @param R_gripper2base Rotation part extracted from the homogeneous matrix that transforms a point
  4690. * expressed in the gripper frame to the robot base frame (`$$_{}^{b}\textrm{T}_g$$`).
  4691. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4692. * for all the transformations from gripper frame to robot base frame.
  4693. * @param t_gripper2base Translation part extracted from the homogeneous matrix that transforms a point
  4694. * expressed in the gripper frame to the robot base frame (`$$_{}^{b}\textrm{T}_g$$`).
  4695. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4696. * from gripper frame to robot base frame.
  4697. * @param R_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4698. * expressed in the target frame to the camera frame (`$$_{}^{c}\textrm{T}_t$$`).
  4699. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4700. * for all the transformations from calibration target frame to camera frame.
  4701. * @param t_target2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4702. * expressed in the target frame to the camera frame (`$$_{}^{c}\textrm{T}_t$$`).
  4703. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4704. * from calibration target frame to camera frame.
  4705. * @param R_cam2gripper Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4706. * expressed in the camera frame to the gripper frame (`$$_{}^{g}\textrm{T}_c$$`).
  4707. * @param t_cam2gripper Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  4708. * expressed in the camera frame to the gripper frame (`$$_{}^{g}\textrm{T}_c$$`).
  4709. *
  4710. * The function performs the Hand-Eye calibration using various methods. One approach consists in estimating the
  4711. * rotation then the translation (separable solutions) and the following methods are implemented:
  4712. * - R. Tsai, R. Lenz A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/EyeCalibration \cite Tsai89
  4713. * - F. Park, B. Martin Robot Sensor Calibration: Solving AX = XB on the Euclidean Group \cite Park94
  4714. * - R. Horaud, F. Dornaika Hand-Eye Calibration \cite Horaud95
  4715. *
  4716. * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
  4717. * with the following implemented methods:
  4718. * - N. Andreff, R. Horaud, B. Espiau On-line Hand-Eye Calibration \cite Andreff99
  4719. * - K. Daniilidis Hand-Eye Calibration Using Dual Quaternions \cite Daniilidis98
  4720. *
  4721. * The following picture describes the Hand-Eye calibration problem where the transformation between a camera ("eye")
  4722. * mounted on a robot gripper ("hand") has to be estimated. This configuration is called eye-in-hand.
  4723. *
  4724. * The eye-to-hand configuration consists in a static camera observing a calibration pattern mounted on the robot
  4725. * end-effector. The transformation from the camera to the robot base frame can then be estimated by inputting
  4726. * the suitable transformations to the function, see below.
  4727. *
  4728. * ![](pics/hand-eye_figure.png)
  4729. *
  4730. * The calibration procedure is the following:
  4731. * - a static calibration pattern is used to estimate the transformation between the target frame
  4732. * and the camera frame
  4733. * - the robot gripper is moved in order to acquire several poses
  4734. * - for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
  4735. * instance the robot kinematics
  4736. * `$$
  4737. * \begin{bmatrix}
  4738. * X_b\\
  4739. * Y_b\\
  4740. * Z_b\\
  4741. * 1
  4742. * \end{bmatrix}
  4743. * =
  4744. * \begin{bmatrix}
  4745. * _{}^{b}\textrm{R}_g & _{}^{b}\textrm{t}_g \\
  4746. * 0_{1 \times 3} & 1
  4747. * \end{bmatrix}
  4748. * \begin{bmatrix}
  4749. * X_g\\
  4750. * Y_g\\
  4751. * Z_g\\
  4752. * 1
  4753. * \end{bmatrix}
  4754. * $$`
  4755. * - for each pose, the homogeneous transformation between the calibration target frame and the camera frame is recorded using
  4756. * for instance a pose estimation method (PnP) from 2D-3D point correspondences
  4757. * `$$
  4758. * \begin{bmatrix}
  4759. * X_c\\
  4760. * Y_c\\
  4761. * Z_c\\
  4762. * 1
  4763. * \end{bmatrix}
  4764. * =
  4765. * \begin{bmatrix}
  4766. * _{}^{c}\textrm{R}_t & _{}^{c}\textrm{t}_t \\
  4767. * 0_{1 \times 3} & 1
  4768. * \end{bmatrix}
  4769. * \begin{bmatrix}
  4770. * X_t\\
  4771. * Y_t\\
  4772. * Z_t\\
  4773. * 1
  4774. * \end{bmatrix}
  4775. * $$`
  4776. *
  4777. * The Hand-Eye calibration procedure returns the following homogeneous transformation
  4778. * `$$
  4779. * \begin{bmatrix}
  4780. * X_g\\
  4781. * Y_g\\
  4782. * Z_g\\
  4783. * 1
  4784. * \end{bmatrix}
  4785. * =
  4786. * \begin{bmatrix}
  4787. * _{}^{g}\textrm{R}_c & _{}^{g}\textrm{t}_c \\
  4788. * 0_{1 \times 3} & 1
  4789. * \end{bmatrix}
  4790. * \begin{bmatrix}
  4791. * X_c\\
  4792. * Y_c\\
  4793. * Z_c\\
  4794. * 1
  4795. * \end{bmatrix}
  4796. * $$`
  4797. *
  4798. * This problem is also known as solving the `$$\mathbf{A}\mathbf{X}=\mathbf{X}\mathbf{B}$$` equation:
  4799. * - for an eye-in-hand configuration
  4800. * `$$
  4801. * \begin{align*}
  4802. * ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
  4803. * \hspace{0.1em} ^{b}{\textrm{T}_g}^{(2)} \hspace{0.2em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
  4804. *
  4805. * (^{b}{\textrm{T}_g}^{(2)})^{-1} \hspace{0.2em} ^{b}{\textrm{T}_g}^{(1)} \hspace{0.2em} ^{g}\textrm{T}_c &=
  4806. * \hspace{0.1em} ^{g}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
  4807. *
  4808. * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
  4809. * \end{align*}
  4810. * $$`
  4811. *
  4812. * - for an eye-to-hand configuration
  4813. * `$$
  4814. * \begin{align*}
  4815. * ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(1)} &=
  4816. * \hspace{0.1em} ^{g}{\textrm{T}_b}^{(2)} \hspace{0.2em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} \\
  4817. *
  4818. * (^{g}{\textrm{T}_b}^{(2)})^{-1} \hspace{0.2em} ^{g}{\textrm{T}_b}^{(1)} \hspace{0.2em} ^{b}\textrm{T}_c &=
  4819. * \hspace{0.1em} ^{b}\textrm{T}_c \hspace{0.2em} ^{c}{\textrm{T}_t}^{(2)} (^{c}{\textrm{T}_t}^{(1)})^{-1} \\
  4820. *
  4821. * \textrm{A}_i \textrm{X} &= \textrm{X} \textrm{B}_i \\
  4822. * \end{align*}
  4823. * $$`
  4824. *
  4825. * \note
  4826. * Additional information can be found on this [website](http://campar.in.tum.de/Chair/HandEyeCalibration).
  4827. * \note
  4828. * A minimum of 2 motions with non parallel rotation axes are necessary to determine the hand-eye transformation.
  4829. * So at least 3 different poses are required, but it is strongly recommended to use many more poses.
  4830. */
  4831. + (void)calibrateHandEye:(NSArray<Mat*>*)R_gripper2base t_gripper2base:(NSArray<Mat*>*)t_gripper2base R_target2cam:(NSArray<Mat*>*)R_target2cam t_target2cam:(NSArray<Mat*>*)t_target2cam R_cam2gripper:(Mat*)R_cam2gripper t_cam2gripper:(Mat*)t_cam2gripper NS_SWIFT_NAME(calibrateHandEye(R_gripper2base:t_gripper2base:R_target2cam:t_target2cam:R_cam2gripper:t_cam2gripper:));
  4832. //
  4833. // void cv::calibrateRobotWorldHandEye(vector_Mat R_world2cam, vector_Mat t_world2cam, vector_Mat R_base2gripper, vector_Mat t_base2gripper, Mat& R_base2world, Mat& t_base2world, Mat& R_gripper2cam, Mat& t_gripper2cam, RobotWorldHandEyeCalibrationMethod method = CALIB_ROBOT_WORLD_HAND_EYE_SHAH)
  4834. //
  4835. /**
  4836. * Computes Robot-World/Hand-Eye calibration: `$$_{}^{w}\textrm{T}_b$$` and `$$_{}^{c}\textrm{T}_g$$`
  4837. *
  4838. * @param R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4839. * expressed in the world frame to the camera frame (`$$_{}^{c}\textrm{T}_w$$`).
  4840. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4841. * for all the transformations from world frame to the camera frame.
  4842. * @param t_world2cam Translation part extracted from the homogeneous matrix that transforms a point
  4843. * expressed in the world frame to the camera frame (`$$_{}^{c}\textrm{T}_w$$`).
  4844. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4845. * from world frame to the camera frame.
  4846. * @param R_base2gripper Rotation part extracted from the homogeneous matrix that transforms a point
  4847. * expressed in the robot base frame to the gripper frame (`$$_{}^{g}\textrm{T}_b$$`).
  4848. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4849. * for all the transformations from robot base frame to the gripper frame.
  4850. * @param t_base2gripper Rotation part extracted from the homogeneous matrix that transforms a point
  4851. * expressed in the robot base frame to the gripper frame (`$$_{}^{g}\textrm{T}_b$$`).
  4852. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4853. * from robot base frame to the gripper frame.
  4854. * @param R_base2world Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4855. * expressed in the robot base frame to the world frame (`$$_{}^{w}\textrm{T}_b$$`).
  4856. * @param t_base2world Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  4857. * expressed in the robot base frame to the world frame (`$$_{}^{w}\textrm{T}_b$$`).
  4858. * @param R_gripper2cam Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4859. * expressed in the gripper frame to the camera frame (`$$_{}^{c}\textrm{T}_g$$`).
  4860. * @param t_gripper2cam Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  4861. * expressed in the gripper frame to the camera frame (`$$_{}^{c}\textrm{T}_g$$`).
  4862. * @param method One of the implemented Robot-World/Hand-Eye calibration method, see cv::RobotWorldHandEyeCalibrationMethod
  4863. *
  4864. * The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the
  4865. * rotation then the translation (separable solutions):
  4866. * - M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
  4867. *
  4868. * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
  4869. * with the following implemented method:
  4870. * - A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA
  4871. *
  4872. * The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame
  4873. * and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated.
  4874. *
  4875. * ![](pics/robot-world_hand-eye_figure.png)
  4876. *
  4877. * The calibration procedure is the following:
  4878. * - a static calibration pattern is used to estimate the transformation between the target frame
  4879. * and the camera frame
  4880. * - the robot gripper is moved in order to acquire several poses
  4881. * - for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
  4882. * instance the robot kinematics
  4883. * `$$
  4884. * \begin{bmatrix}
  4885. * X_g\\
  4886. * Y_g\\
  4887. * Z_g\\
  4888. * 1
  4889. * \end{bmatrix}
  4890. * =
  4891. * \begin{bmatrix}
  4892. * _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\
  4893. * 0_{1 \times 3} & 1
  4894. * \end{bmatrix}
  4895. * \begin{bmatrix}
  4896. * X_b\\
  4897. * Y_b\\
  4898. * Z_b\\
  4899. * 1
  4900. * \end{bmatrix}
  4901. * $$`
  4902. * - for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using
  4903. * for instance a pose estimation method (PnP) from 2D-3D point correspondences
  4904. * `$$
  4905. * \begin{bmatrix}
  4906. * X_c\\
  4907. * Y_c\\
  4908. * Z_c\\
  4909. * 1
  4910. * \end{bmatrix}
  4911. * =
  4912. * \begin{bmatrix}
  4913. * _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\
  4914. * 0_{1 \times 3} & 1
  4915. * \end{bmatrix}
  4916. * \begin{bmatrix}
  4917. * X_w\\
  4918. * Y_w\\
  4919. * Z_w\\
  4920. * 1
  4921. * \end{bmatrix}
  4922. * $$`
  4923. *
  4924. * The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations
  4925. * `$$
  4926. * \begin{bmatrix}
  4927. * X_w\\
  4928. * Y_w\\
  4929. * Z_w\\
  4930. * 1
  4931. * \end{bmatrix}
  4932. * =
  4933. * \begin{bmatrix}
  4934. * _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\
  4935. * 0_{1 \times 3} & 1
  4936. * \end{bmatrix}
  4937. * \begin{bmatrix}
  4938. * X_b\\
  4939. * Y_b\\
  4940. * Z_b\\
  4941. * 1
  4942. * \end{bmatrix}
  4943. * $$`
  4944. * `$$
  4945. * \begin{bmatrix}
  4946. * X_c\\
  4947. * Y_c\\
  4948. * Z_c\\
  4949. * 1
  4950. * \end{bmatrix}
  4951. * =
  4952. * \begin{bmatrix}
  4953. * _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\
  4954. * 0_{1 \times 3} & 1
  4955. * \end{bmatrix}
  4956. * \begin{bmatrix}
  4957. * X_g\\
  4958. * Y_g\\
  4959. * Z_g\\
  4960. * 1
  4961. * \end{bmatrix}
  4962. * $$`
  4963. *
  4964. * This problem is also known as solving the `$$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}$$` equation, with:
  4965. * - `$$\mathbf{A} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_w$$`
  4966. * - `$$\mathbf{X} \Leftrightarrow \hspace{0.1em} _{}^{w}\textrm{T}_b$$`
  4967. * - `$$\mathbf{Z} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_g$$`
  4968. * - `$$\mathbf{B} \Leftrightarrow \hspace{0.1em} _{}^{g}\textrm{T}_b$$`
  4969. *
  4970. * \note
  4971. * At least 3 measurements are required (input vectors size must be greater or equal to 3).
  4972. */
  4973. + (void)calibrateRobotWorldHandEye:(NSArray<Mat*>*)R_world2cam t_world2cam:(NSArray<Mat*>*)t_world2cam R_base2gripper:(NSArray<Mat*>*)R_base2gripper t_base2gripper:(NSArray<Mat*>*)t_base2gripper R_base2world:(Mat*)R_base2world t_base2world:(Mat*)t_base2world R_gripper2cam:(Mat*)R_gripper2cam t_gripper2cam:(Mat*)t_gripper2cam method:(RobotWorldHandEyeCalibrationMethod)method NS_SWIFT_NAME(calibrateRobotWorldHandEye(R_world2cam:t_world2cam:R_base2gripper:t_base2gripper:R_base2world:t_base2world:R_gripper2cam:t_gripper2cam:method:));
  4974. /**
  4975. * Computes Robot-World/Hand-Eye calibration: `$$_{}^{w}\textrm{T}_b$$` and `$$_{}^{c}\textrm{T}_g$$`
  4976. *
  4977. * @param R_world2cam Rotation part extracted from the homogeneous matrix that transforms a point
  4978. * expressed in the world frame to the camera frame (`$$_{}^{c}\textrm{T}_w$$`).
  4979. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4980. * for all the transformations from world frame to the camera frame.
  4981. * @param t_world2cam Translation part extracted from the homogeneous matrix that transforms a point
  4982. * expressed in the world frame to the camera frame (`$$_{}^{c}\textrm{T}_w$$`).
  4983. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4984. * from world frame to the camera frame.
  4985. * @param R_base2gripper Rotation part extracted from the homogeneous matrix that transforms a point
  4986. * expressed in the robot base frame to the gripper frame (`$$_{}^{g}\textrm{T}_b$$`).
  4987. * This is a vector (`vector<Mat>`) that contains the rotation, `(3x3)` rotation matrices or `(3x1)` rotation vectors,
  4988. * for all the transformations from robot base frame to the gripper frame.
  4989. * @param t_base2gripper Rotation part extracted from the homogeneous matrix that transforms a point
  4990. * expressed in the robot base frame to the gripper frame (`$$_{}^{g}\textrm{T}_b$$`).
  4991. * This is a vector (`vector<Mat>`) that contains the `(3x1)` translation vectors for all the transformations
  4992. * from robot base frame to the gripper frame.
  4993. * @param R_base2world Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4994. * expressed in the robot base frame to the world frame (`$$_{}^{w}\textrm{T}_b$$`).
  4995. * @param t_base2world Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  4996. * expressed in the robot base frame to the world frame (`$$_{}^{w}\textrm{T}_b$$`).
  4997. * @param R_gripper2cam Estimated `(3x3)` rotation part extracted from the homogeneous matrix that transforms a point
  4998. * expressed in the gripper frame to the camera frame (`$$_{}^{c}\textrm{T}_g$$`).
  4999. * @param t_gripper2cam Estimated `(3x1)` translation part extracted from the homogeneous matrix that transforms a point
  5000. * expressed in the gripper frame to the camera frame (`$$_{}^{c}\textrm{T}_g$$`).
  5001. *
  5002. * The function performs the Robot-World/Hand-Eye calibration using various methods. One approach consists in estimating the
  5003. * rotation then the translation (separable solutions):
  5004. * - M. Shah, Solving the robot-world/hand-eye calibration problem using the kronecker product \cite Shah2013SolvingTR
  5005. *
  5006. * Another approach consists in estimating simultaneously the rotation and the translation (simultaneous solutions),
  5007. * with the following implemented method:
  5008. * - A. Li, L. Wang, and D. Wu, Simultaneous robot-world and hand-eye calibration using dual-quaternions and kronecker product \cite Li2010SimultaneousRA
  5009. *
  5010. * The following picture describes the Robot-World/Hand-Eye calibration problem where the transformations between a robot and a world frame
  5011. * and between a robot gripper ("hand") and a camera ("eye") mounted at the robot end-effector have to be estimated.
  5012. *
  5013. * ![](pics/robot-world_hand-eye_figure.png)
  5014. *
  5015. * The calibration procedure is the following:
  5016. * - a static calibration pattern is used to estimate the transformation between the target frame
  5017. * and the camera frame
  5018. * - the robot gripper is moved in order to acquire several poses
  5019. * - for each pose, the homogeneous transformation between the gripper frame and the robot base frame is recorded using for
  5020. * instance the robot kinematics
  5021. * `$$
  5022. * \begin{bmatrix}
  5023. * X_g\\
  5024. * Y_g\\
  5025. * Z_g\\
  5026. * 1
  5027. * \end{bmatrix}
  5028. * =
  5029. * \begin{bmatrix}
  5030. * _{}^{g}\textrm{R}_b & _{}^{g}\textrm{t}_b \\
  5031. * 0_{1 \times 3} & 1
  5032. * \end{bmatrix}
  5033. * \begin{bmatrix}
  5034. * X_b\\
  5035. * Y_b\\
  5036. * Z_b\\
  5037. * 1
  5038. * \end{bmatrix}
  5039. * $$`
  5040. * - for each pose, the homogeneous transformation between the calibration target frame (the world frame) and the camera frame is recorded using
  5041. * for instance a pose estimation method (PnP) from 2D-3D point correspondences
  5042. * `$$
  5043. * \begin{bmatrix}
  5044. * X_c\\
  5045. * Y_c\\
  5046. * Z_c\\
  5047. * 1
  5048. * \end{bmatrix}
  5049. * =
  5050. * \begin{bmatrix}
  5051. * _{}^{c}\textrm{R}_w & _{}^{c}\textrm{t}_w \\
  5052. * 0_{1 \times 3} & 1
  5053. * \end{bmatrix}
  5054. * \begin{bmatrix}
  5055. * X_w\\
  5056. * Y_w\\
  5057. * Z_w\\
  5058. * 1
  5059. * \end{bmatrix}
  5060. * $$`
  5061. *
  5062. * The Robot-World/Hand-Eye calibration procedure returns the following homogeneous transformations
  5063. * `$$
  5064. * \begin{bmatrix}
  5065. * X_w\\
  5066. * Y_w\\
  5067. * Z_w\\
  5068. * 1
  5069. * \end{bmatrix}
  5070. * =
  5071. * \begin{bmatrix}
  5072. * _{}^{w}\textrm{R}_b & _{}^{w}\textrm{t}_b \\
  5073. * 0_{1 \times 3} & 1
  5074. * \end{bmatrix}
  5075. * \begin{bmatrix}
  5076. * X_b\\
  5077. * Y_b\\
  5078. * Z_b\\
  5079. * 1
  5080. * \end{bmatrix}
  5081. * $$`
  5082. * `$$
  5083. * \begin{bmatrix}
  5084. * X_c\\
  5085. * Y_c\\
  5086. * Z_c\\
  5087. * 1
  5088. * \end{bmatrix}
  5089. * =
  5090. * \begin{bmatrix}
  5091. * _{}^{c}\textrm{R}_g & _{}^{c}\textrm{t}_g \\
  5092. * 0_{1 \times 3} & 1
  5093. * \end{bmatrix}
  5094. * \begin{bmatrix}
  5095. * X_g\\
  5096. * Y_g\\
  5097. * Z_g\\
  5098. * 1
  5099. * \end{bmatrix}
  5100. * $$`
  5101. *
  5102. * This problem is also known as solving the `$$\mathbf{A}\mathbf{X}=\mathbf{Z}\mathbf{B}$$` equation, with:
  5103. * - `$$\mathbf{A} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_w$$`
  5104. * - `$$\mathbf{X} \Leftrightarrow \hspace{0.1em} _{}^{w}\textrm{T}_b$$`
  5105. * - `$$\mathbf{Z} \Leftrightarrow \hspace{0.1em} _{}^{c}\textrm{T}_g$$`
  5106. * - `$$\mathbf{B} \Leftrightarrow \hspace{0.1em} _{}^{g}\textrm{T}_b$$`
  5107. *
  5108. * \note
  5109. * At least 3 measurements are required (input vectors size must be greater or equal to 3).
  5110. */
  5111. + (void)calibrateRobotWorldHandEye:(NSArray<Mat*>*)R_world2cam t_world2cam:(NSArray<Mat*>*)t_world2cam R_base2gripper:(NSArray<Mat*>*)R_base2gripper t_base2gripper:(NSArray<Mat*>*)t_base2gripper R_base2world:(Mat*)R_base2world t_base2world:(Mat*)t_base2world R_gripper2cam:(Mat*)R_gripper2cam t_gripper2cam:(Mat*)t_gripper2cam NS_SWIFT_NAME(calibrateRobotWorldHandEye(R_world2cam:t_world2cam:R_base2gripper:t_base2gripper:R_base2world:t_base2world:R_gripper2cam:t_gripper2cam:));
  5112. //
  5113. // void cv::convertPointsToHomogeneous(Mat src, Mat& dst)
  5114. //
  5115. /**
  5116. * Converts points from Euclidean to homogeneous space.
  5117. *
  5118. * @param src Input vector of N-dimensional points.
  5119. * @param dst Output vector of N+1-dimensional points.
  5120. *
  5121. * The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of
  5122. * point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
  5123. */
  5124. + (void)convertPointsToHomogeneous:(Mat*)src dst:(Mat*)dst NS_SWIFT_NAME(convertPointsToHomogeneous(src:dst:));
  5125. //
  5126. // void cv::convertPointsFromHomogeneous(Mat src, Mat& dst)
  5127. //
  5128. /**
  5129. * Converts points from homogeneous to Euclidean space.
  5130. *
  5131. * @param src Input vector of N-dimensional points.
  5132. * @param dst Output vector of N-1-dimensional points.
  5133. *
  5134. * The function converts points homogeneous to Euclidean space using perspective projection. That is,
  5135. * each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the
  5136. * output point coordinates will be (0,0,0,...).
  5137. */
  5138. + (void)convertPointsFromHomogeneous:(Mat*)src dst:(Mat*)dst NS_SWIFT_NAME(convertPointsFromHomogeneous(src:dst:));
  5139. //
  5140. // Mat cv::findFundamentalMat(Mat points1, Mat points2, int method, double ransacReprojThreshold, double confidence, int maxIters, Mat& mask = Mat())
  5141. //
  5142. /**
  5143. * Calculates a fundamental matrix from the corresponding points in two images.
  5144. *
  5145. * @param points1 Array of N points from the first image. The point coordinates should be
  5146. * floating-point (single or double precision).
  5147. * @param points2 Array of the second image points of the same size and format as points1 .
  5148. * @param method Method for computing a fundamental matrix.
  5149. * - REF: FM_7POINT for a 7-point algorithm. `$$N = 7$$`
  5150. * - REF: FM_8POINT for an 8-point algorithm. `$$N \ge 8$$`
  5151. * - REF: FM_RANSAC for the RANSAC algorithm. `$$N \ge 8$$`
  5152. * - REF: FM_LMEDS for the LMedS algorithm. `$$N \ge 8$$`
  5153. * @param ransacReprojThreshold Parameter used only for RANSAC. It is the maximum distance from a point to an epipolar
  5154. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5155. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5156. * point localization, image resolution, and the image noise.
  5157. * @param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
  5158. * of confidence (probability) that the estimated matrix is correct.
  5159. * @param mask optional output mask
  5160. * @param maxIters The maximum number of robust method iterations.
  5161. *
  5162. * The epipolar geometry is described by the following equation:
  5163. *
  5164. * `$$[p_2; 1]^T F [p_1; 1] = 0$$`
  5165. *
  5166. * where `$$F$$` is a fundamental matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5167. * second images, respectively.
  5168. *
  5169. * The function calculates the fundamental matrix using one of four methods listed above and returns
  5170. * the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
  5171. * algorithm, the function may return up to 3 solutions ( `$$9 \times 3$$` matrix that stores all 3
  5172. * matrices sequentially).
  5173. *
  5174. * The calculated fundamental matrix may be passed further to #computeCorrespondEpilines that finds the
  5175. * epipolar lines corresponding to the specified points. It can also be passed to
  5176. * #stereoRectifyUncalibrated to compute the rectification transformation. :
  5177. *
  5178. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  5179. * int point_count = 100;
  5180. * vector<Point2f> points1(point_count);
  5181. * vector<Point2f> points2(point_count);
  5182. *
  5183. * // initialize the points here ...
  5184. * for( int i = 0; i < point_count; i++ )
  5185. * {
  5186. * points1[i] = ...;
  5187. * points2[i] = ...;
  5188. * }
  5189. *
  5190. * Mat fundamental_matrix =
  5191. * findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
  5192. *
  5193. */
  5194. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold confidence:(double)confidence maxIters:(int)maxIters mask:(Mat*)mask NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:ransacReprojThreshold:confidence:maxIters:mask:));
  5195. /**
  5196. * Calculates a fundamental matrix from the corresponding points in two images.
  5197. *
  5198. * @param points1 Array of N points from the first image. The point coordinates should be
  5199. * floating-point (single or double precision).
  5200. * @param points2 Array of the second image points of the same size and format as points1 .
  5201. * @param method Method for computing a fundamental matrix.
  5202. * - REF: FM_7POINT for a 7-point algorithm. `$$N = 7$$`
  5203. * - REF: FM_8POINT for an 8-point algorithm. `$$N \ge 8$$`
  5204. * - REF: FM_RANSAC for the RANSAC algorithm. `$$N \ge 8$$`
  5205. * - REF: FM_LMEDS for the LMedS algorithm. `$$N \ge 8$$`
  5206. * @param ransacReprojThreshold Parameter used only for RANSAC. It is the maximum distance from a point to an epipolar
  5207. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5208. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5209. * point localization, image resolution, and the image noise.
  5210. * @param confidence Parameter used for the RANSAC and LMedS methods only. It specifies a desirable level
  5211. * of confidence (probability) that the estimated matrix is correct.
  5212. * @param maxIters The maximum number of robust method iterations.
  5213. *
  5214. * The epipolar geometry is described by the following equation:
  5215. *
  5216. * `$$[p_2; 1]^T F [p_1; 1] = 0$$`
  5217. *
  5218. * where `$$F$$` is a fundamental matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5219. * second images, respectively.
  5220. *
  5221. * The function calculates the fundamental matrix using one of four methods listed above and returns
  5222. * the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
  5223. * algorithm, the function may return up to 3 solutions ( `$$9 \times 3$$` matrix that stores all 3
  5224. * matrices sequentially).
  5225. *
  5226. * The calculated fundamental matrix may be passed further to #computeCorrespondEpilines that finds the
  5227. * epipolar lines corresponding to the specified points. It can also be passed to
  5228. * #stereoRectifyUncalibrated to compute the rectification transformation. :
  5229. *
  5230. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  5231. * int point_count = 100;
  5232. * vector<Point2f> points1(point_count);
  5233. * vector<Point2f> points2(point_count);
  5234. *
  5235. * // initialize the points here ...
  5236. * for( int i = 0; i < point_count; i++ )
  5237. * {
  5238. * points1[i] = ...;
  5239. * points2[i] = ...;
  5240. * }
  5241. *
  5242. * Mat fundamental_matrix =
  5243. * findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
  5244. *
  5245. */
  5246. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold confidence:(double)confidence maxIters:(int)maxIters NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:ransacReprojThreshold:confidence:maxIters:));
  5247. //
  5248. // Mat cv::findFundamentalMat(Mat points1, Mat points2, int method = FM_RANSAC, double ransacReprojThreshold = 3., double confidence = 0.99, Mat& mask = Mat())
  5249. //
  5250. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold confidence:(double)confidence mask:(Mat*)mask NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:ransacReprojThreshold:confidence:mask:));
  5251. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold confidence:(double)confidence NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:ransacReprojThreshold:confidence:));
  5252. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:ransacReprojThreshold:));
  5253. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 method:(int)method NS_SWIFT_NAME(findFundamentalMat(points1:points2:method:));
  5254. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 NS_SWIFT_NAME(findFundamentalMat(points1:points2:));
  5255. //
  5256. // Mat cv::findFundamentalMat(Mat points1, Mat points2, Mat& mask, UsacParams params)
  5257. //
  5258. + (Mat*)findFundamentalMat:(Mat*)points1 points2:(Mat*)points2 mask:(Mat*)mask params:(UsacParams*)params NS_SWIFT_NAME(findFundamentalMat(points1:points2:mask:params:));
  5259. //
  5260. // Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method = RANSAC, double prob = 0.999, double threshold = 1.0, int maxIters = 1000, Mat& mask = Mat())
  5261. //
  5262. /**
  5263. * Calculates an essential matrix from the corresponding points in two images.
  5264. *
  5265. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5266. * be floating-point (single or double precision).
  5267. * @param points2 Array of the second image points of the same size and format as points1 .
  5268. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5269. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5270. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5271. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5272. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5273. * passing these coordinates, pass the identity matrix for this parameter.
  5274. * @param method Method for computing an essential matrix.
  5275. * - REF: RANSAC for the RANSAC algorithm.
  5276. * - REF: LMEDS for the LMedS algorithm.
  5277. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5278. * confidence (probability) that the estimated matrix is correct.
  5279. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5280. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5281. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5282. * point localization, image resolution, and the image noise.
  5283. * @param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
  5284. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5285. * @param maxIters The maximum number of robust method iterations.
  5286. *
  5287. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5288. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5289. *
  5290. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5291. *
  5292. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5293. * second images, respectively. The result of this function may be passed further to
  5294. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5295. */
  5296. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix method:(int)method prob:(double)prob threshold:(double)threshold maxIters:(int)maxIters mask:(Mat*)mask NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:method:prob:threshold:maxIters:mask:));
  5297. /**
  5298. * Calculates an essential matrix from the corresponding points in two images.
  5299. *
  5300. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5301. * be floating-point (single or double precision).
  5302. * @param points2 Array of the second image points of the same size and format as points1 .
  5303. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5304. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5305. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5306. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5307. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5308. * passing these coordinates, pass the identity matrix for this parameter.
  5309. * @param method Method for computing an essential matrix.
  5310. * - REF: RANSAC for the RANSAC algorithm.
  5311. * - REF: LMEDS for the LMedS algorithm.
  5312. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5313. * confidence (probability) that the estimated matrix is correct.
  5314. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5315. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5316. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5317. * point localization, image resolution, and the image noise.
  5318. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5319. * @param maxIters The maximum number of robust method iterations.
  5320. *
  5321. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5322. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5323. *
  5324. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5325. *
  5326. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5327. * second images, respectively. The result of this function may be passed further to
  5328. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5329. */
  5330. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix method:(int)method prob:(double)prob threshold:(double)threshold maxIters:(int)maxIters NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:method:prob:threshold:maxIters:));
  5331. /**
  5332. * Calculates an essential matrix from the corresponding points in two images.
  5333. *
  5334. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5335. * be floating-point (single or double precision).
  5336. * @param points2 Array of the second image points of the same size and format as points1 .
  5337. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5338. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5339. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5340. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5341. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5342. * passing these coordinates, pass the identity matrix for this parameter.
  5343. * @param method Method for computing an essential matrix.
  5344. * - REF: RANSAC for the RANSAC algorithm.
  5345. * - REF: LMEDS for the LMedS algorithm.
  5346. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5347. * confidence (probability) that the estimated matrix is correct.
  5348. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5349. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5350. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5351. * point localization, image resolution, and the image noise.
  5352. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5353. *
  5354. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5355. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5356. *
  5357. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5358. *
  5359. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5360. * second images, respectively. The result of this function may be passed further to
  5361. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5362. */
  5363. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix method:(int)method prob:(double)prob threshold:(double)threshold NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:method:prob:threshold:));
  5364. /**
  5365. * Calculates an essential matrix from the corresponding points in two images.
  5366. *
  5367. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5368. * be floating-point (single or double precision).
  5369. * @param points2 Array of the second image points of the same size and format as points1 .
  5370. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5371. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5372. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5373. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5374. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5375. * passing these coordinates, pass the identity matrix for this parameter.
  5376. * @param method Method for computing an essential matrix.
  5377. * - REF: RANSAC for the RANSAC algorithm.
  5378. * - REF: LMEDS for the LMedS algorithm.
  5379. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5380. * confidence (probability) that the estimated matrix is correct.
  5381. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5382. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5383. * point localization, image resolution, and the image noise.
  5384. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5385. *
  5386. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5387. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5388. *
  5389. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5390. *
  5391. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5392. * second images, respectively. The result of this function may be passed further to
  5393. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5394. */
  5395. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix method:(int)method prob:(double)prob NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:method:prob:));
  5396. /**
  5397. * Calculates an essential matrix from the corresponding points in two images.
  5398. *
  5399. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5400. * be floating-point (single or double precision).
  5401. * @param points2 Array of the second image points of the same size and format as points1 .
  5402. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5403. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5404. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5405. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5406. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5407. * passing these coordinates, pass the identity matrix for this parameter.
  5408. * @param method Method for computing an essential matrix.
  5409. * - REF: RANSAC for the RANSAC algorithm.
  5410. * - REF: LMEDS for the LMedS algorithm.
  5411. * confidence (probability) that the estimated matrix is correct.
  5412. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5413. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5414. * point localization, image resolution, and the image noise.
  5415. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5416. *
  5417. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5418. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5419. *
  5420. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5421. *
  5422. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5423. * second images, respectively. The result of this function may be passed further to
  5424. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5425. */
  5426. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix method:(int)method NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:method:));
  5427. /**
  5428. * Calculates an essential matrix from the corresponding points in two images.
  5429. *
  5430. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5431. * be floating-point (single or double precision).
  5432. * @param points2 Array of the second image points of the same size and format as points1 .
  5433. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  5434. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5435. * same camera intrinsic matrix. If this assumption does not hold for your use case, use
  5436. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5437. * to normalized image coordinates, which are valid for the identity camera intrinsic matrix. When
  5438. * passing these coordinates, pass the identity matrix for this parameter.
  5439. * - REF: RANSAC for the RANSAC algorithm.
  5440. * - REF: LMEDS for the LMedS algorithm.
  5441. * confidence (probability) that the estimated matrix is correct.
  5442. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5443. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5444. * point localization, image resolution, and the image noise.
  5445. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5446. *
  5447. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5448. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5449. *
  5450. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5451. *
  5452. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5453. * second images, respectively. The result of this function may be passed further to
  5454. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5455. */
  5456. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix:));
  5457. //
  5458. // Mat cv::findEssentialMat(Mat points1, Mat points2, double focal = 1.0, Point2d pp = Point2d(0, 0), int method = RANSAC, double prob = 0.999, double threshold = 1.0, int maxIters = 1000, Mat& mask = Mat())
  5459. //
  5460. /**
  5461. *
  5462. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5463. * be floating-point (single or double precision).
  5464. * @param points2 Array of the second image points of the same size and format as points1 .
  5465. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5466. * are feature points from cameras with same focal length and principal point.
  5467. * @param pp principal point of the camera.
  5468. * @param method Method for computing a fundamental matrix.
  5469. * - REF: RANSAC for the RANSAC algorithm.
  5470. * - REF: LMEDS for the LMedS algorithm.
  5471. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5472. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5473. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5474. * point localization, image resolution, and the image noise.
  5475. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5476. * confidence (probability) that the estimated matrix is correct.
  5477. * @param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
  5478. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5479. * @param maxIters The maximum number of robust method iterations.
  5480. *
  5481. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5482. * principal point:
  5483. *
  5484. * `$$A =
  5485. * \begin{bmatrix}
  5486. * f & 0 & x_{pp} \\
  5487. * 0 & f & y_{pp} \\
  5488. * 0 & 0 & 1
  5489. * \end{bmatrix}$$`
  5490. */
  5491. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp method:(int)method prob:(double)prob threshold:(double)threshold maxIters:(int)maxIters mask:(Mat*)mask NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:method:prob:threshold:maxIters:mask:));
  5492. /**
  5493. *
  5494. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5495. * be floating-point (single or double precision).
  5496. * @param points2 Array of the second image points of the same size and format as points1 .
  5497. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5498. * are feature points from cameras with same focal length and principal point.
  5499. * @param pp principal point of the camera.
  5500. * @param method Method for computing a fundamental matrix.
  5501. * - REF: RANSAC for the RANSAC algorithm.
  5502. * - REF: LMEDS for the LMedS algorithm.
  5503. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5504. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5505. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5506. * point localization, image resolution, and the image noise.
  5507. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5508. * confidence (probability) that the estimated matrix is correct.
  5509. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5510. * @param maxIters The maximum number of robust method iterations.
  5511. *
  5512. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5513. * principal point:
  5514. *
  5515. * `$$A =
  5516. * \begin{bmatrix}
  5517. * f & 0 & x_{pp} \\
  5518. * 0 & f & y_{pp} \\
  5519. * 0 & 0 & 1
  5520. * \end{bmatrix}$$`
  5521. */
  5522. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp method:(int)method prob:(double)prob threshold:(double)threshold maxIters:(int)maxIters NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:method:prob:threshold:maxIters:));
  5523. /**
  5524. *
  5525. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5526. * be floating-point (single or double precision).
  5527. * @param points2 Array of the second image points of the same size and format as points1 .
  5528. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5529. * are feature points from cameras with same focal length and principal point.
  5530. * @param pp principal point of the camera.
  5531. * @param method Method for computing a fundamental matrix.
  5532. * - REF: RANSAC for the RANSAC algorithm.
  5533. * - REF: LMEDS for the LMedS algorithm.
  5534. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5535. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5536. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5537. * point localization, image resolution, and the image noise.
  5538. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5539. * confidence (probability) that the estimated matrix is correct.
  5540. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5541. *
  5542. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5543. * principal point:
  5544. *
  5545. * `$$A =
  5546. * \begin{bmatrix}
  5547. * f & 0 & x_{pp} \\
  5548. * 0 & f & y_{pp} \\
  5549. * 0 & 0 & 1
  5550. * \end{bmatrix}$$`
  5551. */
  5552. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp method:(int)method prob:(double)prob threshold:(double)threshold NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:method:prob:threshold:));
  5553. /**
  5554. *
  5555. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5556. * be floating-point (single or double precision).
  5557. * @param points2 Array of the second image points of the same size and format as points1 .
  5558. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5559. * are feature points from cameras with same focal length and principal point.
  5560. * @param pp principal point of the camera.
  5561. * @param method Method for computing a fundamental matrix.
  5562. * - REF: RANSAC for the RANSAC algorithm.
  5563. * - REF: LMEDS for the LMedS algorithm.
  5564. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5565. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5566. * point localization, image resolution, and the image noise.
  5567. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5568. * confidence (probability) that the estimated matrix is correct.
  5569. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5570. *
  5571. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5572. * principal point:
  5573. *
  5574. * `$$A =
  5575. * \begin{bmatrix}
  5576. * f & 0 & x_{pp} \\
  5577. * 0 & f & y_{pp} \\
  5578. * 0 & 0 & 1
  5579. * \end{bmatrix}$$`
  5580. */
  5581. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp method:(int)method prob:(double)prob NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:method:prob:));
  5582. /**
  5583. *
  5584. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5585. * be floating-point (single or double precision).
  5586. * @param points2 Array of the second image points of the same size and format as points1 .
  5587. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5588. * are feature points from cameras with same focal length and principal point.
  5589. * @param pp principal point of the camera.
  5590. * @param method Method for computing a fundamental matrix.
  5591. * - REF: RANSAC for the RANSAC algorithm.
  5592. * - REF: LMEDS for the LMedS algorithm.
  5593. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5594. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5595. * point localization, image resolution, and the image noise.
  5596. * confidence (probability) that the estimated matrix is correct.
  5597. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5598. *
  5599. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5600. * principal point:
  5601. *
  5602. * `$$A =
  5603. * \begin{bmatrix}
  5604. * f & 0 & x_{pp} \\
  5605. * 0 & f & y_{pp} \\
  5606. * 0 & 0 & 1
  5607. * \end{bmatrix}$$`
  5608. */
  5609. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp method:(int)method NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:method:));
  5610. /**
  5611. *
  5612. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5613. * be floating-point (single or double precision).
  5614. * @param points2 Array of the second image points of the same size and format as points1 .
  5615. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5616. * are feature points from cameras with same focal length and principal point.
  5617. * @param pp principal point of the camera.
  5618. * - REF: RANSAC for the RANSAC algorithm.
  5619. * - REF: LMEDS for the LMedS algorithm.
  5620. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5621. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5622. * point localization, image resolution, and the image noise.
  5623. * confidence (probability) that the estimated matrix is correct.
  5624. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5625. *
  5626. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5627. * principal point:
  5628. *
  5629. * `$$A =
  5630. * \begin{bmatrix}
  5631. * f & 0 & x_{pp} \\
  5632. * 0 & f & y_{pp} \\
  5633. * 0 & 0 & 1
  5634. * \end{bmatrix}$$`
  5635. */
  5636. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal pp:(Point2d*)pp NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:pp:));
  5637. /**
  5638. *
  5639. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5640. * be floating-point (single or double precision).
  5641. * @param points2 Array of the second image points of the same size and format as points1 .
  5642. * @param focal focal length of the camera. Note that this function assumes that points1 and points2
  5643. * are feature points from cameras with same focal length and principal point.
  5644. * - REF: RANSAC for the RANSAC algorithm.
  5645. * - REF: LMEDS for the LMedS algorithm.
  5646. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5647. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5648. * point localization, image resolution, and the image noise.
  5649. * confidence (probability) that the estimated matrix is correct.
  5650. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5651. *
  5652. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5653. * principal point:
  5654. *
  5655. * `$$A =
  5656. * \begin{bmatrix}
  5657. * f & 0 & x_{pp} \\
  5658. * 0 & f & y_{pp} \\
  5659. * 0 & 0 & 1
  5660. * \end{bmatrix}$$`
  5661. */
  5662. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 focal:(double)focal NS_SWIFT_NAME(findEssentialMat(points1:points2:focal:));
  5663. /**
  5664. *
  5665. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5666. * be floating-point (single or double precision).
  5667. * @param points2 Array of the second image points of the same size and format as points1 .
  5668. * are feature points from cameras with same focal length and principal point.
  5669. * - REF: RANSAC for the RANSAC algorithm.
  5670. * - REF: LMEDS for the LMedS algorithm.
  5671. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5672. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5673. * point localization, image resolution, and the image noise.
  5674. * confidence (probability) that the estimated matrix is correct.
  5675. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5676. *
  5677. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  5678. * principal point:
  5679. *
  5680. * `$$A =
  5681. * \begin{bmatrix}
  5682. * f & 0 & x_{pp} \\
  5683. * 0 & f & y_{pp} \\
  5684. * 0 & 0 & 1
  5685. * \end{bmatrix}$$`
  5686. */
  5687. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 NS_SWIFT_NAME(findEssentialMat(points1:points2:));
  5688. //
  5689. // Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
  5690. //
  5691. /**
  5692. * Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
  5693. *
  5694. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5695. * be floating-point (single or double precision).
  5696. * @param points2 Array of the second image points of the same size and format as points1 .
  5697. * @param cameraMatrix1 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5698. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5699. * same camera matrix. If this assumption does not hold for your use case, use
  5700. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5701. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5702. * passing these coordinates, pass the identity matrix for this parameter.
  5703. * @param cameraMatrix2 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5704. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5705. * same camera matrix. If this assumption does not hold for your use case, use
  5706. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5707. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5708. * passing these coordinates, pass the identity matrix for this parameter.
  5709. * @param distCoeffs1 Input vector of distortion coefficients
  5710. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5711. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5712. * @param distCoeffs2 Input vector of distortion coefficients
  5713. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5714. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5715. * @param method Method for computing an essential matrix.
  5716. * - REF: RANSAC for the RANSAC algorithm.
  5717. * - REF: LMEDS for the LMedS algorithm.
  5718. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5719. * confidence (probability) that the estimated matrix is correct.
  5720. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5721. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5722. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5723. * point localization, image resolution, and the image noise.
  5724. * @param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
  5725. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5726. *
  5727. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5728. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5729. *
  5730. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5731. *
  5732. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5733. * second images, respectively. The result of this function may be passed further to
  5734. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5735. */
  5736. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 method:(int)method prob:(double)prob threshold:(double)threshold mask:(Mat*)mask NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:method:prob:threshold:mask:));
  5737. /**
  5738. * Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
  5739. *
  5740. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5741. * be floating-point (single or double precision).
  5742. * @param points2 Array of the second image points of the same size and format as points1 .
  5743. * @param cameraMatrix1 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5744. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5745. * same camera matrix. If this assumption does not hold for your use case, use
  5746. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5747. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5748. * passing these coordinates, pass the identity matrix for this parameter.
  5749. * @param cameraMatrix2 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5750. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5751. * same camera matrix. If this assumption does not hold for your use case, use
  5752. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5753. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5754. * passing these coordinates, pass the identity matrix for this parameter.
  5755. * @param distCoeffs1 Input vector of distortion coefficients
  5756. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5757. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5758. * @param distCoeffs2 Input vector of distortion coefficients
  5759. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5760. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5761. * @param method Method for computing an essential matrix.
  5762. * - REF: RANSAC for the RANSAC algorithm.
  5763. * - REF: LMEDS for the LMedS algorithm.
  5764. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5765. * confidence (probability) that the estimated matrix is correct.
  5766. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5767. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5768. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5769. * point localization, image resolution, and the image noise.
  5770. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5771. *
  5772. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5773. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5774. *
  5775. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5776. *
  5777. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5778. * second images, respectively. The result of this function may be passed further to
  5779. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5780. */
  5781. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 method:(int)method prob:(double)prob threshold:(double)threshold NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:method:prob:threshold:));
  5782. /**
  5783. * Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
  5784. *
  5785. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5786. * be floating-point (single or double precision).
  5787. * @param points2 Array of the second image points of the same size and format as points1 .
  5788. * @param cameraMatrix1 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5789. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5790. * same camera matrix. If this assumption does not hold for your use case, use
  5791. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5792. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5793. * passing these coordinates, pass the identity matrix for this parameter.
  5794. * @param cameraMatrix2 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5795. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5796. * same camera matrix. If this assumption does not hold for your use case, use
  5797. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5798. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5799. * passing these coordinates, pass the identity matrix for this parameter.
  5800. * @param distCoeffs1 Input vector of distortion coefficients
  5801. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5802. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5803. * @param distCoeffs2 Input vector of distortion coefficients
  5804. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5805. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5806. * @param method Method for computing an essential matrix.
  5807. * - REF: RANSAC for the RANSAC algorithm.
  5808. * - REF: LMEDS for the LMedS algorithm.
  5809. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5810. * confidence (probability) that the estimated matrix is correct.
  5811. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5812. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5813. * point localization, image resolution, and the image noise.
  5814. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5815. *
  5816. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5817. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5818. *
  5819. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5820. *
  5821. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5822. * second images, respectively. The result of this function may be passed further to
  5823. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5824. */
  5825. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 method:(int)method prob:(double)prob NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:method:prob:));
  5826. /**
  5827. * Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
  5828. *
  5829. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5830. * be floating-point (single or double precision).
  5831. * @param points2 Array of the second image points of the same size and format as points1 .
  5832. * @param cameraMatrix1 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5833. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5834. * same camera matrix. If this assumption does not hold for your use case, use
  5835. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5836. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5837. * passing these coordinates, pass the identity matrix for this parameter.
  5838. * @param cameraMatrix2 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5839. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5840. * same camera matrix. If this assumption does not hold for your use case, use
  5841. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5842. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5843. * passing these coordinates, pass the identity matrix for this parameter.
  5844. * @param distCoeffs1 Input vector of distortion coefficients
  5845. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5846. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5847. * @param distCoeffs2 Input vector of distortion coefficients
  5848. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5849. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5850. * @param method Method for computing an essential matrix.
  5851. * - REF: RANSAC for the RANSAC algorithm.
  5852. * - REF: LMEDS for the LMedS algorithm.
  5853. * confidence (probability) that the estimated matrix is correct.
  5854. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5855. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5856. * point localization, image resolution, and the image noise.
  5857. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5858. *
  5859. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5860. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5861. *
  5862. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5863. *
  5864. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5865. * second images, respectively. The result of this function may be passed further to
  5866. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5867. */
  5868. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 method:(int)method NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:method:));
  5869. /**
  5870. * Calculates an essential matrix from the corresponding points in two images from potentially two different cameras.
  5871. *
  5872. * @param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
  5873. * be floating-point (single or double precision).
  5874. * @param points2 Array of the second image points of the same size and format as points1 .
  5875. * @param cameraMatrix1 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5876. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5877. * same camera matrix. If this assumption does not hold for your use case, use
  5878. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5879. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5880. * passing these coordinates, pass the identity matrix for this parameter.
  5881. * @param cameraMatrix2 Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  5882. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  5883. * same camera matrix. If this assumption does not hold for your use case, use
  5884. * #undistortPoints with `P = cv::NoArray()` for both cameras to transform image points
  5885. * to normalized image coordinates, which are valid for the identity camera matrix. When
  5886. * passing these coordinates, pass the identity matrix for this parameter.
  5887. * @param distCoeffs1 Input vector of distortion coefficients
  5888. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5889. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5890. * @param distCoeffs2 Input vector of distortion coefficients
  5891. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  5892. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  5893. * - REF: RANSAC for the RANSAC algorithm.
  5894. * - REF: LMEDS for the LMedS algorithm.
  5895. * confidence (probability) that the estimated matrix is correct.
  5896. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5897. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5898. * point localization, image resolution, and the image noise.
  5899. * for the other points. The array is computed only in the RANSAC and LMedS methods.
  5900. *
  5901. * This function estimates essential matrix based on the five-point algorithm solver in CITE: Nister03 .
  5902. * CITE: SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
  5903. *
  5904. * `$$[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0$$`
  5905. *
  5906. * where `$$E$$` is an essential matrix, `$$p_1$$` and `$$p_2$$` are corresponding points in the first and the
  5907. * second images, respectively. The result of this function may be passed further to
  5908. * #decomposeEssentialMat or #recoverPose to recover the relative pose between cameras.
  5909. */
  5910. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:));
  5911. //
  5912. // Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix1, Mat cameraMatrix2, Mat dist_coeff1, Mat dist_coeff2, Mat& mask, UsacParams params)
  5913. //
  5914. + (Mat*)findEssentialMat:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 cameraMatrix2:(Mat*)cameraMatrix2 dist_coeff1:(Mat*)dist_coeff1 dist_coeff2:(Mat*)dist_coeff2 mask:(Mat*)mask params:(UsacParams*)params NS_SWIFT_NAME(findEssentialMat(points1:points2:cameraMatrix1:cameraMatrix2:dist_coeff1:dist_coeff2:mask:params:));
  5915. //
  5916. // void cv::decomposeEssentialMat(Mat E, Mat& R1, Mat& R2, Mat& t)
  5917. //
  5918. /**
  5919. * Decompose an essential matrix to possible rotations and translation.
  5920. *
  5921. * @param E The input essential matrix.
  5922. * @param R1 One possible rotation matrix.
  5923. * @param R2 Another possible rotation matrix.
  5924. * @param t One possible translation.
  5925. *
  5926. * This function decomposes the essential matrix E using svd decomposition CITE: HartleyZ00. In
  5927. * general, four possible poses exist for the decomposition of E. They are `$$[R_1, t]$$`,
  5928. * `$$[R_1, -t]$$`, `$$[R_2, t]$$`, `$$[R_2, -t]$$`.
  5929. *
  5930. * If E gives the epipolar constraint `$$[p_2; 1]^T A^{-T} E A^{-1} [p_1; 1] = 0$$` between the image
  5931. * points `$$p_1$$` in the first image and `$$p_2$$` in second image, then any of the tuples
  5932. * `$$[R_1, t]$$`, `$$[R_1, -t]$$`, `$$[R_2, t]$$`, `$$[R_2, -t]$$` is a change of basis from the first
  5933. * camera's coordinate system to the second camera's coordinate system. However, by decomposing E, one
  5934. * can only get the direction of the translation. For this reason, the translation t is returned with
  5935. * unit length.
  5936. */
  5937. + (void)decomposeEssentialMat:(Mat*)E R1:(Mat*)R1 R2:(Mat*)R2 t:(Mat*)t NS_SWIFT_NAME(decomposeEssentialMat(E:R1:R2:t:));
  5938. //
  5939. // int cv::recoverPose(Mat points1, Mat points2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat& E, Mat& R, Mat& t, int method = cv::RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
  5940. //
  5941. /**
  5942. * Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
  5943. * inliers that pass the check.
  5944. *
  5945. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  5946. * floating-point (single or double precision).
  5947. * @param points2 Array of the second image points of the same size and format as points1 .
  5948. * @param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
  5949. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  5950. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  5951. * REF: calibrateCamera.
  5952. * @param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
  5953. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  5954. * @param distCoeffs2 Input/output vector of distortion coefficients, the same as in
  5955. * REF: calibrateCamera.
  5956. * @param E The output essential matrix.
  5957. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  5958. * that performs a change of basis from the first camera's coordinate system to the second camera's
  5959. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  5960. * described below.
  5961. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  5962. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  5963. * length.
  5964. * @param method Method for computing an essential matrix.
  5965. * - REF: RANSAC for the RANSAC algorithm.
  5966. * - REF: LMEDS for the LMedS algorithm.
  5967. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  5968. * confidence (probability) that the estimated matrix is correct.
  5969. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  5970. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  5971. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  5972. * point localization, image resolution, and the image noise.
  5973. * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
  5974. * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
  5975. * recover pose. In the output mask only inliers which pass the cheirality check.
  5976. *
  5977. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  5978. * possible pose hypotheses by doing cheirality check. The cheirality check means that the
  5979. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  5980. *
  5981. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  5982. * scenario, points1 and points2 are the same input for findEssentialMat.:
  5983. *
  5984. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  5985. * int point_count = 100;
  5986. * vector<Point2f> points1(point_count);
  5987. * vector<Point2f> points2(point_count);
  5988. *
  5989. * // initialize the points here ...
  5990. * for( int i = 0; i < point_count; i++ )
  5991. * {
  5992. * points1[i] = ...;
  5993. * points2[i] = ...;
  5994. * }
  5995. *
  5996. * // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
  5997. * Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
  5998. *
  5999. * // Output: Essential matrix, relative rotation and relative translation.
  6000. * Mat E, R, t, mask;
  6001. *
  6002. * recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
  6003. *
  6004. */
  6005. + (int)recoverPose:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 E:(Mat*)E R:(Mat*)R t:(Mat*)t method:(int)method prob:(double)prob threshold:(double)threshold mask:(Mat*)mask NS_SWIFT_NAME(recoverPose(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:E:R:t:method:prob:threshold:mask:));
  6006. /**
  6007. * Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
  6008. * inliers that pass the check.
  6009. *
  6010. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6011. * floating-point (single or double precision).
  6012. * @param points2 Array of the second image points of the same size and format as points1 .
  6013. * @param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
  6014. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6015. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  6016. * REF: calibrateCamera.
  6017. * @param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
  6018. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6019. * @param distCoeffs2 Input/output vector of distortion coefficients, the same as in
  6020. * REF: calibrateCamera.
  6021. * @param E The output essential matrix.
  6022. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6023. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6024. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6025. * described below.
  6026. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6027. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6028. * length.
  6029. * @param method Method for computing an essential matrix.
  6030. * - REF: RANSAC for the RANSAC algorithm.
  6031. * - REF: LMEDS for the LMedS algorithm.
  6032. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  6033. * confidence (probability) that the estimated matrix is correct.
  6034. * @param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
  6035. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  6036. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  6037. * point localization, image resolution, and the image noise.
  6038. * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
  6039. * recover pose. In the output mask only inliers which pass the cheirality check.
  6040. *
  6041. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6042. * possible pose hypotheses by doing cheirality check. The cheirality check means that the
  6043. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6044. *
  6045. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6046. * scenario, points1 and points2 are the same input for findEssentialMat.:
  6047. *
  6048. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6049. * int point_count = 100;
  6050. * vector<Point2f> points1(point_count);
  6051. * vector<Point2f> points2(point_count);
  6052. *
  6053. * // initialize the points here ...
  6054. * for( int i = 0; i < point_count; i++ )
  6055. * {
  6056. * points1[i] = ...;
  6057. * points2[i] = ...;
  6058. * }
  6059. *
  6060. * // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
  6061. * Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
  6062. *
  6063. * // Output: Essential matrix, relative rotation and relative translation.
  6064. * Mat E, R, t, mask;
  6065. *
  6066. * recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
  6067. *
  6068. */
  6069. + (int)recoverPose:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 E:(Mat*)E R:(Mat*)R t:(Mat*)t method:(int)method prob:(double)prob threshold:(double)threshold NS_SWIFT_NAME(recoverPose(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:E:R:t:method:prob:threshold:));
  6070. /**
  6071. * Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
  6072. * inliers that pass the check.
  6073. *
  6074. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6075. * floating-point (single or double precision).
  6076. * @param points2 Array of the second image points of the same size and format as points1 .
  6077. * @param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
  6078. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6079. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  6080. * REF: calibrateCamera.
  6081. * @param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
  6082. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6083. * @param distCoeffs2 Input/output vector of distortion coefficients, the same as in
  6084. * REF: calibrateCamera.
  6085. * @param E The output essential matrix.
  6086. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6087. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6088. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6089. * described below.
  6090. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6091. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6092. * length.
  6093. * @param method Method for computing an essential matrix.
  6094. * - REF: RANSAC for the RANSAC algorithm.
  6095. * - REF: LMEDS for the LMedS algorithm.
  6096. * @param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
  6097. * confidence (probability) that the estimated matrix is correct.
  6098. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  6099. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  6100. * point localization, image resolution, and the image noise.
  6101. * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
  6102. * recover pose. In the output mask only inliers which pass the cheirality check.
  6103. *
  6104. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6105. * possible pose hypotheses by doing cheirality check. The cheirality check means that the
  6106. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6107. *
  6108. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6109. * scenario, points1 and points2 are the same input for findEssentialMat.:
  6110. *
  6111. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6112. * int point_count = 100;
  6113. * vector<Point2f> points1(point_count);
  6114. * vector<Point2f> points2(point_count);
  6115. *
  6116. * // initialize the points here ...
  6117. * for( int i = 0; i < point_count; i++ )
  6118. * {
  6119. * points1[i] = ...;
  6120. * points2[i] = ...;
  6121. * }
  6122. *
  6123. * // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
  6124. * Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
  6125. *
  6126. * // Output: Essential matrix, relative rotation and relative translation.
  6127. * Mat E, R, t, mask;
  6128. *
  6129. * recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
  6130. *
  6131. */
  6132. + (int)recoverPose:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 E:(Mat*)E R:(Mat*)R t:(Mat*)t method:(int)method prob:(double)prob NS_SWIFT_NAME(recoverPose(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:E:R:t:method:prob:));
  6133. /**
  6134. * Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
  6135. * inliers that pass the check.
  6136. *
  6137. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6138. * floating-point (single or double precision).
  6139. * @param points2 Array of the second image points of the same size and format as points1 .
  6140. * @param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
  6141. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6142. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  6143. * REF: calibrateCamera.
  6144. * @param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
  6145. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6146. * @param distCoeffs2 Input/output vector of distortion coefficients, the same as in
  6147. * REF: calibrateCamera.
  6148. * @param E The output essential matrix.
  6149. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6150. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6151. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6152. * described below.
  6153. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6154. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6155. * length.
  6156. * @param method Method for computing an essential matrix.
  6157. * - REF: RANSAC for the RANSAC algorithm.
  6158. * - REF: LMEDS for the LMedS algorithm.
  6159. * confidence (probability) that the estimated matrix is correct.
  6160. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  6161. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  6162. * point localization, image resolution, and the image noise.
  6163. * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
  6164. * recover pose. In the output mask only inliers which pass the cheirality check.
  6165. *
  6166. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6167. * possible pose hypotheses by doing cheirality check. The cheirality check means that the
  6168. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6169. *
  6170. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6171. * scenario, points1 and points2 are the same input for findEssentialMat.:
  6172. *
  6173. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6174. * int point_count = 100;
  6175. * vector<Point2f> points1(point_count);
  6176. * vector<Point2f> points2(point_count);
  6177. *
  6178. * // initialize the points here ...
  6179. * for( int i = 0; i < point_count; i++ )
  6180. * {
  6181. * points1[i] = ...;
  6182. * points2[i] = ...;
  6183. * }
  6184. *
  6185. * // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
  6186. * Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
  6187. *
  6188. * // Output: Essential matrix, relative rotation and relative translation.
  6189. * Mat E, R, t, mask;
  6190. *
  6191. * recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
  6192. *
  6193. */
  6194. + (int)recoverPose:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 E:(Mat*)E R:(Mat*)R t:(Mat*)t method:(int)method NS_SWIFT_NAME(recoverPose(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:E:R:t:method:));
  6195. /**
  6196. * Recovers the relative camera rotation and the translation from corresponding points in two images from two different cameras, using cheirality check. Returns the number of
  6197. * inliers that pass the check.
  6198. *
  6199. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6200. * floating-point (single or double precision).
  6201. * @param points2 Array of the second image points of the same size and format as points1 .
  6202. * @param cameraMatrix1 Input/output camera matrix for the first camera, the same as in
  6203. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6204. * @param distCoeffs1 Input/output vector of distortion coefficients, the same as in
  6205. * REF: calibrateCamera.
  6206. * @param cameraMatrix2 Input/output camera matrix for the first camera, the same as in
  6207. * REF: calibrateCamera. Furthermore, for the stereo case, additional flags may be used, see below.
  6208. * @param distCoeffs2 Input/output vector of distortion coefficients, the same as in
  6209. * REF: calibrateCamera.
  6210. * @param E The output essential matrix.
  6211. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6212. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6213. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6214. * described below.
  6215. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6216. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6217. * length.
  6218. * - REF: RANSAC for the RANSAC algorithm.
  6219. * - REF: LMEDS for the LMedS algorithm.
  6220. * confidence (probability) that the estimated matrix is correct.
  6221. * line in pixels, beyond which the point is considered an outlier and is not used for computing the
  6222. * final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
  6223. * point localization, image resolution, and the image noise.
  6224. * inliers in points1 and points2 for then given essential matrix E. Only these inliers will be used to
  6225. * recover pose. In the output mask only inliers which pass the cheirality check.
  6226. *
  6227. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6228. * possible pose hypotheses by doing cheirality check. The cheirality check means that the
  6229. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6230. *
  6231. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6232. * scenario, points1 and points2 are the same input for findEssentialMat.:
  6233. *
  6234. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6235. * int point_count = 100;
  6236. * vector<Point2f> points1(point_count);
  6237. * vector<Point2f> points2(point_count);
  6238. *
  6239. * // initialize the points here ...
  6240. * for( int i = 0; i < point_count; i++ )
  6241. * {
  6242. * points1[i] = ...;
  6243. * points2[i] = ...;
  6244. * }
  6245. *
  6246. * // Input: camera calibration of both cameras, for example using intrinsic chessboard calibration.
  6247. * Mat cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2;
  6248. *
  6249. * // Output: Essential matrix, relative rotation and relative translation.
  6250. * Mat E, R, t, mask;
  6251. *
  6252. * recoverPose(points1, points2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, E, R, t, mask);
  6253. *
  6254. */
  6255. + (int)recoverPose:(Mat*)points1 points2:(Mat*)points2 cameraMatrix1:(Mat*)cameraMatrix1 distCoeffs1:(Mat*)distCoeffs1 cameraMatrix2:(Mat*)cameraMatrix2 distCoeffs2:(Mat*)distCoeffs2 E:(Mat*)E R:(Mat*)R t:(Mat*)t NS_SWIFT_NAME(recoverPose(points1:points2:cameraMatrix1:distCoeffs1:cameraMatrix2:distCoeffs2:E:R:t:));
  6256. //
  6257. // int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, Mat& mask = Mat())
  6258. //
  6259. /**
  6260. * Recovers the relative camera rotation and the translation from an estimated essential
  6261. * matrix and the corresponding points in two images, using chirality check. Returns the number of
  6262. * inliers that pass the check.
  6263. *
  6264. * @param E The input essential matrix.
  6265. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6266. * floating-point (single or double precision).
  6267. * @param points2 Array of the second image points of the same size and format as points1 .
  6268. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  6269. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  6270. * same camera intrinsic matrix.
  6271. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6272. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6273. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6274. * described below.
  6275. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6276. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6277. * length.
  6278. * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
  6279. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6280. * recover pose. In the output mask only inliers which pass the chirality check.
  6281. *
  6282. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6283. * possible pose hypotheses by doing chirality check. The chirality check means that the
  6284. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6285. *
  6286. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6287. * scenario, points1 and points2 are the same input for #findEssentialMat :
  6288. *
  6289. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6290. * int point_count = 100;
  6291. * vector<Point2f> points1(point_count);
  6292. * vector<Point2f> points2(point_count);
  6293. *
  6294. * // initialize the points here ...
  6295. * for( int i = 0; i < point_count; i++ )
  6296. * {
  6297. * points1[i] = ...;
  6298. * points2[i] = ...;
  6299. * }
  6300. *
  6301. * // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
  6302. * Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
  6303. *
  6304. * Mat E, R, t, mask;
  6305. *
  6306. * E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
  6307. * recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
  6308. *
  6309. */
  6310. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix R:(Mat*)R t:(Mat*)t mask:(Mat*)mask NS_SWIFT_NAME(recoverPose(E:points1:points2:cameraMatrix:R:t:mask:));
  6311. /**
  6312. * Recovers the relative camera rotation and the translation from an estimated essential
  6313. * matrix and the corresponding points in two images, using chirality check. Returns the number of
  6314. * inliers that pass the check.
  6315. *
  6316. * @param E The input essential matrix.
  6317. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6318. * floating-point (single or double precision).
  6319. * @param points2 Array of the second image points of the same size and format as points1 .
  6320. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  6321. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  6322. * same camera intrinsic matrix.
  6323. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6324. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6325. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6326. * described below.
  6327. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6328. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6329. * length.
  6330. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6331. * recover pose. In the output mask only inliers which pass the chirality check.
  6332. *
  6333. * This function decomposes an essential matrix using REF: decomposeEssentialMat and then verifies
  6334. * possible pose hypotheses by doing chirality check. The chirality check means that the
  6335. * triangulated 3D points should have positive depth. Some details can be found in CITE: Nister03.
  6336. *
  6337. * This function can be used to process the output E and mask from REF: findEssentialMat. In this
  6338. * scenario, points1 and points2 are the same input for #findEssentialMat :
  6339. *
  6340. * // Example. Estimation of fundamental matrix using the RANSAC algorithm
  6341. * int point_count = 100;
  6342. * vector<Point2f> points1(point_count);
  6343. * vector<Point2f> points2(point_count);
  6344. *
  6345. * // initialize the points here ...
  6346. * for( int i = 0; i < point_count; i++ )
  6347. * {
  6348. * points1[i] = ...;
  6349. * points2[i] = ...;
  6350. * }
  6351. *
  6352. * // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
  6353. * Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
  6354. *
  6355. * Mat E, R, t, mask;
  6356. *
  6357. * E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
  6358. * recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
  6359. *
  6360. */
  6361. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix R:(Mat*)R t:(Mat*)t NS_SWIFT_NAME(recoverPose(E:points1:points2:cameraMatrix:R:t:));
  6362. //
  6363. // int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat& R, Mat& t, double focal = 1.0, Point2d pp = Point2d(0, 0), Mat& mask = Mat())
  6364. //
  6365. /**
  6366. *
  6367. * @param E The input essential matrix.
  6368. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6369. * floating-point (single or double precision).
  6370. * @param points2 Array of the second image points of the same size and format as points1 .
  6371. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6372. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6373. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6374. * description below.
  6375. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6376. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6377. * length.
  6378. * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
  6379. * are feature points from cameras with same focal length and principal point.
  6380. * @param pp principal point of the camera.
  6381. * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
  6382. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6383. * recover pose. In the output mask only inliers which pass the chirality check.
  6384. *
  6385. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  6386. * principal point:
  6387. *
  6388. * `$$A =
  6389. * \begin{bmatrix}
  6390. * f & 0 & x_{pp} \\
  6391. * 0 & f & y_{pp} \\
  6392. * 0 & 0 & 1
  6393. * \end{bmatrix}$$`
  6394. */
  6395. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 R:(Mat*)R t:(Mat*)t focal:(double)focal pp:(Point2d*)pp mask:(Mat*)mask NS_SWIFT_NAME(recoverPose(E:points1:points2:R:t:focal:pp:mask:));
  6396. /**
  6397. *
  6398. * @param E The input essential matrix.
  6399. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6400. * floating-point (single or double precision).
  6401. * @param points2 Array of the second image points of the same size and format as points1 .
  6402. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6403. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6404. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6405. * description below.
  6406. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6407. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6408. * length.
  6409. * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
  6410. * are feature points from cameras with same focal length and principal point.
  6411. * @param pp principal point of the camera.
  6412. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6413. * recover pose. In the output mask only inliers which pass the chirality check.
  6414. *
  6415. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  6416. * principal point:
  6417. *
  6418. * `$$A =
  6419. * \begin{bmatrix}
  6420. * f & 0 & x_{pp} \\
  6421. * 0 & f & y_{pp} \\
  6422. * 0 & 0 & 1
  6423. * \end{bmatrix}$$`
  6424. */
  6425. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 R:(Mat*)R t:(Mat*)t focal:(double)focal pp:(Point2d*)pp NS_SWIFT_NAME(recoverPose(E:points1:points2:R:t:focal:pp:));
  6426. /**
  6427. *
  6428. * @param E The input essential matrix.
  6429. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6430. * floating-point (single or double precision).
  6431. * @param points2 Array of the second image points of the same size and format as points1 .
  6432. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6433. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6434. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6435. * description below.
  6436. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6437. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6438. * length.
  6439. * @param focal Focal length of the camera. Note that this function assumes that points1 and points2
  6440. * are feature points from cameras with same focal length and principal point.
  6441. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6442. * recover pose. In the output mask only inliers which pass the chirality check.
  6443. *
  6444. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  6445. * principal point:
  6446. *
  6447. * `$$A =
  6448. * \begin{bmatrix}
  6449. * f & 0 & x_{pp} \\
  6450. * 0 & f & y_{pp} \\
  6451. * 0 & 0 & 1
  6452. * \end{bmatrix}$$`
  6453. */
  6454. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 R:(Mat*)R t:(Mat*)t focal:(double)focal NS_SWIFT_NAME(recoverPose(E:points1:points2:R:t:focal:));
  6455. /**
  6456. *
  6457. * @param E The input essential matrix.
  6458. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6459. * floating-point (single or double precision).
  6460. * @param points2 Array of the second image points of the same size and format as points1 .
  6461. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6462. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6463. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6464. * description below.
  6465. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6466. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6467. * length.
  6468. * are feature points from cameras with same focal length and principal point.
  6469. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6470. * recover pose. In the output mask only inliers which pass the chirality check.
  6471. *
  6472. * This function differs from the one above that it computes camera intrinsic matrix from focal length and
  6473. * principal point:
  6474. *
  6475. * `$$A =
  6476. * \begin{bmatrix}
  6477. * f & 0 & x_{pp} \\
  6478. * 0 & f & y_{pp} \\
  6479. * 0 & 0 & 1
  6480. * \end{bmatrix}$$`
  6481. */
  6482. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 R:(Mat*)R t:(Mat*)t NS_SWIFT_NAME(recoverPose(E:points1:points2:R:t:));
  6483. //
  6484. // int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, double distanceThresh, Mat& mask = Mat(), Mat& triangulatedPoints = Mat())
  6485. //
  6486. /**
  6487. *
  6488. * @param E The input essential matrix.
  6489. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6490. * floating-point (single or double precision).
  6491. * @param points2 Array of the second image points of the same size and format as points1.
  6492. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  6493. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  6494. * same camera intrinsic matrix.
  6495. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6496. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6497. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6498. * description below.
  6499. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6500. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6501. * length.
  6502. * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
  6503. * points).
  6504. * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
  6505. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6506. * recover pose. In the output mask only inliers which pass the chirality check.
  6507. * @param triangulatedPoints 3D points which were reconstructed by triangulation.
  6508. *
  6509. * This function differs from the one above that it outputs the triangulated 3D point that are used for
  6510. * the chirality check.
  6511. */
  6512. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix R:(Mat*)R t:(Mat*)t distanceThresh:(double)distanceThresh mask:(Mat*)mask triangulatedPoints:(Mat*)triangulatedPoints NS_SWIFT_NAME(recoverPose(E:points1:points2:cameraMatrix:R:t:distanceThresh:mask:triangulatedPoints:));
  6513. /**
  6514. *
  6515. * @param E The input essential matrix.
  6516. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6517. * floating-point (single or double precision).
  6518. * @param points2 Array of the second image points of the same size and format as points1.
  6519. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  6520. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  6521. * same camera intrinsic matrix.
  6522. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6523. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6524. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6525. * description below.
  6526. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6527. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6528. * length.
  6529. * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
  6530. * points).
  6531. * @param mask Input/output mask for inliers in points1 and points2. If it is not empty, then it marks
  6532. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6533. * recover pose. In the output mask only inliers which pass the chirality check.
  6534. *
  6535. * This function differs from the one above that it outputs the triangulated 3D point that are used for
  6536. * the chirality check.
  6537. */
  6538. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix R:(Mat*)R t:(Mat*)t distanceThresh:(double)distanceThresh mask:(Mat*)mask NS_SWIFT_NAME(recoverPose(E:points1:points2:cameraMatrix:R:t:distanceThresh:mask:));
  6539. /**
  6540. *
  6541. * @param E The input essential matrix.
  6542. * @param points1 Array of N 2D points from the first image. The point coordinates should be
  6543. * floating-point (single or double precision).
  6544. * @param points2 Array of the second image points of the same size and format as points1.
  6545. * @param cameraMatrix Camera intrinsic matrix `$$\cameramatrix{A}$$` .
  6546. * Note that this function assumes that points1 and points2 are feature points from cameras with the
  6547. * same camera intrinsic matrix.
  6548. * @param R Output rotation matrix. Together with the translation vector, this matrix makes up a tuple
  6549. * that performs a change of basis from the first camera's coordinate system to the second camera's
  6550. * coordinate system. Note that, in general, t can not be used for this tuple, see the parameter
  6551. * description below.
  6552. * @param t Output translation vector. This vector is obtained by REF: decomposeEssentialMat and
  6553. * therefore is only known up to scale, i.e. t is the direction of the translation vector and has unit
  6554. * length.
  6555. * @param distanceThresh threshold distance which is used to filter out far away points (i.e. infinite
  6556. * points).
  6557. * inliers in points1 and points2 for the given essential matrix E. Only these inliers will be used to
  6558. * recover pose. In the output mask only inliers which pass the chirality check.
  6559. *
  6560. * This function differs from the one above that it outputs the triangulated 3D point that are used for
  6561. * the chirality check.
  6562. */
  6563. + (int)recoverPose:(Mat*)E points1:(Mat*)points1 points2:(Mat*)points2 cameraMatrix:(Mat*)cameraMatrix R:(Mat*)R t:(Mat*)t distanceThresh:(double)distanceThresh NS_SWIFT_NAME(recoverPose(E:points1:points2:cameraMatrix:R:t:distanceThresh:));
  6564. //
  6565. // void cv::computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat& lines)
  6566. //
  6567. /**
  6568. * For points in an image of a stereo pair, computes the corresponding epilines in the other image.
  6569. *
  6570. * @param points Input points. `$$N \times 1$$` or `$$1 \times N$$` matrix of type CV_32FC2 or
  6571. * vector\<Point2f\> .
  6572. * @param whichImage Index of the image (1 or 2) that contains the points .
  6573. * @param F Fundamental matrix that can be estimated using #findFundamentalMat or #stereoRectify .
  6574. * @param lines Output vector of the epipolar lines corresponding to the points in the other image.
  6575. * Each line `$$ax + by + c=0$$` is encoded by 3 numbers `$$(a, b, c)$$` .
  6576. *
  6577. * For every point in one of the two images of a stereo pair, the function finds the equation of the
  6578. * corresponding epipolar line in the other image.
  6579. *
  6580. * From the fundamental matrix definition (see #findFundamentalMat ), line `$$l^{(2)}_i$$` in the second
  6581. * image for the point `$$p^{(1)}_i$$` in the first image (when whichImage=1 ) is computed as:
  6582. *
  6583. * `$$l^{(2)}_i = F p^{(1)}_i$$`
  6584. *
  6585. * And vice versa, when whichImage=2, `$$l^{(1)}_i$$` is computed from `$$p^{(2)}_i$$` as:
  6586. *
  6587. * `$$l^{(1)}_i = F^T p^{(2)}_i$$`
  6588. *
  6589. * Line coefficients are defined up to a scale. They are normalized so that `$$a_i^2+b_i^2=1$$` .
  6590. */
  6591. + (void)computeCorrespondEpilines:(Mat*)points whichImage:(int)whichImage F:(Mat*)F lines:(Mat*)lines NS_SWIFT_NAME(computeCorrespondEpilines(points:whichImage:F:lines:));
  6592. //
  6593. // void cv::triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat& points4D)
  6594. //
  6595. /**
  6596. * This function reconstructs 3-dimensional points (in homogeneous coordinates) by using
  6597. * their observations with a stereo camera.
  6598. *
  6599. * @param projMatr1 3x4 projection matrix of the first camera, i.e. this matrix projects 3D points
  6600. * given in the world's coordinate system into the first image.
  6601. * @param projMatr2 3x4 projection matrix of the second camera, i.e. this matrix projects 3D points
  6602. * given in the world's coordinate system into the second image.
  6603. * @param projPoints1 2xN array of feature points in the first image. In the case of the c++ version,
  6604. * it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
  6605. * @param projPoints2 2xN array of corresponding points in the second image. In the case of the c++
  6606. * version, it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
  6607. * @param points4D 4xN array of reconstructed points in homogeneous coordinates. These points are
  6608. * returned in the world's coordinate system.
  6609. *
  6610. * NOTE:
  6611. * Keep in mind that all input data should be of float type in order for this function to work.
  6612. *
  6613. * NOTE:
  6614. * If the projection matrices from REF: stereoRectify are used, then the returned points are
  6615. * represented in the first camera's rectified coordinate system.
  6616. *
  6617. * @sa
  6618. * reprojectImageTo3D
  6619. */
  6620. + (void)triangulatePoints:(Mat*)projMatr1 projMatr2:(Mat*)projMatr2 projPoints1:(Mat*)projPoints1 projPoints2:(Mat*)projPoints2 points4D:(Mat*)points4D NS_SWIFT_NAME(triangulatePoints(projMatr1:projMatr2:projPoints1:projPoints2:points4D:));
  6621. //
  6622. // void cv::correctMatches(Mat F, Mat points1, Mat points2, Mat& newPoints1, Mat& newPoints2)
  6623. //
  6624. /**
  6625. * Refines coordinates of corresponding points.
  6626. *
  6627. * @param F 3x3 fundamental matrix.
  6628. * @param points1 1xN array containing the first set of points.
  6629. * @param points2 1xN array containing the second set of points.
  6630. * @param newPoints1 The optimized points1.
  6631. * @param newPoints2 The optimized points2.
  6632. *
  6633. * The function implements the Optimal Triangulation Method (see Multiple View Geometry CITE: HartleyZ00 for details).
  6634. * For each given point correspondence points1[i] \<-\> points2[i], and a fundamental matrix F, it
  6635. * computes the corrected correspondences newPoints1[i] \<-\> newPoints2[i] that minimize the geometric
  6636. * error `$$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2$$` (where `$$d(a,b)$$` is the
  6637. * geometric distance between points `$$a$$` and `$$b$$` ) subject to the epipolar constraint
  6638. * `$$newPoints2^T \cdot F \cdot newPoints1 = 0$$` .
  6639. */
  6640. + (void)correctMatches:(Mat*)F points1:(Mat*)points1 points2:(Mat*)points2 newPoints1:(Mat*)newPoints1 newPoints2:(Mat*)newPoints2 NS_SWIFT_NAME(correctMatches(F:points1:points2:newPoints1:newPoints2:));
  6641. //
  6642. // void cv::filterSpeckles(Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf = Mat())
  6643. //
  6644. /**
  6645. * Filters off small noise blobs (speckles) in the disparity map
  6646. *
  6647. * @param img The input 16-bit signed disparity image
  6648. * @param newVal The disparity value used to paint-off the speckles
  6649. * @param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
  6650. * affected by the algorithm
  6651. * @param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
  6652. * blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
  6653. * disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
  6654. * account when specifying this parameter value.
  6655. * @param buf The optional temporary buffer to avoid memory allocation within the function.
  6656. */
  6657. + (void)filterSpeckles:(Mat*)img newVal:(double)newVal maxSpeckleSize:(int)maxSpeckleSize maxDiff:(double)maxDiff buf:(Mat*)buf NS_SWIFT_NAME(filterSpeckles(img:newVal:maxSpeckleSize:maxDiff:buf:));
  6658. /**
  6659. * Filters off small noise blobs (speckles) in the disparity map
  6660. *
  6661. * @param img The input 16-bit signed disparity image
  6662. * @param newVal The disparity value used to paint-off the speckles
  6663. * @param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
  6664. * affected by the algorithm
  6665. * @param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
  6666. * blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
  6667. * disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
  6668. * account when specifying this parameter value.
  6669. */
  6670. + (void)filterSpeckles:(Mat*)img newVal:(double)newVal maxSpeckleSize:(int)maxSpeckleSize maxDiff:(double)maxDiff NS_SWIFT_NAME(filterSpeckles(img:newVal:maxSpeckleSize:maxDiff:));
  6671. //
  6672. // Rect cv::getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int blockSize)
  6673. //
  6674. + (Rect2i*)getValidDisparityROI:(Rect2i*)roi1 roi2:(Rect2i*)roi2 minDisparity:(int)minDisparity numberOfDisparities:(int)numberOfDisparities blockSize:(int)blockSize NS_SWIFT_NAME(getValidDisparityROI(roi1:roi2:minDisparity:numberOfDisparities:blockSize:));
  6675. //
  6676. // void cv::validateDisparity(Mat& disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
  6677. //
  6678. + (void)validateDisparity:(Mat*)disparity cost:(Mat*)cost minDisparity:(int)minDisparity numberOfDisparities:(int)numberOfDisparities disp12MaxDisp:(int)disp12MaxDisp NS_SWIFT_NAME(validateDisparity(disparity:cost:minDisparity:numberOfDisparities:disp12MaxDisp:));
  6679. + (void)validateDisparity:(Mat*)disparity cost:(Mat*)cost minDisparity:(int)minDisparity numberOfDisparities:(int)numberOfDisparities NS_SWIFT_NAME(validateDisparity(disparity:cost:minDisparity:numberOfDisparities:));
  6680. //
  6681. // void cv::reprojectImageTo3D(Mat disparity, Mat& _3dImage, Mat Q, bool handleMissingValues = false, int ddepth = -1)
  6682. //
  6683. /**
  6684. * Reprojects a disparity image to 3D space.
  6685. *
  6686. * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
  6687. * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
  6688. * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
  6689. * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
  6690. * being used here.
  6691. * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
  6692. * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
  6693. * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
  6694. * camera's rectified coordinate system.
  6695. * @param Q `$$4 \times 4$$` perspective transformation matrix that can be obtained with
  6696. * REF: stereoRectify.
  6697. * @param handleMissingValues Indicates, whether the function should handle missing values (i.e.
  6698. * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
  6699. * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
  6700. * to 3D points with a very large Z value (currently set to 10000).
  6701. * @param ddepth The optional output array depth. If it is -1, the output image will have CV_32F
  6702. * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
  6703. *
  6704. * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
  6705. * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
  6706. * computes:
  6707. *
  6708. * `$$\begin{bmatrix}
  6709. * X \\
  6710. * Y \\
  6711. * Z \\
  6712. * W
  6713. * \end{bmatrix} = Q \begin{bmatrix}
  6714. * x \\
  6715. * y \\
  6716. * \texttt{disparity} (x,y) \\
  6717. * z
  6718. * \end{bmatrix}.$$`
  6719. *
  6720. * @sa
  6721. * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
  6722. */
  6723. + (void)reprojectImageTo3D:(Mat*)disparity _3dImage:(Mat*)_3dImage Q:(Mat*)Q handleMissingValues:(BOOL)handleMissingValues ddepth:(int)ddepth NS_SWIFT_NAME(reprojectImageTo3D(disparity:_3dImage:Q:handleMissingValues:ddepth:));
  6724. /**
  6725. * Reprojects a disparity image to 3D space.
  6726. *
  6727. * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
  6728. * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
  6729. * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
  6730. * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
  6731. * being used here.
  6732. * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
  6733. * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
  6734. * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
  6735. * camera's rectified coordinate system.
  6736. * @param Q `$$4 \times 4$$` perspective transformation matrix that can be obtained with
  6737. * REF: stereoRectify.
  6738. * @param handleMissingValues Indicates, whether the function should handle missing values (i.e.
  6739. * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
  6740. * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
  6741. * to 3D points with a very large Z value (currently set to 10000).
  6742. * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
  6743. *
  6744. * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
  6745. * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
  6746. * computes:
  6747. *
  6748. * `$$\begin{bmatrix}
  6749. * X \\
  6750. * Y \\
  6751. * Z \\
  6752. * W
  6753. * \end{bmatrix} = Q \begin{bmatrix}
  6754. * x \\
  6755. * y \\
  6756. * \texttt{disparity} (x,y) \\
  6757. * z
  6758. * \end{bmatrix}.$$`
  6759. *
  6760. * @sa
  6761. * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
  6762. */
  6763. + (void)reprojectImageTo3D:(Mat*)disparity _3dImage:(Mat*)_3dImage Q:(Mat*)Q handleMissingValues:(BOOL)handleMissingValues NS_SWIFT_NAME(reprojectImageTo3D(disparity:_3dImage:Q:handleMissingValues:));
  6764. /**
  6765. * Reprojects a disparity image to 3D space.
  6766. *
  6767. * @param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
  6768. * floating-point disparity image. The values of 8-bit / 16-bit signed formats are assumed to have no
  6769. * fractional bits. If the disparity is 16-bit signed format, as computed by REF: StereoBM or
  6770. * REF: StereoSGBM and maybe other algorithms, it should be divided by 16 (and scaled to float) before
  6771. * being used here.
  6772. * @param _3dImage Output 3-channel floating-point image of the same size as disparity. Each element of
  6773. * _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity map. If one
  6774. * uses Q obtained by REF: stereoRectify, then the returned points are represented in the first
  6775. * camera's rectified coordinate system.
  6776. * @param Q `$$4 \times 4$$` perspective transformation matrix that can be obtained with
  6777. * REF: stereoRectify.
  6778. * points where the disparity was not computed). If handleMissingValues=true, then pixels with the
  6779. * minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
  6780. * to 3D points with a very large Z value (currently set to 10000).
  6781. * depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
  6782. *
  6783. * The function transforms a single-channel disparity map to a 3-channel image representing a 3D
  6784. * surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it
  6785. * computes:
  6786. *
  6787. * `$$\begin{bmatrix}
  6788. * X \\
  6789. * Y \\
  6790. * Z \\
  6791. * W
  6792. * \end{bmatrix} = Q \begin{bmatrix}
  6793. * x \\
  6794. * y \\
  6795. * \texttt{disparity} (x,y) \\
  6796. * z
  6797. * \end{bmatrix}.$$`
  6798. *
  6799. * @sa
  6800. * To reproject a sparse set of points {(x,y,d),...} to 3D space, use perspectiveTransform.
  6801. */
  6802. + (void)reprojectImageTo3D:(Mat*)disparity _3dImage:(Mat*)_3dImage Q:(Mat*)Q NS_SWIFT_NAME(reprojectImageTo3D(disparity:_3dImage:Q:));
  6803. //
  6804. // double cv::sampsonDistance(Mat pt1, Mat pt2, Mat F)
  6805. //
  6806. /**
  6807. * Calculates the Sampson Distance between two points.
  6808. *
  6809. * The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as:
  6810. * `$$
  6811. * sd( \texttt{pt1} , \texttt{pt2} )=
  6812. * \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2}
  6813. * {((\texttt{F} \cdot \texttt{pt1})(0))^2 +
  6814. * ((\texttt{F} \cdot \texttt{pt1})(1))^2 +
  6815. * ((\texttt{F}^t \cdot \texttt{pt2})(0))^2 +
  6816. * ((\texttt{F}^t \cdot \texttt{pt2})(1))^2}
  6817. * $$`
  6818. * The fundamental matrix may be calculated using the #findFundamentalMat function. See CITE: HartleyZ00 11.4.3 for details.
  6819. * @param pt1 first homogeneous 2d point
  6820. * @param pt2 second homogeneous 2d point
  6821. * @param F fundamental matrix
  6822. * @return The computed Sampson distance.
  6823. */
  6824. + (double)sampsonDistance:(Mat*)pt1 pt2:(Mat*)pt2 F:(Mat*)F NS_SWIFT_NAME(sampsonDistance(pt1:pt2:F:));
  6825. //
  6826. // int cv::estimateAffine3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
  6827. //
  6828. /**
  6829. * Computes an optimal affine transformation between two 3D point sets.
  6830. *
  6831. * It computes
  6832. * `$$
  6833. * \begin{bmatrix}
  6834. * x\\
  6835. * y\\
  6836. * z\\
  6837. * \end{bmatrix}
  6838. * =
  6839. * \begin{bmatrix}
  6840. * a_{11} & a_{12} & a_{13}\\
  6841. * a_{21} & a_{22} & a_{23}\\
  6842. * a_{31} & a_{32} & a_{33}\\
  6843. * \end{bmatrix}
  6844. * \begin{bmatrix}
  6845. * X\\
  6846. * Y\\
  6847. * Z\\
  6848. * \end{bmatrix}
  6849. * +
  6850. * \begin{bmatrix}
  6851. * b_1\\
  6852. * b_2\\
  6853. * b_3\\
  6854. * \end{bmatrix}
  6855. * $$`
  6856. *
  6857. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  6858. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  6859. * @param out Output 3D affine transformation matrix `$$3 \times 4$$` of the form
  6860. * `$$
  6861. * \begin{bmatrix}
  6862. * a_{11} & a_{12} & a_{13} & b_1\\
  6863. * a_{21} & a_{22} & a_{23} & b_2\\
  6864. * a_{31} & a_{32} & a_{33} & b_3\\
  6865. * \end{bmatrix}
  6866. * $$`
  6867. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  6868. * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
  6869. * an inlier.
  6870. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  6871. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  6872. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  6873. *
  6874. * The function estimates an optimal 3D affine transformation between two 3D point sets using the
  6875. * RANSAC algorithm.
  6876. */
  6877. + (int)estimateAffine3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers ransacThreshold:(double)ransacThreshold confidence:(double)confidence NS_SWIFT_NAME(estimateAffine3D(src:dst:out:inliers:ransacThreshold:confidence:));
  6878. /**
  6879. * Computes an optimal affine transformation between two 3D point sets.
  6880. *
  6881. * It computes
  6882. * `$$
  6883. * \begin{bmatrix}
  6884. * x\\
  6885. * y\\
  6886. * z\\
  6887. * \end{bmatrix}
  6888. * =
  6889. * \begin{bmatrix}
  6890. * a_{11} & a_{12} & a_{13}\\
  6891. * a_{21} & a_{22} & a_{23}\\
  6892. * a_{31} & a_{32} & a_{33}\\
  6893. * \end{bmatrix}
  6894. * \begin{bmatrix}
  6895. * X\\
  6896. * Y\\
  6897. * Z\\
  6898. * \end{bmatrix}
  6899. * +
  6900. * \begin{bmatrix}
  6901. * b_1\\
  6902. * b_2\\
  6903. * b_3\\
  6904. * \end{bmatrix}
  6905. * $$`
  6906. *
  6907. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  6908. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  6909. * @param out Output 3D affine transformation matrix `$$3 \times 4$$` of the form
  6910. * `$$
  6911. * \begin{bmatrix}
  6912. * a_{11} & a_{12} & a_{13} & b_1\\
  6913. * a_{21} & a_{22} & a_{23} & b_2\\
  6914. * a_{31} & a_{32} & a_{33} & b_3\\
  6915. * \end{bmatrix}
  6916. * $$`
  6917. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  6918. * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
  6919. * an inlier.
  6920. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  6921. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  6922. *
  6923. * The function estimates an optimal 3D affine transformation between two 3D point sets using the
  6924. * RANSAC algorithm.
  6925. */
  6926. + (int)estimateAffine3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers ransacThreshold:(double)ransacThreshold NS_SWIFT_NAME(estimateAffine3D(src:dst:out:inliers:ransacThreshold:));
  6927. /**
  6928. * Computes an optimal affine transformation between two 3D point sets.
  6929. *
  6930. * It computes
  6931. * `$$
  6932. * \begin{bmatrix}
  6933. * x\\
  6934. * y\\
  6935. * z\\
  6936. * \end{bmatrix}
  6937. * =
  6938. * \begin{bmatrix}
  6939. * a_{11} & a_{12} & a_{13}\\
  6940. * a_{21} & a_{22} & a_{23}\\
  6941. * a_{31} & a_{32} & a_{33}\\
  6942. * \end{bmatrix}
  6943. * \begin{bmatrix}
  6944. * X\\
  6945. * Y\\
  6946. * Z\\
  6947. * \end{bmatrix}
  6948. * +
  6949. * \begin{bmatrix}
  6950. * b_1\\
  6951. * b_2\\
  6952. * b_3\\
  6953. * \end{bmatrix}
  6954. * $$`
  6955. *
  6956. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  6957. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  6958. * @param out Output 3D affine transformation matrix `$$3 \times 4$$` of the form
  6959. * `$$
  6960. * \begin{bmatrix}
  6961. * a_{11} & a_{12} & a_{13} & b_1\\
  6962. * a_{21} & a_{22} & a_{23} & b_2\\
  6963. * a_{31} & a_{32} & a_{33} & b_3\\
  6964. * \end{bmatrix}
  6965. * $$`
  6966. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  6967. * an inlier.
  6968. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  6969. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  6970. *
  6971. * The function estimates an optimal 3D affine transformation between two 3D point sets using the
  6972. * RANSAC algorithm.
  6973. */
  6974. + (int)estimateAffine3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers NS_SWIFT_NAME(estimateAffine3D(src:dst:out:inliers:));
  6975. //
  6976. // Mat cv::estimateAffine3D(Mat src, Mat dst, double* scale = nullptr, bool force_rotation = true)
  6977. //
  6978. /**
  6979. * Computes an optimal affine transformation between two 3D point sets.
  6980. *
  6981. * It computes `$$R,s,t$$` minimizing `$$\sum{i} dst_i - c \cdot R \cdot src_i $$`
  6982. * where `$$R$$` is a 3x3 rotation matrix, `$$t$$` is a 3x1 translation vector and `$$s$$` is a
  6983. * scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least .
  6984. * The estimated affine transform has a homogeneous scale which is a subclass of affine
  6985. * transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3
  6986. * points each.
  6987. *
  6988. * @param src First input 3D point set.
  6989. * @param dst Second input 3D point set.
  6990. * @param scale If null is passed, the scale parameter c will be assumed to be 1.0.
  6991. * Else the pointed-to variable will be set to the optimal scale.
  6992. * @param force_rotation If true, the returned rotation will never be a reflection.
  6993. * This might be unwanted, e.g. when optimizing a transform between a right- and a
  6994. * left-handed coordinate system.
  6995. * @return 3D affine transformation matrix `$$3 \times 4$$` of the form
  6996. * `$$T =
  6997. * \begin{bmatrix}
  6998. * R & t\\
  6999. * \end{bmatrix}
  7000. * $$`
  7001. */
  7002. + (Mat*)estimateAffine3D:(Mat*)src dst:(Mat*)dst scale:(double*)scale force_rotation:(BOOL)force_rotation NS_SWIFT_NAME(estimateAffine3D(src:dst:scale:force_rotation:));
  7003. /**
  7004. * Computes an optimal affine transformation between two 3D point sets.
  7005. *
  7006. * It computes `$$R,s,t$$` minimizing `$$\sum{i} dst_i - c \cdot R \cdot src_i $$`
  7007. * where `$$R$$` is a 3x3 rotation matrix, `$$t$$` is a 3x1 translation vector and `$$s$$` is a
  7008. * scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least .
  7009. * The estimated affine transform has a homogeneous scale which is a subclass of affine
  7010. * transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3
  7011. * points each.
  7012. *
  7013. * @param src First input 3D point set.
  7014. * @param dst Second input 3D point set.
  7015. * @param scale If null is passed, the scale parameter c will be assumed to be 1.0.
  7016. * Else the pointed-to variable will be set to the optimal scale.
  7017. * This might be unwanted, e.g. when optimizing a transform between a right- and a
  7018. * left-handed coordinate system.
  7019. * @return 3D affine transformation matrix `$$3 \times 4$$` of the form
  7020. * `$$T =
  7021. * \begin{bmatrix}
  7022. * R & t\\
  7023. * \end{bmatrix}
  7024. * $$`
  7025. */
  7026. + (Mat*)estimateAffine3D:(Mat*)src dst:(Mat*)dst scale:(double*)scale NS_SWIFT_NAME(estimateAffine3D(src:dst:scale:));
  7027. /**
  7028. * Computes an optimal affine transformation between two 3D point sets.
  7029. *
  7030. * It computes `$$R,s,t$$` minimizing `$$\sum{i} dst_i - c \cdot R \cdot src_i $$`
  7031. * where `$$R$$` is a 3x3 rotation matrix, `$$t$$` is a 3x1 translation vector and `$$s$$` is a
  7032. * scalar size value. This is an implementation of the algorithm by Umeyama \cite umeyama1991least .
  7033. * The estimated affine transform has a homogeneous scale which is a subclass of affine
  7034. * transformations with 7 degrees of freedom. The paired point sets need to comprise at least 3
  7035. * points each.
  7036. *
  7037. * @param src First input 3D point set.
  7038. * @param dst Second input 3D point set.
  7039. * Else the pointed-to variable will be set to the optimal scale.
  7040. * This might be unwanted, e.g. when optimizing a transform between a right- and a
  7041. * left-handed coordinate system.
  7042. * @return 3D affine transformation matrix `$$3 \times 4$$` of the form
  7043. * `$$T =
  7044. * \begin{bmatrix}
  7045. * R & t\\
  7046. * \end{bmatrix}
  7047. * $$`
  7048. */
  7049. + (Mat*)estimateAffine3D:(Mat*)src dst:(Mat*)dst NS_SWIFT_NAME(estimateAffine3D(src:dst:));
  7050. //
  7051. // int cv::estimateTranslation3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
  7052. //
  7053. /**
  7054. * Computes an optimal translation between two 3D point sets.
  7055. *
  7056. * It computes
  7057. * `$$
  7058. * \begin{bmatrix}
  7059. * x\\
  7060. * y\\
  7061. * z\\
  7062. * \end{bmatrix}
  7063. * =
  7064. * \begin{bmatrix}
  7065. * X\\
  7066. * Y\\
  7067. * Z\\
  7068. * \end{bmatrix}
  7069. * +
  7070. * \begin{bmatrix}
  7071. * b_1\\
  7072. * b_2\\
  7073. * b_3\\
  7074. * \end{bmatrix}
  7075. * $$`
  7076. *
  7077. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  7078. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  7079. * @param out Output 3D translation vector `$$3 \times 1$$` of the form
  7080. * `$$
  7081. * \begin{bmatrix}
  7082. * b_1 \\
  7083. * b_2 \\
  7084. * b_3 \\
  7085. * \end{bmatrix}
  7086. * $$`
  7087. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7088. * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
  7089. * an inlier.
  7090. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  7091. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7092. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7093. *
  7094. * The function estimates an optimal 3D translation between two 3D point sets using the
  7095. * RANSAC algorithm.
  7096. *
  7097. */
  7098. + (int)estimateTranslation3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers ransacThreshold:(double)ransacThreshold confidence:(double)confidence NS_SWIFT_NAME(estimateTranslation3D(src:dst:out:inliers:ransacThreshold:confidence:));
  7099. /**
  7100. * Computes an optimal translation between two 3D point sets.
  7101. *
  7102. * It computes
  7103. * `$$
  7104. * \begin{bmatrix}
  7105. * x\\
  7106. * y\\
  7107. * z\\
  7108. * \end{bmatrix}
  7109. * =
  7110. * \begin{bmatrix}
  7111. * X\\
  7112. * Y\\
  7113. * Z\\
  7114. * \end{bmatrix}
  7115. * +
  7116. * \begin{bmatrix}
  7117. * b_1\\
  7118. * b_2\\
  7119. * b_3\\
  7120. * \end{bmatrix}
  7121. * $$`
  7122. *
  7123. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  7124. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  7125. * @param out Output 3D translation vector `$$3 \times 1$$` of the form
  7126. * `$$
  7127. * \begin{bmatrix}
  7128. * b_1 \\
  7129. * b_2 \\
  7130. * b_3 \\
  7131. * \end{bmatrix}
  7132. * $$`
  7133. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7134. * @param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
  7135. * an inlier.
  7136. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7137. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7138. *
  7139. * The function estimates an optimal 3D translation between two 3D point sets using the
  7140. * RANSAC algorithm.
  7141. *
  7142. */
  7143. + (int)estimateTranslation3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers ransacThreshold:(double)ransacThreshold NS_SWIFT_NAME(estimateTranslation3D(src:dst:out:inliers:ransacThreshold:));
  7144. /**
  7145. * Computes an optimal translation between two 3D point sets.
  7146. *
  7147. * It computes
  7148. * `$$
  7149. * \begin{bmatrix}
  7150. * x\\
  7151. * y\\
  7152. * z\\
  7153. * \end{bmatrix}
  7154. * =
  7155. * \begin{bmatrix}
  7156. * X\\
  7157. * Y\\
  7158. * Z\\
  7159. * \end{bmatrix}
  7160. * +
  7161. * \begin{bmatrix}
  7162. * b_1\\
  7163. * b_2\\
  7164. * b_3\\
  7165. * \end{bmatrix}
  7166. * $$`
  7167. *
  7168. * @param src First input 3D point set containing `$$(X,Y,Z)$$`.
  7169. * @param dst Second input 3D point set containing `$$(x,y,z)$$`.
  7170. * @param out Output 3D translation vector `$$3 \times 1$$` of the form
  7171. * `$$
  7172. * \begin{bmatrix}
  7173. * b_1 \\
  7174. * b_2 \\
  7175. * b_3 \\
  7176. * \end{bmatrix}
  7177. * $$`
  7178. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7179. * an inlier.
  7180. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7181. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7182. *
  7183. * The function estimates an optimal 3D translation between two 3D point sets using the
  7184. * RANSAC algorithm.
  7185. *
  7186. */
  7187. + (int)estimateTranslation3D:(Mat*)src dst:(Mat*)dst out:(Mat*)out inliers:(Mat*)inliers NS_SWIFT_NAME(estimateTranslation3D(src:dst:out:inliers:));
  7188. //
  7189. // Mat cv::estimateAffine2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
  7190. //
  7191. /**
  7192. * Computes an optimal affine transformation between two 2D point sets.
  7193. *
  7194. * It computes
  7195. * `$$
  7196. * \begin{bmatrix}
  7197. * x\\
  7198. * y\\
  7199. * \end{bmatrix}
  7200. * =
  7201. * \begin{bmatrix}
  7202. * a_{11} & a_{12}\\
  7203. * a_{21} & a_{22}\\
  7204. * \end{bmatrix}
  7205. * \begin{bmatrix}
  7206. * X\\
  7207. * Y\\
  7208. * \end{bmatrix}
  7209. * +
  7210. * \begin{bmatrix}
  7211. * b_1\\
  7212. * b_2\\
  7213. * \end{bmatrix}
  7214. * $$`
  7215. *
  7216. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7217. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7218. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7219. * @param method Robust method used to compute transformation. The following methods are possible:
  7220. * - REF: RANSAC - RANSAC-based robust method
  7221. * - REF: LMEDS - Least-Median robust method
  7222. * RANSAC is the default method.
  7223. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7224. * a point as an inlier. Applies only to RANSAC.
  7225. * @param maxIters The maximum number of robust method iterations.
  7226. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  7227. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7228. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7229. * @param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt).
  7230. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7231. *
  7232. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7233. * could not be estimated. The returned matrix has the following form:
  7234. * `$$
  7235. * \begin{bmatrix}
  7236. * a_{11} & a_{12} & b_1\\
  7237. * a_{21} & a_{22} & b_2\\
  7238. * \end{bmatrix}
  7239. * $$`
  7240. *
  7241. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7242. * selected robust algorithm.
  7243. *
  7244. * The computed transformation is then refined further (using only inliers) with the
  7245. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7246. *
  7247. * NOTE:
  7248. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7249. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7250. * correctly only when there are more than 50% of inliers.
  7251. *
  7252. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7253. */
  7254. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters confidence:(double)confidence refineIters:(size_t)refineIters NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:));
  7255. /**
  7256. * Computes an optimal affine transformation between two 2D point sets.
  7257. *
  7258. * It computes
  7259. * `$$
  7260. * \begin{bmatrix}
  7261. * x\\
  7262. * y\\
  7263. * \end{bmatrix}
  7264. * =
  7265. * \begin{bmatrix}
  7266. * a_{11} & a_{12}\\
  7267. * a_{21} & a_{22}\\
  7268. * \end{bmatrix}
  7269. * \begin{bmatrix}
  7270. * X\\
  7271. * Y\\
  7272. * \end{bmatrix}
  7273. * +
  7274. * \begin{bmatrix}
  7275. * b_1\\
  7276. * b_2\\
  7277. * \end{bmatrix}
  7278. * $$`
  7279. *
  7280. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7281. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7282. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7283. * @param method Robust method used to compute transformation. The following methods are possible:
  7284. * - REF: RANSAC - RANSAC-based robust method
  7285. * - REF: LMEDS - Least-Median robust method
  7286. * RANSAC is the default method.
  7287. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7288. * a point as an inlier. Applies only to RANSAC.
  7289. * @param maxIters The maximum number of robust method iterations.
  7290. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  7291. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7292. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7293. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7294. *
  7295. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7296. * could not be estimated. The returned matrix has the following form:
  7297. * `$$
  7298. * \begin{bmatrix}
  7299. * a_{11} & a_{12} & b_1\\
  7300. * a_{21} & a_{22} & b_2\\
  7301. * \end{bmatrix}
  7302. * $$`
  7303. *
  7304. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7305. * selected robust algorithm.
  7306. *
  7307. * The computed transformation is then refined further (using only inliers) with the
  7308. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7309. *
  7310. * NOTE:
  7311. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7312. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7313. * correctly only when there are more than 50% of inliers.
  7314. *
  7315. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7316. */
  7317. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters confidence:(double)confidence NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:method:ransacReprojThreshold:maxIters:confidence:));
  7318. /**
  7319. * Computes an optimal affine transformation between two 2D point sets.
  7320. *
  7321. * It computes
  7322. * `$$
  7323. * \begin{bmatrix}
  7324. * x\\
  7325. * y\\
  7326. * \end{bmatrix}
  7327. * =
  7328. * \begin{bmatrix}
  7329. * a_{11} & a_{12}\\
  7330. * a_{21} & a_{22}\\
  7331. * \end{bmatrix}
  7332. * \begin{bmatrix}
  7333. * X\\
  7334. * Y\\
  7335. * \end{bmatrix}
  7336. * +
  7337. * \begin{bmatrix}
  7338. * b_1\\
  7339. * b_2\\
  7340. * \end{bmatrix}
  7341. * $$`
  7342. *
  7343. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7344. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7345. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7346. * @param method Robust method used to compute transformation. The following methods are possible:
  7347. * - REF: RANSAC - RANSAC-based robust method
  7348. * - REF: LMEDS - Least-Median robust method
  7349. * RANSAC is the default method.
  7350. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7351. * a point as an inlier. Applies only to RANSAC.
  7352. * @param maxIters The maximum number of robust method iterations.
  7353. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7354. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7355. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7356. *
  7357. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7358. * could not be estimated. The returned matrix has the following form:
  7359. * `$$
  7360. * \begin{bmatrix}
  7361. * a_{11} & a_{12} & b_1\\
  7362. * a_{21} & a_{22} & b_2\\
  7363. * \end{bmatrix}
  7364. * $$`
  7365. *
  7366. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7367. * selected robust algorithm.
  7368. *
  7369. * The computed transformation is then refined further (using only inliers) with the
  7370. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7371. *
  7372. * NOTE:
  7373. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7374. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7375. * correctly only when there are more than 50% of inliers.
  7376. *
  7377. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7378. */
  7379. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:method:ransacReprojThreshold:maxIters:));
  7380. /**
  7381. * Computes an optimal affine transformation between two 2D point sets.
  7382. *
  7383. * It computes
  7384. * `$$
  7385. * \begin{bmatrix}
  7386. * x\\
  7387. * y\\
  7388. * \end{bmatrix}
  7389. * =
  7390. * \begin{bmatrix}
  7391. * a_{11} & a_{12}\\
  7392. * a_{21} & a_{22}\\
  7393. * \end{bmatrix}
  7394. * \begin{bmatrix}
  7395. * X\\
  7396. * Y\\
  7397. * \end{bmatrix}
  7398. * +
  7399. * \begin{bmatrix}
  7400. * b_1\\
  7401. * b_2\\
  7402. * \end{bmatrix}
  7403. * $$`
  7404. *
  7405. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7406. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7407. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7408. * @param method Robust method used to compute transformation. The following methods are possible:
  7409. * - REF: RANSAC - RANSAC-based robust method
  7410. * - REF: LMEDS - Least-Median robust method
  7411. * RANSAC is the default method.
  7412. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7413. * a point as an inlier. Applies only to RANSAC.
  7414. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7415. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7416. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7417. *
  7418. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7419. * could not be estimated. The returned matrix has the following form:
  7420. * `$$
  7421. * \begin{bmatrix}
  7422. * a_{11} & a_{12} & b_1\\
  7423. * a_{21} & a_{22} & b_2\\
  7424. * \end{bmatrix}
  7425. * $$`
  7426. *
  7427. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7428. * selected robust algorithm.
  7429. *
  7430. * The computed transformation is then refined further (using only inliers) with the
  7431. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7432. *
  7433. * NOTE:
  7434. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7435. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7436. * correctly only when there are more than 50% of inliers.
  7437. *
  7438. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7439. */
  7440. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:method:ransacReprojThreshold:));
  7441. /**
  7442. * Computes an optimal affine transformation between two 2D point sets.
  7443. *
  7444. * It computes
  7445. * `$$
  7446. * \begin{bmatrix}
  7447. * x\\
  7448. * y\\
  7449. * \end{bmatrix}
  7450. * =
  7451. * \begin{bmatrix}
  7452. * a_{11} & a_{12}\\
  7453. * a_{21} & a_{22}\\
  7454. * \end{bmatrix}
  7455. * \begin{bmatrix}
  7456. * X\\
  7457. * Y\\
  7458. * \end{bmatrix}
  7459. * +
  7460. * \begin{bmatrix}
  7461. * b_1\\
  7462. * b_2\\
  7463. * \end{bmatrix}
  7464. * $$`
  7465. *
  7466. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7467. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7468. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7469. * @param method Robust method used to compute transformation. The following methods are possible:
  7470. * - REF: RANSAC - RANSAC-based robust method
  7471. * - REF: LMEDS - Least-Median robust method
  7472. * RANSAC is the default method.
  7473. * a point as an inlier. Applies only to RANSAC.
  7474. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7475. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7476. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7477. *
  7478. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7479. * could not be estimated. The returned matrix has the following form:
  7480. * `$$
  7481. * \begin{bmatrix}
  7482. * a_{11} & a_{12} & b_1\\
  7483. * a_{21} & a_{22} & b_2\\
  7484. * \end{bmatrix}
  7485. * $$`
  7486. *
  7487. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7488. * selected robust algorithm.
  7489. *
  7490. * The computed transformation is then refined further (using only inliers) with the
  7491. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7492. *
  7493. * NOTE:
  7494. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7495. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7496. * correctly only when there are more than 50% of inliers.
  7497. *
  7498. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7499. */
  7500. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:method:));
  7501. /**
  7502. * Computes an optimal affine transformation between two 2D point sets.
  7503. *
  7504. * It computes
  7505. * `$$
  7506. * \begin{bmatrix}
  7507. * x\\
  7508. * y\\
  7509. * \end{bmatrix}
  7510. * =
  7511. * \begin{bmatrix}
  7512. * a_{11} & a_{12}\\
  7513. * a_{21} & a_{22}\\
  7514. * \end{bmatrix}
  7515. * \begin{bmatrix}
  7516. * X\\
  7517. * Y\\
  7518. * \end{bmatrix}
  7519. * +
  7520. * \begin{bmatrix}
  7521. * b_1\\
  7522. * b_2\\
  7523. * \end{bmatrix}
  7524. * $$`
  7525. *
  7526. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7527. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7528. * @param inliers Output vector indicating which points are inliers (1-inlier, 0-outlier).
  7529. * - REF: RANSAC - RANSAC-based robust method
  7530. * - REF: LMEDS - Least-Median robust method
  7531. * RANSAC is the default method.
  7532. * a point as an inlier. Applies only to RANSAC.
  7533. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7534. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7535. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7536. *
  7537. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7538. * could not be estimated. The returned matrix has the following form:
  7539. * `$$
  7540. * \begin{bmatrix}
  7541. * a_{11} & a_{12} & b_1\\
  7542. * a_{21} & a_{22} & b_2\\
  7543. * \end{bmatrix}
  7544. * $$`
  7545. *
  7546. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7547. * selected robust algorithm.
  7548. *
  7549. * The computed transformation is then refined further (using only inliers) with the
  7550. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7551. *
  7552. * NOTE:
  7553. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7554. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7555. * correctly only when there are more than 50% of inliers.
  7556. *
  7557. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7558. */
  7559. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers NS_SWIFT_NAME(estimateAffine2D(from:to:inliers:));
  7560. /**
  7561. * Computes an optimal affine transformation between two 2D point sets.
  7562. *
  7563. * It computes
  7564. * `$$
  7565. * \begin{bmatrix}
  7566. * x\\
  7567. * y\\
  7568. * \end{bmatrix}
  7569. * =
  7570. * \begin{bmatrix}
  7571. * a_{11} & a_{12}\\
  7572. * a_{21} & a_{22}\\
  7573. * \end{bmatrix}
  7574. * \begin{bmatrix}
  7575. * X\\
  7576. * Y\\
  7577. * \end{bmatrix}
  7578. * +
  7579. * \begin{bmatrix}
  7580. * b_1\\
  7581. * b_2\\
  7582. * \end{bmatrix}
  7583. * $$`
  7584. *
  7585. * @param from First input 2D point set containing `$$(X,Y)$$`.
  7586. * @param to Second input 2D point set containing `$$(x,y)$$`.
  7587. * - REF: RANSAC - RANSAC-based robust method
  7588. * - REF: LMEDS - Least-Median robust method
  7589. * RANSAC is the default method.
  7590. * a point as an inlier. Applies only to RANSAC.
  7591. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7592. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7593. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7594. *
  7595. * @return Output 2D affine transformation matrix `$$2 \times 3$$` or empty matrix if transformation
  7596. * could not be estimated. The returned matrix has the following form:
  7597. * `$$
  7598. * \begin{bmatrix}
  7599. * a_{11} & a_{12} & b_1\\
  7600. * a_{21} & a_{22} & b_2\\
  7601. * \end{bmatrix}
  7602. * $$`
  7603. *
  7604. * The function estimates an optimal 2D affine transformation between two 2D point sets using the
  7605. * selected robust algorithm.
  7606. *
  7607. * The computed transformation is then refined further (using only inliers) with the
  7608. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7609. *
  7610. * NOTE:
  7611. * The RANSAC method can handle practically any ratio of outliers but needs a threshold to
  7612. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7613. * correctly only when there are more than 50% of inliers.
  7614. *
  7615. * @see `+estimateAffinePartial2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7616. */
  7617. + (Mat*)estimateAffine2D:(Mat*)from to:(Mat*)to NS_SWIFT_NAME(estimateAffine2D(from:to:));
  7618. //
  7619. // Mat cv::estimateAffine2D(Mat pts1, Mat pts2, Mat& inliers, UsacParams params)
  7620. //
  7621. + (Mat*)estimateAffine2D:(Mat*)pts1 pts2:(Mat*)pts2 inliers:(Mat*)inliers params:(UsacParams*)params NS_SWIFT_NAME(estimateAffine2D(pts1:pts2:inliers:params:));
  7622. //
  7623. // Mat cv::estimateAffinePartial2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
  7624. //
  7625. /**
  7626. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7627. * two 2D point sets.
  7628. *
  7629. * @param from First input 2D point set.
  7630. * @param to Second input 2D point set.
  7631. * @param inliers Output vector indicating which points are inliers.
  7632. * @param method Robust method used to compute transformation. The following methods are possible:
  7633. * - REF: RANSAC - RANSAC-based robust method
  7634. * - REF: LMEDS - Least-Median robust method
  7635. * RANSAC is the default method.
  7636. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7637. * a point as an inlier. Applies only to RANSAC.
  7638. * @param maxIters The maximum number of robust method iterations.
  7639. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  7640. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7641. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7642. * @param refineIters Maximum number of iterations of refining algorithm (Levenberg-Marquardt).
  7643. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7644. *
  7645. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7646. * empty matrix if transformation could not be estimated.
  7647. *
  7648. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7649. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7650. * estimation.
  7651. *
  7652. * The computed transformation is then refined further (using only inliers) with the
  7653. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7654. *
  7655. * Estimated transformation matrix is:
  7656. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7657. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7658. * \end{bmatrix} $$`
  7659. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7660. * translations in `$$ x, y $$` axes respectively.
  7661. *
  7662. * NOTE:
  7663. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7664. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7665. * correctly only when there are more than 50% of inliers.
  7666. *
  7667. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7668. */
  7669. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters confidence:(double)confidence refineIters:(size_t)refineIters NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:));
  7670. /**
  7671. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7672. * two 2D point sets.
  7673. *
  7674. * @param from First input 2D point set.
  7675. * @param to Second input 2D point set.
  7676. * @param inliers Output vector indicating which points are inliers.
  7677. * @param method Robust method used to compute transformation. The following methods are possible:
  7678. * - REF: RANSAC - RANSAC-based robust method
  7679. * - REF: LMEDS - Least-Median robust method
  7680. * RANSAC is the default method.
  7681. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7682. * a point as an inlier. Applies only to RANSAC.
  7683. * @param maxIters The maximum number of robust method iterations.
  7684. * @param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
  7685. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7686. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7687. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7688. *
  7689. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7690. * empty matrix if transformation could not be estimated.
  7691. *
  7692. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7693. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7694. * estimation.
  7695. *
  7696. * The computed transformation is then refined further (using only inliers) with the
  7697. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7698. *
  7699. * Estimated transformation matrix is:
  7700. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7701. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7702. * \end{bmatrix} $$`
  7703. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7704. * translations in `$$ x, y $$` axes respectively.
  7705. *
  7706. * NOTE:
  7707. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7708. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7709. * correctly only when there are more than 50% of inliers.
  7710. *
  7711. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7712. */
  7713. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters confidence:(double)confidence NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:method:ransacReprojThreshold:maxIters:confidence:));
  7714. /**
  7715. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7716. * two 2D point sets.
  7717. *
  7718. * @param from First input 2D point set.
  7719. * @param to Second input 2D point set.
  7720. * @param inliers Output vector indicating which points are inliers.
  7721. * @param method Robust method used to compute transformation. The following methods are possible:
  7722. * - REF: RANSAC - RANSAC-based robust method
  7723. * - REF: LMEDS - Least-Median robust method
  7724. * RANSAC is the default method.
  7725. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7726. * a point as an inlier. Applies only to RANSAC.
  7727. * @param maxIters The maximum number of robust method iterations.
  7728. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7729. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7730. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7731. *
  7732. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7733. * empty matrix if transformation could not be estimated.
  7734. *
  7735. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7736. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7737. * estimation.
  7738. *
  7739. * The computed transformation is then refined further (using only inliers) with the
  7740. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7741. *
  7742. * Estimated transformation matrix is:
  7743. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7744. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7745. * \end{bmatrix} $$`
  7746. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7747. * translations in `$$ x, y $$` axes respectively.
  7748. *
  7749. * NOTE:
  7750. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7751. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7752. * correctly only when there are more than 50% of inliers.
  7753. *
  7754. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7755. */
  7756. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold maxIters:(size_t)maxIters NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:method:ransacReprojThreshold:maxIters:));
  7757. /**
  7758. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7759. * two 2D point sets.
  7760. *
  7761. * @param from First input 2D point set.
  7762. * @param to Second input 2D point set.
  7763. * @param inliers Output vector indicating which points are inliers.
  7764. * @param method Robust method used to compute transformation. The following methods are possible:
  7765. * - REF: RANSAC - RANSAC-based robust method
  7766. * - REF: LMEDS - Least-Median robust method
  7767. * RANSAC is the default method.
  7768. * @param ransacReprojThreshold Maximum reprojection error in the RANSAC algorithm to consider
  7769. * a point as an inlier. Applies only to RANSAC.
  7770. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7771. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7772. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7773. *
  7774. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7775. * empty matrix if transformation could not be estimated.
  7776. *
  7777. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7778. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7779. * estimation.
  7780. *
  7781. * The computed transformation is then refined further (using only inliers) with the
  7782. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7783. *
  7784. * Estimated transformation matrix is:
  7785. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7786. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7787. * \end{bmatrix} $$`
  7788. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7789. * translations in `$$ x, y $$` axes respectively.
  7790. *
  7791. * NOTE:
  7792. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7793. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7794. * correctly only when there are more than 50% of inliers.
  7795. *
  7796. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7797. */
  7798. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method ransacReprojThreshold:(double)ransacReprojThreshold NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:method:ransacReprojThreshold:));
  7799. /**
  7800. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7801. * two 2D point sets.
  7802. *
  7803. * @param from First input 2D point set.
  7804. * @param to Second input 2D point set.
  7805. * @param inliers Output vector indicating which points are inliers.
  7806. * @param method Robust method used to compute transformation. The following methods are possible:
  7807. * - REF: RANSAC - RANSAC-based robust method
  7808. * - REF: LMEDS - Least-Median robust method
  7809. * RANSAC is the default method.
  7810. * a point as an inlier. Applies only to RANSAC.
  7811. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7812. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7813. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7814. *
  7815. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7816. * empty matrix if transformation could not be estimated.
  7817. *
  7818. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7819. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7820. * estimation.
  7821. *
  7822. * The computed transformation is then refined further (using only inliers) with the
  7823. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7824. *
  7825. * Estimated transformation matrix is:
  7826. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7827. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7828. * \end{bmatrix} $$`
  7829. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7830. * translations in `$$ x, y $$` axes respectively.
  7831. *
  7832. * NOTE:
  7833. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7834. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7835. * correctly only when there are more than 50% of inliers.
  7836. *
  7837. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7838. */
  7839. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers method:(int)method NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:method:));
  7840. /**
  7841. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7842. * two 2D point sets.
  7843. *
  7844. * @param from First input 2D point set.
  7845. * @param to Second input 2D point set.
  7846. * @param inliers Output vector indicating which points are inliers.
  7847. * - REF: RANSAC - RANSAC-based robust method
  7848. * - REF: LMEDS - Least-Median robust method
  7849. * RANSAC is the default method.
  7850. * a point as an inlier. Applies only to RANSAC.
  7851. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7852. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7853. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7854. *
  7855. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7856. * empty matrix if transformation could not be estimated.
  7857. *
  7858. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7859. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7860. * estimation.
  7861. *
  7862. * The computed transformation is then refined further (using only inliers) with the
  7863. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7864. *
  7865. * Estimated transformation matrix is:
  7866. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7867. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7868. * \end{bmatrix} $$`
  7869. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7870. * translations in `$$ x, y $$` axes respectively.
  7871. *
  7872. * NOTE:
  7873. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7874. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7875. * correctly only when there are more than 50% of inliers.
  7876. *
  7877. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7878. */
  7879. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to inliers:(Mat*)inliers NS_SWIFT_NAME(estimateAffinePartial2D(from:to:inliers:));
  7880. /**
  7881. * Computes an optimal limited affine transformation with 4 degrees of freedom between
  7882. * two 2D point sets.
  7883. *
  7884. * @param from First input 2D point set.
  7885. * @param to Second input 2D point set.
  7886. * - REF: RANSAC - RANSAC-based robust method
  7887. * - REF: LMEDS - Least-Median robust method
  7888. * RANSAC is the default method.
  7889. * a point as an inlier. Applies only to RANSAC.
  7890. * between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
  7891. * significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
  7892. * Passing 0 will disable refining, so the output matrix will be output of robust method.
  7893. *
  7894. * @return Output 2D affine transformation (4 degrees of freedom) matrix `$$2 \times 3$$` or
  7895. * empty matrix if transformation could not be estimated.
  7896. *
  7897. * The function estimates an optimal 2D affine transformation with 4 degrees of freedom limited to
  7898. * combinations of translation, rotation, and uniform scaling. Uses the selected algorithm for robust
  7899. * estimation.
  7900. *
  7901. * The computed transformation is then refined further (using only inliers) with the
  7902. * Levenberg-Marquardt method to reduce the re-projection error even more.
  7903. *
  7904. * Estimated transformation matrix is:
  7905. * `$$ \begin{bmatrix} \cos(\theta) \cdot s & -\sin(\theta) \cdot s & t_x \\
  7906. * \sin(\theta) \cdot s & \cos(\theta) \cdot s & t_y
  7907. * \end{bmatrix} $$`
  7908. * Where `$$ \theta $$` is the rotation angle, `$$ s $$` the scaling factor and `$$ t_x, t_y $$` are
  7909. * translations in `$$ x, y $$` axes respectively.
  7910. *
  7911. * NOTE:
  7912. * The RANSAC method can handle practically any ratio of outliers but need a threshold to
  7913. * distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
  7914. * correctly only when there are more than 50% of inliers.
  7915. *
  7916. * @see `+estimateAffine2D:to:inliers:method:ransacReprojThreshold:maxIters:confidence:refineIters:`, `getAffineTransform`
  7917. */
  7918. + (Mat*)estimateAffinePartial2D:(Mat*)from to:(Mat*)to NS_SWIFT_NAME(estimateAffinePartial2D(from:to:));
  7919. //
  7920. // int cv::decomposeHomographyMat(Mat H, Mat K, vector_Mat& rotations, vector_Mat& translations, vector_Mat& normals)
  7921. //
  7922. /**
  7923. * Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
  7924. *
  7925. * @param H The input homography matrix between two images.
  7926. * @param K The input camera intrinsic matrix.
  7927. * @param rotations Array of rotation matrices.
  7928. * @param translations Array of translation matrices.
  7929. * @param normals Array of plane normal matrices.
  7930. *
  7931. * This function extracts relative camera motion between two views of a planar object and returns up to
  7932. * four mathematical solution tuples of rotation, translation, and plane normal. The decomposition of
  7933. * the homography matrix H is described in detail in CITE: Malis2007.
  7934. *
  7935. * If the homography H, induced by the plane, gives the constraint
  7936. * `$$s_i \vecthree{x'_i}{y'_i}{1} \sim H \vecthree{x_i}{y_i}{1}$$` on the source image points
  7937. * `$$p_i$$` and the destination image points `$$p'_i$$`, then the tuple of rotations[k] and
  7938. * translations[k] is a change of basis from the source camera's coordinate system to the destination
  7939. * camera's coordinate system. However, by decomposing H, one can only get the translation normalized
  7940. * by the (typically unknown) depth of the scene, i.e. its direction but with normalized length.
  7941. *
  7942. * If point correspondences are available, at least two solutions may further be invalidated, by
  7943. * applying positive depth constraint, i.e. all points must be in front of the camera.
  7944. */
  7945. + (int)decomposeHomographyMat:(Mat*)H K:(Mat*)K rotations:(NSMutableArray<Mat*>*)rotations translations:(NSMutableArray<Mat*>*)translations normals:(NSMutableArray<Mat*>*)normals NS_SWIFT_NAME(decomposeHomographyMat(H:K:rotations:translations:normals:));
  7946. //
  7947. // void cv::filterHomographyDecompByVisibleRefpoints(vector_Mat rotations, vector_Mat normals, Mat beforePoints, Mat afterPoints, Mat& possibleSolutions, Mat pointsMask = Mat())
  7948. //
  7949. /**
  7950. * Filters homography decompositions based on additional information.
  7951. *
  7952. * @param rotations Vector of rotation matrices.
  7953. * @param normals Vector of plane normal matrices.
  7954. * @param beforePoints Vector of (rectified) visible reference points before the homography is applied
  7955. * @param afterPoints Vector of (rectified) visible reference points after the homography is applied
  7956. * @param possibleSolutions Vector of int indices representing the viable solution set after filtering
  7957. * @param pointsMask optional Mat/Vector of 8u type representing the mask for the inliers as given by the #findHomography function
  7958. *
  7959. * This function is intended to filter the output of the #decomposeHomographyMat based on additional
  7960. * information as described in CITE: Malis2007 . The summary of the method: the #decomposeHomographyMat function
  7961. * returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the
  7962. * sets of points visible in the camera frame before and after the homography transformation is applied,
  7963. * we can determine which are the true potential solutions and which are the opposites by verifying which
  7964. * homographies are consistent with all visible reference points being in front of the camera. The inputs
  7965. * are left unchanged; the filtered solution set is returned as indices into the existing one.
  7966. */
  7967. + (void)filterHomographyDecompByVisibleRefpoints:(NSArray<Mat*>*)rotations normals:(NSArray<Mat*>*)normals beforePoints:(Mat*)beforePoints afterPoints:(Mat*)afterPoints possibleSolutions:(Mat*)possibleSolutions pointsMask:(Mat*)pointsMask NS_SWIFT_NAME(filterHomographyDecompByVisibleRefpoints(rotations:normals:beforePoints:afterPoints:possibleSolutions:pointsMask:));
  7968. /**
  7969. * Filters homography decompositions based on additional information.
  7970. *
  7971. * @param rotations Vector of rotation matrices.
  7972. * @param normals Vector of plane normal matrices.
  7973. * @param beforePoints Vector of (rectified) visible reference points before the homography is applied
  7974. * @param afterPoints Vector of (rectified) visible reference points after the homography is applied
  7975. * @param possibleSolutions Vector of int indices representing the viable solution set after filtering
  7976. *
  7977. * This function is intended to filter the output of the #decomposeHomographyMat based on additional
  7978. * information as described in CITE: Malis2007 . The summary of the method: the #decomposeHomographyMat function
  7979. * returns 2 unique solutions and their "opposites" for a total of 4 solutions. If we have access to the
  7980. * sets of points visible in the camera frame before and after the homography transformation is applied,
  7981. * we can determine which are the true potential solutions and which are the opposites by verifying which
  7982. * homographies are consistent with all visible reference points being in front of the camera. The inputs
  7983. * are left unchanged; the filtered solution set is returned as indices into the existing one.
  7984. */
  7985. + (void)filterHomographyDecompByVisibleRefpoints:(NSArray<Mat*>*)rotations normals:(NSArray<Mat*>*)normals beforePoints:(Mat*)beforePoints afterPoints:(Mat*)afterPoints possibleSolutions:(Mat*)possibleSolutions NS_SWIFT_NAME(filterHomographyDecompByVisibleRefpoints(rotations:normals:beforePoints:afterPoints:possibleSolutions:));
  7986. //
  7987. // void cv::undistort(Mat src, Mat& dst, Mat cameraMatrix, Mat distCoeffs, Mat newCameraMatrix = Mat())
  7988. //
  7989. /**
  7990. * Transforms an image to compensate for lens distortion.
  7991. *
  7992. * The function transforms an image to compensate radial and tangential lens distortion.
  7993. *
  7994. * The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap
  7995. * (with bilinear interpolation). See the former function for details of the transformation being
  7996. * performed.
  7997. *
  7998. * Those pixels in the destination image, for which there is no correspondent pixels in the source
  7999. * image, are filled with zeros (black color).
  8000. *
  8001. * A particular subset of the source image that will be visible in the corrected image can be regulated
  8002. * by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate
  8003. * newCameraMatrix depending on your requirements.
  8004. *
  8005. * The camera matrix and the distortion parameters can be determined using #calibrateCamera. If
  8006. * the resolution of images is different from the resolution used at the calibration stage, `$$f_x,
  8007. * f_y, c_x$$` and `$$c_y$$` need to be scaled accordingly, while the distortion coefficients remain
  8008. * the same.
  8009. *
  8010. * @param src Input (distorted) image.
  8011. * @param dst Output (corrected) image that has the same size and type as src .
  8012. * @param cameraMatrix Input camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8013. * @param distCoeffs Input vector of distortion coefficients
  8014. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8015. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8016. * @param newCameraMatrix Camera matrix of the distorted image. By default, it is the same as
  8017. * cameraMatrix but you may additionally scale and shift the result by using a different matrix.
  8018. */
  8019. + (void)undistort:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs newCameraMatrix:(Mat*)newCameraMatrix NS_SWIFT_NAME(undistort(src:dst:cameraMatrix:distCoeffs:newCameraMatrix:));
  8020. /**
  8021. * Transforms an image to compensate for lens distortion.
  8022. *
  8023. * The function transforms an image to compensate radial and tangential lens distortion.
  8024. *
  8025. * The function is simply a combination of #initUndistortRectifyMap (with unity R ) and #remap
  8026. * (with bilinear interpolation). See the former function for details of the transformation being
  8027. * performed.
  8028. *
  8029. * Those pixels in the destination image, for which there is no correspondent pixels in the source
  8030. * image, are filled with zeros (black color).
  8031. *
  8032. * A particular subset of the source image that will be visible in the corrected image can be regulated
  8033. * by newCameraMatrix. You can use #getOptimalNewCameraMatrix to compute the appropriate
  8034. * newCameraMatrix depending on your requirements.
  8035. *
  8036. * The camera matrix and the distortion parameters can be determined using #calibrateCamera. If
  8037. * the resolution of images is different from the resolution used at the calibration stage, `$$f_x,
  8038. * f_y, c_x$$` and `$$c_y$$` need to be scaled accordingly, while the distortion coefficients remain
  8039. * the same.
  8040. *
  8041. * @param src Input (distorted) image.
  8042. * @param dst Output (corrected) image that has the same size and type as src .
  8043. * @param cameraMatrix Input camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8044. * @param distCoeffs Input vector of distortion coefficients
  8045. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8046. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8047. * cameraMatrix but you may additionally scale and shift the result by using a different matrix.
  8048. */
  8049. + (void)undistort:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs NS_SWIFT_NAME(undistort(src:dst:cameraMatrix:distCoeffs:));
  8050. //
  8051. // void cv::initUndistortRectifyMap(Mat cameraMatrix, Mat distCoeffs, Mat R, Mat newCameraMatrix, Size size, int m1type, Mat& map1, Mat& map2)
  8052. //
  8053. /**
  8054. * Computes the undistortion and rectification transformation map.
  8055. *
  8056. * The function computes the joint undistortion and rectification transformation and represents the
  8057. * result in the form of maps for #remap. The undistorted image looks like original, as if it is
  8058. * captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a
  8059. * monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by
  8060. * #getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera,
  8061. * newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify .
  8062. *
  8063. * Also, this new camera is oriented differently in the coordinate space, according to R. That, for
  8064. * example, helps to align two heads of a stereo camera so that the epipolar lines on both images
  8065. * become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera).
  8066. *
  8067. * The function actually builds the maps for the inverse mapping algorithm that is used by #remap. That
  8068. * is, for each pixel `$$(u, v)$$` in the destination (corrected and rectified) image, the function
  8069. * computes the corresponding coordinates in the source image (that is, in the original image from
  8070. * camera). The following process is applied:
  8071. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} }
  8072. * \begin{array}{l}
  8073. * x \leftarrow (u - {c'}_x)/{f'}_x \\
  8074. * y \leftarrow (v - {c'}_y)/{f'}_y \\
  8075. * {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\
  8076. * x' \leftarrow X/W \\
  8077. * y' \leftarrow Y/W \\
  8078. * r^2 \leftarrow x'^2 + y'^2 \\
  8079. * x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
  8080. * + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\
  8081. * y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
  8082. * + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\
  8083. * s\vecthree{x'''}{y'''}{1} =
  8084. * \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)}
  8085. * {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
  8086. * {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\
  8087. * map_x(u,v) \leftarrow x''' f_x + c_x \\
  8088. * map_y(u,v) \leftarrow y''' f_y + c_y
  8089. * \end{array}
  8090. * $$`
  8091. * where `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8092. * are the distortion coefficients.
  8093. *
  8094. * In case of a stereo camera, this function is called twice: once for each camera head, after
  8095. * #stereoRectify, which in its turn is called after #stereoCalibrate. But if the stereo camera
  8096. * was not calibrated, it is still possible to compute the rectification transformations directly from
  8097. * the fundamental matrix using #stereoRectifyUncalibrated. For each camera, the function computes
  8098. * homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D
  8099. * space. R can be computed from H as
  8100. * `$$\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}$$`
  8101. * where cameraMatrix can be chosen arbitrarily.
  8102. *
  8103. * @param cameraMatrix Input camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8104. * @param distCoeffs Input vector of distortion coefficients
  8105. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8106. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8107. * @param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2 ,
  8108. * computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
  8109. * is assumed. In #initUndistortRectifyMap R assumed to be an identity matrix.
  8110. * @param newCameraMatrix New camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}$$`.
  8111. * @param size Undistorted image size.
  8112. * @param m1type Type of the first output map that can be CV_32FC1, CV_32FC2 or CV_16SC2, see #convertMaps
  8113. * @param map1 The first output map.
  8114. * @param map2 The second output map.
  8115. */
  8116. + (void)initUndistortRectifyMap:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs R:(Mat*)R newCameraMatrix:(Mat*)newCameraMatrix size:(Size2i*)size m1type:(int)m1type map1:(Mat*)map1 map2:(Mat*)map2 NS_SWIFT_NAME(initUndistortRectifyMap(cameraMatrix:distCoeffs:R:newCameraMatrix:size:m1type:map1:map2:));
  8117. //
  8118. // void cv::initInverseRectificationMap(Mat cameraMatrix, Mat distCoeffs, Mat R, Mat newCameraMatrix, Size size, int m1type, Mat& map1, Mat& map2)
  8119. //
  8120. /**
  8121. * Computes the projection and inverse-rectification transformation map. In essense, this is the inverse of
  8122. * #initUndistortRectifyMap to accomodate stereo-rectification of projectors ('inverse-cameras') in projector-camera pairs.
  8123. *
  8124. * The function computes the joint projection and inverse rectification transformation and represents the
  8125. * result in the form of maps for #remap. The projected image looks like a distorted version of the original which,
  8126. * once projected by a projector, should visually match the original. In case of a monocular camera, newCameraMatrix
  8127. * is usually equal to cameraMatrix, or it can be computed by
  8128. * #getOptimalNewCameraMatrix for a better control over scaling. In case of a projector-camera pair,
  8129. * newCameraMatrix is normally set to P1 or P2 computed by #stereoRectify .
  8130. *
  8131. * The projector is oriented differently in the coordinate space, according to R. In case of projector-camera pairs,
  8132. * this helps align the projector (in the same manner as #initUndistortRectifyMap for the camera) to create a stereo-rectified pair. This
  8133. * allows epipolar lines on both images to become horizontal and have the same y-coordinate (in case of a horizontally aligned projector-camera pair).
  8134. *
  8135. * The function builds the maps for the inverse mapping algorithm that is used by #remap. That
  8136. * is, for each pixel `$$(u, v)$$` in the destination (projected and inverse-rectified) image, the function
  8137. * computes the corresponding coordinates in the source image (that is, in the original digital image). The following process is applied:
  8138. *
  8139. * `$$
  8140. * \begin{array}{l}
  8141. * \text{newCameraMatrix}\\
  8142. * x \leftarrow (u - {c'}_x)/{f'}_x \\
  8143. * y \leftarrow (v - {c'}_y)/{f'}_y \\
  8144. *
  8145. * \\\text{Undistortion}
  8146. * \\\scriptsize{\textit{though equation shown is for radial undistortion, function implements cv::undistortPoints()}}\\
  8147. * r^2 \leftarrow x^2 + y^2 \\
  8148. * \theta \leftarrow \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}\\
  8149. * x' \leftarrow \frac{x}{\theta} \\
  8150. * y' \leftarrow \frac{y}{\theta} \\
  8151. *
  8152. * \\\text{Rectification}\\
  8153. * {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\
  8154. * x'' \leftarrow X/W \\
  8155. * y'' \leftarrow Y/W \\
  8156. *
  8157. * \\\text{cameraMatrix}\\
  8158. * map_x(u,v) \leftarrow x'' f_x + c_x \\
  8159. * map_y(u,v) \leftarrow y'' f_y + c_y
  8160. * \end{array}
  8161. * $$`
  8162. * where `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8163. * are the distortion coefficients vector distCoeffs.
  8164. *
  8165. * In case of a stereo-rectified projector-camera pair, this function is called for the projector while #initUndistortRectifyMap is called for the camera head.
  8166. * This is done after #stereoRectify, which in turn is called after #stereoCalibrate. If the projector-camera pair
  8167. * is not calibrated, it is still possible to compute the rectification transformations directly from
  8168. * the fundamental matrix using #stereoRectifyUncalibrated. For the projector and camera, the function computes
  8169. * homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D
  8170. * space. R can be computed from H as
  8171. * `$$\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}$$`
  8172. * where cameraMatrix can be chosen arbitrarily.
  8173. *
  8174. * @param cameraMatrix Input camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8175. * @param distCoeffs Input vector of distortion coefficients
  8176. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8177. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8178. * @param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2,
  8179. * computed by #stereoRectify can be passed here. If the matrix is empty, the identity transformation
  8180. * is assumed.
  8181. * @param newCameraMatrix New camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}$$`.
  8182. * @param size Distorted image size.
  8183. * @param m1type Type of the first output map. Can be CV_32FC1, CV_32FC2 or CV_16SC2, see #convertMaps
  8184. * @param map1 The first output map for #remap.
  8185. * @param map2 The second output map for #remap.
  8186. */
  8187. + (void)initInverseRectificationMap:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs R:(Mat*)R newCameraMatrix:(Mat*)newCameraMatrix size:(Size2i*)size m1type:(int)m1type map1:(Mat*)map1 map2:(Mat*)map2 NS_SWIFT_NAME(initInverseRectificationMap(cameraMatrix:distCoeffs:R:newCameraMatrix:size:m1type:map1:map2:));
  8188. //
  8189. // Mat cv::getDefaultNewCameraMatrix(Mat cameraMatrix, Size imgsize = Size(), bool centerPrincipalPoint = false)
  8190. //
  8191. /**
  8192. * Returns the default new camera matrix.
  8193. *
  8194. * The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
  8195. * centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true).
  8196. *
  8197. * In the latter case, the new camera matrix will be:
  8198. *
  8199. * `$$\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,$$`
  8200. *
  8201. * where `$$f_x$$` and `$$f_y$$` are `$$(0,0)$$` and `$$(1,1)$$` elements of cameraMatrix, respectively.
  8202. *
  8203. * By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not
  8204. * move the principal point. However, when you work with stereo, it is important to move the principal
  8205. * points in both views to the same y-coordinate (which is required by most of stereo correspondence
  8206. * algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for
  8207. * each view where the principal points are located at the center.
  8208. *
  8209. * @param cameraMatrix Input camera matrix.
  8210. * @param imgsize Camera view image size in pixels.
  8211. * @param centerPrincipalPoint Location of the principal point in the new camera matrix. The
  8212. * parameter indicates whether this location should be at the image center or not.
  8213. */
  8214. + (Mat*)getDefaultNewCameraMatrix:(Mat*)cameraMatrix imgsize:(Size2i*)imgsize centerPrincipalPoint:(BOOL)centerPrincipalPoint NS_SWIFT_NAME(getDefaultNewCameraMatrix(cameraMatrix:imgsize:centerPrincipalPoint:));
  8215. /**
  8216. * Returns the default new camera matrix.
  8217. *
  8218. * The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
  8219. * centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true).
  8220. *
  8221. * In the latter case, the new camera matrix will be:
  8222. *
  8223. * `$$\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,$$`
  8224. *
  8225. * where `$$f_x$$` and `$$f_y$$` are `$$(0,0)$$` and `$$(1,1)$$` elements of cameraMatrix, respectively.
  8226. *
  8227. * By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not
  8228. * move the principal point. However, when you work with stereo, it is important to move the principal
  8229. * points in both views to the same y-coordinate (which is required by most of stereo correspondence
  8230. * algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for
  8231. * each view where the principal points are located at the center.
  8232. *
  8233. * @param cameraMatrix Input camera matrix.
  8234. * @param imgsize Camera view image size in pixels.
  8235. * parameter indicates whether this location should be at the image center or not.
  8236. */
  8237. + (Mat*)getDefaultNewCameraMatrix:(Mat*)cameraMatrix imgsize:(Size2i*)imgsize NS_SWIFT_NAME(getDefaultNewCameraMatrix(cameraMatrix:imgsize:));
  8238. /**
  8239. * Returns the default new camera matrix.
  8240. *
  8241. * The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
  8242. * centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true).
  8243. *
  8244. * In the latter case, the new camera matrix will be:
  8245. *
  8246. * `$$\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,$$`
  8247. *
  8248. * where `$$f_x$$` and `$$f_y$$` are `$$(0,0)$$` and `$$(1,1)$$` elements of cameraMatrix, respectively.
  8249. *
  8250. * By default, the undistortion functions in OpenCV (see #initUndistortRectifyMap, #undistort) do not
  8251. * move the principal point. However, when you work with stereo, it is important to move the principal
  8252. * points in both views to the same y-coordinate (which is required by most of stereo correspondence
  8253. * algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for
  8254. * each view where the principal points are located at the center.
  8255. *
  8256. * @param cameraMatrix Input camera matrix.
  8257. * parameter indicates whether this location should be at the image center or not.
  8258. */
  8259. + (Mat*)getDefaultNewCameraMatrix:(Mat*)cameraMatrix NS_SWIFT_NAME(getDefaultNewCameraMatrix(cameraMatrix:));
  8260. //
  8261. // void cv::undistortPoints(Mat src, Mat& dst, Mat cameraMatrix, Mat distCoeffs, Mat R = Mat(), Mat P = Mat())
  8262. //
  8263. /**
  8264. * Computes the ideal point coordinates from the observed point coordinates.
  8265. *
  8266. * The function is similar to #undistort and #initUndistortRectifyMap but it operates on a
  8267. * sparse set of points instead of a raster image. Also the function performs a reverse transformation
  8268. * to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a
  8269. * planar object, it does, up to a translation vector, if the proper R is specified.
  8270. *
  8271. * For each observed point coordinate `$$(u, v)$$` the function computes:
  8272. * `$$
  8273. * \begin{array}{l}
  8274. * x^{"} \leftarrow (u - c_x)/f_x \\
  8275. * y^{"} \leftarrow (v - c_y)/f_y \\
  8276. * (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\
  8277. * {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\
  8278. * x \leftarrow X/W \\
  8279. * y \leftarrow Y/W \\
  8280. * \text{only performed if P is specified:} \\
  8281. * u' \leftarrow x {f'}_x + {c'}_x \\
  8282. * v' \leftarrow y {f'}_y + {c'}_y
  8283. * \end{array}
  8284. * $$`
  8285. *
  8286. * where *undistort* is an approximate iterative algorithm that estimates the normalized original
  8287. * point coordinates out of the normalized distorted point coordinates ("normalized" means that the
  8288. * coordinates do not depend on the camera matrix).
  8289. *
  8290. * The function can be used for both a stereo camera head or a monocular camera (when R is empty).
  8291. * @param src Observed point coordinates, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel (CV_32FC2 or CV_64FC2) (or
  8292. * vector\<Point2f\> ).
  8293. * @param dst Output ideal point coordinates (1xN/Nx1 2-channel or vector\<Point2f\> ) after undistortion and reverse perspective
  8294. * transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
  8295. * @param cameraMatrix Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8296. * @param distCoeffs Input vector of distortion coefficients
  8297. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8298. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8299. * @param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by
  8300. * #stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
  8301. * @param P New camera matrix (3x3) or new projection matrix (3x4) `$$\begin{bmatrix} {f'}_x & 0 & {c'}_x & t_x \\ 0 & {f'}_y & {c'}_y & t_y \\ 0 & 0 & 1 & t_z \end{bmatrix}$$`. P1 or P2 computed by
  8302. * #stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.
  8303. */
  8304. + (void)undistortPoints:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs R:(Mat*)R P:(Mat*)P NS_SWIFT_NAME(undistortPoints(src:dst:cameraMatrix:distCoeffs:R:P:));
  8305. /**
  8306. * Computes the ideal point coordinates from the observed point coordinates.
  8307. *
  8308. * The function is similar to #undistort and #initUndistortRectifyMap but it operates on a
  8309. * sparse set of points instead of a raster image. Also the function performs a reverse transformation
  8310. * to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a
  8311. * planar object, it does, up to a translation vector, if the proper R is specified.
  8312. *
  8313. * For each observed point coordinate `$$(u, v)$$` the function computes:
  8314. * `$$
  8315. * \begin{array}{l}
  8316. * x^{"} \leftarrow (u - c_x)/f_x \\
  8317. * y^{"} \leftarrow (v - c_y)/f_y \\
  8318. * (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\
  8319. * {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\
  8320. * x \leftarrow X/W \\
  8321. * y \leftarrow Y/W \\
  8322. * \text{only performed if P is specified:} \\
  8323. * u' \leftarrow x {f'}_x + {c'}_x \\
  8324. * v' \leftarrow y {f'}_y + {c'}_y
  8325. * \end{array}
  8326. * $$`
  8327. *
  8328. * where *undistort* is an approximate iterative algorithm that estimates the normalized original
  8329. * point coordinates out of the normalized distorted point coordinates ("normalized" means that the
  8330. * coordinates do not depend on the camera matrix).
  8331. *
  8332. * The function can be used for both a stereo camera head or a monocular camera (when R is empty).
  8333. * @param src Observed point coordinates, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel (CV_32FC2 or CV_64FC2) (or
  8334. * vector\<Point2f\> ).
  8335. * @param dst Output ideal point coordinates (1xN/Nx1 2-channel or vector\<Point2f\> ) after undistortion and reverse perspective
  8336. * transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
  8337. * @param cameraMatrix Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8338. * @param distCoeffs Input vector of distortion coefficients
  8339. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8340. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8341. * @param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by
  8342. * #stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
  8343. * #stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.
  8344. */
  8345. + (void)undistortPoints:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs R:(Mat*)R NS_SWIFT_NAME(undistortPoints(src:dst:cameraMatrix:distCoeffs:R:));
  8346. /**
  8347. * Computes the ideal point coordinates from the observed point coordinates.
  8348. *
  8349. * The function is similar to #undistort and #initUndistortRectifyMap but it operates on a
  8350. * sparse set of points instead of a raster image. Also the function performs a reverse transformation
  8351. * to #projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a
  8352. * planar object, it does, up to a translation vector, if the proper R is specified.
  8353. *
  8354. * For each observed point coordinate `$$(u, v)$$` the function computes:
  8355. * `$$
  8356. * \begin{array}{l}
  8357. * x^{"} \leftarrow (u - c_x)/f_x \\
  8358. * y^{"} \leftarrow (v - c_y)/f_y \\
  8359. * (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\
  8360. * {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\
  8361. * x \leftarrow X/W \\
  8362. * y \leftarrow Y/W \\
  8363. * \text{only performed if P is specified:} \\
  8364. * u' \leftarrow x {f'}_x + {c'}_x \\
  8365. * v' \leftarrow y {f'}_y + {c'}_y
  8366. * \end{array}
  8367. * $$`
  8368. *
  8369. * where *undistort* is an approximate iterative algorithm that estimates the normalized original
  8370. * point coordinates out of the normalized distorted point coordinates ("normalized" means that the
  8371. * coordinates do not depend on the camera matrix).
  8372. *
  8373. * The function can be used for both a stereo camera head or a monocular camera (when R is empty).
  8374. * @param src Observed point coordinates, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel (CV_32FC2 or CV_64FC2) (or
  8375. * vector\<Point2f\> ).
  8376. * @param dst Output ideal point coordinates (1xN/Nx1 2-channel or vector\<Point2f\> ) after undistortion and reverse perspective
  8377. * transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
  8378. * @param cameraMatrix Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8379. * @param distCoeffs Input vector of distortion coefficients
  8380. * `$$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])$$`
  8381. * of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  8382. * #stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
  8383. * #stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.
  8384. */
  8385. + (void)undistortPoints:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs NS_SWIFT_NAME(undistortPoints(src:dst:cameraMatrix:distCoeffs:));
  8386. //
  8387. // void cv::undistortPoints(Mat src, Mat& dst, Mat cameraMatrix, Mat distCoeffs, Mat R, Mat P, TermCriteria criteria)
  8388. //
  8389. /**
  8390. *
  8391. * NOTE: Default version of #undistortPoints does 5 iterations to compute undistorted points.
  8392. */
  8393. + (void)undistortPointsIter:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs R:(Mat*)R P:(Mat*)P criteria:(TermCriteria*)criteria NS_SWIFT_NAME(undistortPoints(src:dst:cameraMatrix:distCoeffs:R:P:criteria:));
  8394. //
  8395. // void cv::undistortImagePoints(Mat src, Mat& dst, Mat cameraMatrix, Mat distCoeffs, TermCriteria arg1 = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 0.01))
  8396. //
  8397. /**
  8398. * Compute undistorted image points position
  8399. *
  8400. * @param src Observed points position, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel (CV_32FC2 or
  8401. * CV_64FC2) (or vector\<Point2f\> ).
  8402. * @param dst Output undistorted points position (1xN/Nx1 2-channel or vector\<Point2f\> ).
  8403. * @param cameraMatrix Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8404. * @param distCoeffs Distortion coefficients
  8405. */
  8406. + (void)undistortImagePoints:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs arg1:(TermCriteria*)arg1 NS_SWIFT_NAME(undistortImagePoints(src:dst:cameraMatrix:distCoeffs:arg1:));
  8407. /**
  8408. * Compute undistorted image points position
  8409. *
  8410. * @param src Observed points position, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel (CV_32FC2 or
  8411. * CV_64FC2) (or vector\<Point2f\> ).
  8412. * @param dst Output undistorted points position (1xN/Nx1 2-channel or vector\<Point2f\> ).
  8413. * @param cameraMatrix Camera matrix `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}$$` .
  8414. * @param distCoeffs Distortion coefficients
  8415. */
  8416. + (void)undistortImagePoints:(Mat*)src dst:(Mat*)dst cameraMatrix:(Mat*)cameraMatrix distCoeffs:(Mat*)distCoeffs NS_SWIFT_NAME(undistortImagePoints(src:dst:cameraMatrix:distCoeffs:));
  8417. //
  8418. // void cv::fisheye::projectPoints(Mat objectPoints, Mat& imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha = 0, Mat& jacobian = Mat())
  8419. //
  8420. + (void)projectPoints:(Mat*)objectPoints imagePoints:(Mat*)imagePoints rvec:(Mat*)rvec tvec:(Mat*)tvec K:(Mat*)K D:(Mat*)D alpha:(double)alpha jacobian:(Mat*)jacobian NS_SWIFT_NAME(projectPoints(objectPoints:imagePoints:rvec:tvec:K:D:alpha:jacobian:));
  8421. + (void)projectPoints:(Mat*)objectPoints imagePoints:(Mat*)imagePoints rvec:(Mat*)rvec tvec:(Mat*)tvec K:(Mat*)K D:(Mat*)D alpha:(double)alpha NS_SWIFT_NAME(projectPoints(objectPoints:imagePoints:rvec:tvec:K:D:alpha:));
  8422. + (void)projectPoints:(Mat*)objectPoints imagePoints:(Mat*)imagePoints rvec:(Mat*)rvec tvec:(Mat*)tvec K:(Mat*)K D:(Mat*)D NS_SWIFT_NAME(projectPoints(objectPoints:imagePoints:rvec:tvec:K:D:));
  8423. //
  8424. // void cv::fisheye::distortPoints(Mat undistorted, Mat& distorted, Mat K, Mat D, double alpha = 0)
  8425. //
  8426. /**
  8427. * Distorts 2D points using fisheye model.
  8428. *
  8429. * @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is
  8430. * the number of points in the view.
  8431. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8432. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8433. * @param alpha The skew coefficient.
  8434. * @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8435. *
  8436. * Note that the function assumes the camera intrinsic matrix of the undistorted points to be identity.
  8437. * This means if you want to distort image points you have to multiply them with `$$K^{-1}$$`.
  8438. */
  8439. + (void)distortPoints:(Mat*)undistorted distorted:(Mat*)distorted K:(Mat*)K D:(Mat*)D alpha:(double)alpha NS_SWIFT_NAME(distortPoints(undistorted:distorted:K:D:alpha:));
  8440. /**
  8441. * Distorts 2D points using fisheye model.
  8442. *
  8443. * @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is
  8444. * the number of points in the view.
  8445. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8446. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8447. * @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8448. *
  8449. * Note that the function assumes the camera intrinsic matrix of the undistorted points to be identity.
  8450. * This means if you want to distort image points you have to multiply them with `$$K^{-1}$$`.
  8451. */
  8452. + (void)distortPoints:(Mat*)undistorted distorted:(Mat*)distorted K:(Mat*)K D:(Mat*)D NS_SWIFT_NAME(distortPoints(undistorted:distorted:K:D:));
  8453. //
  8454. // void cv::fisheye::undistortPoints(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat R = Mat(), Mat P = Mat(), TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 10, 1e-8))
  8455. //
  8456. /**
  8457. * Undistorts 2D points using fisheye model
  8458. *
  8459. * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
  8460. * number of points in the view.
  8461. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8462. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8463. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8464. * 1-channel or 1x1 3-channel
  8465. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8466. * @param criteria Termination criteria
  8467. * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8468. */
  8469. + (void)undistortPoints:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D R:(Mat*)R P:(Mat*)P criteria:(TermCriteria*)criteria NS_SWIFT_NAME(undistortPoints(distorted:undistorted:K:D:R:P:criteria:));
  8470. /**
  8471. * Undistorts 2D points using fisheye model
  8472. *
  8473. * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
  8474. * number of points in the view.
  8475. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8476. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8477. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8478. * 1-channel or 1x1 3-channel
  8479. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8480. * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8481. */
  8482. + (void)undistortPoints:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D R:(Mat*)R P:(Mat*)P NS_SWIFT_NAME(undistortPoints(distorted:undistorted:K:D:R:P:));
  8483. /**
  8484. * Undistorts 2D points using fisheye model
  8485. *
  8486. * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
  8487. * number of points in the view.
  8488. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8489. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8490. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8491. * 1-channel or 1x1 3-channel
  8492. * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8493. */
  8494. + (void)undistortPoints:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D R:(Mat*)R NS_SWIFT_NAME(undistortPoints(distorted:undistorted:K:D:R:));
  8495. /**
  8496. * Undistorts 2D points using fisheye model
  8497. *
  8498. * @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
  8499. * number of points in the view.
  8500. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8501. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8502. * 1-channel or 1x1 3-channel
  8503. * @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
  8504. */
  8505. + (void)undistortPoints:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D NS_SWIFT_NAME(undistortPoints(distorted:undistorted:K:D:));
  8506. //
  8507. // void cv::fisheye::initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat& map1, Mat& map2)
  8508. //
  8509. /**
  8510. * Computes undistortion and rectification maps for image transform by #remap. If D is empty zero
  8511. * distortion is used, if R or P is empty identity matrixes are used.
  8512. *
  8513. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8514. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8515. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8516. * 1-channel or 1x1 3-channel
  8517. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8518. * @param size Undistorted image size.
  8519. * @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See #convertMaps
  8520. * for details.
  8521. * @param map1 The first output map.
  8522. * @param map2 The second output map.
  8523. */
  8524. + (void)initUndistortRectifyMap:(Mat*)K D:(Mat*)D R:(Mat*)R P:(Mat*)P size:(Size2i*)size m1type:(int)m1type map1:(Mat*)map1 map2:(Mat*)map2 NS_SWIFT_NAME(initUndistortRectifyMap(K:D:R:P:size:m1type:map1:map2:));
  8525. //
  8526. // void cv::fisheye::undistortImage(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat Knew = cv::Mat(), Size new_size = Size())
  8527. //
  8528. /**
  8529. * Transforms an image to compensate for fisheye lens distortion.
  8530. *
  8531. * @param distorted image with fisheye lens distortion.
  8532. * @param undistorted Output image with compensated fisheye lens distortion.
  8533. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8534. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8535. * @param Knew Camera intrinsic matrix of the distorted image. By default, it is the identity matrix but you
  8536. * may additionally scale and shift the result by using a different matrix.
  8537. * @param new_size the new size
  8538. *
  8539. * The function transforms an image to compensate radial and tangential lens distortion.
  8540. *
  8541. * The function is simply a combination of #fisheye::initUndistortRectifyMap (with unity R ) and #remap
  8542. * (with bilinear interpolation). See the former function for details of the transformation being
  8543. * performed.
  8544. *
  8545. * See below the results of undistortImage.
  8546. * - a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
  8547. * k_4, k_5, k_6) of distortion were optimized under calibration)
  8548. * - b\) result of #fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
  8549. * k_3, k_4) of fisheye distortion were optimized under calibration)
  8550. * - c\) original image was captured with fisheye lens
  8551. *
  8552. * Pictures a) and b) almost the same. But if we consider points of image located far from the center
  8553. * of image, we can notice that on image a) these points are distorted.
  8554. *
  8555. * ![image](pics/fisheye_undistorted.jpg)
  8556. */
  8557. + (void)undistortImage:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D Knew:(Mat*)Knew new_size:(Size2i*)new_size NS_SWIFT_NAME(undistortImage(distorted:undistorted:K:D:Knew:new_size:));
  8558. /**
  8559. * Transforms an image to compensate for fisheye lens distortion.
  8560. *
  8561. * @param distorted image with fisheye lens distortion.
  8562. * @param undistorted Output image with compensated fisheye lens distortion.
  8563. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8564. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8565. * @param Knew Camera intrinsic matrix of the distorted image. By default, it is the identity matrix but you
  8566. * may additionally scale and shift the result by using a different matrix.
  8567. *
  8568. * The function transforms an image to compensate radial and tangential lens distortion.
  8569. *
  8570. * The function is simply a combination of #fisheye::initUndistortRectifyMap (with unity R ) and #remap
  8571. * (with bilinear interpolation). See the former function for details of the transformation being
  8572. * performed.
  8573. *
  8574. * See below the results of undistortImage.
  8575. * - a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
  8576. * k_4, k_5, k_6) of distortion were optimized under calibration)
  8577. * - b\) result of #fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
  8578. * k_3, k_4) of fisheye distortion were optimized under calibration)
  8579. * - c\) original image was captured with fisheye lens
  8580. *
  8581. * Pictures a) and b) almost the same. But if we consider points of image located far from the center
  8582. * of image, we can notice that on image a) these points are distorted.
  8583. *
  8584. * ![image](pics/fisheye_undistorted.jpg)
  8585. */
  8586. + (void)undistortImage:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D Knew:(Mat*)Knew NS_SWIFT_NAME(undistortImage(distorted:undistorted:K:D:Knew:));
  8587. /**
  8588. * Transforms an image to compensate for fisheye lens distortion.
  8589. *
  8590. * @param distorted image with fisheye lens distortion.
  8591. * @param undistorted Output image with compensated fisheye lens distortion.
  8592. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8593. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8594. * may additionally scale and shift the result by using a different matrix.
  8595. *
  8596. * The function transforms an image to compensate radial and tangential lens distortion.
  8597. *
  8598. * The function is simply a combination of #fisheye::initUndistortRectifyMap (with unity R ) and #remap
  8599. * (with bilinear interpolation). See the former function for details of the transformation being
  8600. * performed.
  8601. *
  8602. * See below the results of undistortImage.
  8603. * - a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
  8604. * k_4, k_5, k_6) of distortion were optimized under calibration)
  8605. * - b\) result of #fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
  8606. * k_3, k_4) of fisheye distortion were optimized under calibration)
  8607. * - c\) original image was captured with fisheye lens
  8608. *
  8609. * Pictures a) and b) almost the same. But if we consider points of image located far from the center
  8610. * of image, we can notice that on image a) these points are distorted.
  8611. *
  8612. * ![image](pics/fisheye_undistorted.jpg)
  8613. */
  8614. + (void)undistortImage:(Mat*)distorted undistorted:(Mat*)undistorted K:(Mat*)K D:(Mat*)D NS_SWIFT_NAME(undistortImage(distorted:undistorted:K:D:));
  8615. //
  8616. // void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat& P, double balance = 0.0, Size new_size = Size(), double fov_scale = 1.0)
  8617. //
  8618. /**
  8619. * Estimates new camera intrinsic matrix for undistortion or rectification.
  8620. *
  8621. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8622. * @param image_size Size of the image
  8623. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8624. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8625. * 1-channel or 1x1 3-channel
  8626. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8627. * @param balance Sets the new focal length in range between the min focal length and the max focal
  8628. * length. Balance is in range of [0, 1].
  8629. * @param new_size the new size
  8630. * @param fov_scale Divisor for new focal length.
  8631. */
  8632. + (void)estimateNewCameraMatrixForUndistortRectify:(Mat*)K D:(Mat*)D image_size:(Size2i*)image_size R:(Mat*)R P:(Mat*)P balance:(double)balance new_size:(Size2i*)new_size fov_scale:(double)fov_scale NS_SWIFT_NAME(estimateNewCameraMatrixForUndistortRectify(K:D:image_size:R:P:balance:new_size:fov_scale:));
  8633. /**
  8634. * Estimates new camera intrinsic matrix for undistortion or rectification.
  8635. *
  8636. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8637. * @param image_size Size of the image
  8638. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8639. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8640. * 1-channel or 1x1 3-channel
  8641. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8642. * @param balance Sets the new focal length in range between the min focal length and the max focal
  8643. * length. Balance is in range of [0, 1].
  8644. * @param new_size the new size
  8645. */
  8646. + (void)estimateNewCameraMatrixForUndistortRectify:(Mat*)K D:(Mat*)D image_size:(Size2i*)image_size R:(Mat*)R P:(Mat*)P balance:(double)balance new_size:(Size2i*)new_size NS_SWIFT_NAME(estimateNewCameraMatrixForUndistortRectify(K:D:image_size:R:P:balance:new_size:));
  8647. /**
  8648. * Estimates new camera intrinsic matrix for undistortion or rectification.
  8649. *
  8650. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8651. * @param image_size Size of the image
  8652. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8653. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8654. * 1-channel or 1x1 3-channel
  8655. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8656. * @param balance Sets the new focal length in range between the min focal length and the max focal
  8657. * length. Balance is in range of [0, 1].
  8658. */
  8659. + (void)estimateNewCameraMatrixForUndistortRectify:(Mat*)K D:(Mat*)D image_size:(Size2i*)image_size R:(Mat*)R P:(Mat*)P balance:(double)balance NS_SWIFT_NAME(estimateNewCameraMatrixForUndistortRectify(K:D:image_size:R:P:balance:));
  8660. /**
  8661. * Estimates new camera intrinsic matrix for undistortion or rectification.
  8662. *
  8663. * @param K Camera intrinsic matrix `$$cameramatrix{K}$$`.
  8664. * @param image_size Size of the image
  8665. * @param D Input vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8666. * @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
  8667. * 1-channel or 1x1 3-channel
  8668. * @param P New camera intrinsic matrix (3x3) or new projection matrix (3x4)
  8669. * length. Balance is in range of [0, 1].
  8670. */
  8671. + (void)estimateNewCameraMatrixForUndistortRectify:(Mat*)K D:(Mat*)D image_size:(Size2i*)image_size R:(Mat*)R P:(Mat*)P NS_SWIFT_NAME(estimateNewCameraMatrixForUndistortRectify(K:D:image_size:R:P:));
  8672. //
  8673. // double cv::fisheye::calibrate(vector_Mat objectPoints, vector_Mat imagePoints, Size image_size, Mat& K, Mat& D, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
  8674. //
  8675. /**
  8676. * Performs camera calibration
  8677. *
  8678. * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
  8679. * coordinate space.
  8680. * @param imagePoints vector of vectors of the projections of calibration pattern points.
  8681. * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
  8682. * objectPoints[i].size() for each i.
  8683. * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
  8684. * @param K Output 3x3 floating-point camera intrinsic matrix
  8685. * `$$\cameramatrix{A}$$` . If
  8686. * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
  8687. * initialized before calling the function.
  8688. * @param D Output vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8689. * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
  8690. * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
  8691. * the next output parameter description) brings the calibration pattern from the model coordinate
  8692. * space (in which object points are specified) to the world coordinate space, that is, a real
  8693. * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
  8694. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  8695. * @param flags Different flags that may be zero or a combination of the following values:
  8696. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  8697. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  8698. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  8699. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  8700. * of intrinsic optimization.
  8701. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  8702. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  8703. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
  8704. * are set to zeros and stay zero.
  8705. * - REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  8706. * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8707. * - REF: fisheye::CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global
  8708. * optimization. It is the `$$max(width,height)/\pi$$` or the provided `$$f_x$$`, `$$f_y$$` when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8709. * @param criteria Termination criteria for the iterative optimization algorithm.
  8710. */
  8711. + (double)calibrate:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints image_size:(Size2i*)image_size K:(Mat*)K D:(Mat*)D rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(calibrate(objectPoints:imagePoints:image_size:K:D:rvecs:tvecs:flags:criteria:));
  8712. /**
  8713. * Performs camera calibration
  8714. *
  8715. * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
  8716. * coordinate space.
  8717. * @param imagePoints vector of vectors of the projections of calibration pattern points.
  8718. * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
  8719. * objectPoints[i].size() for each i.
  8720. * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
  8721. * @param K Output 3x3 floating-point camera intrinsic matrix
  8722. * `$$\cameramatrix{A}$$` . If
  8723. * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
  8724. * initialized before calling the function.
  8725. * @param D Output vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8726. * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
  8727. * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
  8728. * the next output parameter description) brings the calibration pattern from the model coordinate
  8729. * space (in which object points are specified) to the world coordinate space, that is, a real
  8730. * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
  8731. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  8732. * @param flags Different flags that may be zero or a combination of the following values:
  8733. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  8734. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  8735. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  8736. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  8737. * of intrinsic optimization.
  8738. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  8739. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  8740. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
  8741. * are set to zeros and stay zero.
  8742. * - REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  8743. * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8744. * - REF: fisheye::CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global
  8745. * optimization. It is the `$$max(width,height)/\pi$$` or the provided `$$f_x$$`, `$$f_y$$` when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8746. */
  8747. + (double)calibrate:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints image_size:(Size2i*)image_size K:(Mat*)K D:(Mat*)D rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags NS_SWIFT_NAME(calibrate(objectPoints:imagePoints:image_size:K:D:rvecs:tvecs:flags:));
  8748. /**
  8749. * Performs camera calibration
  8750. *
  8751. * @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
  8752. * coordinate space.
  8753. * @param imagePoints vector of vectors of the projections of calibration pattern points.
  8754. * imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
  8755. * objectPoints[i].size() for each i.
  8756. * @param image_size Size of the image used only to initialize the camera intrinsic matrix.
  8757. * @param K Output 3x3 floating-point camera intrinsic matrix
  8758. * `$$\cameramatrix{A}$$` . If
  8759. * REF: fisheye::CALIB_USE_INTRINSIC_GUESS is specified, some or all of fx, fy, cx, cy must be
  8760. * initialized before calling the function.
  8761. * @param D Output vector of distortion coefficients `$$\distcoeffsfisheye$$`.
  8762. * @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
  8763. * That is, each k-th rotation vector together with the corresponding k-th translation vector (see
  8764. * the next output parameter description) brings the calibration pattern from the model coordinate
  8765. * space (in which object points are specified) to the world coordinate space, that is, a real
  8766. * position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
  8767. * @param tvecs Output vector of translation vectors estimated for each pattern view.
  8768. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS cameraMatrix contains valid initial values of
  8769. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  8770. * center ( imageSize is used), and focal distances are computed in a least-squares fashion.
  8771. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  8772. * of intrinsic optimization.
  8773. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  8774. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  8775. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients
  8776. * are set to zeros and stay zero.
  8777. * - REF: fisheye::CALIB_FIX_PRINCIPAL_POINT The principal point is not changed during the global
  8778. * optimization. It stays at the center or at a different location specified when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8779. * - REF: fisheye::CALIB_FIX_FOCAL_LENGTH The focal length is not changed during the global
  8780. * optimization. It is the `$$max(width,height)/\pi$$` or the provided `$$f_x$$`, `$$f_y$$` when REF: fisheye::CALIB_USE_INTRINSIC_GUESS is set too.
  8781. */
  8782. + (double)calibrate:(NSArray<Mat*>*)objectPoints imagePoints:(NSArray<Mat*>*)imagePoints image_size:(Size2i*)image_size K:(Mat*)K D:(Mat*)D rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs NS_SWIFT_NAME(calibrate(objectPoints:imagePoints:image_size:K:D:rvecs:tvecs:));
  8783. //
  8784. // void cv::fisheye::stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags, Size newImageSize = Size(), double balance = 0.0, double fov_scale = 1.0)
  8785. //
  8786. /**
  8787. * Stereo rectification for fisheye camera model
  8788. *
  8789. * @param K1 First camera intrinsic matrix.
  8790. * @param D1 First camera distortion parameters.
  8791. * @param K2 Second camera intrinsic matrix.
  8792. * @param D2 Second camera distortion parameters.
  8793. * @param imageSize Size of the image used for stereo calibration.
  8794. * @param R Rotation matrix between the coordinate systems of the first and the second
  8795. * cameras.
  8796. * @param tvec Translation vector between coordinate systems of the cameras.
  8797. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
  8798. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
  8799. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  8800. * camera.
  8801. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  8802. * camera.
  8803. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see #reprojectImageTo3D ).
  8804. * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
  8805. * the function makes the principal points of each camera have the same pixel coordinates in the
  8806. * rectified views. And if the flag is not set, the function may still shift the images in the
  8807. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  8808. * useful image area.
  8809. * @param newImageSize New image resolution after rectification. The same size should be passed to
  8810. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  8811. * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
  8812. * preserve details in the original image, especially when there is a big radial distortion.
  8813. * @param balance Sets the new focal length in range between the min focal length and the max focal
  8814. * length. Balance is in range of [0, 1].
  8815. * @param fov_scale Divisor for new focal length.
  8816. */
  8817. + (void)stereoRectify:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R tvec:(Mat*)tvec R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags newImageSize:(Size2i*)newImageSize balance:(double)balance fov_scale:(double)fov_scale NS_SWIFT_NAME(stereoRectify(K1:D1:K2:D2:imageSize:R:tvec:R1:R2:P1:P2:Q:flags:newImageSize:balance:fov_scale:));
  8818. /**
  8819. * Stereo rectification for fisheye camera model
  8820. *
  8821. * @param K1 First camera intrinsic matrix.
  8822. * @param D1 First camera distortion parameters.
  8823. * @param K2 Second camera intrinsic matrix.
  8824. * @param D2 Second camera distortion parameters.
  8825. * @param imageSize Size of the image used for stereo calibration.
  8826. * @param R Rotation matrix between the coordinate systems of the first and the second
  8827. * cameras.
  8828. * @param tvec Translation vector between coordinate systems of the cameras.
  8829. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
  8830. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
  8831. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  8832. * camera.
  8833. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  8834. * camera.
  8835. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see #reprojectImageTo3D ).
  8836. * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
  8837. * the function makes the principal points of each camera have the same pixel coordinates in the
  8838. * rectified views. And if the flag is not set, the function may still shift the images in the
  8839. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  8840. * useful image area.
  8841. * @param newImageSize New image resolution after rectification. The same size should be passed to
  8842. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  8843. * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
  8844. * preserve details in the original image, especially when there is a big radial distortion.
  8845. * @param balance Sets the new focal length in range between the min focal length and the max focal
  8846. * length. Balance is in range of [0, 1].
  8847. */
  8848. + (void)stereoRectify:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R tvec:(Mat*)tvec R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags newImageSize:(Size2i*)newImageSize balance:(double)balance NS_SWIFT_NAME(stereoRectify(K1:D1:K2:D2:imageSize:R:tvec:R1:R2:P1:P2:Q:flags:newImageSize:balance:));
  8849. /**
  8850. * Stereo rectification for fisheye camera model
  8851. *
  8852. * @param K1 First camera intrinsic matrix.
  8853. * @param D1 First camera distortion parameters.
  8854. * @param K2 Second camera intrinsic matrix.
  8855. * @param D2 Second camera distortion parameters.
  8856. * @param imageSize Size of the image used for stereo calibration.
  8857. * @param R Rotation matrix between the coordinate systems of the first and the second
  8858. * cameras.
  8859. * @param tvec Translation vector between coordinate systems of the cameras.
  8860. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
  8861. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
  8862. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  8863. * camera.
  8864. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  8865. * camera.
  8866. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see #reprojectImageTo3D ).
  8867. * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
  8868. * the function makes the principal points of each camera have the same pixel coordinates in the
  8869. * rectified views. And if the flag is not set, the function may still shift the images in the
  8870. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  8871. * useful image area.
  8872. * @param newImageSize New image resolution after rectification. The same size should be passed to
  8873. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  8874. * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
  8875. * preserve details in the original image, especially when there is a big radial distortion.
  8876. * length. Balance is in range of [0, 1].
  8877. */
  8878. + (void)stereoRectify:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R tvec:(Mat*)tvec R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags newImageSize:(Size2i*)newImageSize NS_SWIFT_NAME(stereoRectify(K1:D1:K2:D2:imageSize:R:tvec:R1:R2:P1:P2:Q:flags:newImageSize:));
  8879. /**
  8880. * Stereo rectification for fisheye camera model
  8881. *
  8882. * @param K1 First camera intrinsic matrix.
  8883. * @param D1 First camera distortion parameters.
  8884. * @param K2 Second camera intrinsic matrix.
  8885. * @param D2 Second camera distortion parameters.
  8886. * @param imageSize Size of the image used for stereo calibration.
  8887. * @param R Rotation matrix between the coordinate systems of the first and the second
  8888. * cameras.
  8889. * @param tvec Translation vector between coordinate systems of the cameras.
  8890. * @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
  8891. * @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
  8892. * @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
  8893. * camera.
  8894. * @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
  8895. * camera.
  8896. * @param Q Output `$$4 \times 4$$` disparity-to-depth mapping matrix (see #reprojectImageTo3D ).
  8897. * @param flags Operation flags that may be zero or REF: fisheye::CALIB_ZERO_DISPARITY . If the flag is set,
  8898. * the function makes the principal points of each camera have the same pixel coordinates in the
  8899. * rectified views. And if the flag is not set, the function may still shift the images in the
  8900. * horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
  8901. * useful image area.
  8902. * #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
  8903. * is passed (default), it is set to the original imageSize . Setting it to larger value can help you
  8904. * preserve details in the original image, especially when there is a big radial distortion.
  8905. * length. Balance is in range of [0, 1].
  8906. */
  8907. + (void)stereoRectify:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R tvec:(Mat*)tvec R1:(Mat*)R1 R2:(Mat*)R2 P1:(Mat*)P1 P2:(Mat*)P2 Q:(Mat*)Q flags:(int)flags NS_SWIFT_NAME(stereoRectify(K1:D1:K2:D2:imageSize:R:tvec:R1:R2:P1:P2:Q:flags:));
  8908. //
  8909. // double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, vector_Mat& rvecs, vector_Mat& tvecs, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
  8910. //
  8911. /**
  8912. * Performs stereo calibration
  8913. *
  8914. * @param objectPoints Vector of vectors of the calibration pattern points.
  8915. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  8916. * observed by the first camera.
  8917. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  8918. * observed by the second camera.
  8919. * @param K1 Input/output first camera intrinsic matrix:
  8920. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}$$` , `$$j = 0,\, 1$$` . If
  8921. * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
  8922. * some or all of the matrix components must be initialized.
  8923. * @param D1 Input/output vector of distortion coefficients `$$\distcoeffsfisheye$$` of 4 elements.
  8924. * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
  8925. * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
  8926. * similar to D1 .
  8927. * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
  8928. * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
  8929. * @param T Output translation vector between the coordinate systems of the cameras.
  8930. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  8931. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  8932. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  8933. * description) brings the calibration pattern from the object coordinate space (in which object points are
  8934. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  8935. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  8936. * to camera coordinate space of the first camera of the stereo pair.
  8937. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  8938. * of previous output parameter ( rvecs ).
  8939. * @param flags Different flags that may be zero or a combination of the following values:
  8940. * - REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
  8941. * are estimated.
  8942. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
  8943. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  8944. * center (imageSize is used), and focal distances are computed in a least-squares fashion.
  8945. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  8946. * of intrinsic optimization.
  8947. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  8948. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  8949. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
  8950. * zero.
  8951. * @param criteria Termination criteria for the iterative optimization algorithm.
  8952. */
  8953. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:rvecs:tvecs:flags:criteria:));
  8954. /**
  8955. * Performs stereo calibration
  8956. *
  8957. * @param objectPoints Vector of vectors of the calibration pattern points.
  8958. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  8959. * observed by the first camera.
  8960. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  8961. * observed by the second camera.
  8962. * @param K1 Input/output first camera intrinsic matrix:
  8963. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}$$` , `$$j = 0,\, 1$$` . If
  8964. * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
  8965. * some or all of the matrix components must be initialized.
  8966. * @param D1 Input/output vector of distortion coefficients `$$\distcoeffsfisheye$$` of 4 elements.
  8967. * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
  8968. * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
  8969. * similar to D1 .
  8970. * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
  8971. * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
  8972. * @param T Output translation vector between the coordinate systems of the cameras.
  8973. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  8974. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  8975. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  8976. * description) brings the calibration pattern from the object coordinate space (in which object points are
  8977. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  8978. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  8979. * to camera coordinate space of the first camera of the stereo pair.
  8980. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  8981. * of previous output parameter ( rvecs ).
  8982. * @param flags Different flags that may be zero or a combination of the following values:
  8983. * - REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
  8984. * are estimated.
  8985. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
  8986. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  8987. * center (imageSize is used), and focal distances are computed in a least-squares fashion.
  8988. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  8989. * of intrinsic optimization.
  8990. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  8991. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  8992. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
  8993. * zero.
  8994. */
  8995. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs flags:(int)flags NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:rvecs:tvecs:flags:));
  8996. /**
  8997. * Performs stereo calibration
  8998. *
  8999. * @param objectPoints Vector of vectors of the calibration pattern points.
  9000. * @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
  9001. * observed by the first camera.
  9002. * @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
  9003. * observed by the second camera.
  9004. * @param K1 Input/output first camera intrinsic matrix:
  9005. * `$$\newcommand{\vecthreethree}[9]{ \begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \end{bmatrix} } \vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}$$` , `$$j = 0,\, 1$$` . If
  9006. * any of REF: fisheye::CALIB_USE_INTRINSIC_GUESS , REF: fisheye::CALIB_FIX_INTRINSIC are specified,
  9007. * some or all of the matrix components must be initialized.
  9008. * @param D1 Input/output vector of distortion coefficients `$$\distcoeffsfisheye$$` of 4 elements.
  9009. * @param K2 Input/output second camera intrinsic matrix. The parameter is similar to K1 .
  9010. * @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
  9011. * similar to D1 .
  9012. * @param imageSize Size of the image used only to initialize camera intrinsic matrix.
  9013. * @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
  9014. * @param T Output translation vector between the coordinate systems of the cameras.
  9015. * @param rvecs Output vector of rotation vectors ( REF: Rodrigues ) estimated for each pattern view in the
  9016. * coordinate system of the first camera of the stereo pair (e.g. std::vector<cv::Mat>). More in detail, each
  9017. * i-th rotation vector together with the corresponding i-th translation vector (see the next output parameter
  9018. * description) brings the calibration pattern from the object coordinate space (in which object points are
  9019. * specified) to the camera coordinate space of the first camera of the stereo pair. In more technical terms,
  9020. * the tuple of the i-th rotation and translation vector performs a change of basis from object coordinate space
  9021. * to camera coordinate space of the first camera of the stereo pair.
  9022. * @param tvecs Output vector of translation vectors estimated for each pattern view, see parameter description
  9023. * of previous output parameter ( rvecs ).
  9024. * - REF: fisheye::CALIB_FIX_INTRINSIC Fix K1, K2? and D1, D2? so that only R, T matrices
  9025. * are estimated.
  9026. * - REF: fisheye::CALIB_USE_INTRINSIC_GUESS K1, K2 contains valid initial values of
  9027. * fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
  9028. * center (imageSize is used), and focal distances are computed in a least-squares fashion.
  9029. * - REF: fisheye::CALIB_RECOMPUTE_EXTRINSIC Extrinsic will be recomputed after each iteration
  9030. * of intrinsic optimization.
  9031. * - REF: fisheye::CALIB_CHECK_COND The functions will check validity of condition number.
  9032. * - REF: fisheye::CALIB_FIX_SKEW Skew coefficient (alpha) is set to zero and stay zero.
  9033. * - REF: fisheye::CALIB_FIX_K1,..., REF: fisheye::CALIB_FIX_K4 Selected distortion coefficients are set to zeros and stay
  9034. * zero.
  9035. */
  9036. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T rvecs:(NSMutableArray<Mat*>*)rvecs tvecs:(NSMutableArray<Mat*>*)tvecs NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:rvecs:tvecs:));
  9037. //
  9038. // double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
  9039. //
  9040. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T flags:(int)flags criteria:(TermCriteria*)criteria NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:flags:criteria:));
  9041. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T flags:(int)flags NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:flags:));
  9042. + (double)stereoCalibrate:(NSArray<Mat*>*)objectPoints imagePoints1:(NSArray<Mat*>*)imagePoints1 imagePoints2:(NSArray<Mat*>*)imagePoints2 K1:(Mat*)K1 D1:(Mat*)D1 K2:(Mat*)K2 D2:(Mat*)D2 imageSize:(Size2i*)imageSize R:(Mat*)R T:(Mat*)T NS_SWIFT_NAME(stereoCalibrate(objectPoints:imagePoints1:imagePoints2:K1:D1:K2:D2:imageSize:R:T:));
  9043. @end
  9044. NS_ASSUME_NONNULL_END