Imgproc.cs 653 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.ImgprocModule
  7. {
  8. // C++: class Imgproc
  9. public class Imgproc
  10. {
  11. private const int IPL_BORDER_CONSTANT = 0;
  12. private const int IPL_BORDER_REPLICATE = 1;
  13. private const int IPL_BORDER_REFLECT = 2;
  14. private const int IPL_BORDER_WRAP = 3;
  15. private const int IPL_BORDER_REFLECT_101 = 4;
  16. private const int IPL_BORDER_TRANSPARENT = 5;
  17. private const int CV_INTER_NN = 0;
  18. private const int CV_INTER_LINEAR = 1;
  19. private const int CV_INTER_CUBIC = 2;
  20. private const int CV_INTER_AREA = 3;
  21. private const int CV_INTER_LANCZOS4 = 4;
  22. private const int CV_MOP_ERODE = 0;
  23. private const int CV_MOP_DILATE = 1;
  24. private const int CV_MOP_OPEN = 2;
  25. private const int CV_MOP_CLOSE = 3;
  26. private const int CV_MOP_GRADIENT = 4;
  27. private const int CV_MOP_TOPHAT = 5;
  28. private const int CV_MOP_BLACKHAT = 6;
  29. private const int CV_RETR_EXTERNAL = 0;
  30. private const int CV_RETR_LIST = 1;
  31. private const int CV_RETR_CCOMP = 2;
  32. private const int CV_RETR_TREE = 3;
  33. private const int CV_RETR_FLOODFILL = 4;
  34. private const int CV_CHAIN_APPROX_NONE = 1;
  35. private const int CV_CHAIN_APPROX_SIMPLE = 2;
  36. private const int CV_CHAIN_APPROX_TC89_L1 = 3;
  37. private const int CV_CHAIN_APPROX_TC89_KCOS = 4;
  38. private const int CV_THRESH_BINARY = 0;
  39. private const int CV_THRESH_BINARY_INV = 1;
  40. private const int CV_THRESH_TRUNC = 2;
  41. private const int CV_THRESH_TOZERO = 3;
  42. private const int CV_THRESH_TOZERO_INV = 4;
  43. private const int CV_THRESH_MASK = 7;
  44. private const int CV_THRESH_OTSU = 8;
  45. private const int CV_THRESH_TRIANGLE = 16;
  46. // C++: enum <unnamed>
  47. public const int CV_GAUSSIAN_5x5 = 7;
  48. public const int CV_SCHARR = -1;
  49. public const int CV_MAX_SOBEL_KSIZE = 7;
  50. public const int CV_RGBA2mRGBA = 125;
  51. public const int CV_mRGBA2RGBA = 126;
  52. public const int CV_WARP_FILL_OUTLIERS = 8;
  53. public const int CV_WARP_INVERSE_MAP = 16;
  54. public const int CV_CHAIN_CODE = 0;
  55. public const int CV_LINK_RUNS = 5;
  56. public const int CV_POLY_APPROX_DP = 0;
  57. public const int CV_CONTOURS_MATCH_I1 = 1;
  58. public const int CV_CONTOURS_MATCH_I2 = 2;
  59. public const int CV_CONTOURS_MATCH_I3 = 3;
  60. public const int CV_CLOCKWISE = 1;
  61. public const int CV_COUNTER_CLOCKWISE = 2;
  62. public const int CV_COMP_CORREL = 0;
  63. public const int CV_COMP_CHISQR = 1;
  64. public const int CV_COMP_INTERSECT = 2;
  65. public const int CV_COMP_BHATTACHARYYA = 3;
  66. public const int CV_COMP_HELLINGER = CV_COMP_BHATTACHARYYA;
  67. public const int CV_COMP_CHISQR_ALT = 4;
  68. public const int CV_COMP_KL_DIV = 5;
  69. public const int CV_DIST_MASK_3 = 3;
  70. public const int CV_DIST_MASK_5 = 5;
  71. public const int CV_DIST_MASK_PRECISE = 0;
  72. public const int CV_DIST_LABEL_CCOMP = 0;
  73. public const int CV_DIST_LABEL_PIXEL = 1;
  74. public const int CV_DIST_USER = -1;
  75. public const int CV_DIST_L1 = 1;
  76. public const int CV_DIST_L2 = 2;
  77. public const int CV_DIST_C = 3;
  78. public const int CV_DIST_L12 = 4;
  79. public const int CV_DIST_FAIR = 5;
  80. public const int CV_DIST_WELSCH = 6;
  81. public const int CV_DIST_HUBER = 7;
  82. public const int CV_CANNY_L2_GRADIENT = (1 << 31);
  83. public const int CV_HOUGH_STANDARD = 0;
  84. public const int CV_HOUGH_PROBABILISTIC = 1;
  85. public const int CV_HOUGH_MULTI_SCALE = 2;
  86. public const int CV_HOUGH_GRADIENT = 3;
  87. // C++: enum MorphShapes_c
  88. public const int CV_SHAPE_RECT = 0;
  89. public const int CV_SHAPE_CROSS = 1;
  90. public const int CV_SHAPE_ELLIPSE = 2;
  91. public const int CV_SHAPE_CUSTOM = 100;
  92. // C++: enum SmoothMethod_c
  93. public const int CV_BLUR_NO_SCALE = 0;
  94. public const int CV_BLUR = 1;
  95. public const int CV_GAUSSIAN = 2;
  96. public const int CV_MEDIAN = 3;
  97. public const int CV_BILATERAL = 4;
  98. // C++: enum cv.AdaptiveThresholdTypes
  99. public const int ADAPTIVE_THRESH_MEAN_C = 0;
  100. public const int ADAPTIVE_THRESH_GAUSSIAN_C = 1;
  101. // C++: enum cv.ColorConversionCodes
  102. public const int COLOR_BGR2BGRA = 0;
  103. public const int COLOR_RGB2RGBA = COLOR_BGR2BGRA;
  104. public const int COLOR_BGRA2BGR = 1;
  105. public const int COLOR_RGBA2RGB = COLOR_BGRA2BGR;
  106. public const int COLOR_BGR2RGBA = 2;
  107. public const int COLOR_RGB2BGRA = COLOR_BGR2RGBA;
  108. public const int COLOR_RGBA2BGR = 3;
  109. public const int COLOR_BGRA2RGB = COLOR_RGBA2BGR;
  110. public const int COLOR_BGR2RGB = 4;
  111. public const int COLOR_RGB2BGR = COLOR_BGR2RGB;
  112. public const int COLOR_BGRA2RGBA = 5;
  113. public const int COLOR_RGBA2BGRA = COLOR_BGRA2RGBA;
  114. public const int COLOR_BGR2GRAY = 6;
  115. public const int COLOR_RGB2GRAY = 7;
  116. public const int COLOR_GRAY2BGR = 8;
  117. public const int COLOR_GRAY2RGB = COLOR_GRAY2BGR;
  118. public const int COLOR_GRAY2BGRA = 9;
  119. public const int COLOR_GRAY2RGBA = COLOR_GRAY2BGRA;
  120. public const int COLOR_BGRA2GRAY = 10;
  121. public const int COLOR_RGBA2GRAY = 11;
  122. public const int COLOR_BGR2BGR565 = 12;
  123. public const int COLOR_RGB2BGR565 = 13;
  124. public const int COLOR_BGR5652BGR = 14;
  125. public const int COLOR_BGR5652RGB = 15;
  126. public const int COLOR_BGRA2BGR565 = 16;
  127. public const int COLOR_RGBA2BGR565 = 17;
  128. public const int COLOR_BGR5652BGRA = 18;
  129. public const int COLOR_BGR5652RGBA = 19;
  130. public const int COLOR_GRAY2BGR565 = 20;
  131. public const int COLOR_BGR5652GRAY = 21;
  132. public const int COLOR_BGR2BGR555 = 22;
  133. public const int COLOR_RGB2BGR555 = 23;
  134. public const int COLOR_BGR5552BGR = 24;
  135. public const int COLOR_BGR5552RGB = 25;
  136. public const int COLOR_BGRA2BGR555 = 26;
  137. public const int COLOR_RGBA2BGR555 = 27;
  138. public const int COLOR_BGR5552BGRA = 28;
  139. public const int COLOR_BGR5552RGBA = 29;
  140. public const int COLOR_GRAY2BGR555 = 30;
  141. public const int COLOR_BGR5552GRAY = 31;
  142. public const int COLOR_BGR2XYZ = 32;
  143. public const int COLOR_RGB2XYZ = 33;
  144. public const int COLOR_XYZ2BGR = 34;
  145. public const int COLOR_XYZ2RGB = 35;
  146. public const int COLOR_BGR2YCrCb = 36;
  147. public const int COLOR_RGB2YCrCb = 37;
  148. public const int COLOR_YCrCb2BGR = 38;
  149. public const int COLOR_YCrCb2RGB = 39;
  150. public const int COLOR_BGR2HSV = 40;
  151. public const int COLOR_RGB2HSV = 41;
  152. public const int COLOR_BGR2Lab = 44;
  153. public const int COLOR_RGB2Lab = 45;
  154. public const int COLOR_BGR2Luv = 50;
  155. public const int COLOR_RGB2Luv = 51;
  156. public const int COLOR_BGR2HLS = 52;
  157. public const int COLOR_RGB2HLS = 53;
  158. public const int COLOR_HSV2BGR = 54;
  159. public const int COLOR_HSV2RGB = 55;
  160. public const int COLOR_Lab2BGR = 56;
  161. public const int COLOR_Lab2RGB = 57;
  162. public const int COLOR_Luv2BGR = 58;
  163. public const int COLOR_Luv2RGB = 59;
  164. public const int COLOR_HLS2BGR = 60;
  165. public const int COLOR_HLS2RGB = 61;
  166. public const int COLOR_BGR2HSV_FULL = 66;
  167. public const int COLOR_RGB2HSV_FULL = 67;
  168. public const int COLOR_BGR2HLS_FULL = 68;
  169. public const int COLOR_RGB2HLS_FULL = 69;
  170. public const int COLOR_HSV2BGR_FULL = 70;
  171. public const int COLOR_HSV2RGB_FULL = 71;
  172. public const int COLOR_HLS2BGR_FULL = 72;
  173. public const int COLOR_HLS2RGB_FULL = 73;
  174. public const int COLOR_LBGR2Lab = 74;
  175. public const int COLOR_LRGB2Lab = 75;
  176. public const int COLOR_LBGR2Luv = 76;
  177. public const int COLOR_LRGB2Luv = 77;
  178. public const int COLOR_Lab2LBGR = 78;
  179. public const int COLOR_Lab2LRGB = 79;
  180. public const int COLOR_Luv2LBGR = 80;
  181. public const int COLOR_Luv2LRGB = 81;
  182. public const int COLOR_BGR2YUV = 82;
  183. public const int COLOR_RGB2YUV = 83;
  184. public const int COLOR_YUV2BGR = 84;
  185. public const int COLOR_YUV2RGB = 85;
  186. public const int COLOR_YUV2RGB_NV12 = 90;
  187. public const int COLOR_YUV2BGR_NV12 = 91;
  188. public const int COLOR_YUV2RGB_NV21 = 92;
  189. public const int COLOR_YUV2BGR_NV21 = 93;
  190. public const int COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21;
  191. public const int COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21;
  192. public const int COLOR_YUV2RGBA_NV12 = 94;
  193. public const int COLOR_YUV2BGRA_NV12 = 95;
  194. public const int COLOR_YUV2RGBA_NV21 = 96;
  195. public const int COLOR_YUV2BGRA_NV21 = 97;
  196. public const int COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21;
  197. public const int COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21;
  198. public const int COLOR_YUV2RGB_YV12 = 98;
  199. public const int COLOR_YUV2BGR_YV12 = 99;
  200. public const int COLOR_YUV2RGB_IYUV = 100;
  201. public const int COLOR_YUV2BGR_IYUV = 101;
  202. public const int COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV;
  203. public const int COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV;
  204. public const int COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12;
  205. public const int COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12;
  206. public const int COLOR_YUV2RGBA_YV12 = 102;
  207. public const int COLOR_YUV2BGRA_YV12 = 103;
  208. public const int COLOR_YUV2RGBA_IYUV = 104;
  209. public const int COLOR_YUV2BGRA_IYUV = 105;
  210. public const int COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV;
  211. public const int COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV;
  212. public const int COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12;
  213. public const int COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12;
  214. public const int COLOR_YUV2GRAY_420 = 106;
  215. public const int COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420;
  216. public const int COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420;
  217. public const int COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420;
  218. public const int COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420;
  219. public const int COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420;
  220. public const int COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420;
  221. public const int COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420;
  222. public const int COLOR_YUV2RGB_UYVY = 107;
  223. public const int COLOR_YUV2BGR_UYVY = 108;
  224. public const int COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY;
  225. public const int COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY;
  226. public const int COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY;
  227. public const int COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY;
  228. public const int COLOR_YUV2RGBA_UYVY = 111;
  229. public const int COLOR_YUV2BGRA_UYVY = 112;
  230. public const int COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY;
  231. public const int COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY;
  232. public const int COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY;
  233. public const int COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY;
  234. public const int COLOR_YUV2RGB_YUY2 = 115;
  235. public const int COLOR_YUV2BGR_YUY2 = 116;
  236. public const int COLOR_YUV2RGB_YVYU = 117;
  237. public const int COLOR_YUV2BGR_YVYU = 118;
  238. public const int COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2;
  239. public const int COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2;
  240. public const int COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2;
  241. public const int COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2;
  242. public const int COLOR_YUV2RGBA_YUY2 = 119;
  243. public const int COLOR_YUV2BGRA_YUY2 = 120;
  244. public const int COLOR_YUV2RGBA_YVYU = 121;
  245. public const int COLOR_YUV2BGRA_YVYU = 122;
  246. public const int COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2;
  247. public const int COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2;
  248. public const int COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2;
  249. public const int COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2;
  250. public const int COLOR_YUV2GRAY_UYVY = 123;
  251. public const int COLOR_YUV2GRAY_YUY2 = 124;
  252. public const int COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY;
  253. public const int COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY;
  254. public const int COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2;
  255. public const int COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2;
  256. public const int COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2;
  257. public const int COLOR_RGBA2mRGBA = 125;
  258. public const int COLOR_mRGBA2RGBA = 126;
  259. public const int COLOR_RGB2YUV_I420 = 127;
  260. public const int COLOR_BGR2YUV_I420 = 128;
  261. public const int COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420;
  262. public const int COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420;
  263. public const int COLOR_RGBA2YUV_I420 = 129;
  264. public const int COLOR_BGRA2YUV_I420 = 130;
  265. public const int COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420;
  266. public const int COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420;
  267. public const int COLOR_RGB2YUV_YV12 = 131;
  268. public const int COLOR_BGR2YUV_YV12 = 132;
  269. public const int COLOR_RGBA2YUV_YV12 = 133;
  270. public const int COLOR_BGRA2YUV_YV12 = 134;
  271. public const int COLOR_BayerBG2BGR = 46;
  272. public const int COLOR_BayerGB2BGR = 47;
  273. public const int COLOR_BayerRG2BGR = 48;
  274. public const int COLOR_BayerGR2BGR = 49;
  275. public const int COLOR_BayerRGGB2BGR = COLOR_BayerBG2BGR;
  276. public const int COLOR_BayerGRBG2BGR = COLOR_BayerGB2BGR;
  277. public const int COLOR_BayerBGGR2BGR = COLOR_BayerRG2BGR;
  278. public const int COLOR_BayerGBRG2BGR = COLOR_BayerGR2BGR;
  279. public const int COLOR_BayerRGGB2RGB = COLOR_BayerBGGR2BGR;
  280. public const int COLOR_BayerGRBG2RGB = COLOR_BayerGBRG2BGR;
  281. public const int COLOR_BayerBGGR2RGB = COLOR_BayerRGGB2BGR;
  282. public const int COLOR_BayerGBRG2RGB = COLOR_BayerGRBG2BGR;
  283. public const int COLOR_BayerBG2RGB = COLOR_BayerRG2BGR;
  284. public const int COLOR_BayerGB2RGB = COLOR_BayerGR2BGR;
  285. public const int COLOR_BayerRG2RGB = COLOR_BayerBG2BGR;
  286. public const int COLOR_BayerGR2RGB = COLOR_BayerGB2BGR;
  287. public const int COLOR_BayerBG2GRAY = 86;
  288. public const int COLOR_BayerGB2GRAY = 87;
  289. public const int COLOR_BayerRG2GRAY = 88;
  290. public const int COLOR_BayerGR2GRAY = 89;
  291. public const int COLOR_BayerRGGB2GRAY = COLOR_BayerBG2GRAY;
  292. public const int COLOR_BayerGRBG2GRAY = COLOR_BayerGB2GRAY;
  293. public const int COLOR_BayerBGGR2GRAY = COLOR_BayerRG2GRAY;
  294. public const int COLOR_BayerGBRG2GRAY = COLOR_BayerGR2GRAY;
  295. public const int COLOR_BayerBG2BGR_VNG = 62;
  296. public const int COLOR_BayerGB2BGR_VNG = 63;
  297. public const int COLOR_BayerRG2BGR_VNG = 64;
  298. public const int COLOR_BayerGR2BGR_VNG = 65;
  299. public const int COLOR_BayerRGGB2BGR_VNG = COLOR_BayerBG2BGR_VNG;
  300. public const int COLOR_BayerGRBG2BGR_VNG = COLOR_BayerGB2BGR_VNG;
  301. public const int COLOR_BayerBGGR2BGR_VNG = COLOR_BayerRG2BGR_VNG;
  302. public const int COLOR_BayerGBRG2BGR_VNG = COLOR_BayerGR2BGR_VNG;
  303. public const int COLOR_BayerRGGB2RGB_VNG = COLOR_BayerBGGR2BGR_VNG;
  304. public const int COLOR_BayerGRBG2RGB_VNG = COLOR_BayerGBRG2BGR_VNG;
  305. public const int COLOR_BayerBGGR2RGB_VNG = COLOR_BayerRGGB2BGR_VNG;
  306. public const int COLOR_BayerGBRG2RGB_VNG = COLOR_BayerGRBG2BGR_VNG;
  307. public const int COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG;
  308. public const int COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG;
  309. public const int COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG;
  310. public const int COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG;
  311. public const int COLOR_BayerBG2BGR_EA = 135;
  312. public const int COLOR_BayerGB2BGR_EA = 136;
  313. public const int COLOR_BayerRG2BGR_EA = 137;
  314. public const int COLOR_BayerGR2BGR_EA = 138;
  315. public const int COLOR_BayerRGGB2BGR_EA = COLOR_BayerBG2BGR_EA;
  316. public const int COLOR_BayerGRBG2BGR_EA = COLOR_BayerGB2BGR_EA;
  317. public const int COLOR_BayerBGGR2BGR_EA = COLOR_BayerRG2BGR_EA;
  318. public const int COLOR_BayerGBRG2BGR_EA = COLOR_BayerGR2BGR_EA;
  319. public const int COLOR_BayerRGGB2RGB_EA = COLOR_BayerBGGR2BGR_EA;
  320. public const int COLOR_BayerGRBG2RGB_EA = COLOR_BayerGBRG2BGR_EA;
  321. public const int COLOR_BayerBGGR2RGB_EA = COLOR_BayerRGGB2BGR_EA;
  322. public const int COLOR_BayerGBRG2RGB_EA = COLOR_BayerGRBG2BGR_EA;
  323. public const int COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA;
  324. public const int COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA;
  325. public const int COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA;
  326. public const int COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA;
  327. public const int COLOR_BayerBG2BGRA = 139;
  328. public const int COLOR_BayerGB2BGRA = 140;
  329. public const int COLOR_BayerRG2BGRA = 141;
  330. public const int COLOR_BayerGR2BGRA = 142;
  331. public const int COLOR_BayerRGGB2BGRA = COLOR_BayerBG2BGRA;
  332. public const int COLOR_BayerGRBG2BGRA = COLOR_BayerGB2BGRA;
  333. public const int COLOR_BayerBGGR2BGRA = COLOR_BayerRG2BGRA;
  334. public const int COLOR_BayerGBRG2BGRA = COLOR_BayerGR2BGRA;
  335. public const int COLOR_BayerRGGB2RGBA = COLOR_BayerBGGR2BGRA;
  336. public const int COLOR_BayerGRBG2RGBA = COLOR_BayerGBRG2BGRA;
  337. public const int COLOR_BayerBGGR2RGBA = COLOR_BayerRGGB2BGRA;
  338. public const int COLOR_BayerGBRG2RGBA = COLOR_BayerGRBG2BGRA;
  339. public const int COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA;
  340. public const int COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA;
  341. public const int COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA;
  342. public const int COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA;
  343. public const int COLOR_COLORCVT_MAX = 143;
  344. // C++: enum cv.ColormapTypes
  345. public const int COLORMAP_AUTUMN = 0;
  346. public const int COLORMAP_BONE = 1;
  347. public const int COLORMAP_JET = 2;
  348. public const int COLORMAP_WINTER = 3;
  349. public const int COLORMAP_RAINBOW = 4;
  350. public const int COLORMAP_OCEAN = 5;
  351. public const int COLORMAP_SUMMER = 6;
  352. public const int COLORMAP_SPRING = 7;
  353. public const int COLORMAP_COOL = 8;
  354. public const int COLORMAP_HSV = 9;
  355. public const int COLORMAP_PINK = 10;
  356. public const int COLORMAP_HOT = 11;
  357. public const int COLORMAP_PARULA = 12;
  358. public const int COLORMAP_MAGMA = 13;
  359. public const int COLORMAP_INFERNO = 14;
  360. public const int COLORMAP_PLASMA = 15;
  361. public const int COLORMAP_VIRIDIS = 16;
  362. public const int COLORMAP_CIVIDIS = 17;
  363. public const int COLORMAP_TWILIGHT = 18;
  364. public const int COLORMAP_TWILIGHT_SHIFTED = 19;
  365. public const int COLORMAP_TURBO = 20;
  366. public const int COLORMAP_DEEPGREEN = 21;
  367. // C++: enum cv.ConnectedComponentsAlgorithmsTypes
  368. public const int CCL_DEFAULT = -1;
  369. public const int CCL_WU = 0;
  370. public const int CCL_GRANA = 1;
  371. public const int CCL_BOLELLI = 2;
  372. public const int CCL_SAUF = 3;
  373. public const int CCL_BBDT = 4;
  374. public const int CCL_SPAGHETTI = 5;
  375. // C++: enum cv.ConnectedComponentsTypes
  376. public const int CC_STAT_LEFT = 0;
  377. public const int CC_STAT_TOP = 1;
  378. public const int CC_STAT_WIDTH = 2;
  379. public const int CC_STAT_HEIGHT = 3;
  380. public const int CC_STAT_AREA = 4;
  381. public const int CC_STAT_MAX = 5;
  382. // C++: enum cv.ContourApproximationModes
  383. public const int CHAIN_APPROX_NONE = 1;
  384. public const int CHAIN_APPROX_SIMPLE = 2;
  385. public const int CHAIN_APPROX_TC89_L1 = 3;
  386. public const int CHAIN_APPROX_TC89_KCOS = 4;
  387. // C++: enum cv.DistanceTransformLabelTypes
  388. public const int DIST_LABEL_CCOMP = 0;
  389. public const int DIST_LABEL_PIXEL = 1;
  390. // C++: enum cv.DistanceTransformMasks
  391. public const int DIST_MASK_3 = 3;
  392. public const int DIST_MASK_5 = 5;
  393. public const int DIST_MASK_PRECISE = 0;
  394. // C++: enum cv.DistanceTypes
  395. public const int DIST_USER = -1;
  396. public const int DIST_L1 = 1;
  397. public const int DIST_L2 = 2;
  398. public const int DIST_C = 3;
  399. public const int DIST_L12 = 4;
  400. public const int DIST_FAIR = 5;
  401. public const int DIST_WELSCH = 6;
  402. public const int DIST_HUBER = 7;
  403. // C++: enum cv.FloodFillFlags
  404. public const int FLOODFILL_FIXED_RANGE = 1 << 16;
  405. public const int FLOODFILL_MASK_ONLY = 1 << 17;
  406. // C++: enum cv.GrabCutClasses
  407. public const int GC_BGD = 0;
  408. public const int GC_FGD = 1;
  409. public const int GC_PR_BGD = 2;
  410. public const int GC_PR_FGD = 3;
  411. // C++: enum cv.GrabCutModes
  412. public const int GC_INIT_WITH_RECT = 0;
  413. public const int GC_INIT_WITH_MASK = 1;
  414. public const int GC_EVAL = 2;
  415. public const int GC_EVAL_FREEZE_MODEL = 3;
  416. // C++: enum cv.HersheyFonts
  417. public const int FONT_HERSHEY_SIMPLEX = 0;
  418. public const int FONT_HERSHEY_PLAIN = 1;
  419. public const int FONT_HERSHEY_DUPLEX = 2;
  420. public const int FONT_HERSHEY_COMPLEX = 3;
  421. public const int FONT_HERSHEY_TRIPLEX = 4;
  422. public const int FONT_HERSHEY_COMPLEX_SMALL = 5;
  423. public const int FONT_HERSHEY_SCRIPT_SIMPLEX = 6;
  424. public const int FONT_HERSHEY_SCRIPT_COMPLEX = 7;
  425. public const int FONT_ITALIC = 16;
  426. // C++: enum cv.HistCompMethods
  427. public const int HISTCMP_CORREL = 0;
  428. public const int HISTCMP_CHISQR = 1;
  429. public const int HISTCMP_INTERSECT = 2;
  430. public const int HISTCMP_BHATTACHARYYA = 3;
  431. public const int HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA;
  432. public const int HISTCMP_CHISQR_ALT = 4;
  433. public const int HISTCMP_KL_DIV = 5;
  434. // C++: enum cv.HoughModes
  435. public const int HOUGH_STANDARD = 0;
  436. public const int HOUGH_PROBABILISTIC = 1;
  437. public const int HOUGH_MULTI_SCALE = 2;
  438. public const int HOUGH_GRADIENT = 3;
  439. public const int HOUGH_GRADIENT_ALT = 4;
  440. // C++: enum cv.InterpolationFlags
  441. public const int INTER_NEAREST = 0;
  442. public const int INTER_LINEAR = 1;
  443. public const int INTER_CUBIC = 2;
  444. public const int INTER_AREA = 3;
  445. public const int INTER_LANCZOS4 = 4;
  446. public const int INTER_LINEAR_EXACT = 5;
  447. public const int INTER_NEAREST_EXACT = 6;
  448. public const int INTER_MAX = 7;
  449. public const int WARP_FILL_OUTLIERS = 8;
  450. public const int WARP_INVERSE_MAP = 16;
  451. // C++: enum cv.InterpolationMasks
  452. public const int INTER_BITS = 5;
  453. public const int INTER_BITS2 = INTER_BITS * 2;
  454. public const int INTER_TAB_SIZE = 1 << INTER_BITS;
  455. public const int INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE;
  456. // C++: enum cv.LineSegmentDetectorModes
  457. public const int LSD_REFINE_NONE = 0;
  458. public const int LSD_REFINE_STD = 1;
  459. public const int LSD_REFINE_ADV = 2;
  460. // C++: enum cv.LineTypes
  461. public const int FILLED = -1;
  462. public const int LINE_4 = 4;
  463. public const int LINE_8 = 8;
  464. public const int LINE_AA = 16;
  465. // C++: enum cv.MarkerTypes
  466. public const int MARKER_CROSS = 0;
  467. public const int MARKER_TILTED_CROSS = 1;
  468. public const int MARKER_STAR = 2;
  469. public const int MARKER_DIAMOND = 3;
  470. public const int MARKER_SQUARE = 4;
  471. public const int MARKER_TRIANGLE_UP = 5;
  472. public const int MARKER_TRIANGLE_DOWN = 6;
  473. // C++: enum cv.MorphShapes
  474. public const int MORPH_RECT = 0;
  475. public const int MORPH_CROSS = 1;
  476. public const int MORPH_ELLIPSE = 2;
  477. // C++: enum cv.MorphTypes
  478. public const int MORPH_ERODE = 0;
  479. public const int MORPH_DILATE = 1;
  480. public const int MORPH_OPEN = 2;
  481. public const int MORPH_CLOSE = 3;
  482. public const int MORPH_GRADIENT = 4;
  483. public const int MORPH_TOPHAT = 5;
  484. public const int MORPH_BLACKHAT = 6;
  485. public const int MORPH_HITMISS = 7;
  486. // C++: enum cv.RectanglesIntersectTypes
  487. public const int INTERSECT_NONE = 0;
  488. public const int INTERSECT_PARTIAL = 1;
  489. public const int INTERSECT_FULL = 2;
  490. // C++: enum cv.RetrievalModes
  491. public const int RETR_EXTERNAL = 0;
  492. public const int RETR_LIST = 1;
  493. public const int RETR_CCOMP = 2;
  494. public const int RETR_TREE = 3;
  495. public const int RETR_FLOODFILL = 4;
  496. // C++: enum cv.ShapeMatchModes
  497. public const int CONTOURS_MATCH_I1 = 1;
  498. public const int CONTOURS_MATCH_I2 = 2;
  499. public const int CONTOURS_MATCH_I3 = 3;
  500. // C++: enum cv.SpecialFilter
  501. public const int FILTER_SCHARR = -1;
  502. // C++: enum cv.TemplateMatchModes
  503. public const int TM_SQDIFF = 0;
  504. public const int TM_SQDIFF_NORMED = 1;
  505. public const int TM_CCORR = 2;
  506. public const int TM_CCORR_NORMED = 3;
  507. public const int TM_CCOEFF = 4;
  508. public const int TM_CCOEFF_NORMED = 5;
  509. // C++: enum cv.ThresholdTypes
  510. public const int THRESH_BINARY = 0;
  511. public const int THRESH_BINARY_INV = 1;
  512. public const int THRESH_TRUNC = 2;
  513. public const int THRESH_TOZERO = 3;
  514. public const int THRESH_TOZERO_INV = 4;
  515. public const int THRESH_MASK = 7;
  516. public const int THRESH_OTSU = 8;
  517. public const int THRESH_TRIANGLE = 16;
  518. // C++: enum cv.WarpPolarMode
  519. public const int WARP_POLAR_LINEAR = 0;
  520. public const int WARP_POLAR_LOG = 256;
  521. //
  522. // C++: Ptr_LineSegmentDetector cv::createLineSegmentDetector(int refine = LSD_REFINE_STD, double scale = 0.8, double sigma_scale = 0.6, double quant = 2.0, double ang_th = 22.5, double log_eps = 0, double density_th = 0.7, int n_bins = 1024)
  523. //
  524. /**
  525. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  526. *
  527. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  528. * to edit those, as to tailor it for their own application.
  529. *
  530. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  531. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  532. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  533. * param quant Bound to the quantization error on the gradient norm.
  534. * param ang_th Gradient angle tolerance in degrees.
  535. * param log_eps Detection threshold: -log10(NFA) &gt; log_eps. Used only when advance refinement is chosen.
  536. * param density_th Minimal density of aligned region points in the enclosing rectangle.
  537. * param n_bins Number of bins in pseudo-ordering of gradient modulus.
  538. * return automatically generated
  539. */
  540. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps, double density_th, int n_bins)
  541. {
  542. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_10(refine, scale, sigma_scale, quant, ang_th, log_eps, density_th, n_bins)));
  543. }
  544. /**
  545. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  546. *
  547. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  548. * to edit those, as to tailor it for their own application.
  549. *
  550. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  551. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  552. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  553. * param quant Bound to the quantization error on the gradient norm.
  554. * param ang_th Gradient angle tolerance in degrees.
  555. * param log_eps Detection threshold: -log10(NFA) &gt; log_eps. Used only when advance refinement is chosen.
  556. * param density_th Minimal density of aligned region points in the enclosing rectangle.
  557. * return automatically generated
  558. */
  559. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps, double density_th)
  560. {
  561. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_11(refine, scale, sigma_scale, quant, ang_th, log_eps, density_th)));
  562. }
  563. /**
  564. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  565. *
  566. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  567. * to edit those, as to tailor it for their own application.
  568. *
  569. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  570. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  571. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  572. * param quant Bound to the quantization error on the gradient norm.
  573. * param ang_th Gradient angle tolerance in degrees.
  574. * param log_eps Detection threshold: -log10(NFA) &gt; log_eps. Used only when advance refinement is chosen.
  575. * return automatically generated
  576. */
  577. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps)
  578. {
  579. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_12(refine, scale, sigma_scale, quant, ang_th, log_eps)));
  580. }
  581. /**
  582. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  583. *
  584. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  585. * to edit those, as to tailor it for their own application.
  586. *
  587. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  588. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  589. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  590. * param quant Bound to the quantization error on the gradient norm.
  591. * param ang_th Gradient angle tolerance in degrees.
  592. * return automatically generated
  593. */
  594. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale, double quant, double ang_th)
  595. {
  596. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_13(refine, scale, sigma_scale, quant, ang_th)));
  597. }
  598. /**
  599. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  600. *
  601. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  602. * to edit those, as to tailor it for their own application.
  603. *
  604. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  605. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  606. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  607. * param quant Bound to the quantization error on the gradient norm.
  608. * return automatically generated
  609. */
  610. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale, double quant)
  611. {
  612. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_14(refine, scale, sigma_scale, quant)));
  613. }
  614. /**
  615. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  616. *
  617. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  618. * to edit those, as to tailor it for their own application.
  619. *
  620. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  621. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  622. * param sigma_scale Sigma for Gaussian filter. It is computed as sigma = sigma_scale/scale.
  623. * return automatically generated
  624. */
  625. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale, double sigma_scale)
  626. {
  627. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_15(refine, scale, sigma_scale)));
  628. }
  629. /**
  630. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  631. *
  632. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  633. * to edit those, as to tailor it for their own application.
  634. *
  635. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  636. * param scale The scale of the image that will be used to find the lines. Range (0..1].
  637. * return automatically generated
  638. */
  639. public static LineSegmentDetector createLineSegmentDetector(int refine, double scale)
  640. {
  641. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_16(refine, scale)));
  642. }
  643. /**
  644. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  645. *
  646. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  647. * to edit those, as to tailor it for their own application.
  648. *
  649. * param refine The way found lines will be refined, see #LineSegmentDetectorModes
  650. * return automatically generated
  651. */
  652. public static LineSegmentDetector createLineSegmentDetector(int refine)
  653. {
  654. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_17(refine)));
  655. }
  656. /**
  657. * Creates a smart pointer to a LineSegmentDetector object and initializes it.
  658. *
  659. * The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
  660. * to edit those, as to tailor it for their own application.
  661. *
  662. * return automatically generated
  663. */
  664. public static LineSegmentDetector createLineSegmentDetector()
  665. {
  666. return LineSegmentDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createLineSegmentDetector_18()));
  667. }
  668. //
  669. // C++: Mat cv::getGaussianKernel(int ksize, double sigma, int ktype = CV_64F)
  670. //
  671. /**
  672. * Returns Gaussian filter coefficients.
  673. *
  674. * The function computes and returns the \(\texttt{ksize} \times 1\) matrix of Gaussian filter
  675. * coefficients:
  676. *
  677. * \(G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\)
  678. *
  679. * where \(i=0..\texttt{ksize}-1\) and \(\alpha\) is the scale factor chosen so that \(\sum_i G_i=1\).
  680. *
  681. * Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize
  682. * smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly.
  683. * You may also use the higher-level GaussianBlur.
  684. * param ksize Aperture size. It should be odd ( \(\texttt{ksize} \mod 2 = 1\) ) and positive.
  685. * param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as
  686. * {code sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8}.
  687. * param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
  688. * SEE: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
  689. * return automatically generated
  690. */
  691. public static Mat getGaussianKernel(int ksize, double sigma, int ktype)
  692. {
  693. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getGaussianKernel_10(ksize, sigma, ktype)));
  694. }
  695. /**
  696. * Returns Gaussian filter coefficients.
  697. *
  698. * The function computes and returns the \(\texttt{ksize} \times 1\) matrix of Gaussian filter
  699. * coefficients:
  700. *
  701. * \(G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\)
  702. *
  703. * where \(i=0..\texttt{ksize}-1\) and \(\alpha\) is the scale factor chosen so that \(\sum_i G_i=1\).
  704. *
  705. * Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize
  706. * smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly.
  707. * You may also use the higher-level GaussianBlur.
  708. * param ksize Aperture size. It should be odd ( \(\texttt{ksize} \mod 2 = 1\) ) and positive.
  709. * param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as
  710. * {code sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8}.
  711. * SEE: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
  712. * return automatically generated
  713. */
  714. public static Mat getGaussianKernel(int ksize, double sigma)
  715. {
  716. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getGaussianKernel_11(ksize, sigma)));
  717. }
  718. //
  719. // C++: void cv::getDerivKernels(Mat& kx, Mat& ky, int dx, int dy, int ksize, bool normalize = false, int ktype = CV_32F)
  720. //
  721. /**
  722. * Returns filter coefficients for computing spatial image derivatives.
  723. *
  724. * The function computes and returns the filter coefficients for spatial image derivatives. When
  725. * {code ksize=FILTER_SCHARR}, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
  726. * kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to
  727. *
  728. * param kx Output matrix of row filter coefficients. It has the type ktype .
  729. * param ky Output matrix of column filter coefficients. It has the type ktype .
  730. * param dx Derivative order in respect of x.
  731. * param dy Derivative order in respect of y.
  732. * param ksize Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.
  733. * param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not.
  734. * Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
  735. * going to filter floating-point images, you are likely to use the normalized kernels. But if you
  736. * compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
  737. * all the fractional bits, you may want to set normalize=false .
  738. * param ktype Type of filter coefficients. It can be CV_32f or CV_64F .
  739. */
  740. public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize, bool normalize, int ktype)
  741. {
  742. if (kx != null) kx.ThrowIfDisposed();
  743. if (ky != null) ky.ThrowIfDisposed();
  744. imgproc_Imgproc_getDerivKernels_10(kx.nativeObj, ky.nativeObj, dx, dy, ksize, normalize, ktype);
  745. }
  746. /**
  747. * Returns filter coefficients for computing spatial image derivatives.
  748. *
  749. * The function computes and returns the filter coefficients for spatial image derivatives. When
  750. * {code ksize=FILTER_SCHARR}, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
  751. * kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to
  752. *
  753. * param kx Output matrix of row filter coefficients. It has the type ktype .
  754. * param ky Output matrix of column filter coefficients. It has the type ktype .
  755. * param dx Derivative order in respect of x.
  756. * param dy Derivative order in respect of y.
  757. * param ksize Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.
  758. * param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not.
  759. * Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
  760. * going to filter floating-point images, you are likely to use the normalized kernels. But if you
  761. * compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
  762. * all the fractional bits, you may want to set normalize=false .
  763. */
  764. public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize, bool normalize)
  765. {
  766. if (kx != null) kx.ThrowIfDisposed();
  767. if (ky != null) ky.ThrowIfDisposed();
  768. imgproc_Imgproc_getDerivKernels_11(kx.nativeObj, ky.nativeObj, dx, dy, ksize, normalize);
  769. }
  770. /**
  771. * Returns filter coefficients for computing spatial image derivatives.
  772. *
  773. * The function computes and returns the filter coefficients for spatial image derivatives. When
  774. * {code ksize=FILTER_SCHARR}, the Scharr \(3 \times 3\) kernels are generated (see #Scharr). Otherwise, Sobel
  775. * kernels are generated (see #Sobel). The filters are normally passed to #sepFilter2D or to
  776. *
  777. * param kx Output matrix of row filter coefficients. It has the type ktype .
  778. * param ky Output matrix of column filter coefficients. It has the type ktype .
  779. * param dx Derivative order in respect of x.
  780. * param dy Derivative order in respect of y.
  781. * param ksize Aperture size. It can be FILTER_SCHARR, 1, 3, 5, or 7.
  782. * Theoretically, the coefficients should have the denominator \(=2^{ksize*2-dx-dy-2}\). If you are
  783. * going to filter floating-point images, you are likely to use the normalized kernels. But if you
  784. * compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
  785. * all the fractional bits, you may want to set normalize=false .
  786. */
  787. public static void getDerivKernels(Mat kx, Mat ky, int dx, int dy, int ksize)
  788. {
  789. if (kx != null) kx.ThrowIfDisposed();
  790. if (ky != null) ky.ThrowIfDisposed();
  791. imgproc_Imgproc_getDerivKernels_12(kx.nativeObj, ky.nativeObj, dx, dy, ksize);
  792. }
  793. //
  794. // C++: Mat cv::getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi = CV_PI*0.5, int ktype = CV_64F)
  795. //
  796. /**
  797. * Returns Gabor filter coefficients.
  798. *
  799. * For more details about gabor filter equations and parameters, see: [Gabor
  800. * Filter](http://en.wikipedia.org/wiki/Gabor_filter).
  801. *
  802. * param ksize Size of the filter returned.
  803. * param sigma Standard deviation of the gaussian envelope.
  804. * param theta Orientation of the normal to the parallel stripes of a Gabor function.
  805. * param lambd Wavelength of the sinusoidal factor.
  806. * param gamma Spatial aspect ratio.
  807. * param psi Phase offset.
  808. * param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
  809. * return automatically generated
  810. */
  811. public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi, int ktype)
  812. {
  813. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getGaborKernel_10(ksize.width, ksize.height, sigma, theta, lambd, gamma, psi, ktype)));
  814. }
  815. /**
  816. * Returns Gabor filter coefficients.
  817. *
  818. * For more details about gabor filter equations and parameters, see: [Gabor
  819. * Filter](http://en.wikipedia.org/wiki/Gabor_filter).
  820. *
  821. * param ksize Size of the filter returned.
  822. * param sigma Standard deviation of the gaussian envelope.
  823. * param theta Orientation of the normal to the parallel stripes of a Gabor function.
  824. * param lambd Wavelength of the sinusoidal factor.
  825. * param gamma Spatial aspect ratio.
  826. * param psi Phase offset.
  827. * return automatically generated
  828. */
  829. public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi)
  830. {
  831. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getGaborKernel_11(ksize.width, ksize.height, sigma, theta, lambd, gamma, psi)));
  832. }
  833. /**
  834. * Returns Gabor filter coefficients.
  835. *
  836. * For more details about gabor filter equations and parameters, see: [Gabor
  837. * Filter](http://en.wikipedia.org/wiki/Gabor_filter).
  838. *
  839. * param ksize Size of the filter returned.
  840. * param sigma Standard deviation of the gaussian envelope.
  841. * param theta Orientation of the normal to the parallel stripes of a Gabor function.
  842. * param lambd Wavelength of the sinusoidal factor.
  843. * param gamma Spatial aspect ratio.
  844. * return automatically generated
  845. */
  846. public static Mat getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma)
  847. {
  848. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getGaborKernel_12(ksize.width, ksize.height, sigma, theta, lambd, gamma)));
  849. }
  850. //
  851. // C++: Mat cv::getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1))
  852. //
  853. /**
  854. * Returns a structuring element of the specified size and shape for morphological operations.
  855. *
  856. * The function constructs and returns the structuring element that can be further passed to #erode,
  857. * #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as
  858. * the structuring element.
  859. *
  860. * param shape Element shape that could be one of #MorphShapes
  861. * param ksize Size of the structuring element.
  862. * param anchor Anchor position within the element. The default value \((-1, -1)\) means that the
  863. * anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
  864. * position. In other cases the anchor just regulates how much the result of the morphological
  865. * operation is shifted.
  866. * return automatically generated
  867. */
  868. public static Mat getStructuringElement(int shape, Size ksize, Point anchor)
  869. {
  870. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getStructuringElement_10(shape, ksize.width, ksize.height, anchor.x, anchor.y)));
  871. }
  872. /**
  873. * Returns a structuring element of the specified size and shape for morphological operations.
  874. *
  875. * The function constructs and returns the structuring element that can be further passed to #erode,
  876. * #dilate or #morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as
  877. * the structuring element.
  878. *
  879. * param shape Element shape that could be one of #MorphShapes
  880. * param ksize Size of the structuring element.
  881. * anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
  882. * position. In other cases the anchor just regulates how much the result of the morphological
  883. * operation is shifted.
  884. * return automatically generated
  885. */
  886. public static Mat getStructuringElement(int shape, Size ksize)
  887. {
  888. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getStructuringElement_11(shape, ksize.width, ksize.height)));
  889. }
  890. //
  891. // C++: void cv::medianBlur(Mat src, Mat& dst, int ksize)
  892. //
  893. /**
  894. * Blurs an image using the median filter.
  895. *
  896. * The function smoothes an image using the median filter with the \(\texttt{ksize} \times
  897. * \texttt{ksize}\) aperture. Each channel of a multi-channel image is processed independently.
  898. * In-place operation is supported.
  899. *
  900. * <b>Note:</b> The median filter uses #BORDER_REPLICATE internally to cope with border pixels, see #BorderTypes
  901. *
  902. * param src input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be
  903. * CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.
  904. * param dst destination array of the same size and type as src.
  905. * param ksize aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
  906. * SEE: bilateralFilter, blur, boxFilter, GaussianBlur
  907. */
  908. public static void medianBlur(Mat src, Mat dst, int ksize)
  909. {
  910. if (src != null) src.ThrowIfDisposed();
  911. if (dst != null) dst.ThrowIfDisposed();
  912. imgproc_Imgproc_medianBlur_10(src.nativeObj, dst.nativeObj, ksize);
  913. }
  914. //
  915. // C++: void cv::GaussianBlur(Mat src, Mat& dst, Size ksize, double sigmaX, double sigmaY = 0, int borderType = BORDER_DEFAULT)
  916. //
  917. /**
  918. * Blurs an image using a Gaussian filter.
  919. *
  920. * The function convolves the source image with the specified Gaussian kernel. In-place filtering is
  921. * supported.
  922. *
  923. * param src input image; the image can have any number of channels, which are processed
  924. * independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  925. * param dst output image of the same size and type as src.
  926. * param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
  927. * positive and odd. Or, they can be zero's and then they are computed from sigma.
  928. * param sigmaX Gaussian kernel standard deviation in X direction.
  929. * param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
  930. * equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
  931. * respectively (see #getGaussianKernel for details); to fully control the result regardless of
  932. * possible future modifications of all this semantics, it is recommended to specify all of ksize,
  933. * sigmaX, and sigmaY.
  934. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  935. *
  936. * SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
  937. */
  938. public static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX, double sigmaY, int borderType)
  939. {
  940. if (src != null) src.ThrowIfDisposed();
  941. if (dst != null) dst.ThrowIfDisposed();
  942. imgproc_Imgproc_GaussianBlur_10(src.nativeObj, dst.nativeObj, ksize.width, ksize.height, sigmaX, sigmaY, borderType);
  943. }
  944. /**
  945. * Blurs an image using a Gaussian filter.
  946. *
  947. * The function convolves the source image with the specified Gaussian kernel. In-place filtering is
  948. * supported.
  949. *
  950. * param src input image; the image can have any number of channels, which are processed
  951. * independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  952. * param dst output image of the same size and type as src.
  953. * param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
  954. * positive and odd. Or, they can be zero's and then they are computed from sigma.
  955. * param sigmaX Gaussian kernel standard deviation in X direction.
  956. * param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
  957. * equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
  958. * respectively (see #getGaussianKernel for details); to fully control the result regardless of
  959. * possible future modifications of all this semantics, it is recommended to specify all of ksize,
  960. * sigmaX, and sigmaY.
  961. *
  962. * SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
  963. */
  964. public static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX, double sigmaY)
  965. {
  966. if (src != null) src.ThrowIfDisposed();
  967. if (dst != null) dst.ThrowIfDisposed();
  968. imgproc_Imgproc_GaussianBlur_11(src.nativeObj, dst.nativeObj, ksize.width, ksize.height, sigmaX, sigmaY);
  969. }
  970. /**
  971. * Blurs an image using a Gaussian filter.
  972. *
  973. * The function convolves the source image with the specified Gaussian kernel. In-place filtering is
  974. * supported.
  975. *
  976. * param src input image; the image can have any number of channels, which are processed
  977. * independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  978. * param dst output image of the same size and type as src.
  979. * param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
  980. * positive and odd. Or, they can be zero's and then they are computed from sigma.
  981. * param sigmaX Gaussian kernel standard deviation in X direction.
  982. * equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
  983. * respectively (see #getGaussianKernel for details); to fully control the result regardless of
  984. * possible future modifications of all this semantics, it is recommended to specify all of ksize,
  985. * sigmaX, and sigmaY.
  986. *
  987. * SEE: sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
  988. */
  989. public static void GaussianBlur(Mat src, Mat dst, Size ksize, double sigmaX)
  990. {
  991. if (src != null) src.ThrowIfDisposed();
  992. if (dst != null) dst.ThrowIfDisposed();
  993. imgproc_Imgproc_GaussianBlur_12(src.nativeObj, dst.nativeObj, ksize.width, ksize.height, sigmaX);
  994. }
  995. //
  996. // C++: void cv::bilateralFilter(Mat src, Mat& dst, int d, double sigmaColor, double sigmaSpace, int borderType = BORDER_DEFAULT)
  997. //
  998. /**
  999. * Applies the bilateral filter to an image.
  1000. *
  1001. * The function applies bilateral filtering to the input image, as described in
  1002. * http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
  1003. * bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is
  1004. * very slow compared to most filters.
  1005. *
  1006. * _Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (&lt;
  1007. * 10), the filter will not have much effect, whereas if they are large (&gt; 150), they will have a very
  1008. * strong effect, making the image look "cartoonish".
  1009. *
  1010. * _Filter size_: Large filters (d &gt; 5) are very slow, so it is recommended to use d=5 for real-time
  1011. * applications, and perhaps d=9 for offline applications that need heavy noise filtering.
  1012. *
  1013. * This filter does not work inplace.
  1014. * param src Source 8-bit or floating-point, 1-channel or 3-channel image.
  1015. * param dst Destination image of the same size and type as src .
  1016. * param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
  1017. * it is computed from sigmaSpace.
  1018. * param sigmaColor Filter sigma in the color space. A larger value of the parameter means that
  1019. * farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
  1020. * in larger areas of semi-equal color.
  1021. * param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that
  1022. * farther pixels will influence each other as long as their colors are close enough (see sigmaColor
  1023. * ). When d&gt;0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
  1024. * proportional to sigmaSpace.
  1025. * param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
  1026. */
  1027. public static void bilateralFilter(Mat src, Mat dst, int d, double sigmaColor, double sigmaSpace, int borderType)
  1028. {
  1029. if (src != null) src.ThrowIfDisposed();
  1030. if (dst != null) dst.ThrowIfDisposed();
  1031. imgproc_Imgproc_bilateralFilter_10(src.nativeObj, dst.nativeObj, d, sigmaColor, sigmaSpace, borderType);
  1032. }
  1033. /**
  1034. * Applies the bilateral filter to an image.
  1035. *
  1036. * The function applies bilateral filtering to the input image, as described in
  1037. * http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
  1038. * bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is
  1039. * very slow compared to most filters.
  1040. *
  1041. * _Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (&lt;
  1042. * 10), the filter will not have much effect, whereas if they are large (&gt; 150), they will have a very
  1043. * strong effect, making the image look "cartoonish".
  1044. *
  1045. * _Filter size_: Large filters (d &gt; 5) are very slow, so it is recommended to use d=5 for real-time
  1046. * applications, and perhaps d=9 for offline applications that need heavy noise filtering.
  1047. *
  1048. * This filter does not work inplace.
  1049. * param src Source 8-bit or floating-point, 1-channel or 3-channel image.
  1050. * param dst Destination image of the same size and type as src .
  1051. * param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
  1052. * it is computed from sigmaSpace.
  1053. * param sigmaColor Filter sigma in the color space. A larger value of the parameter means that
  1054. * farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
  1055. * in larger areas of semi-equal color.
  1056. * param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that
  1057. * farther pixels will influence each other as long as their colors are close enough (see sigmaColor
  1058. * ). When d&gt;0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
  1059. * proportional to sigmaSpace.
  1060. */
  1061. public static void bilateralFilter(Mat src, Mat dst, int d, double sigmaColor, double sigmaSpace)
  1062. {
  1063. if (src != null) src.ThrowIfDisposed();
  1064. if (dst != null) dst.ThrowIfDisposed();
  1065. imgproc_Imgproc_bilateralFilter_11(src.nativeObj, dst.nativeObj, d, sigmaColor, sigmaSpace);
  1066. }
  1067. //
  1068. // C++: void cv::boxFilter(Mat src, Mat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), bool normalize = true, int borderType = BORDER_DEFAULT)
  1069. //
  1070. /**
  1071. * Blurs an image using the box filter.
  1072. *
  1073. * The function smooths an image using the kernel:
  1074. *
  1075. * \(\texttt{K} = \alpha \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \end{bmatrix}\)
  1076. *
  1077. * where
  1078. *
  1079. * \(\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} &amp; \texttt{when } \texttt{normalize=true} \\1 &amp; \texttt{otherwise}\end{cases}\)
  1080. *
  1081. * Unnormalized box filter is useful for computing various integral characteristics over each pixel
  1082. * neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
  1083. * algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.
  1084. *
  1085. * param src input image.
  1086. * param dst output image of the same size and type as src.
  1087. * param ddepth the output image depth (-1 to use src.depth()).
  1088. * param ksize blurring kernel size.
  1089. * param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
  1090. * center.
  1091. * param normalize flag, specifying whether the kernel is normalized by its area or not.
  1092. * param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
  1093. * SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integral
  1094. */
  1095. public static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType)
  1096. {
  1097. if (src != null) src.ThrowIfDisposed();
  1098. if (dst != null) dst.ThrowIfDisposed();
  1099. imgproc_Imgproc_boxFilter_10(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y, normalize, borderType);
  1100. }
  1101. /**
  1102. * Blurs an image using the box filter.
  1103. *
  1104. * The function smooths an image using the kernel:
  1105. *
  1106. * \(\texttt{K} = \alpha \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \end{bmatrix}\)
  1107. *
  1108. * where
  1109. *
  1110. * \(\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} &amp; \texttt{when } \texttt{normalize=true} \\1 &amp; \texttt{otherwise}\end{cases}\)
  1111. *
  1112. * Unnormalized box filter is useful for computing various integral characteristics over each pixel
  1113. * neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
  1114. * algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.
  1115. *
  1116. * param src input image.
  1117. * param dst output image of the same size and type as src.
  1118. * param ddepth the output image depth (-1 to use src.depth()).
  1119. * param ksize blurring kernel size.
  1120. * param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
  1121. * center.
  1122. * param normalize flag, specifying whether the kernel is normalized by its area or not.
  1123. * SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integral
  1124. */
  1125. public static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, bool normalize)
  1126. {
  1127. if (src != null) src.ThrowIfDisposed();
  1128. if (dst != null) dst.ThrowIfDisposed();
  1129. imgproc_Imgproc_boxFilter_11(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y, normalize);
  1130. }
  1131. /**
  1132. * Blurs an image using the box filter.
  1133. *
  1134. * The function smooths an image using the kernel:
  1135. *
  1136. * \(\texttt{K} = \alpha \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \end{bmatrix}\)
  1137. *
  1138. * where
  1139. *
  1140. * \(\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} &amp; \texttt{when } \texttt{normalize=true} \\1 &amp; \texttt{otherwise}\end{cases}\)
  1141. *
  1142. * Unnormalized box filter is useful for computing various integral characteristics over each pixel
  1143. * neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
  1144. * algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.
  1145. *
  1146. * param src input image.
  1147. * param dst output image of the same size and type as src.
  1148. * param ddepth the output image depth (-1 to use src.depth()).
  1149. * param ksize blurring kernel size.
  1150. * param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
  1151. * center.
  1152. * SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integral
  1153. */
  1154. public static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor)
  1155. {
  1156. if (src != null) src.ThrowIfDisposed();
  1157. if (dst != null) dst.ThrowIfDisposed();
  1158. imgproc_Imgproc_boxFilter_12(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y);
  1159. }
  1160. /**
  1161. * Blurs an image using the box filter.
  1162. *
  1163. * The function smooths an image using the kernel:
  1164. *
  1165. * \(\texttt{K} = \alpha \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \end{bmatrix}\)
  1166. *
  1167. * where
  1168. *
  1169. * \(\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} &amp; \texttt{when } \texttt{normalize=true} \\1 &amp; \texttt{otherwise}\end{cases}\)
  1170. *
  1171. * Unnormalized box filter is useful for computing various integral characteristics over each pixel
  1172. * neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
  1173. * algorithms, and so on). If you need to compute pixel sums over variable-size windows, use #integral.
  1174. *
  1175. * param src input image.
  1176. * param dst output image of the same size and type as src.
  1177. * param ddepth the output image depth (-1 to use src.depth()).
  1178. * param ksize blurring kernel size.
  1179. * center.
  1180. * SEE: blur, bilateralFilter, GaussianBlur, medianBlur, integral
  1181. */
  1182. public static void boxFilter(Mat src, Mat dst, int ddepth, Size ksize)
  1183. {
  1184. if (src != null) src.ThrowIfDisposed();
  1185. if (dst != null) dst.ThrowIfDisposed();
  1186. imgproc_Imgproc_boxFilter_13(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height);
  1187. }
  1188. //
  1189. // C++: void cv::sqrBoxFilter(Mat src, Mat& dst, int ddepth, Size ksize, Point anchor = Point(-1, -1), bool normalize = true, int borderType = BORDER_DEFAULT)
  1190. //
  1191. /**
  1192. * Calculates the normalized sum of squares of the pixel values overlapping the filter.
  1193. *
  1194. * For every pixel \( (x, y) \) in the source image, the function calculates the sum of squares of those neighboring
  1195. * pixel values which overlap the filter placed over the pixel \( (x, y) \).
  1196. *
  1197. * The unnormalized square box filter can be useful in computing local image statistics such as the local
  1198. * variance and standard deviation around the neighborhood of a pixel.
  1199. *
  1200. * param src input image
  1201. * param dst output image of the same size and type as src
  1202. * param ddepth the output image depth (-1 to use src.depth())
  1203. * param ksize kernel size
  1204. * param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
  1205. * center.
  1206. * param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
  1207. * param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
  1208. * SEE: boxFilter
  1209. */
  1210. public static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, bool normalize, int borderType)
  1211. {
  1212. if (src != null) src.ThrowIfDisposed();
  1213. if (dst != null) dst.ThrowIfDisposed();
  1214. imgproc_Imgproc_sqrBoxFilter_10(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y, normalize, borderType);
  1215. }
  1216. /**
  1217. * Calculates the normalized sum of squares of the pixel values overlapping the filter.
  1218. *
  1219. * For every pixel \( (x, y) \) in the source image, the function calculates the sum of squares of those neighboring
  1220. * pixel values which overlap the filter placed over the pixel \( (x, y) \).
  1221. *
  1222. * The unnormalized square box filter can be useful in computing local image statistics such as the local
  1223. * variance and standard deviation around the neighborhood of a pixel.
  1224. *
  1225. * param src input image
  1226. * param dst output image of the same size and type as src
  1227. * param ddepth the output image depth (-1 to use src.depth())
  1228. * param ksize kernel size
  1229. * param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
  1230. * center.
  1231. * param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
  1232. * SEE: boxFilter
  1233. */
  1234. public static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor, bool normalize)
  1235. {
  1236. if (src != null) src.ThrowIfDisposed();
  1237. if (dst != null) dst.ThrowIfDisposed();
  1238. imgproc_Imgproc_sqrBoxFilter_11(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y, normalize);
  1239. }
  1240. /**
  1241. * Calculates the normalized sum of squares of the pixel values overlapping the filter.
  1242. *
  1243. * For every pixel \( (x, y) \) in the source image, the function calculates the sum of squares of those neighboring
  1244. * pixel values which overlap the filter placed over the pixel \( (x, y) \).
  1245. *
  1246. * The unnormalized square box filter can be useful in computing local image statistics such as the local
  1247. * variance and standard deviation around the neighborhood of a pixel.
  1248. *
  1249. * param src input image
  1250. * param dst output image of the same size and type as src
  1251. * param ddepth the output image depth (-1 to use src.depth())
  1252. * param ksize kernel size
  1253. * param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
  1254. * center.
  1255. * SEE: boxFilter
  1256. */
  1257. public static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize, Point anchor)
  1258. {
  1259. if (src != null) src.ThrowIfDisposed();
  1260. if (dst != null) dst.ThrowIfDisposed();
  1261. imgproc_Imgproc_sqrBoxFilter_12(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height, anchor.x, anchor.y);
  1262. }
  1263. /**
  1264. * Calculates the normalized sum of squares of the pixel values overlapping the filter.
  1265. *
  1266. * For every pixel \( (x, y) \) in the source image, the function calculates the sum of squares of those neighboring
  1267. * pixel values which overlap the filter placed over the pixel \( (x, y) \).
  1268. *
  1269. * The unnormalized square box filter can be useful in computing local image statistics such as the local
  1270. * variance and standard deviation around the neighborhood of a pixel.
  1271. *
  1272. * param src input image
  1273. * param dst output image of the same size and type as src
  1274. * param ddepth the output image depth (-1 to use src.depth())
  1275. * param ksize kernel size
  1276. * center.
  1277. * SEE: boxFilter
  1278. */
  1279. public static void sqrBoxFilter(Mat src, Mat dst, int ddepth, Size ksize)
  1280. {
  1281. if (src != null) src.ThrowIfDisposed();
  1282. if (dst != null) dst.ThrowIfDisposed();
  1283. imgproc_Imgproc_sqrBoxFilter_13(src.nativeObj, dst.nativeObj, ddepth, ksize.width, ksize.height);
  1284. }
  1285. //
  1286. // C++: void cv::blur(Mat src, Mat& dst, Size ksize, Point anchor = Point(-1,-1), int borderType = BORDER_DEFAULT)
  1287. //
  1288. /**
  1289. * Blurs an image using the normalized box filter.
  1290. *
  1291. * The function smooths an image using the kernel:
  1292. *
  1293. * \(\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \end{bmatrix}\)
  1294. *
  1295. * The call {code blur(src, dst, ksize, anchor, borderType)} is equivalent to `boxFilter(src, dst, src.type(), ksize,
  1296. * anchor, true, borderType)`.
  1297. *
  1298. * param src input image; it can have any number of channels, which are processed independently, but
  1299. * the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  1300. * param dst output image of the same size and type as src.
  1301. * param ksize blurring kernel size.
  1302. * param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
  1303. * center.
  1304. * param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
  1305. * SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlur
  1306. */
  1307. public static void blur(Mat src, Mat dst, Size ksize, Point anchor, int borderType)
  1308. {
  1309. if (src != null) src.ThrowIfDisposed();
  1310. if (dst != null) dst.ThrowIfDisposed();
  1311. imgproc_Imgproc_blur_10(src.nativeObj, dst.nativeObj, ksize.width, ksize.height, anchor.x, anchor.y, borderType);
  1312. }
  1313. /**
  1314. * Blurs an image using the normalized box filter.
  1315. *
  1316. * The function smooths an image using the kernel:
  1317. *
  1318. * \(\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \end{bmatrix}\)
  1319. *
  1320. * The call {code blur(src, dst, ksize, anchor, borderType)} is equivalent to `boxFilter(src, dst, src.type(), ksize,
  1321. * anchor, true, borderType)`.
  1322. *
  1323. * param src input image; it can have any number of channels, which are processed independently, but
  1324. * the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  1325. * param dst output image of the same size and type as src.
  1326. * param ksize blurring kernel size.
  1327. * param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
  1328. * center.
  1329. * SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlur
  1330. */
  1331. public static void blur(Mat src, Mat dst, Size ksize, Point anchor)
  1332. {
  1333. if (src != null) src.ThrowIfDisposed();
  1334. if (dst != null) dst.ThrowIfDisposed();
  1335. imgproc_Imgproc_blur_11(src.nativeObj, dst.nativeObj, ksize.width, ksize.height, anchor.x, anchor.y);
  1336. }
  1337. /**
  1338. * Blurs an image using the normalized box filter.
  1339. *
  1340. * The function smooths an image using the kernel:
  1341. *
  1342. * \(\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \hdotsfor{6} \\ 1 &amp; 1 &amp; 1 &amp; \cdots &amp; 1 &amp; 1 \\ \end{bmatrix}\)
  1343. *
  1344. * The call {code blur(src, dst, ksize, anchor, borderType)} is equivalent to `boxFilter(src, dst, src.type(), ksize,
  1345. * anchor, true, borderType)`.
  1346. *
  1347. * param src input image; it can have any number of channels, which are processed independently, but
  1348. * the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  1349. * param dst output image of the same size and type as src.
  1350. * param ksize blurring kernel size.
  1351. * center.
  1352. * SEE: boxFilter, bilateralFilter, GaussianBlur, medianBlur
  1353. */
  1354. public static void blur(Mat src, Mat dst, Size ksize)
  1355. {
  1356. if (src != null) src.ThrowIfDisposed();
  1357. if (dst != null) dst.ThrowIfDisposed();
  1358. imgproc_Imgproc_blur_12(src.nativeObj, dst.nativeObj, ksize.width, ksize.height);
  1359. }
  1360. //
  1361. // C++: void cv::stackBlur(Mat src, Mat& dst, Size ksize)
  1362. //
  1363. /**
  1364. * Blurs an image using the stackBlur.
  1365. *
  1366. * The function applies and stackBlur to an image.
  1367. * stackBlur can generate similar results as Gaussian blur, and the time consumption does not increase with the increase of kernel size.
  1368. * It creates a kind of moving stack of colors whilst scanning through the image. Thereby it just has to add one new block of color to the right side
  1369. * of the stack and remove the leftmost color. The remaining colors on the topmost layer of the stack are either added on or reduced by one,
  1370. * depending on if they are on the right or on the left side of the stack. The only supported borderType is BORDER_REPLICATE.
  1371. * Original paper was proposed by Mario Klingemann, which can be found http://underdestruction.com/2004/02/25/stackblur-2004.
  1372. *
  1373. * param src input image. The number of channels can be arbitrary, but the depth should be one of
  1374. * CV_8U, CV_16U, CV_16S or CV_32F.
  1375. * param dst output image of the same size and type as src.
  1376. * param ksize stack-blurring kernel size. The ksize.width and ksize.height can differ but they both must be
  1377. * positive and odd.
  1378. */
  1379. public static void stackBlur(Mat src, Mat dst, Size ksize)
  1380. {
  1381. if (src != null) src.ThrowIfDisposed();
  1382. if (dst != null) dst.ThrowIfDisposed();
  1383. imgproc_Imgproc_stackBlur_10(src.nativeObj, dst.nativeObj, ksize.width, ksize.height);
  1384. }
  1385. //
  1386. // C++: void cv::filter2D(Mat src, Mat& dst, int ddepth, Mat kernel, Point anchor = Point(-1,-1), double delta = 0, int borderType = BORDER_DEFAULT)
  1387. //
  1388. /**
  1389. * Convolves an image with the kernel.
  1390. *
  1391. * The function applies an arbitrary linear filter to an image. In-place operation is supported. When
  1392. * the aperture is partially outside the image, the function interpolates outlier pixel values
  1393. * according to the specified border mode.
  1394. *
  1395. * The function does actually compute correlation, not the convolution:
  1396. *
  1397. * \(\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' &lt; \texttt{kernel.cols}\\{0\leq y' &lt; \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\)
  1398. *
  1399. * That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
  1400. * the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
  1401. * anchor.y - 1)`.
  1402. *
  1403. * The function uses the DFT-based algorithm in case of sufficiently large kernels (~{code 11 x 11} or
  1404. * larger) and the direct algorithm for small kernels.
  1405. *
  1406. * param src input image.
  1407. * param dst output image of the same size and the same number of channels as src.
  1408. * param ddepth desired depth of the destination image, see REF: filter_depths "combinations"
  1409. * param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
  1410. * matrix; if you want to apply different kernels to different channels, split the image into
  1411. * separate color planes using split and process them individually.
  1412. * param anchor anchor of the kernel that indicates the relative position of a filtered point within
  1413. * the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
  1414. * is at the kernel center.
  1415. * param delta optional value added to the filtered pixels before storing them in dst.
  1416. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  1417. * SEE: sepFilter2D, dft, matchTemplate
  1418. */
  1419. public static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta, int borderType)
  1420. {
  1421. if (src != null) src.ThrowIfDisposed();
  1422. if (dst != null) dst.ThrowIfDisposed();
  1423. if (kernel != null) kernel.ThrowIfDisposed();
  1424. imgproc_Imgproc_filter2D_10(src.nativeObj, dst.nativeObj, ddepth, kernel.nativeObj, anchor.x, anchor.y, delta, borderType);
  1425. }
  1426. /**
  1427. * Convolves an image with the kernel.
  1428. *
  1429. * The function applies an arbitrary linear filter to an image. In-place operation is supported. When
  1430. * the aperture is partially outside the image, the function interpolates outlier pixel values
  1431. * according to the specified border mode.
  1432. *
  1433. * The function does actually compute correlation, not the convolution:
  1434. *
  1435. * \(\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' &lt; \texttt{kernel.cols}\\{0\leq y' &lt; \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\)
  1436. *
  1437. * That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
  1438. * the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
  1439. * anchor.y - 1)`.
  1440. *
  1441. * The function uses the DFT-based algorithm in case of sufficiently large kernels (~{code 11 x 11} or
  1442. * larger) and the direct algorithm for small kernels.
  1443. *
  1444. * param src input image.
  1445. * param dst output image of the same size and the same number of channels as src.
  1446. * param ddepth desired depth of the destination image, see REF: filter_depths "combinations"
  1447. * param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
  1448. * matrix; if you want to apply different kernels to different channels, split the image into
  1449. * separate color planes using split and process them individually.
  1450. * param anchor anchor of the kernel that indicates the relative position of a filtered point within
  1451. * the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
  1452. * is at the kernel center.
  1453. * param delta optional value added to the filtered pixels before storing them in dst.
  1454. * SEE: sepFilter2D, dft, matchTemplate
  1455. */
  1456. public static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor, double delta)
  1457. {
  1458. if (src != null) src.ThrowIfDisposed();
  1459. if (dst != null) dst.ThrowIfDisposed();
  1460. if (kernel != null) kernel.ThrowIfDisposed();
  1461. imgproc_Imgproc_filter2D_11(src.nativeObj, dst.nativeObj, ddepth, kernel.nativeObj, anchor.x, anchor.y, delta);
  1462. }
  1463. /**
  1464. * Convolves an image with the kernel.
  1465. *
  1466. * The function applies an arbitrary linear filter to an image. In-place operation is supported. When
  1467. * the aperture is partially outside the image, the function interpolates outlier pixel values
  1468. * according to the specified border mode.
  1469. *
  1470. * The function does actually compute correlation, not the convolution:
  1471. *
  1472. * \(\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' &lt; \texttt{kernel.cols}\\{0\leq y' &lt; \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\)
  1473. *
  1474. * That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
  1475. * the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
  1476. * anchor.y - 1)`.
  1477. *
  1478. * The function uses the DFT-based algorithm in case of sufficiently large kernels (~{code 11 x 11} or
  1479. * larger) and the direct algorithm for small kernels.
  1480. *
  1481. * param src input image.
  1482. * param dst output image of the same size and the same number of channels as src.
  1483. * param ddepth desired depth of the destination image, see REF: filter_depths "combinations"
  1484. * param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
  1485. * matrix; if you want to apply different kernels to different channels, split the image into
  1486. * separate color planes using split and process them individually.
  1487. * param anchor anchor of the kernel that indicates the relative position of a filtered point within
  1488. * the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
  1489. * is at the kernel center.
  1490. * SEE: sepFilter2D, dft, matchTemplate
  1491. */
  1492. public static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel, Point anchor)
  1493. {
  1494. if (src != null) src.ThrowIfDisposed();
  1495. if (dst != null) dst.ThrowIfDisposed();
  1496. if (kernel != null) kernel.ThrowIfDisposed();
  1497. imgproc_Imgproc_filter2D_12(src.nativeObj, dst.nativeObj, ddepth, kernel.nativeObj, anchor.x, anchor.y);
  1498. }
  1499. /**
  1500. * Convolves an image with the kernel.
  1501. *
  1502. * The function applies an arbitrary linear filter to an image. In-place operation is supported. When
  1503. * the aperture is partially outside the image, the function interpolates outlier pixel values
  1504. * according to the specified border mode.
  1505. *
  1506. * The function does actually compute correlation, not the convolution:
  1507. *
  1508. * \(\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' &lt; \texttt{kernel.cols}\\{0\leq y' &lt; \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\)
  1509. *
  1510. * That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
  1511. * the kernel using #flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
  1512. * anchor.y - 1)`.
  1513. *
  1514. * The function uses the DFT-based algorithm in case of sufficiently large kernels (~{code 11 x 11} or
  1515. * larger) and the direct algorithm for small kernels.
  1516. *
  1517. * param src input image.
  1518. * param dst output image of the same size and the same number of channels as src.
  1519. * param ddepth desired depth of the destination image, see REF: filter_depths "combinations"
  1520. * param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
  1521. * matrix; if you want to apply different kernels to different channels, split the image into
  1522. * separate color planes using split and process them individually.
  1523. * the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
  1524. * is at the kernel center.
  1525. * SEE: sepFilter2D, dft, matchTemplate
  1526. */
  1527. public static void filter2D(Mat src, Mat dst, int ddepth, Mat kernel)
  1528. {
  1529. if (src != null) src.ThrowIfDisposed();
  1530. if (dst != null) dst.ThrowIfDisposed();
  1531. if (kernel != null) kernel.ThrowIfDisposed();
  1532. imgproc_Imgproc_filter2D_13(src.nativeObj, dst.nativeObj, ddepth, kernel.nativeObj);
  1533. }
  1534. //
  1535. // C++: void cv::sepFilter2D(Mat src, Mat& dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor = Point(-1,-1), double delta = 0, int borderType = BORDER_DEFAULT)
  1536. //
  1537. /**
  1538. * Applies a separable linear filter to an image.
  1539. *
  1540. * The function applies a separable linear filter to the image. That is, first, every row of src is
  1541. * filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
  1542. * kernel kernelY. The final result shifted by delta is stored in dst .
  1543. *
  1544. * param src Source image.
  1545. * param dst Destination image of the same size and the same number of channels as src .
  1546. * param ddepth Destination image depth, see REF: filter_depths "combinations"
  1547. * param kernelX Coefficients for filtering each row.
  1548. * param kernelY Coefficients for filtering each column.
  1549. * param anchor Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
  1550. * is at the kernel center.
  1551. * param delta Value added to the filtered results before storing them.
  1552. * param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  1553. * SEE: filter2D, Sobel, GaussianBlur, boxFilter, blur
  1554. */
  1555. public static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta, int borderType)
  1556. {
  1557. if (src != null) src.ThrowIfDisposed();
  1558. if (dst != null) dst.ThrowIfDisposed();
  1559. if (kernelX != null) kernelX.ThrowIfDisposed();
  1560. if (kernelY != null) kernelY.ThrowIfDisposed();
  1561. imgproc_Imgproc_sepFilter2D_10(src.nativeObj, dst.nativeObj, ddepth, kernelX.nativeObj, kernelY.nativeObj, anchor.x, anchor.y, delta, borderType);
  1562. }
  1563. /**
  1564. * Applies a separable linear filter to an image.
  1565. *
  1566. * The function applies a separable linear filter to the image. That is, first, every row of src is
  1567. * filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
  1568. * kernel kernelY. The final result shifted by delta is stored in dst .
  1569. *
  1570. * param src Source image.
  1571. * param dst Destination image of the same size and the same number of channels as src .
  1572. * param ddepth Destination image depth, see REF: filter_depths "combinations"
  1573. * param kernelX Coefficients for filtering each row.
  1574. * param kernelY Coefficients for filtering each column.
  1575. * param anchor Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
  1576. * is at the kernel center.
  1577. * param delta Value added to the filtered results before storing them.
  1578. * SEE: filter2D, Sobel, GaussianBlur, boxFilter, blur
  1579. */
  1580. public static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor, double delta)
  1581. {
  1582. if (src != null) src.ThrowIfDisposed();
  1583. if (dst != null) dst.ThrowIfDisposed();
  1584. if (kernelX != null) kernelX.ThrowIfDisposed();
  1585. if (kernelY != null) kernelY.ThrowIfDisposed();
  1586. imgproc_Imgproc_sepFilter2D_11(src.nativeObj, dst.nativeObj, ddepth, kernelX.nativeObj, kernelY.nativeObj, anchor.x, anchor.y, delta);
  1587. }
  1588. /**
  1589. * Applies a separable linear filter to an image.
  1590. *
  1591. * The function applies a separable linear filter to the image. That is, first, every row of src is
  1592. * filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
  1593. * kernel kernelY. The final result shifted by delta is stored in dst .
  1594. *
  1595. * param src Source image.
  1596. * param dst Destination image of the same size and the same number of channels as src .
  1597. * param ddepth Destination image depth, see REF: filter_depths "combinations"
  1598. * param kernelX Coefficients for filtering each row.
  1599. * param kernelY Coefficients for filtering each column.
  1600. * param anchor Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor
  1601. * is at the kernel center.
  1602. * SEE: filter2D, Sobel, GaussianBlur, boxFilter, blur
  1603. */
  1604. public static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor)
  1605. {
  1606. if (src != null) src.ThrowIfDisposed();
  1607. if (dst != null) dst.ThrowIfDisposed();
  1608. if (kernelX != null) kernelX.ThrowIfDisposed();
  1609. if (kernelY != null) kernelY.ThrowIfDisposed();
  1610. imgproc_Imgproc_sepFilter2D_12(src.nativeObj, dst.nativeObj, ddepth, kernelX.nativeObj, kernelY.nativeObj, anchor.x, anchor.y);
  1611. }
  1612. /**
  1613. * Applies a separable linear filter to an image.
  1614. *
  1615. * The function applies a separable linear filter to the image. That is, first, every row of src is
  1616. * filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
  1617. * kernel kernelY. The final result shifted by delta is stored in dst .
  1618. *
  1619. * param src Source image.
  1620. * param dst Destination image of the same size and the same number of channels as src .
  1621. * param ddepth Destination image depth, see REF: filter_depths "combinations"
  1622. * param kernelX Coefficients for filtering each row.
  1623. * param kernelY Coefficients for filtering each column.
  1624. * is at the kernel center.
  1625. * SEE: filter2D, Sobel, GaussianBlur, boxFilter, blur
  1626. */
  1627. public static void sepFilter2D(Mat src, Mat dst, int ddepth, Mat kernelX, Mat kernelY)
  1628. {
  1629. if (src != null) src.ThrowIfDisposed();
  1630. if (dst != null) dst.ThrowIfDisposed();
  1631. if (kernelX != null) kernelX.ThrowIfDisposed();
  1632. if (kernelY != null) kernelY.ThrowIfDisposed();
  1633. imgproc_Imgproc_sepFilter2D_13(src.nativeObj, dst.nativeObj, ddepth, kernelX.nativeObj, kernelY.nativeObj);
  1634. }
  1635. //
  1636. // C++: void cv::Sobel(Mat src, Mat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  1637. //
  1638. /**
  1639. * Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
  1640. *
  1641. * In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to
  1642. * calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\)
  1643. * kernel is used (that is, no Gaussian smoothing is done). {code ksize = 1} can only be used for the first
  1644. * or the second x- or y- derivatives.
  1645. *
  1646. * There is also the special value {code ksize = #FILTER_SCHARR (-1)} that corresponds to the \(3\times3\) Scharr
  1647. * filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
  1648. *
  1649. * \(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
  1650. *
  1651. * for the x-derivative, or transposed for the y-derivative.
  1652. *
  1653. * The function calculates an image derivative by convolving the image with the appropriate kernel:
  1654. *
  1655. * \(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
  1656. *
  1657. * The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
  1658. * resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
  1659. * or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
  1660. * case corresponds to a kernel of:
  1661. *
  1662. * \(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
  1663. *
  1664. * The second case corresponds to a kernel of:
  1665. *
  1666. * \(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)
  1667. *
  1668. * param src input image.
  1669. * param dst output image of the same size and the same number of channels as src .
  1670. * param ddepth output image depth, see REF: filter_depths "combinations"; in the case of
  1671. * 8-bit input images it will result in truncated derivatives.
  1672. * param dx order of the derivative x.
  1673. * param dy order of the derivative y.
  1674. * param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
  1675. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  1676. * applied (see #getDerivKernels for details).
  1677. * param delta optional delta value that is added to the results prior to storing them in dst.
  1678. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  1679. * SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
  1680. */
  1681. public static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType)
  1682. {
  1683. if (src != null) src.ThrowIfDisposed();
  1684. if (dst != null) dst.ThrowIfDisposed();
  1685. imgproc_Imgproc_Sobel_10(src.nativeObj, dst.nativeObj, ddepth, dx, dy, ksize, scale, delta, borderType);
  1686. }
  1687. /**
  1688. * Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
  1689. *
  1690. * In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to
  1691. * calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\)
  1692. * kernel is used (that is, no Gaussian smoothing is done). {code ksize = 1} can only be used for the first
  1693. * or the second x- or y- derivatives.
  1694. *
  1695. * There is also the special value {code ksize = #FILTER_SCHARR (-1)} that corresponds to the \(3\times3\) Scharr
  1696. * filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
  1697. *
  1698. * \(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
  1699. *
  1700. * for the x-derivative, or transposed for the y-derivative.
  1701. *
  1702. * The function calculates an image derivative by convolving the image with the appropriate kernel:
  1703. *
  1704. * \(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
  1705. *
  1706. * The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
  1707. * resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
  1708. * or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
  1709. * case corresponds to a kernel of:
  1710. *
  1711. * \(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
  1712. *
  1713. * The second case corresponds to a kernel of:
  1714. *
  1715. * \(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)
  1716. *
  1717. * param src input image.
  1718. * param dst output image of the same size and the same number of channels as src .
  1719. * param ddepth output image depth, see REF: filter_depths "combinations"; in the case of
  1720. * 8-bit input images it will result in truncated derivatives.
  1721. * param dx order of the derivative x.
  1722. * param dy order of the derivative y.
  1723. * param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
  1724. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  1725. * applied (see #getDerivKernels for details).
  1726. * param delta optional delta value that is added to the results prior to storing them in dst.
  1727. * SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
  1728. */
  1729. public static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale, double delta)
  1730. {
  1731. if (src != null) src.ThrowIfDisposed();
  1732. if (dst != null) dst.ThrowIfDisposed();
  1733. imgproc_Imgproc_Sobel_11(src.nativeObj, dst.nativeObj, ddepth, dx, dy, ksize, scale, delta);
  1734. }
  1735. /**
  1736. * Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
  1737. *
  1738. * In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to
  1739. * calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\)
  1740. * kernel is used (that is, no Gaussian smoothing is done). {code ksize = 1} can only be used for the first
  1741. * or the second x- or y- derivatives.
  1742. *
  1743. * There is also the special value {code ksize = #FILTER_SCHARR (-1)} that corresponds to the \(3\times3\) Scharr
  1744. * filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
  1745. *
  1746. * \(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
  1747. *
  1748. * for the x-derivative, or transposed for the y-derivative.
  1749. *
  1750. * The function calculates an image derivative by convolving the image with the appropriate kernel:
  1751. *
  1752. * \(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
  1753. *
  1754. * The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
  1755. * resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
  1756. * or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
  1757. * case corresponds to a kernel of:
  1758. *
  1759. * \(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
  1760. *
  1761. * The second case corresponds to a kernel of:
  1762. *
  1763. * \(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)
  1764. *
  1765. * param src input image.
  1766. * param dst output image of the same size and the same number of channels as src .
  1767. * param ddepth output image depth, see REF: filter_depths "combinations"; in the case of
  1768. * 8-bit input images it will result in truncated derivatives.
  1769. * param dx order of the derivative x.
  1770. * param dy order of the derivative y.
  1771. * param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
  1772. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  1773. * applied (see #getDerivKernels for details).
  1774. * SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
  1775. */
  1776. public static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize, double scale)
  1777. {
  1778. if (src != null) src.ThrowIfDisposed();
  1779. if (dst != null) dst.ThrowIfDisposed();
  1780. imgproc_Imgproc_Sobel_12(src.nativeObj, dst.nativeObj, ddepth, dx, dy, ksize, scale);
  1781. }
  1782. /**
  1783. * Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
  1784. *
  1785. * In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to
  1786. * calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\)
  1787. * kernel is used (that is, no Gaussian smoothing is done). {code ksize = 1} can only be used for the first
  1788. * or the second x- or y- derivatives.
  1789. *
  1790. * There is also the special value {code ksize = #FILTER_SCHARR (-1)} that corresponds to the \(3\times3\) Scharr
  1791. * filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
  1792. *
  1793. * \(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
  1794. *
  1795. * for the x-derivative, or transposed for the y-derivative.
  1796. *
  1797. * The function calculates an image derivative by convolving the image with the appropriate kernel:
  1798. *
  1799. * \(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
  1800. *
  1801. * The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
  1802. * resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
  1803. * or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
  1804. * case corresponds to a kernel of:
  1805. *
  1806. * \(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
  1807. *
  1808. * The second case corresponds to a kernel of:
  1809. *
  1810. * \(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)
  1811. *
  1812. * param src input image.
  1813. * param dst output image of the same size and the same number of channels as src .
  1814. * param ddepth output image depth, see REF: filter_depths "combinations"; in the case of
  1815. * 8-bit input images it will result in truncated derivatives.
  1816. * param dx order of the derivative x.
  1817. * param dy order of the derivative y.
  1818. * param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
  1819. * applied (see #getDerivKernels for details).
  1820. * SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
  1821. */
  1822. public static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy, int ksize)
  1823. {
  1824. if (src != null) src.ThrowIfDisposed();
  1825. if (dst != null) dst.ThrowIfDisposed();
  1826. imgproc_Imgproc_Sobel_13(src.nativeObj, dst.nativeObj, ddepth, dx, dy, ksize);
  1827. }
  1828. /**
  1829. * Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
  1830. *
  1831. * In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to
  1832. * calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\)
  1833. * kernel is used (that is, no Gaussian smoothing is done). {code ksize = 1} can only be used for the first
  1834. * or the second x- or y- derivatives.
  1835. *
  1836. * There is also the special value {code ksize = #FILTER_SCHARR (-1)} that corresponds to the \(3\times3\) Scharr
  1837. * filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
  1838. *
  1839. * \(\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\)
  1840. *
  1841. * for the x-derivative, or transposed for the y-derivative.
  1842. *
  1843. * The function calculates an image derivative by convolving the image with the appropriate kernel:
  1844. *
  1845. * \(\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\)
  1846. *
  1847. * The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
  1848. * resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
  1849. * or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
  1850. * case corresponds to a kernel of:
  1851. *
  1852. * \(\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\)
  1853. *
  1854. * The second case corresponds to a kernel of:
  1855. *
  1856. * \(\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\)
  1857. *
  1858. * param src input image.
  1859. * param dst output image of the same size and the same number of channels as src .
  1860. * param ddepth output image depth, see REF: filter_depths "combinations"; in the case of
  1861. * 8-bit input images it will result in truncated derivatives.
  1862. * param dx order of the derivative x.
  1863. * param dy order of the derivative y.
  1864. * applied (see #getDerivKernels for details).
  1865. * SEE: Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
  1866. */
  1867. public static void Sobel(Mat src, Mat dst, int ddepth, int dx, int dy)
  1868. {
  1869. if (src != null) src.ThrowIfDisposed();
  1870. if (dst != null) dst.ThrowIfDisposed();
  1871. imgproc_Imgproc_Sobel_14(src.nativeObj, dst.nativeObj, ddepth, dx, dy);
  1872. }
  1873. //
  1874. // C++: void cv::spatialGradient(Mat src, Mat& dx, Mat& dy, int ksize = 3, int borderType = BORDER_DEFAULT)
  1875. //
  1876. /**
  1877. * Calculates the first order image derivative in both x and y using a Sobel operator
  1878. *
  1879. * Equivalent to calling:
  1880. *
  1881. * <code>
  1882. * Sobel( src, dx, CV_16SC1, 1, 0, 3 );
  1883. * Sobel( src, dy, CV_16SC1, 0, 1, 3 );
  1884. * </code>
  1885. *
  1886. * param src input image.
  1887. * param dx output image with first-order derivative in x.
  1888. * param dy output image with first-order derivative in y.
  1889. * param ksize size of Sobel kernel. It must be 3.
  1890. * param borderType pixel extrapolation method, see #BorderTypes.
  1891. * Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
  1892. *
  1893. * SEE: Sobel
  1894. */
  1895. public static void spatialGradient(Mat src, Mat dx, Mat dy, int ksize, int borderType)
  1896. {
  1897. if (src != null) src.ThrowIfDisposed();
  1898. if (dx != null) dx.ThrowIfDisposed();
  1899. if (dy != null) dy.ThrowIfDisposed();
  1900. imgproc_Imgproc_spatialGradient_10(src.nativeObj, dx.nativeObj, dy.nativeObj, ksize, borderType);
  1901. }
  1902. /**
  1903. * Calculates the first order image derivative in both x and y using a Sobel operator
  1904. *
  1905. * Equivalent to calling:
  1906. *
  1907. * <code>
  1908. * Sobel( src, dx, CV_16SC1, 1, 0, 3 );
  1909. * Sobel( src, dy, CV_16SC1, 0, 1, 3 );
  1910. * </code>
  1911. *
  1912. * param src input image.
  1913. * param dx output image with first-order derivative in x.
  1914. * param dy output image with first-order derivative in y.
  1915. * param ksize size of Sobel kernel. It must be 3.
  1916. * Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
  1917. *
  1918. * SEE: Sobel
  1919. */
  1920. public static void spatialGradient(Mat src, Mat dx, Mat dy, int ksize)
  1921. {
  1922. if (src != null) src.ThrowIfDisposed();
  1923. if (dx != null) dx.ThrowIfDisposed();
  1924. if (dy != null) dy.ThrowIfDisposed();
  1925. imgproc_Imgproc_spatialGradient_11(src.nativeObj, dx.nativeObj, dy.nativeObj, ksize);
  1926. }
  1927. /**
  1928. * Calculates the first order image derivative in both x and y using a Sobel operator
  1929. *
  1930. * Equivalent to calling:
  1931. *
  1932. * <code>
  1933. * Sobel( src, dx, CV_16SC1, 1, 0, 3 );
  1934. * Sobel( src, dy, CV_16SC1, 0, 1, 3 );
  1935. * </code>
  1936. *
  1937. * param src input image.
  1938. * param dx output image with first-order derivative in x.
  1939. * param dy output image with first-order derivative in y.
  1940. * Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
  1941. *
  1942. * SEE: Sobel
  1943. */
  1944. public static void spatialGradient(Mat src, Mat dx, Mat dy)
  1945. {
  1946. if (src != null) src.ThrowIfDisposed();
  1947. if (dx != null) dx.ThrowIfDisposed();
  1948. if (dy != null) dy.ThrowIfDisposed();
  1949. imgproc_Imgproc_spatialGradient_12(src.nativeObj, dx.nativeObj, dy.nativeObj);
  1950. }
  1951. //
  1952. // C++: void cv::Scharr(Mat src, Mat& dst, int ddepth, int dx, int dy, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  1953. //
  1954. /**
  1955. * Calculates the first x- or y- image derivative using Scharr operator.
  1956. *
  1957. * The function computes the first x- or y- spatial image derivative using the Scharr operator. The
  1958. * call
  1959. *
  1960. * \(\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\)
  1961. *
  1962. * is equivalent to
  1963. *
  1964. * \(\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\)
  1965. *
  1966. * param src input image.
  1967. * param dst output image of the same size and the same number of channels as src.
  1968. * param ddepth output image depth, see REF: filter_depths "combinations"
  1969. * param dx order of the derivative x.
  1970. * param dy order of the derivative y.
  1971. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  1972. * applied (see #getDerivKernels for details).
  1973. * param delta optional delta value that is added to the results prior to storing them in dst.
  1974. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  1975. * SEE: cartToPolar
  1976. */
  1977. public static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale, double delta, int borderType)
  1978. {
  1979. if (src != null) src.ThrowIfDisposed();
  1980. if (dst != null) dst.ThrowIfDisposed();
  1981. imgproc_Imgproc_Scharr_10(src.nativeObj, dst.nativeObj, ddepth, dx, dy, scale, delta, borderType);
  1982. }
  1983. /**
  1984. * Calculates the first x- or y- image derivative using Scharr operator.
  1985. *
  1986. * The function computes the first x- or y- spatial image derivative using the Scharr operator. The
  1987. * call
  1988. *
  1989. * \(\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\)
  1990. *
  1991. * is equivalent to
  1992. *
  1993. * \(\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\)
  1994. *
  1995. * param src input image.
  1996. * param dst output image of the same size and the same number of channels as src.
  1997. * param ddepth output image depth, see REF: filter_depths "combinations"
  1998. * param dx order of the derivative x.
  1999. * param dy order of the derivative y.
  2000. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  2001. * applied (see #getDerivKernels for details).
  2002. * param delta optional delta value that is added to the results prior to storing them in dst.
  2003. * SEE: cartToPolar
  2004. */
  2005. public static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale, double delta)
  2006. {
  2007. if (src != null) src.ThrowIfDisposed();
  2008. if (dst != null) dst.ThrowIfDisposed();
  2009. imgproc_Imgproc_Scharr_11(src.nativeObj, dst.nativeObj, ddepth, dx, dy, scale, delta);
  2010. }
  2011. /**
  2012. * Calculates the first x- or y- image derivative using Scharr operator.
  2013. *
  2014. * The function computes the first x- or y- spatial image derivative using the Scharr operator. The
  2015. * call
  2016. *
  2017. * \(\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\)
  2018. *
  2019. * is equivalent to
  2020. *
  2021. * \(\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\)
  2022. *
  2023. * param src input image.
  2024. * param dst output image of the same size and the same number of channels as src.
  2025. * param ddepth output image depth, see REF: filter_depths "combinations"
  2026. * param dx order of the derivative x.
  2027. * param dy order of the derivative y.
  2028. * param scale optional scale factor for the computed derivative values; by default, no scaling is
  2029. * applied (see #getDerivKernels for details).
  2030. * SEE: cartToPolar
  2031. */
  2032. public static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy, double scale)
  2033. {
  2034. if (src != null) src.ThrowIfDisposed();
  2035. if (dst != null) dst.ThrowIfDisposed();
  2036. imgproc_Imgproc_Scharr_12(src.nativeObj, dst.nativeObj, ddepth, dx, dy, scale);
  2037. }
  2038. /**
  2039. * Calculates the first x- or y- image derivative using Scharr operator.
  2040. *
  2041. * The function computes the first x- or y- spatial image derivative using the Scharr operator. The
  2042. * call
  2043. *
  2044. * \(\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\)
  2045. *
  2046. * is equivalent to
  2047. *
  2048. * \(\texttt{Sobel(src, dst, ddepth, dx, dy, FILTER_SCHARR, scale, delta, borderType)} .\)
  2049. *
  2050. * param src input image.
  2051. * param dst output image of the same size and the same number of channels as src.
  2052. * param ddepth output image depth, see REF: filter_depths "combinations"
  2053. * param dx order of the derivative x.
  2054. * param dy order of the derivative y.
  2055. * applied (see #getDerivKernels for details).
  2056. * SEE: cartToPolar
  2057. */
  2058. public static void Scharr(Mat src, Mat dst, int ddepth, int dx, int dy)
  2059. {
  2060. if (src != null) src.ThrowIfDisposed();
  2061. if (dst != null) dst.ThrowIfDisposed();
  2062. imgproc_Imgproc_Scharr_13(src.nativeObj, dst.nativeObj, ddepth, dx, dy);
  2063. }
  2064. //
  2065. // C++: void cv::Laplacian(Mat src, Mat& dst, int ddepth, int ksize = 1, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  2066. //
  2067. /**
  2068. * Calculates the Laplacian of an image.
  2069. *
  2070. * The function calculates the Laplacian of the source image by adding up the second x and y
  2071. * derivatives calculated using the Sobel operator:
  2072. *
  2073. * \(\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\)
  2074. *
  2075. * This is done when {code ksize &gt; 1}. When {code ksize == 1}, the Laplacian is computed by filtering the image
  2076. * with the following \(3 \times 3\) aperture:
  2077. *
  2078. * \(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)
  2079. *
  2080. * param src Source image.
  2081. * param dst Destination image of the same size and the same number of channels as src .
  2082. * param ddepth Desired depth of the destination image, see REF: filter_depths "combinations".
  2083. * param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
  2084. * details. The size must be positive and odd.
  2085. * param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
  2086. * applied. See #getDerivKernels for details.
  2087. * param delta Optional delta value that is added to the results prior to storing them in dst .
  2088. * param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  2089. * SEE: Sobel, Scharr
  2090. */
  2091. public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale, double delta, int borderType)
  2092. {
  2093. if (src != null) src.ThrowIfDisposed();
  2094. if (dst != null) dst.ThrowIfDisposed();
  2095. imgproc_Imgproc_Laplacian_10(src.nativeObj, dst.nativeObj, ddepth, ksize, scale, delta, borderType);
  2096. }
  2097. /**
  2098. * Calculates the Laplacian of an image.
  2099. *
  2100. * The function calculates the Laplacian of the source image by adding up the second x and y
  2101. * derivatives calculated using the Sobel operator:
  2102. *
  2103. * \(\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\)
  2104. *
  2105. * This is done when {code ksize &gt; 1}. When {code ksize == 1}, the Laplacian is computed by filtering the image
  2106. * with the following \(3 \times 3\) aperture:
  2107. *
  2108. * \(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)
  2109. *
  2110. * param src Source image.
  2111. * param dst Destination image of the same size and the same number of channels as src .
  2112. * param ddepth Desired depth of the destination image, see REF: filter_depths "combinations".
  2113. * param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
  2114. * details. The size must be positive and odd.
  2115. * param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
  2116. * applied. See #getDerivKernels for details.
  2117. * param delta Optional delta value that is added to the results prior to storing them in dst .
  2118. * SEE: Sobel, Scharr
  2119. */
  2120. public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale, double delta)
  2121. {
  2122. if (src != null) src.ThrowIfDisposed();
  2123. if (dst != null) dst.ThrowIfDisposed();
  2124. imgproc_Imgproc_Laplacian_11(src.nativeObj, dst.nativeObj, ddepth, ksize, scale, delta);
  2125. }
  2126. /**
  2127. * Calculates the Laplacian of an image.
  2128. *
  2129. * The function calculates the Laplacian of the source image by adding up the second x and y
  2130. * derivatives calculated using the Sobel operator:
  2131. *
  2132. * \(\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\)
  2133. *
  2134. * This is done when {code ksize &gt; 1}. When {code ksize == 1}, the Laplacian is computed by filtering the image
  2135. * with the following \(3 \times 3\) aperture:
  2136. *
  2137. * \(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)
  2138. *
  2139. * param src Source image.
  2140. * param dst Destination image of the same size and the same number of channels as src .
  2141. * param ddepth Desired depth of the destination image, see REF: filter_depths "combinations".
  2142. * param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
  2143. * details. The size must be positive and odd.
  2144. * param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
  2145. * applied. See #getDerivKernels for details.
  2146. * SEE: Sobel, Scharr
  2147. */
  2148. public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize, double scale)
  2149. {
  2150. if (src != null) src.ThrowIfDisposed();
  2151. if (dst != null) dst.ThrowIfDisposed();
  2152. imgproc_Imgproc_Laplacian_12(src.nativeObj, dst.nativeObj, ddepth, ksize, scale);
  2153. }
  2154. /**
  2155. * Calculates the Laplacian of an image.
  2156. *
  2157. * The function calculates the Laplacian of the source image by adding up the second x and y
  2158. * derivatives calculated using the Sobel operator:
  2159. *
  2160. * \(\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\)
  2161. *
  2162. * This is done when {code ksize &gt; 1}. When {code ksize == 1}, the Laplacian is computed by filtering the image
  2163. * with the following \(3 \times 3\) aperture:
  2164. *
  2165. * \(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)
  2166. *
  2167. * param src Source image.
  2168. * param dst Destination image of the same size and the same number of channels as src .
  2169. * param ddepth Desired depth of the destination image, see REF: filter_depths "combinations".
  2170. * param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
  2171. * details. The size must be positive and odd.
  2172. * applied. See #getDerivKernels for details.
  2173. * SEE: Sobel, Scharr
  2174. */
  2175. public static void Laplacian(Mat src, Mat dst, int ddepth, int ksize)
  2176. {
  2177. if (src != null) src.ThrowIfDisposed();
  2178. if (dst != null) dst.ThrowIfDisposed();
  2179. imgproc_Imgproc_Laplacian_13(src.nativeObj, dst.nativeObj, ddepth, ksize);
  2180. }
  2181. /**
  2182. * Calculates the Laplacian of an image.
  2183. *
  2184. * The function calculates the Laplacian of the source image by adding up the second x and y
  2185. * derivatives calculated using the Sobel operator:
  2186. *
  2187. * \(\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\)
  2188. *
  2189. * This is done when {code ksize &gt; 1}. When {code ksize == 1}, the Laplacian is computed by filtering the image
  2190. * with the following \(3 \times 3\) aperture:
  2191. *
  2192. * \(\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\)
  2193. *
  2194. * param src Source image.
  2195. * param dst Destination image of the same size and the same number of channels as src .
  2196. * param ddepth Desired depth of the destination image, see REF: filter_depths "combinations".
  2197. * details. The size must be positive and odd.
  2198. * applied. See #getDerivKernels for details.
  2199. * SEE: Sobel, Scharr
  2200. */
  2201. public static void Laplacian(Mat src, Mat dst, int ddepth)
  2202. {
  2203. if (src != null) src.ThrowIfDisposed();
  2204. if (dst != null) dst.ThrowIfDisposed();
  2205. imgproc_Imgproc_Laplacian_14(src.nativeObj, dst.nativeObj, ddepth);
  2206. }
  2207. //
  2208. // C++: void cv::Canny(Mat image, Mat& edges, double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)
  2209. //
  2210. /**
  2211. * Finds edges in an image using the Canny algorithm CITE: Canny86 .
  2212. *
  2213. * The function finds edges in the input image and marks them in the output map edges using the
  2214. * Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
  2215. * largest value is used to find initial segments of strong edges. See
  2216. * &lt;http://en.wikipedia.org/wiki/Canny_edge_detector&gt;
  2217. *
  2218. * param image 8-bit input image.
  2219. * param edges output edge map; single channels 8-bit image, which has the same size as image .
  2220. * param threshold1 first threshold for the hysteresis procedure.
  2221. * param threshold2 second threshold for the hysteresis procedure.
  2222. * param apertureSize aperture size for the Sobel operator.
  2223. * param L2gradient a flag, indicating whether a more accurate \(L_2\) norm
  2224. * \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
  2225. * L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
  2226. * L2gradient=false ).
  2227. */
  2228. public static void Canny(Mat image, Mat edges, double threshold1, double threshold2, int apertureSize, bool L2gradient)
  2229. {
  2230. if (image != null) image.ThrowIfDisposed();
  2231. if (edges != null) edges.ThrowIfDisposed();
  2232. imgproc_Imgproc_Canny_10(image.nativeObj, edges.nativeObj, threshold1, threshold2, apertureSize, L2gradient);
  2233. }
  2234. /**
  2235. * Finds edges in an image using the Canny algorithm CITE: Canny86 .
  2236. *
  2237. * The function finds edges in the input image and marks them in the output map edges using the
  2238. * Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
  2239. * largest value is used to find initial segments of strong edges. See
  2240. * &lt;http://en.wikipedia.org/wiki/Canny_edge_detector&gt;
  2241. *
  2242. * param image 8-bit input image.
  2243. * param edges output edge map; single channels 8-bit image, which has the same size as image .
  2244. * param threshold1 first threshold for the hysteresis procedure.
  2245. * param threshold2 second threshold for the hysteresis procedure.
  2246. * param apertureSize aperture size for the Sobel operator.
  2247. * \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
  2248. * L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
  2249. * L2gradient=false ).
  2250. */
  2251. public static void Canny(Mat image, Mat edges, double threshold1, double threshold2, int apertureSize)
  2252. {
  2253. if (image != null) image.ThrowIfDisposed();
  2254. if (edges != null) edges.ThrowIfDisposed();
  2255. imgproc_Imgproc_Canny_11(image.nativeObj, edges.nativeObj, threshold1, threshold2, apertureSize);
  2256. }
  2257. /**
  2258. * Finds edges in an image using the Canny algorithm CITE: Canny86 .
  2259. *
  2260. * The function finds edges in the input image and marks them in the output map edges using the
  2261. * Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
  2262. * largest value is used to find initial segments of strong edges. See
  2263. * &lt;http://en.wikipedia.org/wiki/Canny_edge_detector&gt;
  2264. *
  2265. * param image 8-bit input image.
  2266. * param edges output edge map; single channels 8-bit image, which has the same size as image .
  2267. * param threshold1 first threshold for the hysteresis procedure.
  2268. * param threshold2 second threshold for the hysteresis procedure.
  2269. * \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
  2270. * L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
  2271. * L2gradient=false ).
  2272. */
  2273. public static void Canny(Mat image, Mat edges, double threshold1, double threshold2)
  2274. {
  2275. if (image != null) image.ThrowIfDisposed();
  2276. if (edges != null) edges.ThrowIfDisposed();
  2277. imgproc_Imgproc_Canny_12(image.nativeObj, edges.nativeObj, threshold1, threshold2);
  2278. }
  2279. //
  2280. // C++: void cv::Canny(Mat dx, Mat dy, Mat& edges, double threshold1, double threshold2, bool L2gradient = false)
  2281. //
  2282. /**
  2283. * \overload
  2284. *
  2285. * Finds edges in an image using the Canny algorithm with custom image gradient.
  2286. *
  2287. * param dx 16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
  2288. * param dy 16-bit y derivative of input image (same type as dx).
  2289. * param edges output edge map; single channels 8-bit image, which has the same size as image .
  2290. * param threshold1 first threshold for the hysteresis procedure.
  2291. * param threshold2 second threshold for the hysteresis procedure.
  2292. * param L2gradient a flag, indicating whether a more accurate \(L_2\) norm
  2293. * \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
  2294. * L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
  2295. * L2gradient=false ).
  2296. */
  2297. public static void Canny(Mat dx, Mat dy, Mat edges, double threshold1, double threshold2, bool L2gradient)
  2298. {
  2299. if (dx != null) dx.ThrowIfDisposed();
  2300. if (dy != null) dy.ThrowIfDisposed();
  2301. if (edges != null) edges.ThrowIfDisposed();
  2302. imgproc_Imgproc_Canny_13(dx.nativeObj, dy.nativeObj, edges.nativeObj, threshold1, threshold2, L2gradient);
  2303. }
  2304. /**
  2305. * \overload
  2306. *
  2307. * Finds edges in an image using the Canny algorithm with custom image gradient.
  2308. *
  2309. * param dx 16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
  2310. * param dy 16-bit y derivative of input image (same type as dx).
  2311. * param edges output edge map; single channels 8-bit image, which has the same size as image .
  2312. * param threshold1 first threshold for the hysteresis procedure.
  2313. * param threshold2 second threshold for the hysteresis procedure.
  2314. * \(=\sqrt{(dI/dx)^2 + (dI/dy)^2}\) should be used to calculate the image gradient magnitude (
  2315. * L2gradient=true ), or whether the default \(L_1\) norm \(=|dI/dx|+|dI/dy|\) is enough (
  2316. * L2gradient=false ).
  2317. */
  2318. public static void Canny(Mat dx, Mat dy, Mat edges, double threshold1, double threshold2)
  2319. {
  2320. if (dx != null) dx.ThrowIfDisposed();
  2321. if (dy != null) dy.ThrowIfDisposed();
  2322. if (edges != null) edges.ThrowIfDisposed();
  2323. imgproc_Imgproc_Canny_14(dx.nativeObj, dy.nativeObj, edges.nativeObj, threshold1, threshold2);
  2324. }
  2325. //
  2326. // C++: void cv::cornerMinEigenVal(Mat src, Mat& dst, int blockSize, int ksize = 3, int borderType = BORDER_DEFAULT)
  2327. //
  2328. /**
  2329. * Calculates the minimal eigenvalue of gradient matrices for corner detection.
  2330. *
  2331. * The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
  2332. * eigenvalue of the covariance matrix of derivatives, that is, \(\min(\lambda_1, \lambda_2)\) in terms
  2333. * of the formulae in the cornerEigenValsAndVecs description.
  2334. *
  2335. * param src Input single-channel 8-bit or floating-point image.
  2336. * param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
  2337. * src .
  2338. * param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
  2339. * param ksize Aperture parameter for the Sobel operator.
  2340. * param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
  2341. */
  2342. public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize, int ksize, int borderType)
  2343. {
  2344. if (src != null) src.ThrowIfDisposed();
  2345. if (dst != null) dst.ThrowIfDisposed();
  2346. imgproc_Imgproc_cornerMinEigenVal_10(src.nativeObj, dst.nativeObj, blockSize, ksize, borderType);
  2347. }
  2348. /**
  2349. * Calculates the minimal eigenvalue of gradient matrices for corner detection.
  2350. *
  2351. * The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
  2352. * eigenvalue of the covariance matrix of derivatives, that is, \(\min(\lambda_1, \lambda_2)\) in terms
  2353. * of the formulae in the cornerEigenValsAndVecs description.
  2354. *
  2355. * param src Input single-channel 8-bit or floating-point image.
  2356. * param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
  2357. * src .
  2358. * param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
  2359. * param ksize Aperture parameter for the Sobel operator.
  2360. */
  2361. public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize, int ksize)
  2362. {
  2363. if (src != null) src.ThrowIfDisposed();
  2364. if (dst != null) dst.ThrowIfDisposed();
  2365. imgproc_Imgproc_cornerMinEigenVal_11(src.nativeObj, dst.nativeObj, blockSize, ksize);
  2366. }
  2367. /**
  2368. * Calculates the minimal eigenvalue of gradient matrices for corner detection.
  2369. *
  2370. * The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
  2371. * eigenvalue of the covariance matrix of derivatives, that is, \(\min(\lambda_1, \lambda_2)\) in terms
  2372. * of the formulae in the cornerEigenValsAndVecs description.
  2373. *
  2374. * param src Input single-channel 8-bit or floating-point image.
  2375. * param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
  2376. * src .
  2377. * param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
  2378. */
  2379. public static void cornerMinEigenVal(Mat src, Mat dst, int blockSize)
  2380. {
  2381. if (src != null) src.ThrowIfDisposed();
  2382. if (dst != null) dst.ThrowIfDisposed();
  2383. imgproc_Imgproc_cornerMinEigenVal_12(src.nativeObj, dst.nativeObj, blockSize);
  2384. }
  2385. //
  2386. // C++: void cv::cornerHarris(Mat src, Mat& dst, int blockSize, int ksize, double k, int borderType = BORDER_DEFAULT)
  2387. //
  2388. /**
  2389. * Harris corner detector.
  2390. *
  2391. * The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and
  2392. * cornerEigenValsAndVecs , for each pixel \((x, y)\) it calculates a \(2\times2\) gradient covariance
  2393. * matrix \(M^{(x,y)}\) over a \(\texttt{blockSize} \times \texttt{blockSize}\) neighborhood. Then, it
  2394. * computes the following characteristic:
  2395. *
  2396. * \(\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\)
  2397. *
  2398. * Corners in the image can be found as the local maxima of this response map.
  2399. *
  2400. * param src Input single-channel 8-bit or floating-point image.
  2401. * param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same
  2402. * size as src .
  2403. * param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
  2404. * param ksize Aperture parameter for the Sobel operator.
  2405. * param k Harris detector free parameter. See the formula above.
  2406. * param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
  2407. */
  2408. public static void cornerHarris(Mat src, Mat dst, int blockSize, int ksize, double k, int borderType)
  2409. {
  2410. if (src != null) src.ThrowIfDisposed();
  2411. if (dst != null) dst.ThrowIfDisposed();
  2412. imgproc_Imgproc_cornerHarris_10(src.nativeObj, dst.nativeObj, blockSize, ksize, k, borderType);
  2413. }
  2414. /**
  2415. * Harris corner detector.
  2416. *
  2417. * The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and
  2418. * cornerEigenValsAndVecs , for each pixel \((x, y)\) it calculates a \(2\times2\) gradient covariance
  2419. * matrix \(M^{(x,y)}\) over a \(\texttt{blockSize} \times \texttt{blockSize}\) neighborhood. Then, it
  2420. * computes the following characteristic:
  2421. *
  2422. * \(\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\)
  2423. *
  2424. * Corners in the image can be found as the local maxima of this response map.
  2425. *
  2426. * param src Input single-channel 8-bit or floating-point image.
  2427. * param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same
  2428. * size as src .
  2429. * param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
  2430. * param ksize Aperture parameter for the Sobel operator.
  2431. * param k Harris detector free parameter. See the formula above.
  2432. */
  2433. public static void cornerHarris(Mat src, Mat dst, int blockSize, int ksize, double k)
  2434. {
  2435. if (src != null) src.ThrowIfDisposed();
  2436. if (dst != null) dst.ThrowIfDisposed();
  2437. imgproc_Imgproc_cornerHarris_11(src.nativeObj, dst.nativeObj, blockSize, ksize, k);
  2438. }
  2439. //
  2440. // C++: void cv::cornerEigenValsAndVecs(Mat src, Mat& dst, int blockSize, int ksize, int borderType = BORDER_DEFAULT)
  2441. //
  2442. /**
  2443. * Calculates eigenvalues and eigenvectors of image blocks for corner detection.
  2444. *
  2445. * For every pixel \(p\) , the function cornerEigenValsAndVecs considers a blockSize \(\times\) blockSize
  2446. * neighborhood \(S(p)\) . It calculates the covariation matrix of derivatives over the neighborhood as:
  2447. *
  2448. * \(M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 &amp; \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy &amp; \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\)
  2449. *
  2450. * where the derivatives are computed using the Sobel operator.
  2451. *
  2452. * After that, it finds eigenvectors and eigenvalues of \(M\) and stores them in the destination image as
  2453. * \((\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\) where
  2454. *
  2455. * <ul>
  2456. * <li>
  2457. * \(\lambda_1, \lambda_2\) are the non-sorted eigenvalues of \(M\)
  2458. * </li>
  2459. * <li>
  2460. * \(x_1, y_1\) are the eigenvectors corresponding to \(\lambda_1\)
  2461. * </li>
  2462. * <li>
  2463. * \(x_2, y_2\) are the eigenvectors corresponding to \(\lambda_2\)
  2464. * </li>
  2465. * </ul>
  2466. *
  2467. * The output of the function can be used for robust edge or corner detection.
  2468. *
  2469. * param src Input single-channel 8-bit or floating-point image.
  2470. * param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
  2471. * param blockSize Neighborhood size (see details below).
  2472. * param ksize Aperture parameter for the Sobel operator.
  2473. * param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
  2474. *
  2475. * SEE: cornerMinEigenVal, cornerHarris, preCornerDetect
  2476. */
  2477. public static void cornerEigenValsAndVecs(Mat src, Mat dst, int blockSize, int ksize, int borderType)
  2478. {
  2479. if (src != null) src.ThrowIfDisposed();
  2480. if (dst != null) dst.ThrowIfDisposed();
  2481. imgproc_Imgproc_cornerEigenValsAndVecs_10(src.nativeObj, dst.nativeObj, blockSize, ksize, borderType);
  2482. }
  2483. /**
  2484. * Calculates eigenvalues and eigenvectors of image blocks for corner detection.
  2485. *
  2486. * For every pixel \(p\) , the function cornerEigenValsAndVecs considers a blockSize \(\times\) blockSize
  2487. * neighborhood \(S(p)\) . It calculates the covariation matrix of derivatives over the neighborhood as:
  2488. *
  2489. * \(M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 &amp; \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy &amp; \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\)
  2490. *
  2491. * where the derivatives are computed using the Sobel operator.
  2492. *
  2493. * After that, it finds eigenvectors and eigenvalues of \(M\) and stores them in the destination image as
  2494. * \((\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\) where
  2495. *
  2496. * <ul>
  2497. * <li>
  2498. * \(\lambda_1, \lambda_2\) are the non-sorted eigenvalues of \(M\)
  2499. * </li>
  2500. * <li>
  2501. * \(x_1, y_1\) are the eigenvectors corresponding to \(\lambda_1\)
  2502. * </li>
  2503. * <li>
  2504. * \(x_2, y_2\) are the eigenvectors corresponding to \(\lambda_2\)
  2505. * </li>
  2506. * </ul>
  2507. *
  2508. * The output of the function can be used for robust edge or corner detection.
  2509. *
  2510. * param src Input single-channel 8-bit or floating-point image.
  2511. * param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
  2512. * param blockSize Neighborhood size (see details below).
  2513. * param ksize Aperture parameter for the Sobel operator.
  2514. *
  2515. * SEE: cornerMinEigenVal, cornerHarris, preCornerDetect
  2516. */
  2517. public static void cornerEigenValsAndVecs(Mat src, Mat dst, int blockSize, int ksize)
  2518. {
  2519. if (src != null) src.ThrowIfDisposed();
  2520. if (dst != null) dst.ThrowIfDisposed();
  2521. imgproc_Imgproc_cornerEigenValsAndVecs_11(src.nativeObj, dst.nativeObj, blockSize, ksize);
  2522. }
  2523. //
  2524. // C++: void cv::preCornerDetect(Mat src, Mat& dst, int ksize, int borderType = BORDER_DEFAULT)
  2525. //
  2526. /**
  2527. * Calculates a feature map for corner detection.
  2528. *
  2529. * The function calculates the complex spatial derivative-based function of the source image
  2530. *
  2531. * \(\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\)
  2532. *
  2533. * where \(D_x\),\(D_y\) are the first image derivatives, \(D_{xx}\),\(D_{yy}\) are the second image
  2534. * derivatives, and \(D_{xy}\) is the mixed derivative.
  2535. *
  2536. * The corners can be found as local maximums of the functions, as shown below:
  2537. * <code>
  2538. * Mat corners, dilated_corners;
  2539. * preCornerDetect(image, corners, 3);
  2540. * // dilation with 3x3 rectangular structuring element
  2541. * dilate(corners, dilated_corners, Mat(), 1);
  2542. * Mat corner_mask = corners == dilated_corners;
  2543. * </code>
  2544. *
  2545. * param src Source single-channel 8-bit of floating-point image.
  2546. * param dst Output image that has the type CV_32F and the same size as src .
  2547. * param ksize %Aperture size of the Sobel .
  2548. * param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
  2549. */
  2550. public static void preCornerDetect(Mat src, Mat dst, int ksize, int borderType)
  2551. {
  2552. if (src != null) src.ThrowIfDisposed();
  2553. if (dst != null) dst.ThrowIfDisposed();
  2554. imgproc_Imgproc_preCornerDetect_10(src.nativeObj, dst.nativeObj, ksize, borderType);
  2555. }
  2556. /**
  2557. * Calculates a feature map for corner detection.
  2558. *
  2559. * The function calculates the complex spatial derivative-based function of the source image
  2560. *
  2561. * \(\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\)
  2562. *
  2563. * where \(D_x\),\(D_y\) are the first image derivatives, \(D_{xx}\),\(D_{yy}\) are the second image
  2564. * derivatives, and \(D_{xy}\) is the mixed derivative.
  2565. *
  2566. * The corners can be found as local maximums of the functions, as shown below:
  2567. * <code>
  2568. * Mat corners, dilated_corners;
  2569. * preCornerDetect(image, corners, 3);
  2570. * // dilation with 3x3 rectangular structuring element
  2571. * dilate(corners, dilated_corners, Mat(), 1);
  2572. * Mat corner_mask = corners == dilated_corners;
  2573. * </code>
  2574. *
  2575. * param src Source single-channel 8-bit of floating-point image.
  2576. * param dst Output image that has the type CV_32F and the same size as src .
  2577. * param ksize %Aperture size of the Sobel .
  2578. */
  2579. public static void preCornerDetect(Mat src, Mat dst, int ksize)
  2580. {
  2581. if (src != null) src.ThrowIfDisposed();
  2582. if (dst != null) dst.ThrowIfDisposed();
  2583. imgproc_Imgproc_preCornerDetect_11(src.nativeObj, dst.nativeObj, ksize);
  2584. }
  2585. //
  2586. // C++: void cv::cornerSubPix(Mat image, Mat& corners, Size winSize, Size zeroZone, TermCriteria criteria)
  2587. //
  2588. /**
  2589. * Refines the corner locations.
  2590. *
  2591. * The function iterates to find the sub-pixel accurate location of corners or radial saddle
  2592. * points as described in CITE: forstner1987fast, and as shown on the figure below.
  2593. *
  2594. * ![image](pics/cornersubpix.png)
  2595. *
  2596. * Sub-pixel accurate corner locator is based on the observation that every vector from the center \(q\)
  2597. * to a point \(p\) located within a neighborhood of \(q\) is orthogonal to the image gradient at \(p\)
  2598. * subject to image and measurement noise. Consider the expression:
  2599. *
  2600. * \(\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\)
  2601. *
  2602. * where \({DI_{p_i}}\) is an image gradient at one of the points \(p_i\) in a neighborhood of \(q\) . The
  2603. * value of \(q\) is to be found so that \(\epsilon_i\) is minimized. A system of equations may be set up
  2604. * with \(\epsilon_i\) set to zero:
  2605. *
  2606. * \(\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) \cdot q - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\)
  2607. *
  2608. * where the gradients are summed within a neighborhood ("search window") of \(q\) . Calling the first
  2609. * gradient term \(G\) and the second gradient term \(b\) gives:
  2610. *
  2611. * \(q = G^{-1} \cdot b\)
  2612. *
  2613. * The algorithm sets the center of the neighborhood window at this new center \(q\) and then iterates
  2614. * until the center stays within a set threshold.
  2615. *
  2616. * param image Input single-channel, 8-bit or float image.
  2617. * param corners Initial coordinates of the input corners and refined coordinates provided for
  2618. * output.
  2619. * param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) ,
  2620. * then a \((5*2+1) \times (5*2+1) = 11 \times 11\) search window is used.
  2621. * param zeroZone Half of the size of the dead region in the middle of the search zone over which
  2622. * the summation in the formula below is not done. It is used sometimes to avoid possible
  2623. * singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such
  2624. * a size.
  2625. * param criteria Criteria for termination of the iterative process of corner refinement. That is,
  2626. * the process of corner position refinement stops either after criteria.maxCount iterations or when
  2627. * the corner position moves by less than criteria.epsilon on some iteration.
  2628. */
  2629. public static void cornerSubPix(Mat image, Mat corners, Size winSize, Size zeroZone, TermCriteria criteria)
  2630. {
  2631. if (image != null) image.ThrowIfDisposed();
  2632. if (corners != null) corners.ThrowIfDisposed();
  2633. imgproc_Imgproc_cornerSubPix_10(image.nativeObj, corners.nativeObj, winSize.width, winSize.height, zeroZone.width, zeroZone.height, criteria.type, criteria.maxCount, criteria.epsilon);
  2634. }
  2635. //
  2636. // C++: void cv::goodFeaturesToTrack(Mat image, vector_Point& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask = Mat(), int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
  2637. //
  2638. /**
  2639. * Determines strong corners on an image.
  2640. *
  2641. * The function finds the most prominent corners in the image or in the specified image region, as
  2642. * described in CITE: Shi94
  2643. *
  2644. * <ul>
  2645. * <li>
  2646. * Function calculates the corner quality measure at every source image pixel using the
  2647. * #cornerMinEigenVal or #cornerHarris .
  2648. * </li>
  2649. * <li>
  2650. * Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
  2651. * retained).
  2652. * </li>
  2653. * <li>
  2654. * The corners with the minimal eigenvalue less than
  2655. * \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.
  2656. * </li>
  2657. * <li>
  2658. * The remaining corners are sorted by the quality measure in the descending order.
  2659. * </li>
  2660. * <li>
  2661. * Function throws away each corner for which there is a stronger corner at a distance less than
  2662. * maxDistance.
  2663. * </li>
  2664. * </ul>
  2665. *
  2666. * The function can be used to initialize a point-based tracker of an object.
  2667. *
  2668. * <b>Note:</b> If the function is called with different values A and B of the parameter qualityLevel , and
  2669. * A &gt; B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
  2670. * with qualityLevel=B .
  2671. *
  2672. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2673. * param corners Output vector of detected corners.
  2674. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2675. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2676. * and all detected corners are returned.
  2677. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2678. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2679. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2680. * quality measure less than the product are rejected. For example, if the best corner has the
  2681. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2682. * less than 15 are rejected.
  2683. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2684. * param mask Optional region of interest. If the image is not empty (it needs to have the type
  2685. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2686. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  2687. * pixel neighborhood. See cornerEigenValsAndVecs .
  2688. * param useHarrisDetector Parameter indicating whether to use a Harris detector (see #cornerHarris)
  2689. * or #cornerMinEigenVal.
  2690. * param k Free parameter of the Harris detector.
  2691. *
  2692. * SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
  2693. */
  2694. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, bool useHarrisDetector, double k)
  2695. {
  2696. if (image != null) image.ThrowIfDisposed();
  2697. if (corners != null) corners.ThrowIfDisposed();
  2698. if (mask != null) mask.ThrowIfDisposed();
  2699. Mat corners_mat = corners;
  2700. imgproc_Imgproc_goodFeaturesToTrack_10(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize, useHarrisDetector, k);
  2701. }
  2702. /**
  2703. * Determines strong corners on an image.
  2704. *
  2705. * The function finds the most prominent corners in the image or in the specified image region, as
  2706. * described in CITE: Shi94
  2707. *
  2708. * <ul>
  2709. * <li>
  2710. * Function calculates the corner quality measure at every source image pixel using the
  2711. * #cornerMinEigenVal or #cornerHarris .
  2712. * </li>
  2713. * <li>
  2714. * Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
  2715. * retained).
  2716. * </li>
  2717. * <li>
  2718. * The corners with the minimal eigenvalue less than
  2719. * \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.
  2720. * </li>
  2721. * <li>
  2722. * The remaining corners are sorted by the quality measure in the descending order.
  2723. * </li>
  2724. * <li>
  2725. * Function throws away each corner for which there is a stronger corner at a distance less than
  2726. * maxDistance.
  2727. * </li>
  2728. * </ul>
  2729. *
  2730. * The function can be used to initialize a point-based tracker of an object.
  2731. *
  2732. * <b>Note:</b> If the function is called with different values A and B of the parameter qualityLevel , and
  2733. * A &gt; B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
  2734. * with qualityLevel=B .
  2735. *
  2736. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2737. * param corners Output vector of detected corners.
  2738. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2739. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2740. * and all detected corners are returned.
  2741. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2742. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2743. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2744. * quality measure less than the product are rejected. For example, if the best corner has the
  2745. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2746. * less than 15 are rejected.
  2747. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2748. * param mask Optional region of interest. If the image is not empty (it needs to have the type
  2749. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2750. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  2751. * pixel neighborhood. See cornerEigenValsAndVecs .
  2752. * param useHarrisDetector Parameter indicating whether to use a Harris detector (see #cornerHarris)
  2753. * or #cornerMinEigenVal.
  2754. *
  2755. * SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
  2756. */
  2757. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, bool useHarrisDetector)
  2758. {
  2759. if (image != null) image.ThrowIfDisposed();
  2760. if (corners != null) corners.ThrowIfDisposed();
  2761. if (mask != null) mask.ThrowIfDisposed();
  2762. Mat corners_mat = corners;
  2763. imgproc_Imgproc_goodFeaturesToTrack_11(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize, useHarrisDetector);
  2764. }
  2765. /**
  2766. * Determines strong corners on an image.
  2767. *
  2768. * The function finds the most prominent corners in the image or in the specified image region, as
  2769. * described in CITE: Shi94
  2770. *
  2771. * <ul>
  2772. * <li>
  2773. * Function calculates the corner quality measure at every source image pixel using the
  2774. * #cornerMinEigenVal or #cornerHarris .
  2775. * </li>
  2776. * <li>
  2777. * Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
  2778. * retained).
  2779. * </li>
  2780. * <li>
  2781. * The corners with the minimal eigenvalue less than
  2782. * \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.
  2783. * </li>
  2784. * <li>
  2785. * The remaining corners are sorted by the quality measure in the descending order.
  2786. * </li>
  2787. * <li>
  2788. * Function throws away each corner for which there is a stronger corner at a distance less than
  2789. * maxDistance.
  2790. * </li>
  2791. * </ul>
  2792. *
  2793. * The function can be used to initialize a point-based tracker of an object.
  2794. *
  2795. * <b>Note:</b> If the function is called with different values A and B of the parameter qualityLevel , and
  2796. * A &gt; B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
  2797. * with qualityLevel=B .
  2798. *
  2799. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2800. * param corners Output vector of detected corners.
  2801. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2802. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2803. * and all detected corners are returned.
  2804. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2805. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2806. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2807. * quality measure less than the product are rejected. For example, if the best corner has the
  2808. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2809. * less than 15 are rejected.
  2810. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2811. * param mask Optional region of interest. If the image is not empty (it needs to have the type
  2812. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2813. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  2814. * pixel neighborhood. See cornerEigenValsAndVecs .
  2815. * or #cornerMinEigenVal.
  2816. *
  2817. * SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
  2818. */
  2819. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize)
  2820. {
  2821. if (image != null) image.ThrowIfDisposed();
  2822. if (corners != null) corners.ThrowIfDisposed();
  2823. if (mask != null) mask.ThrowIfDisposed();
  2824. Mat corners_mat = corners;
  2825. imgproc_Imgproc_goodFeaturesToTrack_12(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize);
  2826. }
  2827. /**
  2828. * Determines strong corners on an image.
  2829. *
  2830. * The function finds the most prominent corners in the image or in the specified image region, as
  2831. * described in CITE: Shi94
  2832. *
  2833. * <ul>
  2834. * <li>
  2835. * Function calculates the corner quality measure at every source image pixel using the
  2836. * #cornerMinEigenVal or #cornerHarris .
  2837. * </li>
  2838. * <li>
  2839. * Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
  2840. * retained).
  2841. * </li>
  2842. * <li>
  2843. * The corners with the minimal eigenvalue less than
  2844. * \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.
  2845. * </li>
  2846. * <li>
  2847. * The remaining corners are sorted by the quality measure in the descending order.
  2848. * </li>
  2849. * <li>
  2850. * Function throws away each corner for which there is a stronger corner at a distance less than
  2851. * maxDistance.
  2852. * </li>
  2853. * </ul>
  2854. *
  2855. * The function can be used to initialize a point-based tracker of an object.
  2856. *
  2857. * <b>Note:</b> If the function is called with different values A and B of the parameter qualityLevel , and
  2858. * A &gt; B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
  2859. * with qualityLevel=B .
  2860. *
  2861. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2862. * param corners Output vector of detected corners.
  2863. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2864. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2865. * and all detected corners are returned.
  2866. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2867. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2868. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2869. * quality measure less than the product are rejected. For example, if the best corner has the
  2870. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2871. * less than 15 are rejected.
  2872. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2873. * param mask Optional region of interest. If the image is not empty (it needs to have the type
  2874. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2875. * pixel neighborhood. See cornerEigenValsAndVecs .
  2876. * or #cornerMinEigenVal.
  2877. *
  2878. * SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
  2879. */
  2880. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask)
  2881. {
  2882. if (image != null) image.ThrowIfDisposed();
  2883. if (corners != null) corners.ThrowIfDisposed();
  2884. if (mask != null) mask.ThrowIfDisposed();
  2885. Mat corners_mat = corners;
  2886. imgproc_Imgproc_goodFeaturesToTrack_13(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj);
  2887. }
  2888. /**
  2889. * Determines strong corners on an image.
  2890. *
  2891. * The function finds the most prominent corners in the image or in the specified image region, as
  2892. * described in CITE: Shi94
  2893. *
  2894. * <ul>
  2895. * <li>
  2896. * Function calculates the corner quality measure at every source image pixel using the
  2897. * #cornerMinEigenVal or #cornerHarris .
  2898. * </li>
  2899. * <li>
  2900. * Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
  2901. * retained).
  2902. * </li>
  2903. * <li>
  2904. * The corners with the minimal eigenvalue less than
  2905. * \(\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\) are rejected.
  2906. * </li>
  2907. * <li>
  2908. * The remaining corners are sorted by the quality measure in the descending order.
  2909. * </li>
  2910. * <li>
  2911. * Function throws away each corner for which there is a stronger corner at a distance less than
  2912. * maxDistance.
  2913. * </li>
  2914. * </ul>
  2915. *
  2916. * The function can be used to initialize a point-based tracker of an object.
  2917. *
  2918. * <b>Note:</b> If the function is called with different values A and B of the parameter qualityLevel , and
  2919. * A &gt; B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
  2920. * with qualityLevel=B .
  2921. *
  2922. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2923. * param corners Output vector of detected corners.
  2924. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2925. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2926. * and all detected corners are returned.
  2927. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2928. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2929. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2930. * quality measure less than the product are rejected. For example, if the best corner has the
  2931. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2932. * less than 15 are rejected.
  2933. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2934. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2935. * pixel neighborhood. See cornerEigenValsAndVecs .
  2936. * or #cornerMinEigenVal.
  2937. *
  2938. * SEE: cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
  2939. */
  2940. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance)
  2941. {
  2942. if (image != null) image.ThrowIfDisposed();
  2943. if (corners != null) corners.ThrowIfDisposed();
  2944. Mat corners_mat = corners;
  2945. imgproc_Imgproc_goodFeaturesToTrack_14(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance);
  2946. }
  2947. //
  2948. // C++: void cv::goodFeaturesToTrack(Mat image, vector_Point& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, bool useHarrisDetector = false, double k = 0.04)
  2949. //
  2950. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, bool useHarrisDetector, double k)
  2951. {
  2952. if (image != null) image.ThrowIfDisposed();
  2953. if (corners != null) corners.ThrowIfDisposed();
  2954. if (mask != null) mask.ThrowIfDisposed();
  2955. Mat corners_mat = corners;
  2956. imgproc_Imgproc_goodFeaturesToTrack_15(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize, gradientSize, useHarrisDetector, k);
  2957. }
  2958. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, bool useHarrisDetector)
  2959. {
  2960. if (image != null) image.ThrowIfDisposed();
  2961. if (corners != null) corners.ThrowIfDisposed();
  2962. if (mask != null) mask.ThrowIfDisposed();
  2963. Mat corners_mat = corners;
  2964. imgproc_Imgproc_goodFeaturesToTrack_16(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize, gradientSize, useHarrisDetector);
  2965. }
  2966. public static void goodFeaturesToTrack(Mat image, MatOfPoint corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize)
  2967. {
  2968. if (image != null) image.ThrowIfDisposed();
  2969. if (corners != null) corners.ThrowIfDisposed();
  2970. if (mask != null) mask.ThrowIfDisposed();
  2971. Mat corners_mat = corners;
  2972. imgproc_Imgproc_goodFeaturesToTrack_17(image.nativeObj, corners_mat.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, blockSize, gradientSize);
  2973. }
  2974. //
  2975. // C++: void cv::goodFeaturesToTrack(Mat image, Mat& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat& cornersQuality, int blockSize = 3, int gradientSize = 3, bool useHarrisDetector = false, double k = 0.04)
  2976. //
  2977. /**
  2978. * Same as above, but returns also quality measure of the detected corners.
  2979. *
  2980. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  2981. * param corners Output vector of detected corners.
  2982. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  2983. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  2984. * and all detected corners are returned.
  2985. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  2986. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  2987. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  2988. * quality measure less than the product are rejected. For example, if the best corner has the
  2989. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  2990. * less than 15 are rejected.
  2991. * param minDistance Minimum possible Euclidean distance between the returned corners.
  2992. * param mask Region of interest. If the image is not empty (it needs to have the type
  2993. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  2994. * param cornersQuality Output vector of quality measure of the detected corners.
  2995. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  2996. * pixel neighborhood. See cornerEigenValsAndVecs .
  2997. * param gradientSize Aperture parameter for the Sobel operator used for derivatives computation.
  2998. * See cornerEigenValsAndVecs .
  2999. * param useHarrisDetector Parameter indicating whether to use a Harris detector (see #cornerHarris)
  3000. * or #cornerMinEigenVal.
  3001. * param k Free parameter of the Harris detector.
  3002. */
  3003. public static void goodFeaturesToTrackWithQuality(Mat image, Mat corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat cornersQuality, int blockSize, int gradientSize, bool useHarrisDetector, double k)
  3004. {
  3005. if (image != null) image.ThrowIfDisposed();
  3006. if (corners != null) corners.ThrowIfDisposed();
  3007. if (mask != null) mask.ThrowIfDisposed();
  3008. if (cornersQuality != null) cornersQuality.ThrowIfDisposed();
  3009. imgproc_Imgproc_goodFeaturesToTrackWithQuality_10(image.nativeObj, corners.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, cornersQuality.nativeObj, blockSize, gradientSize, useHarrisDetector, k);
  3010. }
  3011. /**
  3012. * Same as above, but returns also quality measure of the detected corners.
  3013. *
  3014. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  3015. * param corners Output vector of detected corners.
  3016. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  3017. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  3018. * and all detected corners are returned.
  3019. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  3020. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  3021. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  3022. * quality measure less than the product are rejected. For example, if the best corner has the
  3023. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  3024. * less than 15 are rejected.
  3025. * param minDistance Minimum possible Euclidean distance between the returned corners.
  3026. * param mask Region of interest. If the image is not empty (it needs to have the type
  3027. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  3028. * param cornersQuality Output vector of quality measure of the detected corners.
  3029. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  3030. * pixel neighborhood. See cornerEigenValsAndVecs .
  3031. * param gradientSize Aperture parameter for the Sobel operator used for derivatives computation.
  3032. * See cornerEigenValsAndVecs .
  3033. * param useHarrisDetector Parameter indicating whether to use a Harris detector (see #cornerHarris)
  3034. * or #cornerMinEigenVal.
  3035. */
  3036. public static void goodFeaturesToTrackWithQuality(Mat image, Mat corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat cornersQuality, int blockSize, int gradientSize, bool useHarrisDetector)
  3037. {
  3038. if (image != null) image.ThrowIfDisposed();
  3039. if (corners != null) corners.ThrowIfDisposed();
  3040. if (mask != null) mask.ThrowIfDisposed();
  3041. if (cornersQuality != null) cornersQuality.ThrowIfDisposed();
  3042. imgproc_Imgproc_goodFeaturesToTrackWithQuality_11(image.nativeObj, corners.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, cornersQuality.nativeObj, blockSize, gradientSize, useHarrisDetector);
  3043. }
  3044. /**
  3045. * Same as above, but returns also quality measure of the detected corners.
  3046. *
  3047. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  3048. * param corners Output vector of detected corners.
  3049. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  3050. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  3051. * and all detected corners are returned.
  3052. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  3053. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  3054. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  3055. * quality measure less than the product are rejected. For example, if the best corner has the
  3056. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  3057. * less than 15 are rejected.
  3058. * param minDistance Minimum possible Euclidean distance between the returned corners.
  3059. * param mask Region of interest. If the image is not empty (it needs to have the type
  3060. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  3061. * param cornersQuality Output vector of quality measure of the detected corners.
  3062. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  3063. * pixel neighborhood. See cornerEigenValsAndVecs .
  3064. * param gradientSize Aperture parameter for the Sobel operator used for derivatives computation.
  3065. * See cornerEigenValsAndVecs .
  3066. * or #cornerMinEigenVal.
  3067. */
  3068. public static void goodFeaturesToTrackWithQuality(Mat image, Mat corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat cornersQuality, int blockSize, int gradientSize)
  3069. {
  3070. if (image != null) image.ThrowIfDisposed();
  3071. if (corners != null) corners.ThrowIfDisposed();
  3072. if (mask != null) mask.ThrowIfDisposed();
  3073. if (cornersQuality != null) cornersQuality.ThrowIfDisposed();
  3074. imgproc_Imgproc_goodFeaturesToTrackWithQuality_12(image.nativeObj, corners.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, cornersQuality.nativeObj, blockSize, gradientSize);
  3075. }
  3076. /**
  3077. * Same as above, but returns also quality measure of the detected corners.
  3078. *
  3079. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  3080. * param corners Output vector of detected corners.
  3081. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  3082. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  3083. * and all detected corners are returned.
  3084. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  3085. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  3086. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  3087. * quality measure less than the product are rejected. For example, if the best corner has the
  3088. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  3089. * less than 15 are rejected.
  3090. * param minDistance Minimum possible Euclidean distance between the returned corners.
  3091. * param mask Region of interest. If the image is not empty (it needs to have the type
  3092. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  3093. * param cornersQuality Output vector of quality measure of the detected corners.
  3094. * param blockSize Size of an average block for computing a derivative covariation matrix over each
  3095. * pixel neighborhood. See cornerEigenValsAndVecs .
  3096. * See cornerEigenValsAndVecs .
  3097. * or #cornerMinEigenVal.
  3098. */
  3099. public static void goodFeaturesToTrackWithQuality(Mat image, Mat corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat cornersQuality, int blockSize)
  3100. {
  3101. if (image != null) image.ThrowIfDisposed();
  3102. if (corners != null) corners.ThrowIfDisposed();
  3103. if (mask != null) mask.ThrowIfDisposed();
  3104. if (cornersQuality != null) cornersQuality.ThrowIfDisposed();
  3105. imgproc_Imgproc_goodFeaturesToTrackWithQuality_13(image.nativeObj, corners.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, cornersQuality.nativeObj, blockSize);
  3106. }
  3107. /**
  3108. * Same as above, but returns also quality measure of the detected corners.
  3109. *
  3110. * param image Input 8-bit or floating-point 32-bit, single-channel image.
  3111. * param corners Output vector of detected corners.
  3112. * param maxCorners Maximum number of corners to return. If there are more corners than are found,
  3113. * the strongest of them is returned. {code maxCorners &lt;= 0} implies that no limit on the maximum is set
  3114. * and all detected corners are returned.
  3115. * param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
  3116. * parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
  3117. * (see #cornerMinEigenVal ) or the Harris function response (see #cornerHarris ). The corners with the
  3118. * quality measure less than the product are rejected. For example, if the best corner has the
  3119. * quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
  3120. * less than 15 are rejected.
  3121. * param minDistance Minimum possible Euclidean distance between the returned corners.
  3122. * param mask Region of interest. If the image is not empty (it needs to have the type
  3123. * CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
  3124. * param cornersQuality Output vector of quality measure of the detected corners.
  3125. * pixel neighborhood. See cornerEigenValsAndVecs .
  3126. * See cornerEigenValsAndVecs .
  3127. * or #cornerMinEigenVal.
  3128. */
  3129. public static void goodFeaturesToTrackWithQuality(Mat image, Mat corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat cornersQuality)
  3130. {
  3131. if (image != null) image.ThrowIfDisposed();
  3132. if (corners != null) corners.ThrowIfDisposed();
  3133. if (mask != null) mask.ThrowIfDisposed();
  3134. if (cornersQuality != null) cornersQuality.ThrowIfDisposed();
  3135. imgproc_Imgproc_goodFeaturesToTrackWithQuality_14(image.nativeObj, corners.nativeObj, maxCorners, qualityLevel, minDistance, mask.nativeObj, cornersQuality.nativeObj);
  3136. }
  3137. //
  3138. // C++: void cv::HoughLines(Mat image, Mat& lines, double rho, double theta, int threshold, double srn = 0, double stn = 0, double min_theta = 0, double max_theta = CV_PI)
  3139. //
  3140. /**
  3141. * Finds lines in a binary image using the standard Hough transform.
  3142. *
  3143. * The function implements the standard or standard multi-scale Hough transform algorithm for line
  3144. * detection. See &lt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&gt; for a good explanation of Hough
  3145. * transform.
  3146. *
  3147. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3148. * param lines Output vector of lines. Each line is represented by a 2 or 3 element vector
  3149. * \((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\), where \(\rho\) is the distance from
  3150. * the coordinate origin \((0,0)\) (top-left corner of the image), \(\theta\) is the line rotation
  3151. * angle in radians ( \(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ), and
  3152. * \(\textrm{votes}\) is the value of accumulator.
  3153. * param rho Distance resolution of the accumulator in pixels.
  3154. * param theta Angle resolution of the accumulator in radians.
  3155. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3156. * votes ( \(&gt;\texttt{threshold}\) ).
  3157. * param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho.
  3158. * The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
  3159. * rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these
  3160. * parameters should be positive.
  3161. * param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
  3162. * param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines.
  3163. * Must fall between 0 and max_theta.
  3164. * param max_theta For standard and multi-scale Hough transform, an upper bound for the angle.
  3165. * Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly
  3166. * less than max_theta, depending on the parameters min_theta and theta.
  3167. */
  3168. public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta)
  3169. {
  3170. if (image != null) image.ThrowIfDisposed();
  3171. if (lines != null) lines.ThrowIfDisposed();
  3172. imgproc_Imgproc_HoughLines_10(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn, min_theta, max_theta);
  3173. }
  3174. /**
  3175. * Finds lines in a binary image using the standard Hough transform.
  3176. *
  3177. * The function implements the standard or standard multi-scale Hough transform algorithm for line
  3178. * detection. See &lt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&gt; for a good explanation of Hough
  3179. * transform.
  3180. *
  3181. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3182. * param lines Output vector of lines. Each line is represented by a 2 or 3 element vector
  3183. * \((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\), where \(\rho\) is the distance from
  3184. * the coordinate origin \((0,0)\) (top-left corner of the image), \(\theta\) is the line rotation
  3185. * angle in radians ( \(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ), and
  3186. * \(\textrm{votes}\) is the value of accumulator.
  3187. * param rho Distance resolution of the accumulator in pixels.
  3188. * param theta Angle resolution of the accumulator in radians.
  3189. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3190. * votes ( \(&gt;\texttt{threshold}\) ).
  3191. * param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho.
  3192. * The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
  3193. * rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these
  3194. * parameters should be positive.
  3195. * param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
  3196. * param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines.
  3197. * Must fall between 0 and max_theta.
  3198. * Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly
  3199. * less than max_theta, depending on the parameters min_theta and theta.
  3200. */
  3201. public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta)
  3202. {
  3203. if (image != null) image.ThrowIfDisposed();
  3204. if (lines != null) lines.ThrowIfDisposed();
  3205. imgproc_Imgproc_HoughLines_11(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn, min_theta);
  3206. }
  3207. /**
  3208. * Finds lines in a binary image using the standard Hough transform.
  3209. *
  3210. * The function implements the standard or standard multi-scale Hough transform algorithm for line
  3211. * detection. See &lt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&gt; for a good explanation of Hough
  3212. * transform.
  3213. *
  3214. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3215. * param lines Output vector of lines. Each line is represented by a 2 or 3 element vector
  3216. * \((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\), where \(\rho\) is the distance from
  3217. * the coordinate origin \((0,0)\) (top-left corner of the image), \(\theta\) is the line rotation
  3218. * angle in radians ( \(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ), and
  3219. * \(\textrm{votes}\) is the value of accumulator.
  3220. * param rho Distance resolution of the accumulator in pixels.
  3221. * param theta Angle resolution of the accumulator in radians.
  3222. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3223. * votes ( \(&gt;\texttt{threshold}\) ).
  3224. * param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho.
  3225. * The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
  3226. * rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these
  3227. * parameters should be positive.
  3228. * param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
  3229. * Must fall between 0 and max_theta.
  3230. * Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly
  3231. * less than max_theta, depending on the parameters min_theta and theta.
  3232. */
  3233. public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn)
  3234. {
  3235. if (image != null) image.ThrowIfDisposed();
  3236. if (lines != null) lines.ThrowIfDisposed();
  3237. imgproc_Imgproc_HoughLines_12(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn);
  3238. }
  3239. /**
  3240. * Finds lines in a binary image using the standard Hough transform.
  3241. *
  3242. * The function implements the standard or standard multi-scale Hough transform algorithm for line
  3243. * detection. See &lt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&gt; for a good explanation of Hough
  3244. * transform.
  3245. *
  3246. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3247. * param lines Output vector of lines. Each line is represented by a 2 or 3 element vector
  3248. * \((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\), where \(\rho\) is the distance from
  3249. * the coordinate origin \((0,0)\) (top-left corner of the image), \(\theta\) is the line rotation
  3250. * angle in radians ( \(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ), and
  3251. * \(\textrm{votes}\) is the value of accumulator.
  3252. * param rho Distance resolution of the accumulator in pixels.
  3253. * param theta Angle resolution of the accumulator in radians.
  3254. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3255. * votes ( \(&gt;\texttt{threshold}\) ).
  3256. * param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho.
  3257. * The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
  3258. * rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these
  3259. * parameters should be positive.
  3260. * Must fall between 0 and max_theta.
  3261. * Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly
  3262. * less than max_theta, depending on the parameters min_theta and theta.
  3263. */
  3264. public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold, double srn)
  3265. {
  3266. if (image != null) image.ThrowIfDisposed();
  3267. if (lines != null) lines.ThrowIfDisposed();
  3268. imgproc_Imgproc_HoughLines_13(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn);
  3269. }
  3270. /**
  3271. * Finds lines in a binary image using the standard Hough transform.
  3272. *
  3273. * The function implements the standard or standard multi-scale Hough transform algorithm for line
  3274. * detection. See &lt;http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm&gt; for a good explanation of Hough
  3275. * transform.
  3276. *
  3277. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3278. * param lines Output vector of lines. Each line is represented by a 2 or 3 element vector
  3279. * \((\rho, \theta)\) or \((\rho, \theta, \textrm{votes})\), where \(\rho\) is the distance from
  3280. * the coordinate origin \((0,0)\) (top-left corner of the image), \(\theta\) is the line rotation
  3281. * angle in radians ( \(0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\) ), and
  3282. * \(\textrm{votes}\) is the value of accumulator.
  3283. * param rho Distance resolution of the accumulator in pixels.
  3284. * param theta Angle resolution of the accumulator in radians.
  3285. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3286. * votes ( \(&gt;\texttt{threshold}\) ).
  3287. * The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
  3288. * rho/srn. If both srn=0 and stn=0, the classical Hough transform is used. Otherwise, both these
  3289. * parameters should be positive.
  3290. * Must fall between 0 and max_theta.
  3291. * Must fall between min_theta and CV_PI. The actual maximum angle in the accumulator may be slightly
  3292. * less than max_theta, depending on the parameters min_theta and theta.
  3293. */
  3294. public static void HoughLines(Mat image, Mat lines, double rho, double theta, int threshold)
  3295. {
  3296. if (image != null) image.ThrowIfDisposed();
  3297. if (lines != null) lines.ThrowIfDisposed();
  3298. imgproc_Imgproc_HoughLines_14(image.nativeObj, lines.nativeObj, rho, theta, threshold);
  3299. }
  3300. //
  3301. // C++: void cv::HoughLinesP(Mat image, Mat& lines, double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0)
  3302. //
  3303. /**
  3304. * Finds line segments in a binary image using the probabilistic Hough transform.
  3305. *
  3306. * The function implements the probabilistic Hough transform algorithm for line detection, described
  3307. * in CITE: Matas00
  3308. *
  3309. * See the line detection example below:
  3310. * INCLUDE: snippets/imgproc_HoughLinesP.cpp
  3311. * This is a sample picture the function parameters have been tuned for:
  3312. *
  3313. * ![image](pics/building.jpg)
  3314. *
  3315. * And this is the output of the above program in case of the probabilistic Hough transform:
  3316. *
  3317. * ![image](pics/houghp.png)
  3318. *
  3319. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3320. * param lines Output vector of lines. Each line is represented by a 4-element vector
  3321. * \((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
  3322. * line segment.
  3323. * param rho Distance resolution of the accumulator in pixels.
  3324. * param theta Angle resolution of the accumulator in radians.
  3325. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3326. * votes ( \(&gt;\texttt{threshold}\) ).
  3327. * param minLineLength Minimum line length. Line segments shorter than that are rejected.
  3328. * param maxLineGap Maximum allowed gap between points on the same line to link them.
  3329. *
  3330. * SEE: LineSegmentDetector
  3331. */
  3332. public static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold, double minLineLength, double maxLineGap)
  3333. {
  3334. if (image != null) image.ThrowIfDisposed();
  3335. if (lines != null) lines.ThrowIfDisposed();
  3336. imgproc_Imgproc_HoughLinesP_10(image.nativeObj, lines.nativeObj, rho, theta, threshold, minLineLength, maxLineGap);
  3337. }
  3338. /**
  3339. * Finds line segments in a binary image using the probabilistic Hough transform.
  3340. *
  3341. * The function implements the probabilistic Hough transform algorithm for line detection, described
  3342. * in CITE: Matas00
  3343. *
  3344. * See the line detection example below:
  3345. * INCLUDE: snippets/imgproc_HoughLinesP.cpp
  3346. * This is a sample picture the function parameters have been tuned for:
  3347. *
  3348. * ![image](pics/building.jpg)
  3349. *
  3350. * And this is the output of the above program in case of the probabilistic Hough transform:
  3351. *
  3352. * ![image](pics/houghp.png)
  3353. *
  3354. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3355. * param lines Output vector of lines. Each line is represented by a 4-element vector
  3356. * \((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
  3357. * line segment.
  3358. * param rho Distance resolution of the accumulator in pixels.
  3359. * param theta Angle resolution of the accumulator in radians.
  3360. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3361. * votes ( \(&gt;\texttt{threshold}\) ).
  3362. * param minLineLength Minimum line length. Line segments shorter than that are rejected.
  3363. *
  3364. * SEE: LineSegmentDetector
  3365. */
  3366. public static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold, double minLineLength)
  3367. {
  3368. if (image != null) image.ThrowIfDisposed();
  3369. if (lines != null) lines.ThrowIfDisposed();
  3370. imgproc_Imgproc_HoughLinesP_11(image.nativeObj, lines.nativeObj, rho, theta, threshold, minLineLength);
  3371. }
  3372. /**
  3373. * Finds line segments in a binary image using the probabilistic Hough transform.
  3374. *
  3375. * The function implements the probabilistic Hough transform algorithm for line detection, described
  3376. * in CITE: Matas00
  3377. *
  3378. * See the line detection example below:
  3379. * INCLUDE: snippets/imgproc_HoughLinesP.cpp
  3380. * This is a sample picture the function parameters have been tuned for:
  3381. *
  3382. * ![image](pics/building.jpg)
  3383. *
  3384. * And this is the output of the above program in case of the probabilistic Hough transform:
  3385. *
  3386. * ![image](pics/houghp.png)
  3387. *
  3388. * param image 8-bit, single-channel binary source image. The image may be modified by the function.
  3389. * param lines Output vector of lines. Each line is represented by a 4-element vector
  3390. * \((x_1, y_1, x_2, y_2)\) , where \((x_1,y_1)\) and \((x_2, y_2)\) are the ending points of each detected
  3391. * line segment.
  3392. * param rho Distance resolution of the accumulator in pixels.
  3393. * param theta Angle resolution of the accumulator in radians.
  3394. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3395. * votes ( \(&gt;\texttt{threshold}\) ).
  3396. *
  3397. * SEE: LineSegmentDetector
  3398. */
  3399. public static void HoughLinesP(Mat image, Mat lines, double rho, double theta, int threshold)
  3400. {
  3401. if (image != null) image.ThrowIfDisposed();
  3402. if (lines != null) lines.ThrowIfDisposed();
  3403. imgproc_Imgproc_HoughLinesP_12(image.nativeObj, lines.nativeObj, rho, theta, threshold);
  3404. }
  3405. //
  3406. // C++: void cv::HoughLinesPointSet(Mat point, Mat& lines, int lines_max, int threshold, double min_rho, double max_rho, double rho_step, double min_theta, double max_theta, double theta_step)
  3407. //
  3408. /**
  3409. * Finds lines in a set of points using the standard Hough transform.
  3410. *
  3411. * The function finds lines in a set of points using a modification of the Hough transform.
  3412. * INCLUDE: snippets/imgproc_HoughLinesPointSet.cpp
  3413. * param point Input vector of points. Each vector must be encoded as a Point vector \((x,y)\). Type must be CV_32FC2 or CV_32SC2.
  3414. * param lines Output vector of found lines. Each vector is encoded as a vector&lt;Vec3d&gt; \((votes, rho, theta)\).
  3415. * The larger the value of 'votes', the higher the reliability of the Hough line.
  3416. * param lines_max Max count of Hough lines.
  3417. * param threshold %Accumulator threshold parameter. Only those lines are returned that get enough
  3418. * votes ( \(&gt;\texttt{threshold}\) ).
  3419. * param min_rho Minimum value for \(\rho\) for the accumulator (Note: \(\rho\) can be negative. The absolute value \(|\rho|\) is the distance of a line to the origin.).
  3420. * param max_rho Maximum value for \(\rho\) for the accumulator.
  3421. * param rho_step Distance resolution of the accumulator.
  3422. * param min_theta Minimum angle value of the accumulator in radians.
  3423. * param max_theta Upper bound for the angle value of the accumulator in radians. The actual maximum
  3424. * angle may be slightly less than max_theta, depending on the parameters min_theta and theta_step.
  3425. * param theta_step Angle resolution of the accumulator in radians.
  3426. */
  3427. public static void HoughLinesPointSet(Mat point, Mat lines, int lines_max, int threshold, double min_rho, double max_rho, double rho_step, double min_theta, double max_theta, double theta_step)
  3428. {
  3429. if (point != null) point.ThrowIfDisposed();
  3430. if (lines != null) lines.ThrowIfDisposed();
  3431. imgproc_Imgproc_HoughLinesPointSet_10(point.nativeObj, lines.nativeObj, lines_max, threshold, min_rho, max_rho, rho_step, min_theta, max_theta, theta_step);
  3432. }
  3433. //
  3434. // C++: void cv::HoughCircles(Mat image, Mat& circles, int method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
  3435. //
  3436. /**
  3437. * Finds circles in a grayscale image using the Hough transform.
  3438. *
  3439. * The function finds circles in a grayscale image using a modification of the Hough transform.
  3440. *
  3441. * Example: :
  3442. * INCLUDE: snippets/imgproc_HoughLinesCircles.cpp
  3443. *
  3444. * <b>Note:</b> Usually the function detects the centers of circles well. However, it may fail to find correct
  3445. * radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
  3446. * you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number
  3447. * to return centers only without radius search, and find the correct radius using an additional procedure.
  3448. *
  3449. * It also helps to smooth image a bit unless it's already soft. For example,
  3450. * GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.
  3451. *
  3452. * param image 8-bit, single-channel, grayscale input image.
  3453. * param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
  3454. * floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .
  3455. * param method Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
  3456. * param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
  3457. * dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
  3458. * half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
  3459. * unless some small very circles need to be detected.
  3460. * param minDist Minimum distance between the centers of the detected circles. If the parameter is
  3461. * too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
  3462. * too large, some circles may be missed.
  3463. * param param1 First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
  3464. * it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
  3465. * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
  3466. * shough normally be higher, such as 300 or normally exposed and contrasty images.
  3467. * param param2 Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
  3468. * accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
  3469. * false circles may be detected. Circles, corresponding to the larger accumulator values, will be
  3470. * returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
  3471. * The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
  3472. * If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
  3473. * But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
  3474. * param minRadius Minimum circle radius.
  3475. * param maxRadius Maximum circle radius. If &lt;= 0, uses the maximum image dimension. If &lt; 0, #HOUGH_GRADIENT returns
  3476. * centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
  3477. *
  3478. * SEE: fitEllipse, minEnclosingCircle
  3479. */
  3480. public static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
  3481. {
  3482. if (image != null) image.ThrowIfDisposed();
  3483. if (circles != null) circles.ThrowIfDisposed();
  3484. imgproc_Imgproc_HoughCircles_10(image.nativeObj, circles.nativeObj, method, dp, minDist, param1, param2, minRadius, maxRadius);
  3485. }
  3486. /**
  3487. * Finds circles in a grayscale image using the Hough transform.
  3488. *
  3489. * The function finds circles in a grayscale image using a modification of the Hough transform.
  3490. *
  3491. * Example: :
  3492. * INCLUDE: snippets/imgproc_HoughLinesCircles.cpp
  3493. *
  3494. * <b>Note:</b> Usually the function detects the centers of circles well. However, it may fail to find correct
  3495. * radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
  3496. * you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number
  3497. * to return centers only without radius search, and find the correct radius using an additional procedure.
  3498. *
  3499. * It also helps to smooth image a bit unless it's already soft. For example,
  3500. * GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.
  3501. *
  3502. * param image 8-bit, single-channel, grayscale input image.
  3503. * param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
  3504. * floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .
  3505. * param method Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
  3506. * param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
  3507. * dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
  3508. * half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
  3509. * unless some small very circles need to be detected.
  3510. * param minDist Minimum distance between the centers of the detected circles. If the parameter is
  3511. * too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
  3512. * too large, some circles may be missed.
  3513. * param param1 First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
  3514. * it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
  3515. * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
  3516. * shough normally be higher, such as 300 or normally exposed and contrasty images.
  3517. * param param2 Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
  3518. * accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
  3519. * false circles may be detected. Circles, corresponding to the larger accumulator values, will be
  3520. * returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
  3521. * The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
  3522. * If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
  3523. * But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
  3524. * param minRadius Minimum circle radius.
  3525. * centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
  3526. *
  3527. * SEE: fitEllipse, minEnclosingCircle
  3528. */
  3529. public static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2, int minRadius)
  3530. {
  3531. if (image != null) image.ThrowIfDisposed();
  3532. if (circles != null) circles.ThrowIfDisposed();
  3533. imgproc_Imgproc_HoughCircles_11(image.nativeObj, circles.nativeObj, method, dp, minDist, param1, param2, minRadius);
  3534. }
  3535. /**
  3536. * Finds circles in a grayscale image using the Hough transform.
  3537. *
  3538. * The function finds circles in a grayscale image using a modification of the Hough transform.
  3539. *
  3540. * Example: :
  3541. * INCLUDE: snippets/imgproc_HoughLinesCircles.cpp
  3542. *
  3543. * <b>Note:</b> Usually the function detects the centers of circles well. However, it may fail to find correct
  3544. * radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
  3545. * you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number
  3546. * to return centers only without radius search, and find the correct radius using an additional procedure.
  3547. *
  3548. * It also helps to smooth image a bit unless it's already soft. For example,
  3549. * GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.
  3550. *
  3551. * param image 8-bit, single-channel, grayscale input image.
  3552. * param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
  3553. * floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .
  3554. * param method Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
  3555. * param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
  3556. * dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
  3557. * half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
  3558. * unless some small very circles need to be detected.
  3559. * param minDist Minimum distance between the centers of the detected circles. If the parameter is
  3560. * too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
  3561. * too large, some circles may be missed.
  3562. * param param1 First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
  3563. * it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
  3564. * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
  3565. * shough normally be higher, such as 300 or normally exposed and contrasty images.
  3566. * param param2 Second method-specific parameter. In case of #HOUGH_GRADIENT, it is the
  3567. * accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
  3568. * false circles may be detected. Circles, corresponding to the larger accumulator values, will be
  3569. * returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
  3570. * The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
  3571. * If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
  3572. * But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
  3573. * centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
  3574. *
  3575. * SEE: fitEllipse, minEnclosingCircle
  3576. */
  3577. public static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1, double param2)
  3578. {
  3579. if (image != null) image.ThrowIfDisposed();
  3580. if (circles != null) circles.ThrowIfDisposed();
  3581. imgproc_Imgproc_HoughCircles_12(image.nativeObj, circles.nativeObj, method, dp, minDist, param1, param2);
  3582. }
  3583. /**
  3584. * Finds circles in a grayscale image using the Hough transform.
  3585. *
  3586. * The function finds circles in a grayscale image using a modification of the Hough transform.
  3587. *
  3588. * Example: :
  3589. * INCLUDE: snippets/imgproc_HoughLinesCircles.cpp
  3590. *
  3591. * <b>Note:</b> Usually the function detects the centers of circles well. However, it may fail to find correct
  3592. * radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
  3593. * you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number
  3594. * to return centers only without radius search, and find the correct radius using an additional procedure.
  3595. *
  3596. * It also helps to smooth image a bit unless it's already soft. For example,
  3597. * GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.
  3598. *
  3599. * param image 8-bit, single-channel, grayscale input image.
  3600. * param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
  3601. * floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .
  3602. * param method Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
  3603. * param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
  3604. * dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
  3605. * half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
  3606. * unless some small very circles need to be detected.
  3607. * param minDist Minimum distance between the centers of the detected circles. If the parameter is
  3608. * too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
  3609. * too large, some circles may be missed.
  3610. * param param1 First method-specific parameter. In case of #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT,
  3611. * it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
  3612. * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
  3613. * shough normally be higher, such as 300 or normally exposed and contrasty images.
  3614. * accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
  3615. * false circles may be detected. Circles, corresponding to the larger accumulator values, will be
  3616. * returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
  3617. * The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
  3618. * If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
  3619. * But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
  3620. * centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
  3621. *
  3622. * SEE: fitEllipse, minEnclosingCircle
  3623. */
  3624. public static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist, double param1)
  3625. {
  3626. if (image != null) image.ThrowIfDisposed();
  3627. if (circles != null) circles.ThrowIfDisposed();
  3628. imgproc_Imgproc_HoughCircles_13(image.nativeObj, circles.nativeObj, method, dp, minDist, param1);
  3629. }
  3630. /**
  3631. * Finds circles in a grayscale image using the Hough transform.
  3632. *
  3633. * The function finds circles in a grayscale image using a modification of the Hough transform.
  3634. *
  3635. * Example: :
  3636. * INCLUDE: snippets/imgproc_HoughLinesCircles.cpp
  3637. *
  3638. * <b>Note:</b> Usually the function detects the centers of circles well. However, it may fail to find correct
  3639. * radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
  3640. * you know it. Or, in the case of #HOUGH_GRADIENT method you may set maxRadius to a negative number
  3641. * to return centers only without radius search, and find the correct radius using an additional procedure.
  3642. *
  3643. * It also helps to smooth image a bit unless it's already soft. For example,
  3644. * GaussianBlur() with 7x7 kernel and 1.5x1.5 sigma or similar blurring may help.
  3645. *
  3646. * param image 8-bit, single-channel, grayscale input image.
  3647. * param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
  3648. * floating-point vector \((x, y, radius)\) or \((x, y, radius, votes)\) .
  3649. * param method Detection method, see #HoughModes. The available methods are #HOUGH_GRADIENT and #HOUGH_GRADIENT_ALT.
  3650. * param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
  3651. * dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
  3652. * half as big width and height. For #HOUGH_GRADIENT_ALT the recommended value is dp=1.5,
  3653. * unless some small very circles need to be detected.
  3654. * param minDist Minimum distance between the centers of the detected circles. If the parameter is
  3655. * too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
  3656. * too large, some circles may be missed.
  3657. * it is the higher threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
  3658. * Note that #HOUGH_GRADIENT_ALT uses #Scharr algorithm to compute image derivatives, so the threshold value
  3659. * shough normally be higher, such as 300 or normally exposed and contrasty images.
  3660. * accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
  3661. * false circles may be detected. Circles, corresponding to the larger accumulator values, will be
  3662. * returned first. In the case of #HOUGH_GRADIENT_ALT algorithm, this is the circle "perfectness" measure.
  3663. * The closer it to 1, the better shaped circles algorithm selects. In most cases 0.9 should be fine.
  3664. * If you want get better detection of small circles, you may decrease it to 0.85, 0.8 or even less.
  3665. * But then also try to limit the search range [minRadius, maxRadius] to avoid many false circles.
  3666. * centers without finding the radius. #HOUGH_GRADIENT_ALT always computes circle radiuses.
  3667. *
  3668. * SEE: fitEllipse, minEnclosingCircle
  3669. */
  3670. public static void HoughCircles(Mat image, Mat circles, int method, double dp, double minDist)
  3671. {
  3672. if (image != null) image.ThrowIfDisposed();
  3673. if (circles != null) circles.ThrowIfDisposed();
  3674. imgproc_Imgproc_HoughCircles_14(image.nativeObj, circles.nativeObj, method, dp, minDist);
  3675. }
  3676. //
  3677. // C++: void cv::erode(Mat src, Mat& dst, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  3678. //
  3679. /**
  3680. * Erodes an image by using a specific structuring element.
  3681. *
  3682. * The function erodes the source image using the specified structuring element that determines the
  3683. * shape of a pixel neighborhood over which the minimum is taken:
  3684. *
  3685. * \(\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3686. *
  3687. * The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
  3688. * case of multi-channel images, each channel is processed independently.
  3689. *
  3690. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3691. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3692. * param dst output image of the same size and type as src.
  3693. * param kernel structuring element used for erosion; if {code element=Mat()}, a {code 3 x 3} rectangular
  3694. * structuring element is used. Kernel can be created using #getStructuringElement.
  3695. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3696. * anchor is at the element center.
  3697. * param iterations number of times erosion is applied.
  3698. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  3699. * param borderValue border value in case of a constant border
  3700. * SEE: dilate, morphologyEx, getStructuringElement
  3701. */
  3702. public static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
  3703. {
  3704. if (src != null) src.ThrowIfDisposed();
  3705. if (dst != null) dst.ThrowIfDisposed();
  3706. if (kernel != null) kernel.ThrowIfDisposed();
  3707. imgproc_Imgproc_erode_10(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  3708. }
  3709. /**
  3710. * Erodes an image by using a specific structuring element.
  3711. *
  3712. * The function erodes the source image using the specified structuring element that determines the
  3713. * shape of a pixel neighborhood over which the minimum is taken:
  3714. *
  3715. * \(\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3716. *
  3717. * The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
  3718. * case of multi-channel images, each channel is processed independently.
  3719. *
  3720. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3721. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3722. * param dst output image of the same size and type as src.
  3723. * param kernel structuring element used for erosion; if {code element=Mat()}, a {code 3 x 3} rectangular
  3724. * structuring element is used. Kernel can be created using #getStructuringElement.
  3725. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3726. * anchor is at the element center.
  3727. * param iterations number of times erosion is applied.
  3728. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  3729. * SEE: dilate, morphologyEx, getStructuringElement
  3730. */
  3731. public static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType)
  3732. {
  3733. if (src != null) src.ThrowIfDisposed();
  3734. if (dst != null) dst.ThrowIfDisposed();
  3735. if (kernel != null) kernel.ThrowIfDisposed();
  3736. imgproc_Imgproc_erode_11(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType);
  3737. }
  3738. /**
  3739. * Erodes an image by using a specific structuring element.
  3740. *
  3741. * The function erodes the source image using the specified structuring element that determines the
  3742. * shape of a pixel neighborhood over which the minimum is taken:
  3743. *
  3744. * \(\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3745. *
  3746. * The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
  3747. * case of multi-channel images, each channel is processed independently.
  3748. *
  3749. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3750. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3751. * param dst output image of the same size and type as src.
  3752. * param kernel structuring element used for erosion; if {code element=Mat()}, a {code 3 x 3} rectangular
  3753. * structuring element is used. Kernel can be created using #getStructuringElement.
  3754. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3755. * anchor is at the element center.
  3756. * param iterations number of times erosion is applied.
  3757. * SEE: dilate, morphologyEx, getStructuringElement
  3758. */
  3759. public static void erode(Mat src, Mat dst, Mat kernel, Point anchor, int iterations)
  3760. {
  3761. if (src != null) src.ThrowIfDisposed();
  3762. if (dst != null) dst.ThrowIfDisposed();
  3763. if (kernel != null) kernel.ThrowIfDisposed();
  3764. imgproc_Imgproc_erode_12(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations);
  3765. }
  3766. /**
  3767. * Erodes an image by using a specific structuring element.
  3768. *
  3769. * The function erodes the source image using the specified structuring element that determines the
  3770. * shape of a pixel neighborhood over which the minimum is taken:
  3771. *
  3772. * \(\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3773. *
  3774. * The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
  3775. * case of multi-channel images, each channel is processed independently.
  3776. *
  3777. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3778. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3779. * param dst output image of the same size and type as src.
  3780. * param kernel structuring element used for erosion; if {code element=Mat()}, a {code 3 x 3} rectangular
  3781. * structuring element is used. Kernel can be created using #getStructuringElement.
  3782. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3783. * anchor is at the element center.
  3784. * SEE: dilate, morphologyEx, getStructuringElement
  3785. */
  3786. public static void erode(Mat src, Mat dst, Mat kernel, Point anchor)
  3787. {
  3788. if (src != null) src.ThrowIfDisposed();
  3789. if (dst != null) dst.ThrowIfDisposed();
  3790. if (kernel != null) kernel.ThrowIfDisposed();
  3791. imgproc_Imgproc_erode_13(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y);
  3792. }
  3793. /**
  3794. * Erodes an image by using a specific structuring element.
  3795. *
  3796. * The function erodes the source image using the specified structuring element that determines the
  3797. * shape of a pixel neighborhood over which the minimum is taken:
  3798. *
  3799. * \(\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3800. *
  3801. * The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
  3802. * case of multi-channel images, each channel is processed independently.
  3803. *
  3804. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3805. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3806. * param dst output image of the same size and type as src.
  3807. * param kernel structuring element used for erosion; if {code element=Mat()}, a {code 3 x 3} rectangular
  3808. * structuring element is used. Kernel can be created using #getStructuringElement.
  3809. * anchor is at the element center.
  3810. * SEE: dilate, morphologyEx, getStructuringElement
  3811. */
  3812. public static void erode(Mat src, Mat dst, Mat kernel)
  3813. {
  3814. if (src != null) src.ThrowIfDisposed();
  3815. if (dst != null) dst.ThrowIfDisposed();
  3816. if (kernel != null) kernel.ThrowIfDisposed();
  3817. imgproc_Imgproc_erode_14(src.nativeObj, dst.nativeObj, kernel.nativeObj);
  3818. }
  3819. //
  3820. // C++: void cv::dilate(Mat src, Mat& dst, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  3821. //
  3822. /**
  3823. * Dilates an image by using a specific structuring element.
  3824. *
  3825. * The function dilates the source image using the specified structuring element that determines the
  3826. * shape of a pixel neighborhood over which the maximum is taken:
  3827. * \(\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3828. *
  3829. * The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
  3830. * case of multi-channel images, each channel is processed independently.
  3831. *
  3832. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3833. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3834. * param dst output image of the same size and type as src.
  3835. * param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
  3836. * structuring element is used. Kernel can be created using #getStructuringElement
  3837. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3838. * anchor is at the element center.
  3839. * param iterations number of times dilation is applied.
  3840. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.
  3841. * param borderValue border value in case of a constant border
  3842. * SEE: erode, morphologyEx, getStructuringElement
  3843. */
  3844. public static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
  3845. {
  3846. if (src != null) src.ThrowIfDisposed();
  3847. if (dst != null) dst.ThrowIfDisposed();
  3848. if (kernel != null) kernel.ThrowIfDisposed();
  3849. imgproc_Imgproc_dilate_10(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  3850. }
  3851. /**
  3852. * Dilates an image by using a specific structuring element.
  3853. *
  3854. * The function dilates the source image using the specified structuring element that determines the
  3855. * shape of a pixel neighborhood over which the maximum is taken:
  3856. * \(\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3857. *
  3858. * The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
  3859. * case of multi-channel images, each channel is processed independently.
  3860. *
  3861. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3862. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3863. * param dst output image of the same size and type as src.
  3864. * param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
  3865. * structuring element is used. Kernel can be created using #getStructuringElement
  3866. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3867. * anchor is at the element center.
  3868. * param iterations number of times dilation is applied.
  3869. * param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.
  3870. * SEE: erode, morphologyEx, getStructuringElement
  3871. */
  3872. public static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations, int borderType)
  3873. {
  3874. if (src != null) src.ThrowIfDisposed();
  3875. if (dst != null) dst.ThrowIfDisposed();
  3876. if (kernel != null) kernel.ThrowIfDisposed();
  3877. imgproc_Imgproc_dilate_11(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType);
  3878. }
  3879. /**
  3880. * Dilates an image by using a specific structuring element.
  3881. *
  3882. * The function dilates the source image using the specified structuring element that determines the
  3883. * shape of a pixel neighborhood over which the maximum is taken:
  3884. * \(\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3885. *
  3886. * The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
  3887. * case of multi-channel images, each channel is processed independently.
  3888. *
  3889. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3890. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3891. * param dst output image of the same size and type as src.
  3892. * param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
  3893. * structuring element is used. Kernel can be created using #getStructuringElement
  3894. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3895. * anchor is at the element center.
  3896. * param iterations number of times dilation is applied.
  3897. * SEE: erode, morphologyEx, getStructuringElement
  3898. */
  3899. public static void dilate(Mat src, Mat dst, Mat kernel, Point anchor, int iterations)
  3900. {
  3901. if (src != null) src.ThrowIfDisposed();
  3902. if (dst != null) dst.ThrowIfDisposed();
  3903. if (kernel != null) kernel.ThrowIfDisposed();
  3904. imgproc_Imgproc_dilate_12(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y, iterations);
  3905. }
  3906. /**
  3907. * Dilates an image by using a specific structuring element.
  3908. *
  3909. * The function dilates the source image using the specified structuring element that determines the
  3910. * shape of a pixel neighborhood over which the maximum is taken:
  3911. * \(\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3912. *
  3913. * The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
  3914. * case of multi-channel images, each channel is processed independently.
  3915. *
  3916. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3917. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3918. * param dst output image of the same size and type as src.
  3919. * param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
  3920. * structuring element is used. Kernel can be created using #getStructuringElement
  3921. * param anchor position of the anchor within the element; default value (-1, -1) means that the
  3922. * anchor is at the element center.
  3923. * SEE: erode, morphologyEx, getStructuringElement
  3924. */
  3925. public static void dilate(Mat src, Mat dst, Mat kernel, Point anchor)
  3926. {
  3927. if (src != null) src.ThrowIfDisposed();
  3928. if (dst != null) dst.ThrowIfDisposed();
  3929. if (kernel != null) kernel.ThrowIfDisposed();
  3930. imgproc_Imgproc_dilate_13(src.nativeObj, dst.nativeObj, kernel.nativeObj, anchor.x, anchor.y);
  3931. }
  3932. /**
  3933. * Dilates an image by using a specific structuring element.
  3934. *
  3935. * The function dilates the source image using the specified structuring element that determines the
  3936. * shape of a pixel neighborhood over which the maximum is taken:
  3937. * \(\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\)
  3938. *
  3939. * The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
  3940. * case of multi-channel images, each channel is processed independently.
  3941. *
  3942. * param src input image; the number of channels can be arbitrary, but the depth should be one of
  3943. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3944. * param dst output image of the same size and type as src.
  3945. * param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
  3946. * structuring element is used. Kernel can be created using #getStructuringElement
  3947. * anchor is at the element center.
  3948. * SEE: erode, morphologyEx, getStructuringElement
  3949. */
  3950. public static void dilate(Mat src, Mat dst, Mat kernel)
  3951. {
  3952. if (src != null) src.ThrowIfDisposed();
  3953. if (dst != null) dst.ThrowIfDisposed();
  3954. if (kernel != null) kernel.ThrowIfDisposed();
  3955. imgproc_Imgproc_dilate_14(src.nativeObj, dst.nativeObj, kernel.nativeObj);
  3956. }
  3957. //
  3958. // C++: void cv::morphologyEx(Mat src, Mat& dst, int op, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  3959. //
  3960. /**
  3961. * Performs advanced morphological transformations.
  3962. *
  3963. * The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as
  3964. * basic operations.
  3965. *
  3966. * Any of the operations can be done in-place. In case of multi-channel images, each channel is
  3967. * processed independently.
  3968. *
  3969. * param src Source image. The number of channels can be arbitrary. The depth should be one of
  3970. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  3971. * param dst Destination image of the same size and type as source image.
  3972. * param op Type of a morphological operation, see #MorphTypes
  3973. * param kernel Structuring element. It can be created using #getStructuringElement.
  3974. * param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
  3975. * kernel center.
  3976. * param iterations Number of times erosion and dilation are applied.
  3977. * param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  3978. * param borderValue Border value in case of a constant border. The default value has a special
  3979. * meaning.
  3980. * SEE: dilate, erode, getStructuringElement
  3981. * <b>Note:</b> The number of iterations is the number of times erosion or dilatation operation will be applied.
  3982. * For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
  3983. * successively: erode -&gt; erode -&gt; dilate -&gt; dilate (and not erode -&gt; dilate -&gt; erode -&gt; dilate).
  3984. */
  3985. public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations, int borderType, Scalar borderValue)
  3986. {
  3987. if (src != null) src.ThrowIfDisposed();
  3988. if (dst != null) dst.ThrowIfDisposed();
  3989. if (kernel != null) kernel.ThrowIfDisposed();
  3990. imgproc_Imgproc_morphologyEx_10(src.nativeObj, dst.nativeObj, op, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  3991. }
  3992. /**
  3993. * Performs advanced morphological transformations.
  3994. *
  3995. * The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as
  3996. * basic operations.
  3997. *
  3998. * Any of the operations can be done in-place. In case of multi-channel images, each channel is
  3999. * processed independently.
  4000. *
  4001. * param src Source image. The number of channels can be arbitrary. The depth should be one of
  4002. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  4003. * param dst Destination image of the same size and type as source image.
  4004. * param op Type of a morphological operation, see #MorphTypes
  4005. * param kernel Structuring element. It can be created using #getStructuringElement.
  4006. * param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
  4007. * kernel center.
  4008. * param iterations Number of times erosion and dilation are applied.
  4009. * param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
  4010. * meaning.
  4011. * SEE: dilate, erode, getStructuringElement
  4012. * <b>Note:</b> The number of iterations is the number of times erosion or dilatation operation will be applied.
  4013. * For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
  4014. * successively: erode -&gt; erode -&gt; dilate -&gt; dilate (and not erode -&gt; dilate -&gt; erode -&gt; dilate).
  4015. */
  4016. public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations, int borderType)
  4017. {
  4018. if (src != null) src.ThrowIfDisposed();
  4019. if (dst != null) dst.ThrowIfDisposed();
  4020. if (kernel != null) kernel.ThrowIfDisposed();
  4021. imgproc_Imgproc_morphologyEx_11(src.nativeObj, dst.nativeObj, op, kernel.nativeObj, anchor.x, anchor.y, iterations, borderType);
  4022. }
  4023. /**
  4024. * Performs advanced morphological transformations.
  4025. *
  4026. * The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as
  4027. * basic operations.
  4028. *
  4029. * Any of the operations can be done in-place. In case of multi-channel images, each channel is
  4030. * processed independently.
  4031. *
  4032. * param src Source image. The number of channels can be arbitrary. The depth should be one of
  4033. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  4034. * param dst Destination image of the same size and type as source image.
  4035. * param op Type of a morphological operation, see #MorphTypes
  4036. * param kernel Structuring element. It can be created using #getStructuringElement.
  4037. * param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
  4038. * kernel center.
  4039. * param iterations Number of times erosion and dilation are applied.
  4040. * meaning.
  4041. * SEE: dilate, erode, getStructuringElement
  4042. * <b>Note:</b> The number of iterations is the number of times erosion or dilatation operation will be applied.
  4043. * For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
  4044. * successively: erode -&gt; erode -&gt; dilate -&gt; dilate (and not erode -&gt; dilate -&gt; erode -&gt; dilate).
  4045. */
  4046. public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor, int iterations)
  4047. {
  4048. if (src != null) src.ThrowIfDisposed();
  4049. if (dst != null) dst.ThrowIfDisposed();
  4050. if (kernel != null) kernel.ThrowIfDisposed();
  4051. imgproc_Imgproc_morphologyEx_12(src.nativeObj, dst.nativeObj, op, kernel.nativeObj, anchor.x, anchor.y, iterations);
  4052. }
  4053. /**
  4054. * Performs advanced morphological transformations.
  4055. *
  4056. * The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as
  4057. * basic operations.
  4058. *
  4059. * Any of the operations can be done in-place. In case of multi-channel images, each channel is
  4060. * processed independently.
  4061. *
  4062. * param src Source image. The number of channels can be arbitrary. The depth should be one of
  4063. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  4064. * param dst Destination image of the same size and type as source image.
  4065. * param op Type of a morphological operation, see #MorphTypes
  4066. * param kernel Structuring element. It can be created using #getStructuringElement.
  4067. * param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
  4068. * kernel center.
  4069. * meaning.
  4070. * SEE: dilate, erode, getStructuringElement
  4071. * <b>Note:</b> The number of iterations is the number of times erosion or dilatation operation will be applied.
  4072. * For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
  4073. * successively: erode -&gt; erode -&gt; dilate -&gt; dilate (and not erode -&gt; dilate -&gt; erode -&gt; dilate).
  4074. */
  4075. public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel, Point anchor)
  4076. {
  4077. if (src != null) src.ThrowIfDisposed();
  4078. if (dst != null) dst.ThrowIfDisposed();
  4079. if (kernel != null) kernel.ThrowIfDisposed();
  4080. imgproc_Imgproc_morphologyEx_13(src.nativeObj, dst.nativeObj, op, kernel.nativeObj, anchor.x, anchor.y);
  4081. }
  4082. /**
  4083. * Performs advanced morphological transformations.
  4084. *
  4085. * The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as
  4086. * basic operations.
  4087. *
  4088. * Any of the operations can be done in-place. In case of multi-channel images, each channel is
  4089. * processed independently.
  4090. *
  4091. * param src Source image. The number of channels can be arbitrary. The depth should be one of
  4092. * CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  4093. * param dst Destination image of the same size and type as source image.
  4094. * param op Type of a morphological operation, see #MorphTypes
  4095. * param kernel Structuring element. It can be created using #getStructuringElement.
  4096. * kernel center.
  4097. * meaning.
  4098. * SEE: dilate, erode, getStructuringElement
  4099. * <b>Note:</b> The number of iterations is the number of times erosion or dilatation operation will be applied.
  4100. * For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply
  4101. * successively: erode -&gt; erode -&gt; dilate -&gt; dilate (and not erode -&gt; dilate -&gt; erode -&gt; dilate).
  4102. */
  4103. public static void morphologyEx(Mat src, Mat dst, int op, Mat kernel)
  4104. {
  4105. if (src != null) src.ThrowIfDisposed();
  4106. if (dst != null) dst.ThrowIfDisposed();
  4107. if (kernel != null) kernel.ThrowIfDisposed();
  4108. imgproc_Imgproc_morphologyEx_14(src.nativeObj, dst.nativeObj, op, kernel.nativeObj);
  4109. }
  4110. //
  4111. // C++: void cv::resize(Mat src, Mat& dst, Size dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR)
  4112. //
  4113. /**
  4114. * Resizes an image.
  4115. *
  4116. * The function resize resizes the image src down to or up to the specified size. Note that the
  4117. * initial dst type or size are not taken into account. Instead, the size and type are derived from
  4118. * the {code src},{code dsize},{code fx}, and {code fy}. If you want to resize src so that it fits the pre-created dst,
  4119. * you may call the function as follows:
  4120. * <code>
  4121. * // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
  4122. * resize(src, dst, dst.size(), 0, 0, interpolation);
  4123. * </code>
  4124. * If you want to decimate the image by factor of 2 in each direction, you can call the function this
  4125. * way:
  4126. * <code>
  4127. * // specify fx and fy and let the function compute the destination image size.
  4128. * resize(src, dst, Size(), 0.5, 0.5, interpolation);
  4129. * </code>
  4130. * To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
  4131. * enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR
  4132. * (faster but still looks OK).
  4133. *
  4134. * param src input image.
  4135. * param dst output image; it has the size dsize (when it is non-zero) or the size computed from
  4136. * src.size(), fx, and fy; the type of dst is the same as of src.
  4137. * param dsize output image size; if it equals zero ({code None} in Python), it is computed as:
  4138. * \(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
  4139. * Either dsize or both fx and fy must be non-zero.
  4140. * param fx scale factor along the horizontal axis; when it equals 0, it is computed as
  4141. * \(\texttt{(double)dsize.width/src.cols}\)
  4142. * param fy scale factor along the vertical axis; when it equals 0, it is computed as
  4143. * \(\texttt{(double)dsize.height/src.rows}\)
  4144. * param interpolation interpolation method, see #InterpolationFlags
  4145. *
  4146. * SEE: warpAffine, warpPerspective, remap
  4147. */
  4148. public static void resize(Mat src, Mat dst, Size dsize, double fx, double fy, int interpolation)
  4149. {
  4150. if (src != null) src.ThrowIfDisposed();
  4151. if (dst != null) dst.ThrowIfDisposed();
  4152. imgproc_Imgproc_resize_10(src.nativeObj, dst.nativeObj, dsize.width, dsize.height, fx, fy, interpolation);
  4153. }
  4154. /**
  4155. * Resizes an image.
  4156. *
  4157. * The function resize resizes the image src down to or up to the specified size. Note that the
  4158. * initial dst type or size are not taken into account. Instead, the size and type are derived from
  4159. * the {code src},{code dsize},{code fx}, and {code fy}. If you want to resize src so that it fits the pre-created dst,
  4160. * you may call the function as follows:
  4161. * <code>
  4162. * // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
  4163. * resize(src, dst, dst.size(), 0, 0, interpolation);
  4164. * </code>
  4165. * If you want to decimate the image by factor of 2 in each direction, you can call the function this
  4166. * way:
  4167. * <code>
  4168. * // specify fx and fy and let the function compute the destination image size.
  4169. * resize(src, dst, Size(), 0.5, 0.5, interpolation);
  4170. * </code>
  4171. * To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
  4172. * enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR
  4173. * (faster but still looks OK).
  4174. *
  4175. * param src input image.
  4176. * param dst output image; it has the size dsize (when it is non-zero) or the size computed from
  4177. * src.size(), fx, and fy; the type of dst is the same as of src.
  4178. * param dsize output image size; if it equals zero ({code None} in Python), it is computed as:
  4179. * \(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
  4180. * Either dsize or both fx and fy must be non-zero.
  4181. * param fx scale factor along the horizontal axis; when it equals 0, it is computed as
  4182. * \(\texttt{(double)dsize.width/src.cols}\)
  4183. * param fy scale factor along the vertical axis; when it equals 0, it is computed as
  4184. * \(\texttt{(double)dsize.height/src.rows}\)
  4185. *
  4186. * SEE: warpAffine, warpPerspective, remap
  4187. */
  4188. public static void resize(Mat src, Mat dst, Size dsize, double fx, double fy)
  4189. {
  4190. if (src != null) src.ThrowIfDisposed();
  4191. if (dst != null) dst.ThrowIfDisposed();
  4192. imgproc_Imgproc_resize_11(src.nativeObj, dst.nativeObj, dsize.width, dsize.height, fx, fy);
  4193. }
  4194. /**
  4195. * Resizes an image.
  4196. *
  4197. * The function resize resizes the image src down to or up to the specified size. Note that the
  4198. * initial dst type or size are not taken into account. Instead, the size and type are derived from
  4199. * the {code src},{code dsize},{code fx}, and {code fy}. If you want to resize src so that it fits the pre-created dst,
  4200. * you may call the function as follows:
  4201. * <code>
  4202. * // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
  4203. * resize(src, dst, dst.size(), 0, 0, interpolation);
  4204. * </code>
  4205. * If you want to decimate the image by factor of 2 in each direction, you can call the function this
  4206. * way:
  4207. * <code>
  4208. * // specify fx and fy and let the function compute the destination image size.
  4209. * resize(src, dst, Size(), 0.5, 0.5, interpolation);
  4210. * </code>
  4211. * To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
  4212. * enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR
  4213. * (faster but still looks OK).
  4214. *
  4215. * param src input image.
  4216. * param dst output image; it has the size dsize (when it is non-zero) or the size computed from
  4217. * src.size(), fx, and fy; the type of dst is the same as of src.
  4218. * param dsize output image size; if it equals zero ({code None} in Python), it is computed as:
  4219. * \(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
  4220. * Either dsize or both fx and fy must be non-zero.
  4221. * param fx scale factor along the horizontal axis; when it equals 0, it is computed as
  4222. * \(\texttt{(double)dsize.width/src.cols}\)
  4223. * \(\texttt{(double)dsize.height/src.rows}\)
  4224. *
  4225. * SEE: warpAffine, warpPerspective, remap
  4226. */
  4227. public static void resize(Mat src, Mat dst, Size dsize, double fx)
  4228. {
  4229. if (src != null) src.ThrowIfDisposed();
  4230. if (dst != null) dst.ThrowIfDisposed();
  4231. imgproc_Imgproc_resize_12(src.nativeObj, dst.nativeObj, dsize.width, dsize.height, fx);
  4232. }
  4233. /**
  4234. * Resizes an image.
  4235. *
  4236. * The function resize resizes the image src down to or up to the specified size. Note that the
  4237. * initial dst type or size are not taken into account. Instead, the size and type are derived from
  4238. * the {code src},{code dsize},{code fx}, and {code fy}. If you want to resize src so that it fits the pre-created dst,
  4239. * you may call the function as follows:
  4240. * <code>
  4241. * // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
  4242. * resize(src, dst, dst.size(), 0, 0, interpolation);
  4243. * </code>
  4244. * If you want to decimate the image by factor of 2 in each direction, you can call the function this
  4245. * way:
  4246. * <code>
  4247. * // specify fx and fy and let the function compute the destination image size.
  4248. * resize(src, dst, Size(), 0.5, 0.5, interpolation);
  4249. * </code>
  4250. * To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to
  4251. * enlarge an image, it will generally look best with #INTER_CUBIC (slow) or #INTER_LINEAR
  4252. * (faster but still looks OK).
  4253. *
  4254. * param src input image.
  4255. * param dst output image; it has the size dsize (when it is non-zero) or the size computed from
  4256. * src.size(), fx, and fy; the type of dst is the same as of src.
  4257. * param dsize output image size; if it equals zero ({code None} in Python), it is computed as:
  4258. * \(\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\)
  4259. * Either dsize or both fx and fy must be non-zero.
  4260. * \(\texttt{(double)dsize.width/src.cols}\)
  4261. * \(\texttt{(double)dsize.height/src.rows}\)
  4262. *
  4263. * SEE: warpAffine, warpPerspective, remap
  4264. */
  4265. public static void resize(Mat src, Mat dst, Size dsize)
  4266. {
  4267. if (src != null) src.ThrowIfDisposed();
  4268. if (dst != null) dst.ThrowIfDisposed();
  4269. imgproc_Imgproc_resize_13(src.nativeObj, dst.nativeObj, dsize.width, dsize.height);
  4270. }
  4271. //
  4272. // C++: void cv::warpAffine(Mat src, Mat& dst, Mat M, Size dsize, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  4273. //
  4274. /**
  4275. * Applies an affine transformation to an image.
  4276. *
  4277. * The function warpAffine transforms the source image using the specified matrix:
  4278. *
  4279. * \(\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\)
  4280. *
  4281. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
  4282. * with #invertAffineTransform and then put in the formula above instead of M. The function cannot
  4283. * operate in-place.
  4284. *
  4285. * param src input image.
  4286. * param dst output image that has the size dsize and the same type as src .
  4287. * param M \(2\times 3\) transformation matrix.
  4288. * param dsize size of the output image.
  4289. * param flags combination of interpolation methods (see #InterpolationFlags) and the optional
  4290. * flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
  4291. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4292. * param borderMode pixel extrapolation method (see #BorderTypes); when
  4293. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
  4294. * the "outliers" in the source image are not modified by the function.
  4295. * param borderValue value used in case of a constant border; by default, it is 0.
  4296. *
  4297. * SEE: warpPerspective, resize, remap, getRectSubPix, transform
  4298. */
  4299. public static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode, Scalar borderValue)
  4300. {
  4301. if (src != null) src.ThrowIfDisposed();
  4302. if (dst != null) dst.ThrowIfDisposed();
  4303. if (M != null) M.ThrowIfDisposed();
  4304. imgproc_Imgproc_warpAffine_10(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags, borderMode, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  4305. }
  4306. /**
  4307. * Applies an affine transformation to an image.
  4308. *
  4309. * The function warpAffine transforms the source image using the specified matrix:
  4310. *
  4311. * \(\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\)
  4312. *
  4313. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
  4314. * with #invertAffineTransform and then put in the formula above instead of M. The function cannot
  4315. * operate in-place.
  4316. *
  4317. * param src input image.
  4318. * param dst output image that has the size dsize and the same type as src .
  4319. * param M \(2\times 3\) transformation matrix.
  4320. * param dsize size of the output image.
  4321. * param flags combination of interpolation methods (see #InterpolationFlags) and the optional
  4322. * flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
  4323. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4324. * param borderMode pixel extrapolation method (see #BorderTypes); when
  4325. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
  4326. * the "outliers" in the source image are not modified by the function.
  4327. *
  4328. * SEE: warpPerspective, resize, remap, getRectSubPix, transform
  4329. */
  4330. public static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode)
  4331. {
  4332. if (src != null) src.ThrowIfDisposed();
  4333. if (dst != null) dst.ThrowIfDisposed();
  4334. if (M != null) M.ThrowIfDisposed();
  4335. imgproc_Imgproc_warpAffine_11(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags, borderMode);
  4336. }
  4337. /**
  4338. * Applies an affine transformation to an image.
  4339. *
  4340. * The function warpAffine transforms the source image using the specified matrix:
  4341. *
  4342. * \(\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\)
  4343. *
  4344. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
  4345. * with #invertAffineTransform and then put in the formula above instead of M. The function cannot
  4346. * operate in-place.
  4347. *
  4348. * param src input image.
  4349. * param dst output image that has the size dsize and the same type as src .
  4350. * param M \(2\times 3\) transformation matrix.
  4351. * param dsize size of the output image.
  4352. * param flags combination of interpolation methods (see #InterpolationFlags) and the optional
  4353. * flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
  4354. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4355. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
  4356. * the "outliers" in the source image are not modified by the function.
  4357. *
  4358. * SEE: warpPerspective, resize, remap, getRectSubPix, transform
  4359. */
  4360. public static void warpAffine(Mat src, Mat dst, Mat M, Size dsize, int flags)
  4361. {
  4362. if (src != null) src.ThrowIfDisposed();
  4363. if (dst != null) dst.ThrowIfDisposed();
  4364. if (M != null) M.ThrowIfDisposed();
  4365. imgproc_Imgproc_warpAffine_12(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags);
  4366. }
  4367. /**
  4368. * Applies an affine transformation to an image.
  4369. *
  4370. * The function warpAffine transforms the source image using the specified matrix:
  4371. *
  4372. * \(\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\)
  4373. *
  4374. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
  4375. * with #invertAffineTransform and then put in the formula above instead of M. The function cannot
  4376. * operate in-place.
  4377. *
  4378. * param src input image.
  4379. * param dst output image that has the size dsize and the same type as src .
  4380. * param M \(2\times 3\) transformation matrix.
  4381. * param dsize size of the output image.
  4382. * flag #WARP_INVERSE_MAP that means that M is the inverse transformation (
  4383. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4384. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
  4385. * the "outliers" in the source image are not modified by the function.
  4386. *
  4387. * SEE: warpPerspective, resize, remap, getRectSubPix, transform
  4388. */
  4389. public static void warpAffine(Mat src, Mat dst, Mat M, Size dsize)
  4390. {
  4391. if (src != null) src.ThrowIfDisposed();
  4392. if (dst != null) dst.ThrowIfDisposed();
  4393. if (M != null) M.ThrowIfDisposed();
  4394. imgproc_Imgproc_warpAffine_13(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height);
  4395. }
  4396. //
  4397. // C++: void cv::warpPerspective(Mat src, Mat& dst, Mat M, Size dsize, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  4398. //
  4399. /**
  4400. * Applies a perspective transformation to an image.
  4401. *
  4402. * The function warpPerspective transforms the source image using the specified matrix:
  4403. *
  4404. * \(\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
  4405. * \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\)
  4406. *
  4407. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
  4408. * and then put in the formula above instead of M. The function cannot operate in-place.
  4409. *
  4410. * param src input image.
  4411. * param dst output image that has the size dsize and the same type as src .
  4412. * param M \(3\times 3\) transformation matrix.
  4413. * param dsize size of the output image.
  4414. * param flags combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
  4415. * optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
  4416. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4417. * param borderMode pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE).
  4418. * param borderValue value used in case of a constant border; by default, it equals 0.
  4419. *
  4420. * SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransform
  4421. */
  4422. public static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode, Scalar borderValue)
  4423. {
  4424. if (src != null) src.ThrowIfDisposed();
  4425. if (dst != null) dst.ThrowIfDisposed();
  4426. if (M != null) M.ThrowIfDisposed();
  4427. imgproc_Imgproc_warpPerspective_10(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags, borderMode, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  4428. }
  4429. /**
  4430. * Applies a perspective transformation to an image.
  4431. *
  4432. * The function warpPerspective transforms the source image using the specified matrix:
  4433. *
  4434. * \(\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
  4435. * \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\)
  4436. *
  4437. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
  4438. * and then put in the formula above instead of M. The function cannot operate in-place.
  4439. *
  4440. * param src input image.
  4441. * param dst output image that has the size dsize and the same type as src .
  4442. * param M \(3\times 3\) transformation matrix.
  4443. * param dsize size of the output image.
  4444. * param flags combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
  4445. * optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
  4446. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4447. * param borderMode pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE).
  4448. *
  4449. * SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransform
  4450. */
  4451. public static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags, int borderMode)
  4452. {
  4453. if (src != null) src.ThrowIfDisposed();
  4454. if (dst != null) dst.ThrowIfDisposed();
  4455. if (M != null) M.ThrowIfDisposed();
  4456. imgproc_Imgproc_warpPerspective_11(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags, borderMode);
  4457. }
  4458. /**
  4459. * Applies a perspective transformation to an image.
  4460. *
  4461. * The function warpPerspective transforms the source image using the specified matrix:
  4462. *
  4463. * \(\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
  4464. * \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\)
  4465. *
  4466. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
  4467. * and then put in the formula above instead of M. The function cannot operate in-place.
  4468. *
  4469. * param src input image.
  4470. * param dst output image that has the size dsize and the same type as src .
  4471. * param M \(3\times 3\) transformation matrix.
  4472. * param dsize size of the output image.
  4473. * param flags combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the
  4474. * optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
  4475. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4476. *
  4477. * SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransform
  4478. */
  4479. public static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize, int flags)
  4480. {
  4481. if (src != null) src.ThrowIfDisposed();
  4482. if (dst != null) dst.ThrowIfDisposed();
  4483. if (M != null) M.ThrowIfDisposed();
  4484. imgproc_Imgproc_warpPerspective_12(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height, flags);
  4485. }
  4486. /**
  4487. * Applies a perspective transformation to an image.
  4488. *
  4489. * The function warpPerspective transforms the source image using the specified matrix:
  4490. *
  4491. * \(\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
  4492. * \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\)
  4493. *
  4494. * when the flag #WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
  4495. * and then put in the formula above instead of M. The function cannot operate in-place.
  4496. *
  4497. * param src input image.
  4498. * param dst output image that has the size dsize and the same type as src .
  4499. * param M \(3\times 3\) transformation matrix.
  4500. * param dsize size of the output image.
  4501. * optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation (
  4502. * \(\texttt{dst}\rightarrow\texttt{src}\) ).
  4503. *
  4504. * SEE: warpAffine, resize, remap, getRectSubPix, perspectiveTransform
  4505. */
  4506. public static void warpPerspective(Mat src, Mat dst, Mat M, Size dsize)
  4507. {
  4508. if (src != null) src.ThrowIfDisposed();
  4509. if (dst != null) dst.ThrowIfDisposed();
  4510. if (M != null) M.ThrowIfDisposed();
  4511. imgproc_Imgproc_warpPerspective_13(src.nativeObj, dst.nativeObj, M.nativeObj, dsize.width, dsize.height);
  4512. }
  4513. //
  4514. // C++: void cv::remap(Mat src, Mat& dst, Mat map1, Mat map2, int interpolation, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  4515. //
  4516. /**
  4517. * Applies a generic geometrical transformation to an image.
  4518. *
  4519. * The function remap transforms the source image using the specified map:
  4520. *
  4521. * \(\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\)
  4522. *
  4523. * where values of pixels with non-integer coordinates are computed using one of available
  4524. * interpolation methods. \(map_x\) and \(map_y\) can be encoded as separate floating-point maps
  4525. * in \(map_1\) and \(map_2\) respectively, or interleaved floating-point maps of \((x,y)\) in
  4526. * \(map_1\), or fixed-point maps created by using #convertMaps. The reason you might want to
  4527. * convert from floating to fixed-point representations of a map is that they can yield much faster
  4528. * (\~2x) remapping operations. In the converted case, \(map_1\) contains pairs (cvFloor(x),
  4529. * cvFloor(y)) and \(map_2\) contains indices in a table of interpolation coefficients.
  4530. *
  4531. * This function cannot operate in-place.
  4532. *
  4533. * param src Source image.
  4534. * param dst Destination image. It has the same size as map1 and the same type as src .
  4535. * param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 ,
  4536. * CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point
  4537. * representation to fixed-point for speed.
  4538. * param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
  4539. * if map1 is (x,y) points), respectively.
  4540. * param interpolation Interpolation method (see #InterpolationFlags). The methods #INTER_AREA
  4541. * and #INTER_LINEAR_EXACT are not supported by this function.
  4542. * param borderMode Pixel extrapolation method (see #BorderTypes). When
  4543. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
  4544. * corresponds to the "outliers" in the source image are not modified by the function.
  4545. * param borderValue Value used in case of a constant border. By default, it is 0.
  4546. * <b>Note:</b>
  4547. * Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
  4548. */
  4549. public static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode, Scalar borderValue)
  4550. {
  4551. if (src != null) src.ThrowIfDisposed();
  4552. if (dst != null) dst.ThrowIfDisposed();
  4553. if (map1 != null) map1.ThrowIfDisposed();
  4554. if (map2 != null) map2.ThrowIfDisposed();
  4555. imgproc_Imgproc_remap_10(src.nativeObj, dst.nativeObj, map1.nativeObj, map2.nativeObj, interpolation, borderMode, borderValue.val[0], borderValue.val[1], borderValue.val[2], borderValue.val[3]);
  4556. }
  4557. /**
  4558. * Applies a generic geometrical transformation to an image.
  4559. *
  4560. * The function remap transforms the source image using the specified map:
  4561. *
  4562. * \(\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\)
  4563. *
  4564. * where values of pixels with non-integer coordinates are computed using one of available
  4565. * interpolation methods. \(map_x\) and \(map_y\) can be encoded as separate floating-point maps
  4566. * in \(map_1\) and \(map_2\) respectively, or interleaved floating-point maps of \((x,y)\) in
  4567. * \(map_1\), or fixed-point maps created by using #convertMaps. The reason you might want to
  4568. * convert from floating to fixed-point representations of a map is that they can yield much faster
  4569. * (\~2x) remapping operations. In the converted case, \(map_1\) contains pairs (cvFloor(x),
  4570. * cvFloor(y)) and \(map_2\) contains indices in a table of interpolation coefficients.
  4571. *
  4572. * This function cannot operate in-place.
  4573. *
  4574. * param src Source image.
  4575. * param dst Destination image. It has the same size as map1 and the same type as src .
  4576. * param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 ,
  4577. * CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point
  4578. * representation to fixed-point for speed.
  4579. * param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
  4580. * if map1 is (x,y) points), respectively.
  4581. * param interpolation Interpolation method (see #InterpolationFlags). The methods #INTER_AREA
  4582. * and #INTER_LINEAR_EXACT are not supported by this function.
  4583. * param borderMode Pixel extrapolation method (see #BorderTypes). When
  4584. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
  4585. * corresponds to the "outliers" in the source image are not modified by the function.
  4586. * <b>Note:</b>
  4587. * Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
  4588. */
  4589. public static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation, int borderMode)
  4590. {
  4591. if (src != null) src.ThrowIfDisposed();
  4592. if (dst != null) dst.ThrowIfDisposed();
  4593. if (map1 != null) map1.ThrowIfDisposed();
  4594. if (map2 != null) map2.ThrowIfDisposed();
  4595. imgproc_Imgproc_remap_11(src.nativeObj, dst.nativeObj, map1.nativeObj, map2.nativeObj, interpolation, borderMode);
  4596. }
  4597. /**
  4598. * Applies a generic geometrical transformation to an image.
  4599. *
  4600. * The function remap transforms the source image using the specified map:
  4601. *
  4602. * \(\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\)
  4603. *
  4604. * where values of pixels with non-integer coordinates are computed using one of available
  4605. * interpolation methods. \(map_x\) and \(map_y\) can be encoded as separate floating-point maps
  4606. * in \(map_1\) and \(map_2\) respectively, or interleaved floating-point maps of \((x,y)\) in
  4607. * \(map_1\), or fixed-point maps created by using #convertMaps. The reason you might want to
  4608. * convert from floating to fixed-point representations of a map is that they can yield much faster
  4609. * (\~2x) remapping operations. In the converted case, \(map_1\) contains pairs (cvFloor(x),
  4610. * cvFloor(y)) and \(map_2\) contains indices in a table of interpolation coefficients.
  4611. *
  4612. * This function cannot operate in-place.
  4613. *
  4614. * param src Source image.
  4615. * param dst Destination image. It has the same size as map1 and the same type as src .
  4616. * param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 ,
  4617. * CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point
  4618. * representation to fixed-point for speed.
  4619. * param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
  4620. * if map1 is (x,y) points), respectively.
  4621. * param interpolation Interpolation method (see #InterpolationFlags). The methods #INTER_AREA
  4622. * and #INTER_LINEAR_EXACT are not supported by this function.
  4623. * borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that
  4624. * corresponds to the "outliers" in the source image are not modified by the function.
  4625. * <b>Note:</b>
  4626. * Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
  4627. */
  4628. public static void remap(Mat src, Mat dst, Mat map1, Mat map2, int interpolation)
  4629. {
  4630. if (src != null) src.ThrowIfDisposed();
  4631. if (dst != null) dst.ThrowIfDisposed();
  4632. if (map1 != null) map1.ThrowIfDisposed();
  4633. if (map2 != null) map2.ThrowIfDisposed();
  4634. imgproc_Imgproc_remap_12(src.nativeObj, dst.nativeObj, map1.nativeObj, map2.nativeObj, interpolation);
  4635. }
  4636. //
  4637. // C++: void cv::convertMaps(Mat map1, Mat map2, Mat& dstmap1, Mat& dstmap2, int dstmap1type, bool nninterpolation = false)
  4638. //
  4639. /**
  4640. * Converts image transformation maps from one representation to another.
  4641. *
  4642. * The function converts a pair of maps for remap from one representation to another. The following
  4643. * options ( (map1.type(), map2.type()) \(\rightarrow\) (dstmap1.type(), dstmap2.type()) ) are
  4644. * supported:
  4645. *
  4646. * <ul>
  4647. * <li>
  4648. * \(\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\). This is the
  4649. * most frequently used conversion operation, in which the original floating-point maps (see #remap)
  4650. * are converted to a more compact and much faster fixed-point representation. The first output array
  4651. * contains the rounded coordinates and the second array (created only when nninterpolation=false )
  4652. * contains indices in the interpolation tables.
  4653. * </li>
  4654. * </ul>
  4655. *
  4656. * <ul>
  4657. * <li>
  4658. * \(\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\). The same as above but
  4659. * the original maps are stored in one 2-channel matrix.
  4660. * </li>
  4661. * </ul>
  4662. *
  4663. * <ul>
  4664. * <li>
  4665. * Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same
  4666. * as the originals.
  4667. * </li>
  4668. * </ul>
  4669. *
  4670. * param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
  4671. * param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
  4672. * respectively.
  4673. * param dstmap1 The first output map that has the type dstmap1type and the same size as src .
  4674. * param dstmap2 The second output map.
  4675. * param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or
  4676. * CV_32FC2 .
  4677. * param nninterpolation Flag indicating whether the fixed-point maps are used for the
  4678. * nearest-neighbor or for a more complex interpolation.
  4679. *
  4680. * SEE: remap, undistort, initUndistortRectifyMap
  4681. */
  4682. public static void convertMaps(Mat map1, Mat map2, Mat dstmap1, Mat dstmap2, int dstmap1type, bool nninterpolation)
  4683. {
  4684. if (map1 != null) map1.ThrowIfDisposed();
  4685. if (map2 != null) map2.ThrowIfDisposed();
  4686. if (dstmap1 != null) dstmap1.ThrowIfDisposed();
  4687. if (dstmap2 != null) dstmap2.ThrowIfDisposed();
  4688. imgproc_Imgproc_convertMaps_10(map1.nativeObj, map2.nativeObj, dstmap1.nativeObj, dstmap2.nativeObj, dstmap1type, nninterpolation);
  4689. }
  4690. /**
  4691. * Converts image transformation maps from one representation to another.
  4692. *
  4693. * The function converts a pair of maps for remap from one representation to another. The following
  4694. * options ( (map1.type(), map2.type()) \(\rightarrow\) (dstmap1.type(), dstmap2.type()) ) are
  4695. * supported:
  4696. *
  4697. * <ul>
  4698. * <li>
  4699. * \(\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\). This is the
  4700. * most frequently used conversion operation, in which the original floating-point maps (see #remap)
  4701. * are converted to a more compact and much faster fixed-point representation. The first output array
  4702. * contains the rounded coordinates and the second array (created only when nninterpolation=false )
  4703. * contains indices in the interpolation tables.
  4704. * </li>
  4705. * </ul>
  4706. *
  4707. * <ul>
  4708. * <li>
  4709. * \(\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\). The same as above but
  4710. * the original maps are stored in one 2-channel matrix.
  4711. * </li>
  4712. * </ul>
  4713. *
  4714. * <ul>
  4715. * <li>
  4716. * Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same
  4717. * as the originals.
  4718. * </li>
  4719. * </ul>
  4720. *
  4721. * param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
  4722. * param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
  4723. * respectively.
  4724. * param dstmap1 The first output map that has the type dstmap1type and the same size as src .
  4725. * param dstmap2 The second output map.
  4726. * param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or
  4727. * CV_32FC2 .
  4728. * nearest-neighbor or for a more complex interpolation.
  4729. *
  4730. * SEE: remap, undistort, initUndistortRectifyMap
  4731. */
  4732. public static void convertMaps(Mat map1, Mat map2, Mat dstmap1, Mat dstmap2, int dstmap1type)
  4733. {
  4734. if (map1 != null) map1.ThrowIfDisposed();
  4735. if (map2 != null) map2.ThrowIfDisposed();
  4736. if (dstmap1 != null) dstmap1.ThrowIfDisposed();
  4737. if (dstmap2 != null) dstmap2.ThrowIfDisposed();
  4738. imgproc_Imgproc_convertMaps_11(map1.nativeObj, map2.nativeObj, dstmap1.nativeObj, dstmap2.nativeObj, dstmap1type);
  4739. }
  4740. //
  4741. // C++: Mat cv::getRotationMatrix2D(Point2f center, double angle, double scale)
  4742. //
  4743. /**
  4744. * Calculates an affine matrix of 2D rotation.
  4745. *
  4746. * The function calculates the following matrix:
  4747. *
  4748. * \(\begin{bmatrix} \alpha &amp; \beta &amp; (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta &amp; \alpha &amp; \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\)
  4749. *
  4750. * where
  4751. *
  4752. * \(\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\)
  4753. *
  4754. * The transformation maps the rotation center to itself. If this is not the target, adjust the shift.
  4755. *
  4756. * param center Center of the rotation in the source image.
  4757. * param angle Rotation angle in degrees. Positive values mean counter-clockwise rotation (the
  4758. * coordinate origin is assumed to be the top-left corner).
  4759. * param scale Isotropic scale factor.
  4760. *
  4761. * SEE: getAffineTransform, warpAffine, transform
  4762. * return automatically generated
  4763. */
  4764. public static Mat getRotationMatrix2D(Point center, double angle, double scale)
  4765. {
  4766. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getRotationMatrix2D_10(center.x, center.y, angle, scale)));
  4767. }
  4768. //
  4769. // C++: void cv::invertAffineTransform(Mat M, Mat& iM)
  4770. //
  4771. /**
  4772. * Inverts an affine transformation.
  4773. *
  4774. * The function computes an inverse affine transformation represented by \(2 \times 3\) matrix M:
  4775. *
  4776. * \(\begin{bmatrix} a_{11} &amp; a_{12} &amp; b_1 \\ a_{21} &amp; a_{22} &amp; b_2 \end{bmatrix}\)
  4777. *
  4778. * The result is also a \(2 \times 3\) matrix of the same type as M.
  4779. *
  4780. * param M Original affine transformation.
  4781. * param iM Output reverse affine transformation.
  4782. */
  4783. public static void invertAffineTransform(Mat M, Mat iM)
  4784. {
  4785. if (M != null) M.ThrowIfDisposed();
  4786. if (iM != null) iM.ThrowIfDisposed();
  4787. imgproc_Imgproc_invertAffineTransform_10(M.nativeObj, iM.nativeObj);
  4788. }
  4789. //
  4790. // C++: Mat cv::getPerspectiveTransform(Mat src, Mat dst, int solveMethod = DECOMP_LU)
  4791. //
  4792. /**
  4793. * Calculates a perspective transform from four pairs of the corresponding points.
  4794. *
  4795. * The function calculates the \(3 \times 3\) matrix of a perspective transform so that:
  4796. *
  4797. * \(\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\)
  4798. *
  4799. * where
  4800. *
  4801. * \(dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\)
  4802. *
  4803. * param src Coordinates of quadrangle vertices in the source image.
  4804. * param dst Coordinates of the corresponding quadrangle vertices in the destination image.
  4805. * param solveMethod method passed to cv::solve (#DecompTypes)
  4806. *
  4807. * SEE: findHomography, warpPerspective, perspectiveTransform
  4808. * return automatically generated
  4809. */
  4810. public static Mat getPerspectiveTransform(Mat src, Mat dst, int solveMethod)
  4811. {
  4812. if (src != null) src.ThrowIfDisposed();
  4813. if (dst != null) dst.ThrowIfDisposed();
  4814. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getPerspectiveTransform_10(src.nativeObj, dst.nativeObj, solveMethod)));
  4815. }
  4816. /**
  4817. * Calculates a perspective transform from four pairs of the corresponding points.
  4818. *
  4819. * The function calculates the \(3 \times 3\) matrix of a perspective transform so that:
  4820. *
  4821. * \(\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\)
  4822. *
  4823. * where
  4824. *
  4825. * \(dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\)
  4826. *
  4827. * param src Coordinates of quadrangle vertices in the source image.
  4828. * param dst Coordinates of the corresponding quadrangle vertices in the destination image.
  4829. *
  4830. * SEE: findHomography, warpPerspective, perspectiveTransform
  4831. * return automatically generated
  4832. */
  4833. public static Mat getPerspectiveTransform(Mat src, Mat dst)
  4834. {
  4835. if (src != null) src.ThrowIfDisposed();
  4836. if (dst != null) dst.ThrowIfDisposed();
  4837. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getPerspectiveTransform_11(src.nativeObj, dst.nativeObj)));
  4838. }
  4839. //
  4840. // C++: Mat cv::getAffineTransform(vector_Point2f src, vector_Point2f dst)
  4841. //
  4842. public static Mat getAffineTransform(MatOfPoint2f src, MatOfPoint2f dst)
  4843. {
  4844. if (src != null) src.ThrowIfDisposed();
  4845. if (dst != null) dst.ThrowIfDisposed();
  4846. Mat src_mat = src;
  4847. Mat dst_mat = dst;
  4848. return new Mat(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_getAffineTransform_10(src_mat.nativeObj, dst_mat.nativeObj)));
  4849. }
  4850. //
  4851. // C++: void cv::getRectSubPix(Mat image, Size patchSize, Point2f center, Mat& patch, int patchType = -1)
  4852. //
  4853. /**
  4854. * Retrieves a pixel rectangle from an image with sub-pixel accuracy.
  4855. *
  4856. * The function getRectSubPix extracts pixels from src:
  4857. *
  4858. * \(patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\)
  4859. *
  4860. * where the values of the pixels at non-integer coordinates are retrieved using bilinear
  4861. * interpolation. Every channel of multi-channel images is processed independently. Also
  4862. * the image should be a single channel or three channel image. While the center of the
  4863. * rectangle must be inside the image, parts of the rectangle may be outside.
  4864. *
  4865. * param image Source image.
  4866. * param patchSize Size of the extracted patch.
  4867. * param center Floating point coordinates of the center of the extracted rectangle within the
  4868. * source image. The center must be inside the image.
  4869. * param patch Extracted patch that has the size patchSize and the same number of channels as src .
  4870. * param patchType Depth of the extracted pixels. By default, they have the same depth as src .
  4871. *
  4872. * SEE: warpAffine, warpPerspective
  4873. */
  4874. public static void getRectSubPix(Mat image, Size patchSize, Point center, Mat patch, int patchType)
  4875. {
  4876. if (image != null) image.ThrowIfDisposed();
  4877. if (patch != null) patch.ThrowIfDisposed();
  4878. imgproc_Imgproc_getRectSubPix_10(image.nativeObj, patchSize.width, patchSize.height, center.x, center.y, patch.nativeObj, patchType);
  4879. }
  4880. /**
  4881. * Retrieves a pixel rectangle from an image with sub-pixel accuracy.
  4882. *
  4883. * The function getRectSubPix extracts pixels from src:
  4884. *
  4885. * \(patch(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\)
  4886. *
  4887. * where the values of the pixels at non-integer coordinates are retrieved using bilinear
  4888. * interpolation. Every channel of multi-channel images is processed independently. Also
  4889. * the image should be a single channel or three channel image. While the center of the
  4890. * rectangle must be inside the image, parts of the rectangle may be outside.
  4891. *
  4892. * param image Source image.
  4893. * param patchSize Size of the extracted patch.
  4894. * param center Floating point coordinates of the center of the extracted rectangle within the
  4895. * source image. The center must be inside the image.
  4896. * param patch Extracted patch that has the size patchSize and the same number of channels as src .
  4897. *
  4898. * SEE: warpAffine, warpPerspective
  4899. */
  4900. public static void getRectSubPix(Mat image, Size patchSize, Point center, Mat patch)
  4901. {
  4902. if (image != null) image.ThrowIfDisposed();
  4903. if (patch != null) patch.ThrowIfDisposed();
  4904. imgproc_Imgproc_getRectSubPix_11(image.nativeObj, patchSize.width, patchSize.height, center.x, center.y, patch.nativeObj);
  4905. }
  4906. //
  4907. // C++: void cv::logPolar(Mat src, Mat& dst, Point2f center, double M, int flags)
  4908. //
  4909. /**
  4910. * Remaps an image to semilog-polar coordinates space.
  4911. *
  4912. * deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG);
  4913. *
  4914. *
  4915. * Transform the source image using the following transformation (See REF: polar_remaps_reference_image "Polar remaps reference image d)"):
  4916. * \(\begin{array}{l}
  4917. * dst( \rho , \phi ) = src(x,y) \\
  4918. * dst.size() \leftarrow src.size()
  4919. * \end{array}\)
  4920. *
  4921. * where
  4922. * \(\begin{array}{l}
  4923. * I = (dx,dy) = (x - center.x,y - center.y) \\
  4924. * \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\
  4925. * \phi = Kangle \cdot \texttt{angle} (I) \\
  4926. * \end{array}\)
  4927. *
  4928. * and
  4929. * \(\begin{array}{l}
  4930. * M = src.cols / log_e(maxRadius) \\
  4931. * Kangle = src.rows / 2\Pi \\
  4932. * \end{array}\)
  4933. *
  4934. * The function emulates the human "foveal" vision and can be used for fast scale and
  4935. * rotation-invariant template matching, for object tracking and so forth.
  4936. * param src Source image
  4937. * param dst Destination image. It will have same size and type as src.
  4938. * param center The transformation center; where the output precision is maximal
  4939. * param M Magnitude scale parameter. It determines the radius of the bounding circle to transform too.
  4940. * param flags A combination of interpolation methods, see #InterpolationFlags
  4941. *
  4942. * <b>Note:</b>
  4943. * <ul>
  4944. * <li>
  4945. * The function can not operate in-place.
  4946. * </li>
  4947. * <li>
  4948. * To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  4949. * </li>
  4950. * </ul>
  4951. *
  4952. * SEE: cv::linearPolar
  4953. */
  4954. [Obsolete("This method is deprecated.")]
  4955. public static void logPolar(Mat src, Mat dst, Point center, double M, int flags)
  4956. {
  4957. if (src != null) src.ThrowIfDisposed();
  4958. if (dst != null) dst.ThrowIfDisposed();
  4959. imgproc_Imgproc_logPolar_10(src.nativeObj, dst.nativeObj, center.x, center.y, M, flags);
  4960. }
  4961. //
  4962. // C++: void cv::linearPolar(Mat src, Mat& dst, Point2f center, double maxRadius, int flags)
  4963. //
  4964. /**
  4965. * Remaps an image to polar coordinates space.
  4966. *
  4967. * deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags)
  4968. *
  4969. *
  4970. * Transform the source image using the following transformation (See REF: polar_remaps_reference_image "Polar remaps reference image c)"):
  4971. * \(\begin{array}{l}
  4972. * dst( \rho , \phi ) = src(x,y) \\
  4973. * dst.size() \leftarrow src.size()
  4974. * \end{array}\)
  4975. *
  4976. * where
  4977. * \(\begin{array}{l}
  4978. * I = (dx,dy) = (x - center.x,y - center.y) \\
  4979. * \rho = Kmag \cdot \texttt{magnitude} (I) ,\\
  4980. * \phi = angle \cdot \texttt{angle} (I)
  4981. * \end{array}\)
  4982. *
  4983. * and
  4984. * \(\begin{array}{l}
  4985. * Kx = src.cols / maxRadius \\
  4986. * Ky = src.rows / 2\Pi
  4987. * \end{array}\)
  4988. *
  4989. *
  4990. * param src Source image
  4991. * param dst Destination image. It will have same size and type as src.
  4992. * param center The transformation center;
  4993. * param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
  4994. * param flags A combination of interpolation methods, see #InterpolationFlags
  4995. *
  4996. * <b>Note:</b>
  4997. * <ul>
  4998. * <li>
  4999. * The function can not operate in-place.
  5000. * </li>
  5001. * <li>
  5002. * To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  5003. * </li>
  5004. * </ul>
  5005. *
  5006. * SEE: cv::logPolar
  5007. */
  5008. [Obsolete("This method is deprecated.")]
  5009. public static void linearPolar(Mat src, Mat dst, Point center, double maxRadius, int flags)
  5010. {
  5011. if (src != null) src.ThrowIfDisposed();
  5012. if (dst != null) dst.ThrowIfDisposed();
  5013. imgproc_Imgproc_linearPolar_10(src.nativeObj, dst.nativeObj, center.x, center.y, maxRadius, flags);
  5014. }
  5015. //
  5016. // C++: void cv::warpPolar(Mat src, Mat& dst, Size dsize, Point2f center, double maxRadius, int flags)
  5017. //
  5018. /**
  5019. * Remaps an image to polar or semilog-polar coordinates space
  5020. *
  5021. * polar_remaps_reference_image
  5022. * ![Polar remaps reference](pics/polar_remap_doc.png)
  5023. *
  5024. * Transform the source image using the following transformation:
  5025. * \(
  5026. * dst(\rho , \phi ) = src(x,y)
  5027. * \)
  5028. *
  5029. * where
  5030. * \(
  5031. * \begin{array}{l}
  5032. * \vec{I} = (x - center.x, \;y - center.y) \\
  5033. * \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\
  5034. * \rho = \left\{\begin{matrix}
  5035. * Klin \cdot \texttt{magnitude} (\vec{I}) &amp; default \\
  5036. * Klog \cdot log_e(\texttt{magnitude} (\vec{I})) &amp; if \; semilog \\
  5037. * \end{matrix}\right.
  5038. * \end{array}
  5039. * \)
  5040. *
  5041. * and
  5042. * \(
  5043. * \begin{array}{l}
  5044. * Kangle = dsize.height / 2\Pi \\
  5045. * Klin = dsize.width / maxRadius \\
  5046. * Klog = dsize.width / log_e(maxRadius) \\
  5047. * \end{array}
  5048. * \)
  5049. *
  5050. *
  5051. * \par Linear vs semilog mapping
  5052. *
  5053. * Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to {code flags} to specify the polar mapping mode.
  5054. *
  5055. * Linear is the default mode.
  5056. *
  5057. * The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision)
  5058. * in contrast to peripheral vision where acuity is minor.
  5059. *
  5060. * \par Option on {code dsize}:
  5061. *
  5062. * <ul>
  5063. * <li>
  5064. * if both values in {code dsize &lt;=0 } (default),
  5065. * the destination image will have (almost) same area of source bounding circle:
  5066. * \(\begin{array}{l}
  5067. * dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\
  5068. * dsize.width = \texttt{cvRound}(maxRadius) \\
  5069. * dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\
  5070. * \end{array}\)
  5071. * </li>
  5072. * </ul>
  5073. *
  5074. *
  5075. * <ul>
  5076. * <li>
  5077. * if only {code dsize.height &lt;= 0},
  5078. * the destination image area will be proportional to the bounding circle area but scaled by {code Kx * Kx}:
  5079. * \(\begin{array}{l}
  5080. * dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\
  5081. * \end{array}
  5082. * \)
  5083. * </li>
  5084. * </ul>
  5085. *
  5086. * <ul>
  5087. * <li>
  5088. * if both values in {code dsize &gt; 0 },
  5089. * the destination image will have the given size therefore the area of the bounding circle will be scaled to {code dsize}.
  5090. * </li>
  5091. * </ul>
  5092. *
  5093. *
  5094. * \par Reverse mapping
  5095. *
  5096. * You can get reverse mapping adding #WARP_INVERSE_MAP to {code flags}
  5097. * \snippet polar_transforms.cpp InverseMap
  5098. *
  5099. * In addiction, to calculate the original coordinate from a polar mapped coordinate \((rho, phi)-&gt;(x, y)\):
  5100. * \snippet polar_transforms.cpp InverseCoordinate
  5101. *
  5102. * param src Source image.
  5103. * param dst Destination image. It will have same type as src.
  5104. * param dsize The destination image size (see description for valid options).
  5105. * param center The transformation center.
  5106. * param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too.
  5107. * param flags A combination of interpolation methods, #InterpolationFlags + #WarpPolarMode.
  5108. * <ul>
  5109. * <li>
  5110. * Add #WARP_POLAR_LINEAR to select linear polar mapping (default)
  5111. * </li>
  5112. * <li>
  5113. * Add #WARP_POLAR_LOG to select semilog polar mapping
  5114. * </li>
  5115. * <li>
  5116. * Add #WARP_INVERSE_MAP for reverse mapping.
  5117. * </li>
  5118. * </ul>
  5119. * <b>Note:</b>
  5120. * <ul>
  5121. * <li>
  5122. * The function can not operate in-place.
  5123. * </li>
  5124. * <li>
  5125. * To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees.
  5126. * </li>
  5127. * <li>
  5128. * This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767.
  5129. * </li>
  5130. * </ul>
  5131. *
  5132. * SEE: cv::remap
  5133. */
  5134. public static void warpPolar(Mat src, Mat dst, Size dsize, Point center, double maxRadius, int flags)
  5135. {
  5136. if (src != null) src.ThrowIfDisposed();
  5137. if (dst != null) dst.ThrowIfDisposed();
  5138. imgproc_Imgproc_warpPolar_10(src.nativeObj, dst.nativeObj, dsize.width, dsize.height, center.x, center.y, maxRadius, flags);
  5139. }
  5140. //
  5141. // C++: void cv::integral(Mat src, Mat& sum, Mat& sqsum, Mat& tilted, int sdepth = -1, int sqdepth = -1)
  5142. //
  5143. /**
  5144. * Calculates the integral of an image.
  5145. *
  5146. * The function calculates one or more integral images for the source image as follows:
  5147. *
  5148. * \(\texttt{sum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)\)
  5149. *
  5150. * \(\texttt{sqsum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)^2\)
  5151. *
  5152. * \(\texttt{tilted} (X,Y) = \sum _{y&lt;Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\)
  5153. *
  5154. * Using these integral images, you can calculate sum, mean, and standard deviation over a specific
  5155. * up-right or rotated rectangular region of the image in a constant time, for example:
  5156. *
  5157. * \(\sum _{x_1 \leq x &lt; x_2, \, y_1 \leq y &lt; y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\)
  5158. *
  5159. * It makes possible to do a fast blurring or fast block correlation with a variable window size, for
  5160. * example. In case of multi-channel images, sums for each channel are accumulated independently.
  5161. *
  5162. * As a practical example, the next figure shows the calculation of the integral of a straight
  5163. * rectangle Rect(4,4,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
  5164. * original image are shown, as well as the relative pixels in the integral images sum and tilted .
  5165. *
  5166. * ![integral calculation example](pics/integral.png)
  5167. *
  5168. * param src input image as \(W \times H\), 8-bit or floating-point (32f or 64f).
  5169. * param sum integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).
  5170. * param sqsum integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
  5171. * floating-point (64f) array.
  5172. * param tilted integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
  5173. * the same data type as sum.
  5174. * param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
  5175. * CV_64F.
  5176. * param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
  5177. */
  5178. public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted, int sdepth, int sqdepth)
  5179. {
  5180. if (src != null) src.ThrowIfDisposed();
  5181. if (sum != null) sum.ThrowIfDisposed();
  5182. if (sqsum != null) sqsum.ThrowIfDisposed();
  5183. if (tilted != null) tilted.ThrowIfDisposed();
  5184. imgproc_Imgproc_integral3_10(src.nativeObj, sum.nativeObj, sqsum.nativeObj, tilted.nativeObj, sdepth, sqdepth);
  5185. }
  5186. /**
  5187. * Calculates the integral of an image.
  5188. *
  5189. * The function calculates one or more integral images for the source image as follows:
  5190. *
  5191. * \(\texttt{sum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)\)
  5192. *
  5193. * \(\texttt{sqsum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)^2\)
  5194. *
  5195. * \(\texttt{tilted} (X,Y) = \sum _{y&lt;Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\)
  5196. *
  5197. * Using these integral images, you can calculate sum, mean, and standard deviation over a specific
  5198. * up-right or rotated rectangular region of the image in a constant time, for example:
  5199. *
  5200. * \(\sum _{x_1 \leq x &lt; x_2, \, y_1 \leq y &lt; y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\)
  5201. *
  5202. * It makes possible to do a fast blurring or fast block correlation with a variable window size, for
  5203. * example. In case of multi-channel images, sums for each channel are accumulated independently.
  5204. *
  5205. * As a practical example, the next figure shows the calculation of the integral of a straight
  5206. * rectangle Rect(4,4,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
  5207. * original image are shown, as well as the relative pixels in the integral images sum and tilted .
  5208. *
  5209. * ![integral calculation example](pics/integral.png)
  5210. *
  5211. * param src input image as \(W \times H\), 8-bit or floating-point (32f or 64f).
  5212. * param sum integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).
  5213. * param sqsum integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
  5214. * floating-point (64f) array.
  5215. * param tilted integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
  5216. * the same data type as sum.
  5217. * param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
  5218. * CV_64F.
  5219. */
  5220. public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted, int sdepth)
  5221. {
  5222. if (src != null) src.ThrowIfDisposed();
  5223. if (sum != null) sum.ThrowIfDisposed();
  5224. if (sqsum != null) sqsum.ThrowIfDisposed();
  5225. if (tilted != null) tilted.ThrowIfDisposed();
  5226. imgproc_Imgproc_integral3_11(src.nativeObj, sum.nativeObj, sqsum.nativeObj, tilted.nativeObj, sdepth);
  5227. }
  5228. /**
  5229. * Calculates the integral of an image.
  5230. *
  5231. * The function calculates one or more integral images for the source image as follows:
  5232. *
  5233. * \(\texttt{sum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)\)
  5234. *
  5235. * \(\texttt{sqsum} (X,Y) = \sum _{x&lt;X,y&lt;Y} \texttt{image} (x,y)^2\)
  5236. *
  5237. * \(\texttt{tilted} (X,Y) = \sum _{y&lt;Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\)
  5238. *
  5239. * Using these integral images, you can calculate sum, mean, and standard deviation over a specific
  5240. * up-right or rotated rectangular region of the image in a constant time, for example:
  5241. *
  5242. * \(\sum _{x_1 \leq x &lt; x_2, \, y_1 \leq y &lt; y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\)
  5243. *
  5244. * It makes possible to do a fast blurring or fast block correlation with a variable window size, for
  5245. * example. In case of multi-channel images, sums for each channel are accumulated independently.
  5246. *
  5247. * As a practical example, the next figure shows the calculation of the integral of a straight
  5248. * rectangle Rect(4,4,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
  5249. * original image are shown, as well as the relative pixels in the integral images sum and tilted .
  5250. *
  5251. * ![integral calculation example](pics/integral.png)
  5252. *
  5253. * param src input image as \(W \times H\), 8-bit or floating-point (32f or 64f).
  5254. * param sum integral image as \((W+1)\times (H+1)\) , 32-bit integer or floating-point (32f or 64f).
  5255. * param sqsum integral image for squared pixel values; it is \((W+1)\times (H+1)\), double-precision
  5256. * floating-point (64f) array.
  5257. * param tilted integral for the image rotated by 45 degrees; it is \((W+1)\times (H+1)\) array with
  5258. * the same data type as sum.
  5259. * CV_64F.
  5260. */
  5261. public static void integral3(Mat src, Mat sum, Mat sqsum, Mat tilted)
  5262. {
  5263. if (src != null) src.ThrowIfDisposed();
  5264. if (sum != null) sum.ThrowIfDisposed();
  5265. if (sqsum != null) sqsum.ThrowIfDisposed();
  5266. if (tilted != null) tilted.ThrowIfDisposed();
  5267. imgproc_Imgproc_integral3_12(src.nativeObj, sum.nativeObj, sqsum.nativeObj, tilted.nativeObj);
  5268. }
  5269. //
  5270. // C++: void cv::integral(Mat src, Mat& sum, int sdepth = -1)
  5271. //
  5272. public static void integral(Mat src, Mat sum, int sdepth)
  5273. {
  5274. if (src != null) src.ThrowIfDisposed();
  5275. if (sum != null) sum.ThrowIfDisposed();
  5276. imgproc_Imgproc_integral_10(src.nativeObj, sum.nativeObj, sdepth);
  5277. }
  5278. public static void integral(Mat src, Mat sum)
  5279. {
  5280. if (src != null) src.ThrowIfDisposed();
  5281. if (sum != null) sum.ThrowIfDisposed();
  5282. imgproc_Imgproc_integral_11(src.nativeObj, sum.nativeObj);
  5283. }
  5284. //
  5285. // C++: void cv::integral(Mat src, Mat& sum, Mat& sqsum, int sdepth = -1, int sqdepth = -1)
  5286. //
  5287. public static void integral2(Mat src, Mat sum, Mat sqsum, int sdepth, int sqdepth)
  5288. {
  5289. if (src != null) src.ThrowIfDisposed();
  5290. if (sum != null) sum.ThrowIfDisposed();
  5291. if (sqsum != null) sqsum.ThrowIfDisposed();
  5292. imgproc_Imgproc_integral2_10(src.nativeObj, sum.nativeObj, sqsum.nativeObj, sdepth, sqdepth);
  5293. }
  5294. public static void integral2(Mat src, Mat sum, Mat sqsum, int sdepth)
  5295. {
  5296. if (src != null) src.ThrowIfDisposed();
  5297. if (sum != null) sum.ThrowIfDisposed();
  5298. if (sqsum != null) sqsum.ThrowIfDisposed();
  5299. imgproc_Imgproc_integral2_11(src.nativeObj, sum.nativeObj, sqsum.nativeObj, sdepth);
  5300. }
  5301. public static void integral2(Mat src, Mat sum, Mat sqsum)
  5302. {
  5303. if (src != null) src.ThrowIfDisposed();
  5304. if (sum != null) sum.ThrowIfDisposed();
  5305. if (sqsum != null) sqsum.ThrowIfDisposed();
  5306. imgproc_Imgproc_integral2_12(src.nativeObj, sum.nativeObj, sqsum.nativeObj);
  5307. }
  5308. //
  5309. // C++: void cv::accumulate(Mat src, Mat& dst, Mat mask = Mat())
  5310. //
  5311. /**
  5312. * Adds an image to the accumulator image.
  5313. *
  5314. * The function adds src or some of its elements to dst :
  5315. *
  5316. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5317. *
  5318. * The function supports multi-channel images. Each channel is processed independently.
  5319. *
  5320. * The function cv::accumulate can be used, for example, to collect statistics of a scene background
  5321. * viewed by a still camera and for the further foreground-background segmentation.
  5322. *
  5323. * param src Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
  5324. * param dst %Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
  5325. * param mask Optional operation mask.
  5326. *
  5327. * SEE: accumulateSquare, accumulateProduct, accumulateWeighted
  5328. */
  5329. public static void accumulate(Mat src, Mat dst, Mat mask)
  5330. {
  5331. if (src != null) src.ThrowIfDisposed();
  5332. if (dst != null) dst.ThrowIfDisposed();
  5333. if (mask != null) mask.ThrowIfDisposed();
  5334. imgproc_Imgproc_accumulate_10(src.nativeObj, dst.nativeObj, mask.nativeObj);
  5335. }
  5336. /**
  5337. * Adds an image to the accumulator image.
  5338. *
  5339. * The function adds src or some of its elements to dst :
  5340. *
  5341. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5342. *
  5343. * The function supports multi-channel images. Each channel is processed independently.
  5344. *
  5345. * The function cv::accumulate can be used, for example, to collect statistics of a scene background
  5346. * viewed by a still camera and for the further foreground-background segmentation.
  5347. *
  5348. * param src Input image of type CV_8UC(n), CV_16UC(n), CV_32FC(n) or CV_64FC(n), where n is a positive integer.
  5349. * param dst %Accumulator image with the same number of channels as input image, and a depth of CV_32F or CV_64F.
  5350. *
  5351. * SEE: accumulateSquare, accumulateProduct, accumulateWeighted
  5352. */
  5353. public static void accumulate(Mat src, Mat dst)
  5354. {
  5355. if (src != null) src.ThrowIfDisposed();
  5356. if (dst != null) dst.ThrowIfDisposed();
  5357. imgproc_Imgproc_accumulate_11(src.nativeObj, dst.nativeObj);
  5358. }
  5359. //
  5360. // C++: void cv::accumulateSquare(Mat src, Mat& dst, Mat mask = Mat())
  5361. //
  5362. /**
  5363. * Adds the square of a source image to the accumulator image.
  5364. *
  5365. * The function adds the input image src or its selected region, raised to a power of 2, to the
  5366. * accumulator dst :
  5367. *
  5368. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5369. *
  5370. * The function supports multi-channel images. Each channel is processed independently.
  5371. *
  5372. * param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
  5373. * param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
  5374. * floating-point.
  5375. * param mask Optional operation mask.
  5376. *
  5377. * SEE: accumulateSquare, accumulateProduct, accumulateWeighted
  5378. */
  5379. public static void accumulateSquare(Mat src, Mat dst, Mat mask)
  5380. {
  5381. if (src != null) src.ThrowIfDisposed();
  5382. if (dst != null) dst.ThrowIfDisposed();
  5383. if (mask != null) mask.ThrowIfDisposed();
  5384. imgproc_Imgproc_accumulateSquare_10(src.nativeObj, dst.nativeObj, mask.nativeObj);
  5385. }
  5386. /**
  5387. * Adds the square of a source image to the accumulator image.
  5388. *
  5389. * The function adds the input image src or its selected region, raised to a power of 2, to the
  5390. * accumulator dst :
  5391. *
  5392. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5393. *
  5394. * The function supports multi-channel images. Each channel is processed independently.
  5395. *
  5396. * param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
  5397. * param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
  5398. * floating-point.
  5399. *
  5400. * SEE: accumulateSquare, accumulateProduct, accumulateWeighted
  5401. */
  5402. public static void accumulateSquare(Mat src, Mat dst)
  5403. {
  5404. if (src != null) src.ThrowIfDisposed();
  5405. if (dst != null) dst.ThrowIfDisposed();
  5406. imgproc_Imgproc_accumulateSquare_11(src.nativeObj, dst.nativeObj);
  5407. }
  5408. //
  5409. // C++: void cv::accumulateProduct(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
  5410. //
  5411. /**
  5412. * Adds the per-element product of two input images to the accumulator image.
  5413. *
  5414. * The function adds the product of two images or their selected regions to the accumulator dst :
  5415. *
  5416. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5417. *
  5418. * The function supports multi-channel images. Each channel is processed independently.
  5419. *
  5420. * param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
  5421. * param src2 Second input image of the same type and the same size as src1 .
  5422. * param dst %Accumulator image with the same number of channels as input images, 32-bit or 64-bit
  5423. * floating-point.
  5424. * param mask Optional operation mask.
  5425. *
  5426. * SEE: accumulate, accumulateSquare, accumulateWeighted
  5427. */
  5428. public static void accumulateProduct(Mat src1, Mat src2, Mat dst, Mat mask)
  5429. {
  5430. if (src1 != null) src1.ThrowIfDisposed();
  5431. if (src2 != null) src2.ThrowIfDisposed();
  5432. if (dst != null) dst.ThrowIfDisposed();
  5433. if (mask != null) mask.ThrowIfDisposed();
  5434. imgproc_Imgproc_accumulateProduct_10(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
  5435. }
  5436. /**
  5437. * Adds the per-element product of two input images to the accumulator image.
  5438. *
  5439. * The function adds the product of two images or their selected regions to the accumulator dst :
  5440. *
  5441. * \(\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5442. *
  5443. * The function supports multi-channel images. Each channel is processed independently.
  5444. *
  5445. * param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
  5446. * param src2 Second input image of the same type and the same size as src1 .
  5447. * param dst %Accumulator image with the same number of channels as input images, 32-bit or 64-bit
  5448. * floating-point.
  5449. *
  5450. * SEE: accumulate, accumulateSquare, accumulateWeighted
  5451. */
  5452. public static void accumulateProduct(Mat src1, Mat src2, Mat dst)
  5453. {
  5454. if (src1 != null) src1.ThrowIfDisposed();
  5455. if (src2 != null) src2.ThrowIfDisposed();
  5456. if (dst != null) dst.ThrowIfDisposed();
  5457. imgproc_Imgproc_accumulateProduct_11(src1.nativeObj, src2.nativeObj, dst.nativeObj);
  5458. }
  5459. //
  5460. // C++: void cv::accumulateWeighted(Mat src, Mat& dst, double alpha, Mat mask = Mat())
  5461. //
  5462. /**
  5463. * Updates a running average.
  5464. *
  5465. * The function calculates the weighted sum of the input image src and the accumulator dst so that dst
  5466. * becomes a running average of a frame sequence:
  5467. *
  5468. * \(\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5469. *
  5470. * That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images).
  5471. * The function supports multi-channel images. Each channel is processed independently.
  5472. *
  5473. * param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
  5474. * param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
  5475. * floating-point.
  5476. * param alpha Weight of the input image.
  5477. * param mask Optional operation mask.
  5478. *
  5479. * SEE: accumulate, accumulateSquare, accumulateProduct
  5480. */
  5481. public static void accumulateWeighted(Mat src, Mat dst, double alpha, Mat mask)
  5482. {
  5483. if (src != null) src.ThrowIfDisposed();
  5484. if (dst != null) dst.ThrowIfDisposed();
  5485. if (mask != null) mask.ThrowIfDisposed();
  5486. imgproc_Imgproc_accumulateWeighted_10(src.nativeObj, dst.nativeObj, alpha, mask.nativeObj);
  5487. }
  5488. /**
  5489. * Updates a running average.
  5490. *
  5491. * The function calculates the weighted sum of the input image src and the accumulator dst so that dst
  5492. * becomes a running average of a frame sequence:
  5493. *
  5494. * \(\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\)
  5495. *
  5496. * That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images).
  5497. * The function supports multi-channel images. Each channel is processed independently.
  5498. *
  5499. * param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
  5500. * param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
  5501. * floating-point.
  5502. * param alpha Weight of the input image.
  5503. *
  5504. * SEE: accumulate, accumulateSquare, accumulateProduct
  5505. */
  5506. public static void accumulateWeighted(Mat src, Mat dst, double alpha)
  5507. {
  5508. if (src != null) src.ThrowIfDisposed();
  5509. if (dst != null) dst.ThrowIfDisposed();
  5510. imgproc_Imgproc_accumulateWeighted_11(src.nativeObj, dst.nativeObj, alpha);
  5511. }
  5512. //
  5513. // C++: Point2d cv::phaseCorrelate(Mat src1, Mat src2, Mat window = Mat(), double* response = 0)
  5514. //
  5515. /**
  5516. * The function is used to detect translational shifts that occur between two images.
  5517. *
  5518. * The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
  5519. * the frequency domain. It can be used for fast image registration as well as motion estimation. For
  5520. * more information please see &lt;http://en.wikipedia.org/wiki/Phase_correlation&gt;
  5521. *
  5522. * Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
  5523. * with getOptimalDFTSize.
  5524. *
  5525. * The function performs the following equations:
  5526. * <ul>
  5527. * <li>
  5528. * First it applies a Hanning window (see &lt;http://en.wikipedia.org/wiki/Hann_function&gt;) to each
  5529. * image to remove possible edge effects. This window is cached until the array size changes to speed
  5530. * up processing time.
  5531. * </li>
  5532. * <li>
  5533. * Next it computes the forward DFTs of each source array:
  5534. * \(\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\)
  5535. * where \(\mathcal{F}\) is the forward DFT.
  5536. * </li>
  5537. * <li>
  5538. * It then computes the cross-power spectrum of each frequency domain array:
  5539. * \(R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\)
  5540. * </li>
  5541. * <li>
  5542. * Next the cross-correlation is converted back into the time domain via the inverse DFT:
  5543. * \(r = \mathcal{F}^{-1}\{R\}\)
  5544. * </li>
  5545. * <li>
  5546. * Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to
  5547. * achieve sub-pixel accuracy.
  5548. * \((\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\)
  5549. * </li>
  5550. * <li>
  5551. * If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5
  5552. * centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single
  5553. * peak) and will be smaller when there are multiple peaks.
  5554. * </li>
  5555. * </ul>
  5556. *
  5557. * param src1 Source floating point array (CV_32FC1 or CV_64FC1)
  5558. * param src2 Source floating point array (CV_32FC1 or CV_64FC1)
  5559. * param window Floating point array with windowing coefficients to reduce edge effects (optional).
  5560. * param response Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).
  5561. * return detected phase shift (sub-pixel) between the two arrays.
  5562. *
  5563. * SEE: dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
  5564. */
  5565. public static Point phaseCorrelate(Mat src1, Mat src2, Mat window, double[] response)
  5566. {
  5567. if (src1 != null) src1.ThrowIfDisposed();
  5568. if (src2 != null) src2.ThrowIfDisposed();
  5569. if (window != null) window.ThrowIfDisposed();
  5570. double[] response_out = new double[1];
  5571. double[] tmpArray = new double[2];
  5572. imgproc_Imgproc_phaseCorrelate_10(src1.nativeObj, src2.nativeObj, window.nativeObj, response_out, tmpArray);
  5573. Point retVal = new Point(tmpArray);
  5574. if (response != null) response[0] = (double)response_out[0];
  5575. return retVal;
  5576. }
  5577. /**
  5578. * The function is used to detect translational shifts that occur between two images.
  5579. *
  5580. * The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
  5581. * the frequency domain. It can be used for fast image registration as well as motion estimation. For
  5582. * more information please see &lt;http://en.wikipedia.org/wiki/Phase_correlation&gt;
  5583. *
  5584. * Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
  5585. * with getOptimalDFTSize.
  5586. *
  5587. * The function performs the following equations:
  5588. * <ul>
  5589. * <li>
  5590. * First it applies a Hanning window (see &lt;http://en.wikipedia.org/wiki/Hann_function&gt;) to each
  5591. * image to remove possible edge effects. This window is cached until the array size changes to speed
  5592. * up processing time.
  5593. * </li>
  5594. * <li>
  5595. * Next it computes the forward DFTs of each source array:
  5596. * \(\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\)
  5597. * where \(\mathcal{F}\) is the forward DFT.
  5598. * </li>
  5599. * <li>
  5600. * It then computes the cross-power spectrum of each frequency domain array:
  5601. * \(R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\)
  5602. * </li>
  5603. * <li>
  5604. * Next the cross-correlation is converted back into the time domain via the inverse DFT:
  5605. * \(r = \mathcal{F}^{-1}\{R\}\)
  5606. * </li>
  5607. * <li>
  5608. * Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to
  5609. * achieve sub-pixel accuracy.
  5610. * \((\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\)
  5611. * </li>
  5612. * <li>
  5613. * If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5
  5614. * centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single
  5615. * peak) and will be smaller when there are multiple peaks.
  5616. * </li>
  5617. * </ul>
  5618. *
  5619. * param src1 Source floating point array (CV_32FC1 or CV_64FC1)
  5620. * param src2 Source floating point array (CV_32FC1 or CV_64FC1)
  5621. * param window Floating point array with windowing coefficients to reduce edge effects (optional).
  5622. * return detected phase shift (sub-pixel) between the two arrays.
  5623. *
  5624. * SEE: dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
  5625. */
  5626. public static Point phaseCorrelate(Mat src1, Mat src2, Mat window)
  5627. {
  5628. if (src1 != null) src1.ThrowIfDisposed();
  5629. if (src2 != null) src2.ThrowIfDisposed();
  5630. if (window != null) window.ThrowIfDisposed();
  5631. double[] tmpArray = new double[2];
  5632. imgproc_Imgproc_phaseCorrelate_11(src1.nativeObj, src2.nativeObj, window.nativeObj, tmpArray);
  5633. Point retVal = new Point(tmpArray);
  5634. return retVal;
  5635. }
  5636. /**
  5637. * The function is used to detect translational shifts that occur between two images.
  5638. *
  5639. * The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
  5640. * the frequency domain. It can be used for fast image registration as well as motion estimation. For
  5641. * more information please see &lt;http://en.wikipedia.org/wiki/Phase_correlation&gt;
  5642. *
  5643. * Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
  5644. * with getOptimalDFTSize.
  5645. *
  5646. * The function performs the following equations:
  5647. * <ul>
  5648. * <li>
  5649. * First it applies a Hanning window (see &lt;http://en.wikipedia.org/wiki/Hann_function&gt;) to each
  5650. * image to remove possible edge effects. This window is cached until the array size changes to speed
  5651. * up processing time.
  5652. * </li>
  5653. * <li>
  5654. * Next it computes the forward DFTs of each source array:
  5655. * \(\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\)
  5656. * where \(\mathcal{F}\) is the forward DFT.
  5657. * </li>
  5658. * <li>
  5659. * It then computes the cross-power spectrum of each frequency domain array:
  5660. * \(R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\)
  5661. * </li>
  5662. * <li>
  5663. * Next the cross-correlation is converted back into the time domain via the inverse DFT:
  5664. * \(r = \mathcal{F}^{-1}\{R\}\)
  5665. * </li>
  5666. * <li>
  5667. * Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to
  5668. * achieve sub-pixel accuracy.
  5669. * \((\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\)
  5670. * </li>
  5671. * <li>
  5672. * If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5
  5673. * centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single
  5674. * peak) and will be smaller when there are multiple peaks.
  5675. * </li>
  5676. * </ul>
  5677. *
  5678. * param src1 Source floating point array (CV_32FC1 or CV_64FC1)
  5679. * param src2 Source floating point array (CV_32FC1 or CV_64FC1)
  5680. * return detected phase shift (sub-pixel) between the two arrays.
  5681. *
  5682. * SEE: dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
  5683. */
  5684. public static Point phaseCorrelate(Mat src1, Mat src2)
  5685. {
  5686. if (src1 != null) src1.ThrowIfDisposed();
  5687. if (src2 != null) src2.ThrowIfDisposed();
  5688. double[] tmpArray = new double[2];
  5689. imgproc_Imgproc_phaseCorrelate_12(src1.nativeObj, src2.nativeObj, tmpArray);
  5690. Point retVal = new Point(tmpArray);
  5691. return retVal;
  5692. }
  5693. //
  5694. // C++: void cv::createHanningWindow(Mat& dst, Size winSize, int type)
  5695. //
  5696. /**
  5697. * This function computes a Hanning window coefficients in two dimensions.
  5698. *
  5699. * See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function)
  5700. * for more information.
  5701. *
  5702. * An example is shown below:
  5703. * <code>
  5704. * // create hanning window of size 100x100 and type CV_32F
  5705. * Mat hann;
  5706. * createHanningWindow(hann, Size(100, 100), CV_32F);
  5707. * </code>
  5708. * param dst Destination array to place Hann coefficients in
  5709. * param winSize The window size specifications (both width and height must be &gt; 1)
  5710. * param type Created array type
  5711. */
  5712. public static void createHanningWindow(Mat dst, Size winSize, int type)
  5713. {
  5714. if (dst != null) dst.ThrowIfDisposed();
  5715. imgproc_Imgproc_createHanningWindow_10(dst.nativeObj, winSize.width, winSize.height, type);
  5716. }
  5717. //
  5718. // C++: void cv::divSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
  5719. //
  5720. /**
  5721. * Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum.
  5722. *
  5723. * The function cv::divSpectrums performs the per-element division of the first array by the second array.
  5724. * The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.
  5725. *
  5726. * param a first input array.
  5727. * param b second input array of the same size and type as src1 .
  5728. * param c output array of the same size and type as src1 .
  5729. * param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
  5730. * each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a {code 0} as value.
  5731. * param conjB optional flag that conjugates the second input array before the multiplication (true)
  5732. * or not (false).
  5733. */
  5734. public static void divSpectrums(Mat a, Mat b, Mat c, int flags, bool conjB)
  5735. {
  5736. if (a != null) a.ThrowIfDisposed();
  5737. if (b != null) b.ThrowIfDisposed();
  5738. if (c != null) c.ThrowIfDisposed();
  5739. imgproc_Imgproc_divSpectrums_10(a.nativeObj, b.nativeObj, c.nativeObj, flags, conjB);
  5740. }
  5741. /**
  5742. * Performs the per-element division of the first Fourier spectrum by the second Fourier spectrum.
  5743. *
  5744. * The function cv::divSpectrums performs the per-element division of the first array by the second array.
  5745. * The arrays are CCS-packed or complex matrices that are results of a real or complex Fourier transform.
  5746. *
  5747. * param a first input array.
  5748. * param b second input array of the same size and type as src1 .
  5749. * param c output array of the same size and type as src1 .
  5750. * param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
  5751. * each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a {code 0} as value.
  5752. * or not (false).
  5753. */
  5754. public static void divSpectrums(Mat a, Mat b, Mat c, int flags)
  5755. {
  5756. if (a != null) a.ThrowIfDisposed();
  5757. if (b != null) b.ThrowIfDisposed();
  5758. if (c != null) c.ThrowIfDisposed();
  5759. imgproc_Imgproc_divSpectrums_11(a.nativeObj, b.nativeObj, c.nativeObj, flags);
  5760. }
  5761. //
  5762. // C++: double cv::threshold(Mat src, Mat& dst, double thresh, double maxval, int type)
  5763. //
  5764. /**
  5765. * Applies a fixed-level threshold to each array element.
  5766. *
  5767. * The function applies fixed-level thresholding to a multiple-channel array. The function is typically
  5768. * used to get a bi-level (binary) image out of a grayscale image ( #compare could be also used for
  5769. * this purpose) or for removing a noise, that is, filtering out pixels with too small or too large
  5770. * values. There are several types of thresholding supported by the function. They are determined by
  5771. * type parameter.
  5772. *
  5773. * Also, the special values #THRESH_OTSU or #THRESH_TRIANGLE may be combined with one of the
  5774. * above values. In these cases, the function determines the optimal threshold value using the Otsu's
  5775. * or Triangle algorithm and uses it instead of the specified thresh.
  5776. *
  5777. * <b>Note:</b> Currently, the Otsu's and Triangle methods are implemented only for 8-bit single-channel images.
  5778. *
  5779. * param src input array (multiple-channel, 8-bit or 32-bit floating point).
  5780. * param dst output array of the same size and type and the same number of channels as src.
  5781. * param thresh threshold value.
  5782. * param maxval maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding
  5783. * types.
  5784. * param type thresholding type (see #ThresholdTypes).
  5785. * return the computed threshold value if Otsu's or Triangle methods used.
  5786. *
  5787. * SEE: adaptiveThreshold, findContours, compare, min, max
  5788. */
  5789. public static double threshold(Mat src, Mat dst, double thresh, double maxval, int type)
  5790. {
  5791. if (src != null) src.ThrowIfDisposed();
  5792. if (dst != null) dst.ThrowIfDisposed();
  5793. return imgproc_Imgproc_threshold_10(src.nativeObj, dst.nativeObj, thresh, maxval, type);
  5794. }
  5795. //
  5796. // C++: void cv::adaptiveThreshold(Mat src, Mat& dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)
  5797. //
  5798. /**
  5799. * Applies an adaptive threshold to an array.
  5800. *
  5801. * The function transforms a grayscale image to a binary image according to the formulae:
  5802. * <ul>
  5803. * <li>
  5804. * <b>THRESH_BINARY</b>
  5805. * \(dst(x,y) = \fork{\texttt{maxValue}}{if \(src(x,y) &gt; T(x,y)\)}{0}{otherwise}\)
  5806. * </li>
  5807. * <li>
  5808. * <b>THRESH_BINARY_INV</b>
  5809. * \(dst(x,y) = \fork{0}{if \(src(x,y) &gt; T(x,y)\)}{\texttt{maxValue}}{otherwise}\)
  5810. * where \(T(x,y)\) is a threshold calculated individually for each pixel (see adaptiveMethod parameter).
  5811. * </li>
  5812. * </ul>
  5813. *
  5814. * The function can process the image in-place.
  5815. *
  5816. * param src Source 8-bit single-channel image.
  5817. * param dst Destination image of the same size and the same type as src.
  5818. * param maxValue Non-zero value assigned to the pixels for which the condition is satisfied
  5819. * param adaptiveMethod Adaptive thresholding algorithm to use, see #AdaptiveThresholdTypes.
  5820. * The #BORDER_REPLICATE | #BORDER_ISOLATED is used to process boundaries.
  5821. * param thresholdType Thresholding type that must be either #THRESH_BINARY or #THRESH_BINARY_INV,
  5822. * see #ThresholdTypes.
  5823. * param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the
  5824. * pixel: 3, 5, 7, and so on.
  5825. * param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it
  5826. * is positive but may be zero or negative as well.
  5827. *
  5828. * SEE: threshold, blur, GaussianBlur
  5829. */
  5830. public static void adaptiveThreshold(Mat src, Mat dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)
  5831. {
  5832. if (src != null) src.ThrowIfDisposed();
  5833. if (dst != null) dst.ThrowIfDisposed();
  5834. imgproc_Imgproc_adaptiveThreshold_10(src.nativeObj, dst.nativeObj, maxValue, adaptiveMethod, thresholdType, blockSize, C);
  5835. }
  5836. //
  5837. // C++: void cv::pyrDown(Mat src, Mat& dst, Size dstsize = Size(), int borderType = BORDER_DEFAULT)
  5838. //
  5839. /**
  5840. * Blurs an image and downsamples it.
  5841. *
  5842. * By default, size of the output image is computed as {code Size((src.cols+1)/2, (src.rows+1)/2)}, but in
  5843. * any case, the following conditions should be satisfied:
  5844. *
  5845. * \(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
  5846. *
  5847. * The function performs the downsampling step of the Gaussian pyramid construction. First, it
  5848. * convolves the source image with the kernel:
  5849. *
  5850. * \(\frac{1}{256} \begin{bmatrix} 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 6 &amp; 24 &amp; 36 &amp; 24 &amp; 6 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \end{bmatrix}\)
  5851. *
  5852. * Then, it downsamples the image by rejecting even rows and columns.
  5853. *
  5854. * param src input image.
  5855. * param dst output image; it has the specified size and the same type as src.
  5856. * param dstsize size of the output image.
  5857. * param borderType Pixel extrapolation method, see #BorderTypes (#BORDER_CONSTANT isn't supported)
  5858. */
  5859. public static void pyrDown(Mat src, Mat dst, Size dstsize, int borderType)
  5860. {
  5861. if (src != null) src.ThrowIfDisposed();
  5862. if (dst != null) dst.ThrowIfDisposed();
  5863. imgproc_Imgproc_pyrDown_10(src.nativeObj, dst.nativeObj, dstsize.width, dstsize.height, borderType);
  5864. }
  5865. /**
  5866. * Blurs an image and downsamples it.
  5867. *
  5868. * By default, size of the output image is computed as {code Size((src.cols+1)/2, (src.rows+1)/2)}, but in
  5869. * any case, the following conditions should be satisfied:
  5870. *
  5871. * \(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
  5872. *
  5873. * The function performs the downsampling step of the Gaussian pyramid construction. First, it
  5874. * convolves the source image with the kernel:
  5875. *
  5876. * \(\frac{1}{256} \begin{bmatrix} 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 6 &amp; 24 &amp; 36 &amp; 24 &amp; 6 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \end{bmatrix}\)
  5877. *
  5878. * Then, it downsamples the image by rejecting even rows and columns.
  5879. *
  5880. * param src input image.
  5881. * param dst output image; it has the specified size and the same type as src.
  5882. * param dstsize size of the output image.
  5883. */
  5884. public static void pyrDown(Mat src, Mat dst, Size dstsize)
  5885. {
  5886. if (src != null) src.ThrowIfDisposed();
  5887. if (dst != null) dst.ThrowIfDisposed();
  5888. imgproc_Imgproc_pyrDown_11(src.nativeObj, dst.nativeObj, dstsize.width, dstsize.height);
  5889. }
  5890. /**
  5891. * Blurs an image and downsamples it.
  5892. *
  5893. * By default, size of the output image is computed as {code Size((src.cols+1)/2, (src.rows+1)/2)}, but in
  5894. * any case, the following conditions should be satisfied:
  5895. *
  5896. * \(\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\)
  5897. *
  5898. * The function performs the downsampling step of the Gaussian pyramid construction. First, it
  5899. * convolves the source image with the kernel:
  5900. *
  5901. * \(\frac{1}{256} \begin{bmatrix} 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 6 &amp; 24 &amp; 36 &amp; 24 &amp; 6 \\ 4 &amp; 16 &amp; 24 &amp; 16 &amp; 4 \\ 1 &amp; 4 &amp; 6 &amp; 4 &amp; 1 \end{bmatrix}\)
  5902. *
  5903. * Then, it downsamples the image by rejecting even rows and columns.
  5904. *
  5905. * param src input image.
  5906. * param dst output image; it has the specified size and the same type as src.
  5907. */
  5908. public static void pyrDown(Mat src, Mat dst)
  5909. {
  5910. if (src != null) src.ThrowIfDisposed();
  5911. if (dst != null) dst.ThrowIfDisposed();
  5912. imgproc_Imgproc_pyrDown_12(src.nativeObj, dst.nativeObj);
  5913. }
  5914. //
  5915. // C++: void cv::pyrUp(Mat src, Mat& dst, Size dstsize = Size(), int borderType = BORDER_DEFAULT)
  5916. //
  5917. /**
  5918. * Upsamples an image and then blurs it.
  5919. *
  5920. * By default, size of the output image is computed as {code Size(src.cols\*2, (src.rows\*2)}, but in any
  5921. * case, the following conditions should be satisfied:
  5922. *
  5923. * \(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
  5924. *
  5925. * The function performs the upsampling step of the Gaussian pyramid construction, though it can
  5926. * actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
  5927. * injecting even zero rows and columns and then convolves the result with the same kernel as in
  5928. * pyrDown multiplied by 4.
  5929. *
  5930. * param src input image.
  5931. * param dst output image. It has the specified size and the same type as src .
  5932. * param dstsize size of the output image.
  5933. * param borderType Pixel extrapolation method, see #BorderTypes (only #BORDER_DEFAULT is supported)
  5934. */
  5935. public static void pyrUp(Mat src, Mat dst, Size dstsize, int borderType)
  5936. {
  5937. if (src != null) src.ThrowIfDisposed();
  5938. if (dst != null) dst.ThrowIfDisposed();
  5939. imgproc_Imgproc_pyrUp_10(src.nativeObj, dst.nativeObj, dstsize.width, dstsize.height, borderType);
  5940. }
  5941. /**
  5942. * Upsamples an image and then blurs it.
  5943. *
  5944. * By default, size of the output image is computed as {code Size(src.cols\*2, (src.rows\*2)}, but in any
  5945. * case, the following conditions should be satisfied:
  5946. *
  5947. * \(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
  5948. *
  5949. * The function performs the upsampling step of the Gaussian pyramid construction, though it can
  5950. * actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
  5951. * injecting even zero rows and columns and then convolves the result with the same kernel as in
  5952. * pyrDown multiplied by 4.
  5953. *
  5954. * param src input image.
  5955. * param dst output image. It has the specified size and the same type as src .
  5956. * param dstsize size of the output image.
  5957. */
  5958. public static void pyrUp(Mat src, Mat dst, Size dstsize)
  5959. {
  5960. if (src != null) src.ThrowIfDisposed();
  5961. if (dst != null) dst.ThrowIfDisposed();
  5962. imgproc_Imgproc_pyrUp_11(src.nativeObj, dst.nativeObj, dstsize.width, dstsize.height);
  5963. }
  5964. /**
  5965. * Upsamples an image and then blurs it.
  5966. *
  5967. * By default, size of the output image is computed as {code Size(src.cols\*2, (src.rows\*2)}, but in any
  5968. * case, the following conditions should be satisfied:
  5969. *
  5970. * \(\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\)
  5971. *
  5972. * The function performs the upsampling step of the Gaussian pyramid construction, though it can
  5973. * actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
  5974. * injecting even zero rows and columns and then convolves the result with the same kernel as in
  5975. * pyrDown multiplied by 4.
  5976. *
  5977. * param src input image.
  5978. * param dst output image. It has the specified size and the same type as src .
  5979. */
  5980. public static void pyrUp(Mat src, Mat dst)
  5981. {
  5982. if (src != null) src.ThrowIfDisposed();
  5983. if (dst != null) dst.ThrowIfDisposed();
  5984. imgproc_Imgproc_pyrUp_12(src.nativeObj, dst.nativeObj);
  5985. }
  5986. //
  5987. // C++: void cv::calcHist(vector_Mat images, vector_int channels, Mat mask, Mat& hist, vector_int histSize, vector_float ranges, bool accumulate = false)
  5988. //
  5989. /**
  5990. *
  5991. *
  5992. * this variant supports only uniform histograms.
  5993. *
  5994. * ranges argument is either empty vector or a flattened vector of histSize.size()*2 elements
  5995. * (histSize.size() element pairs). The first and second elements of each pair specify the lower and
  5996. * upper boundaries.
  5997. * param images automatically generated
  5998. * param channels automatically generated
  5999. * param mask automatically generated
  6000. * param hist automatically generated
  6001. * param histSize automatically generated
  6002. * param ranges automatically generated
  6003. * param accumulate automatically generated
  6004. */
  6005. public static void calcHist(List<Mat> images, MatOfInt channels, Mat mask, Mat hist, MatOfInt histSize, MatOfFloat ranges, bool accumulate)
  6006. {
  6007. if (channels != null) channels.ThrowIfDisposed();
  6008. if (mask != null) mask.ThrowIfDisposed();
  6009. if (hist != null) hist.ThrowIfDisposed();
  6010. if (histSize != null) histSize.ThrowIfDisposed();
  6011. if (ranges != null) ranges.ThrowIfDisposed();
  6012. Mat images_mat = Converters.vector_Mat_to_Mat(images);
  6013. Mat channels_mat = channels;
  6014. Mat histSize_mat = histSize;
  6015. Mat ranges_mat = ranges;
  6016. imgproc_Imgproc_calcHist_10(images_mat.nativeObj, channels_mat.nativeObj, mask.nativeObj, hist.nativeObj, histSize_mat.nativeObj, ranges_mat.nativeObj, accumulate);
  6017. }
  6018. /**
  6019. *
  6020. *
  6021. * this variant supports only uniform histograms.
  6022. *
  6023. * ranges argument is either empty vector or a flattened vector of histSize.size()*2 elements
  6024. * (histSize.size() element pairs). The first and second elements of each pair specify the lower and
  6025. * upper boundaries.
  6026. * param images automatically generated
  6027. * param channels automatically generated
  6028. * param mask automatically generated
  6029. * param hist automatically generated
  6030. * param histSize automatically generated
  6031. * param ranges automatically generated
  6032. */
  6033. public static void calcHist(List<Mat> images, MatOfInt channels, Mat mask, Mat hist, MatOfInt histSize, MatOfFloat ranges)
  6034. {
  6035. if (channels != null) channels.ThrowIfDisposed();
  6036. if (mask != null) mask.ThrowIfDisposed();
  6037. if (hist != null) hist.ThrowIfDisposed();
  6038. if (histSize != null) histSize.ThrowIfDisposed();
  6039. if (ranges != null) ranges.ThrowIfDisposed();
  6040. Mat images_mat = Converters.vector_Mat_to_Mat(images);
  6041. Mat channels_mat = channels;
  6042. Mat histSize_mat = histSize;
  6043. Mat ranges_mat = ranges;
  6044. imgproc_Imgproc_calcHist_11(images_mat.nativeObj, channels_mat.nativeObj, mask.nativeObj, hist.nativeObj, histSize_mat.nativeObj, ranges_mat.nativeObj);
  6045. }
  6046. //
  6047. // C++: void cv::calcBackProject(vector_Mat images, vector_int channels, Mat hist, Mat& dst, vector_float ranges, double scale)
  6048. //
  6049. public static void calcBackProject(List<Mat> images, MatOfInt channels, Mat hist, Mat dst, MatOfFloat ranges, double scale)
  6050. {
  6051. if (channels != null) channels.ThrowIfDisposed();
  6052. if (hist != null) hist.ThrowIfDisposed();
  6053. if (dst != null) dst.ThrowIfDisposed();
  6054. if (ranges != null) ranges.ThrowIfDisposed();
  6055. Mat images_mat = Converters.vector_Mat_to_Mat(images);
  6056. Mat channels_mat = channels;
  6057. Mat ranges_mat = ranges;
  6058. imgproc_Imgproc_calcBackProject_10(images_mat.nativeObj, channels_mat.nativeObj, hist.nativeObj, dst.nativeObj, ranges_mat.nativeObj, scale);
  6059. }
  6060. //
  6061. // C++: double cv::compareHist(Mat H1, Mat H2, int method)
  6062. //
  6063. /**
  6064. * Compares two histograms.
  6065. *
  6066. * The function cv::compareHist compares two dense or two sparse histograms using the specified method.
  6067. *
  6068. * The function returns \(d(H_1, H_2)\) .
  6069. *
  6070. * While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable
  6071. * for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling
  6072. * problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms
  6073. * or more general sparse configurations of weighted points, consider using the #EMD function.
  6074. *
  6075. * param H1 First compared histogram.
  6076. * param H2 Second compared histogram of the same size as H1 .
  6077. * param method Comparison method, see #HistCompMethods
  6078. * return automatically generated
  6079. */
  6080. public static double compareHist(Mat H1, Mat H2, int method)
  6081. {
  6082. if (H1 != null) H1.ThrowIfDisposed();
  6083. if (H2 != null) H2.ThrowIfDisposed();
  6084. return imgproc_Imgproc_compareHist_10(H1.nativeObj, H2.nativeObj, method);
  6085. }
  6086. //
  6087. // C++: void cv::equalizeHist(Mat src, Mat& dst)
  6088. //
  6089. /**
  6090. * Equalizes the histogram of a grayscale image.
  6091. *
  6092. * The function equalizes the histogram of the input image using the following algorithm:
  6093. *
  6094. * <ul>
  6095. * <li>
  6096. * Calculate the histogram \(H\) for src .
  6097. * </li>
  6098. * <li>
  6099. * Normalize the histogram so that the sum of histogram bins is 255.
  6100. * </li>
  6101. * <li>
  6102. * Compute the integral of the histogram:
  6103. * \(H'_i = \sum _{0 \le j &lt; i} H(j)\)
  6104. * </li>
  6105. * <li>
  6106. * Transform the image using \(H'\) as a look-up table: \(\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\)
  6107. * </li>
  6108. * </ul>
  6109. *
  6110. * The algorithm normalizes the brightness and increases the contrast of the image.
  6111. *
  6112. * param src Source 8-bit single channel image.
  6113. * param dst Destination image of the same size and type as src .
  6114. */
  6115. public static void equalizeHist(Mat src, Mat dst)
  6116. {
  6117. if (src != null) src.ThrowIfDisposed();
  6118. if (dst != null) dst.ThrowIfDisposed();
  6119. imgproc_Imgproc_equalizeHist_10(src.nativeObj, dst.nativeObj);
  6120. }
  6121. //
  6122. // C++: Ptr_CLAHE cv::createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8))
  6123. //
  6124. /**
  6125. * Creates a smart pointer to a cv::CLAHE class and initializes it.
  6126. *
  6127. * param clipLimit Threshold for contrast limiting.
  6128. * param tileGridSize Size of grid for histogram equalization. Input image will be divided into
  6129. * equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
  6130. * return automatically generated
  6131. */
  6132. public static CLAHE createCLAHE(double clipLimit, Size tileGridSize)
  6133. {
  6134. return CLAHE.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createCLAHE_10(clipLimit, tileGridSize.width, tileGridSize.height)));
  6135. }
  6136. /**
  6137. * Creates a smart pointer to a cv::CLAHE class and initializes it.
  6138. *
  6139. * param clipLimit Threshold for contrast limiting.
  6140. * equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
  6141. * return automatically generated
  6142. */
  6143. public static CLAHE createCLAHE(double clipLimit)
  6144. {
  6145. return CLAHE.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createCLAHE_11(clipLimit)));
  6146. }
  6147. /**
  6148. * Creates a smart pointer to a cv::CLAHE class and initializes it.
  6149. *
  6150. * equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
  6151. * return automatically generated
  6152. */
  6153. public static CLAHE createCLAHE()
  6154. {
  6155. return CLAHE.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createCLAHE_12()));
  6156. }
  6157. //
  6158. // C++: float cv::wrapperEMD(Mat signature1, Mat signature2, int distType, Mat cost = Mat(), Ptr_float& lowerBound = Ptr<float>(), Mat& flow = Mat())
  6159. //
  6160. /**
  6161. * Computes the "minimal work" distance between two weighted point configurations.
  6162. *
  6163. * The function computes the earth mover distance and/or a lower boundary of the distance between the
  6164. * two weighted point configurations. One of the applications described in CITE: RubnerSept98,
  6165. * CITE: Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation
  6166. * problem that is solved using some modification of a simplex algorithm, thus the complexity is
  6167. * exponential in the worst case, though, on average it is much faster. In the case of a real metric
  6168. * the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used
  6169. * to determine roughly whether the two signatures are far enough so that they cannot relate to the
  6170. * same object.
  6171. *
  6172. * param signature1 First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
  6173. * Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
  6174. * a single column (weights only) if the user-defined cost matrix is used. The weights must be
  6175. * non-negative and have at least one non-zero value.
  6176. * param signature2 Second signature of the same format as signature1 , though the number of rows
  6177. * may be different. The total weights may be different. In this case an extra "dummy" point is added
  6178. * to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
  6179. * value.
  6180. * param distType Used metric. See #DistanceTypes.
  6181. * param cost User-defined \(\texttt{size1}\times \texttt{size2}\) cost matrix. Also, if a cost matrix
  6182. * is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
  6183. * signatures that is a distance between mass centers. The lower boundary may not be calculated if
  6184. * the user-defined cost matrix is used, the total weights of point configurations are not equal, or
  6185. * if the signatures consist of weights only (the signature matrices have a single column). You
  6186. * <b>must</b> initialize \*lowerBound . If the calculated distance between mass centers is greater or
  6187. * equal to \*lowerBound (it means that the signatures are far enough), the function does not
  6188. * calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
  6189. * return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
  6190. * should be set to 0.
  6191. * param flow Resultant \(\texttt{size1} \times \texttt{size2}\) flow matrix: \(\texttt{flow}_{i,j}\) is
  6192. * a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .
  6193. * return automatically generated
  6194. */
  6195. public static float EMD(Mat signature1, Mat signature2, int distType, Mat cost, Mat flow)
  6196. {
  6197. if (signature1 != null) signature1.ThrowIfDisposed();
  6198. if (signature2 != null) signature2.ThrowIfDisposed();
  6199. if (cost != null) cost.ThrowIfDisposed();
  6200. if (flow != null) flow.ThrowIfDisposed();
  6201. return imgproc_Imgproc_EMD_10(signature1.nativeObj, signature2.nativeObj, distType, cost.nativeObj, flow.nativeObj);
  6202. }
  6203. /**
  6204. * Computes the "minimal work" distance between two weighted point configurations.
  6205. *
  6206. * The function computes the earth mover distance and/or a lower boundary of the distance between the
  6207. * two weighted point configurations. One of the applications described in CITE: RubnerSept98,
  6208. * CITE: Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation
  6209. * problem that is solved using some modification of a simplex algorithm, thus the complexity is
  6210. * exponential in the worst case, though, on average it is much faster. In the case of a real metric
  6211. * the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used
  6212. * to determine roughly whether the two signatures are far enough so that they cannot relate to the
  6213. * same object.
  6214. *
  6215. * param signature1 First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
  6216. * Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
  6217. * a single column (weights only) if the user-defined cost matrix is used. The weights must be
  6218. * non-negative and have at least one non-zero value.
  6219. * param signature2 Second signature of the same format as signature1 , though the number of rows
  6220. * may be different. The total weights may be different. In this case an extra "dummy" point is added
  6221. * to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
  6222. * value.
  6223. * param distType Used metric. See #DistanceTypes.
  6224. * param cost User-defined \(\texttt{size1}\times \texttt{size2}\) cost matrix. Also, if a cost matrix
  6225. * is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
  6226. * signatures that is a distance between mass centers. The lower boundary may not be calculated if
  6227. * the user-defined cost matrix is used, the total weights of point configurations are not equal, or
  6228. * if the signatures consist of weights only (the signature matrices have a single column). You
  6229. * <b>must</b> initialize \*lowerBound . If the calculated distance between mass centers is greater or
  6230. * equal to \*lowerBound (it means that the signatures are far enough), the function does not
  6231. * calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
  6232. * return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
  6233. * should be set to 0.
  6234. * a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .
  6235. * return automatically generated
  6236. */
  6237. public static float EMD(Mat signature1, Mat signature2, int distType, Mat cost)
  6238. {
  6239. if (signature1 != null) signature1.ThrowIfDisposed();
  6240. if (signature2 != null) signature2.ThrowIfDisposed();
  6241. if (cost != null) cost.ThrowIfDisposed();
  6242. return imgproc_Imgproc_EMD_11(signature1.nativeObj, signature2.nativeObj, distType, cost.nativeObj);
  6243. }
  6244. /**
  6245. * Computes the "minimal work" distance between two weighted point configurations.
  6246. *
  6247. * The function computes the earth mover distance and/or a lower boundary of the distance between the
  6248. * two weighted point configurations. One of the applications described in CITE: RubnerSept98,
  6249. * CITE: Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation
  6250. * problem that is solved using some modification of a simplex algorithm, thus the complexity is
  6251. * exponential in the worst case, though, on average it is much faster. In the case of a real metric
  6252. * the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used
  6253. * to determine roughly whether the two signatures are far enough so that they cannot relate to the
  6254. * same object.
  6255. *
  6256. * param signature1 First signature, a \(\texttt{size1}\times \texttt{dims}+1\) floating-point matrix.
  6257. * Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
  6258. * a single column (weights only) if the user-defined cost matrix is used. The weights must be
  6259. * non-negative and have at least one non-zero value.
  6260. * param signature2 Second signature of the same format as signature1 , though the number of rows
  6261. * may be different. The total weights may be different. In this case an extra "dummy" point is added
  6262. * to either signature1 or signature2. The weights must be non-negative and have at least one non-zero
  6263. * value.
  6264. * param distType Used metric. See #DistanceTypes.
  6265. * is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
  6266. * signatures that is a distance between mass centers. The lower boundary may not be calculated if
  6267. * the user-defined cost matrix is used, the total weights of point configurations are not equal, or
  6268. * if the signatures consist of weights only (the signature matrices have a single column). You
  6269. * <b>must</b> initialize \*lowerBound . If the calculated distance between mass centers is greater or
  6270. * equal to \*lowerBound (it means that the signatures are far enough), the function does not
  6271. * calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
  6272. * return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
  6273. * should be set to 0.
  6274. * a flow from \(i\) -th point of signature1 to \(j\) -th point of signature2 .
  6275. * return automatically generated
  6276. */
  6277. public static float EMD(Mat signature1, Mat signature2, int distType)
  6278. {
  6279. if (signature1 != null) signature1.ThrowIfDisposed();
  6280. if (signature2 != null) signature2.ThrowIfDisposed();
  6281. return imgproc_Imgproc_EMD_13(signature1.nativeObj, signature2.nativeObj, distType);
  6282. }
  6283. //
  6284. // C++: void cv::watershed(Mat image, Mat& markers)
  6285. //
  6286. /**
  6287. * Performs a marker-based image segmentation using the watershed algorithm.
  6288. *
  6289. * The function implements one of the variants of watershed, non-parametric marker-based segmentation
  6290. * algorithm, described in CITE: Meyer92 .
  6291. *
  6292. * Before passing the image to the function, you have to roughly outline the desired regions in the
  6293. * image markers with positive (&gt;0) indices. So, every region is represented as one or more connected
  6294. * components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary
  6295. * mask using #findContours and #drawContours (see the watershed.cpp demo). The markers are "seeds" of
  6296. * the future image regions. All the other pixels in markers , whose relation to the outlined regions
  6297. * is not known and should be defined by the algorithm, should be set to 0's. In the function output,
  6298. * each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the
  6299. * regions.
  6300. *
  6301. * <b>Note:</b> Any two neighbor connected components are not necessarily separated by a watershed boundary
  6302. * (-1's pixels); for example, they can touch each other in the initial marker image passed to the
  6303. * function.
  6304. *
  6305. * param image Input 8-bit 3-channel image.
  6306. * param markers Input/output 32-bit single-channel image (map) of markers. It should have the same
  6307. * size as image .
  6308. *
  6309. * SEE: findContours
  6310. */
  6311. public static void watershed(Mat image, Mat markers)
  6312. {
  6313. if (image != null) image.ThrowIfDisposed();
  6314. if (markers != null) markers.ThrowIfDisposed();
  6315. imgproc_Imgproc_watershed_10(image.nativeObj, markers.nativeObj);
  6316. }
  6317. //
  6318. // C++: void cv::pyrMeanShiftFiltering(Mat src, Mat& dst, double sp, double sr, int maxLevel = 1, TermCriteria termcrit = TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1))
  6319. //
  6320. /**
  6321. * Performs initial step of meanshift segmentation of an image.
  6322. *
  6323. * The function implements the filtering stage of meanshift segmentation, that is, the output of the
  6324. * function is the filtered "posterized" image with color gradients and fine-grain texture flattened.
  6325. * At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes
  6326. * meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is
  6327. * considered:
  6328. *
  6329. * \((x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\)
  6330. *
  6331. * where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively
  6332. * (though, the algorithm does not depend on the color space used, so any 3-component color space can
  6333. * be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector
  6334. * (R',G',B') are found and they act as the neighborhood center on the next iteration:
  6335. *
  6336. * \((X,Y)~(X',Y'), (R,G,B)~(R',G',B').\)
  6337. *
  6338. * After the iterations over, the color components of the initial pixel (that is, the pixel from where
  6339. * the iterations started) are set to the final value (average color at the last iteration):
  6340. *
  6341. * \(I(X,Y) &lt;- (R*,G*,B*)\)
  6342. *
  6343. * When maxLevel &gt; 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is
  6344. * run on the smallest layer first. After that, the results are propagated to the larger layer and the
  6345. * iterations are run again only on those pixels where the layer colors differ by more than sr from the
  6346. * lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the
  6347. * results will be actually different from the ones obtained by running the meanshift procedure on the
  6348. * whole original image (i.e. when maxLevel==0).
  6349. *
  6350. * param src The source 8-bit, 3-channel image.
  6351. * param dst The destination image of the same format and the same size as the source.
  6352. * param sp The spatial window radius.
  6353. * param sr The color window radius.
  6354. * param maxLevel Maximum level of the pyramid for the segmentation.
  6355. * param termcrit Termination criteria: when to stop meanshift iterations.
  6356. */
  6357. public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr, int maxLevel, TermCriteria termcrit)
  6358. {
  6359. if (src != null) src.ThrowIfDisposed();
  6360. if (dst != null) dst.ThrowIfDisposed();
  6361. imgproc_Imgproc_pyrMeanShiftFiltering_10(src.nativeObj, dst.nativeObj, sp, sr, maxLevel, termcrit.type, termcrit.maxCount, termcrit.epsilon);
  6362. }
  6363. /**
  6364. * Performs initial step of meanshift segmentation of an image.
  6365. *
  6366. * The function implements the filtering stage of meanshift segmentation, that is, the output of the
  6367. * function is the filtered "posterized" image with color gradients and fine-grain texture flattened.
  6368. * At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes
  6369. * meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is
  6370. * considered:
  6371. *
  6372. * \((x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\)
  6373. *
  6374. * where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively
  6375. * (though, the algorithm does not depend on the color space used, so any 3-component color space can
  6376. * be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector
  6377. * (R',G',B') are found and they act as the neighborhood center on the next iteration:
  6378. *
  6379. * \((X,Y)~(X',Y'), (R,G,B)~(R',G',B').\)
  6380. *
  6381. * After the iterations over, the color components of the initial pixel (that is, the pixel from where
  6382. * the iterations started) are set to the final value (average color at the last iteration):
  6383. *
  6384. * \(I(X,Y) &lt;- (R*,G*,B*)\)
  6385. *
  6386. * When maxLevel &gt; 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is
  6387. * run on the smallest layer first. After that, the results are propagated to the larger layer and the
  6388. * iterations are run again only on those pixels where the layer colors differ by more than sr from the
  6389. * lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the
  6390. * results will be actually different from the ones obtained by running the meanshift procedure on the
  6391. * whole original image (i.e. when maxLevel==0).
  6392. *
  6393. * param src The source 8-bit, 3-channel image.
  6394. * param dst The destination image of the same format and the same size as the source.
  6395. * param sp The spatial window radius.
  6396. * param sr The color window radius.
  6397. * param maxLevel Maximum level of the pyramid for the segmentation.
  6398. */
  6399. public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr, int maxLevel)
  6400. {
  6401. if (src != null) src.ThrowIfDisposed();
  6402. if (dst != null) dst.ThrowIfDisposed();
  6403. imgproc_Imgproc_pyrMeanShiftFiltering_11(src.nativeObj, dst.nativeObj, sp, sr, maxLevel);
  6404. }
  6405. /**
  6406. * Performs initial step of meanshift segmentation of an image.
  6407. *
  6408. * The function implements the filtering stage of meanshift segmentation, that is, the output of the
  6409. * function is the filtered "posterized" image with color gradients and fine-grain texture flattened.
  6410. * At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes
  6411. * meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is
  6412. * considered:
  6413. *
  6414. * \((x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\)
  6415. *
  6416. * where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively
  6417. * (though, the algorithm does not depend on the color space used, so any 3-component color space can
  6418. * be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector
  6419. * (R',G',B') are found and they act as the neighborhood center on the next iteration:
  6420. *
  6421. * \((X,Y)~(X',Y'), (R,G,B)~(R',G',B').\)
  6422. *
  6423. * After the iterations over, the color components of the initial pixel (that is, the pixel from where
  6424. * the iterations started) are set to the final value (average color at the last iteration):
  6425. *
  6426. * \(I(X,Y) &lt;- (R*,G*,B*)\)
  6427. *
  6428. * When maxLevel &gt; 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is
  6429. * run on the smallest layer first. After that, the results are propagated to the larger layer and the
  6430. * iterations are run again only on those pixels where the layer colors differ by more than sr from the
  6431. * lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the
  6432. * results will be actually different from the ones obtained by running the meanshift procedure on the
  6433. * whole original image (i.e. when maxLevel==0).
  6434. *
  6435. * param src The source 8-bit, 3-channel image.
  6436. * param dst The destination image of the same format and the same size as the source.
  6437. * param sp The spatial window radius.
  6438. * param sr The color window radius.
  6439. */
  6440. public static void pyrMeanShiftFiltering(Mat src, Mat dst, double sp, double sr)
  6441. {
  6442. if (src != null) src.ThrowIfDisposed();
  6443. if (dst != null) dst.ThrowIfDisposed();
  6444. imgproc_Imgproc_pyrMeanShiftFiltering_12(src.nativeObj, dst.nativeObj, sp, sr);
  6445. }
  6446. //
  6447. // C++: void cv::grabCut(Mat img, Mat& mask, Rect rect, Mat& bgdModel, Mat& fgdModel, int iterCount, int mode = GC_EVAL)
  6448. //
  6449. /**
  6450. * Runs the GrabCut algorithm.
  6451. *
  6452. * The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
  6453. *
  6454. * param img Input 8-bit 3-channel image.
  6455. * param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
  6456. * mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.
  6457. * param rect ROI containing a segmented object. The pixels outside of the ROI are marked as
  6458. * "obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .
  6459. * param bgdModel Temporary array for the background model. Do not modify it while you are
  6460. * processing the same image.
  6461. * param fgdModel Temporary arrays for the foreground model. Do not modify it while you are
  6462. * processing the same image.
  6463. * param iterCount Number of iterations the algorithm should make before returning the result. Note
  6464. * that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
  6465. * mode==GC_EVAL .
  6466. * param mode Operation mode that could be one of the #GrabCutModes
  6467. */
  6468. public static void grabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount, int mode)
  6469. {
  6470. if (img != null) img.ThrowIfDisposed();
  6471. if (mask != null) mask.ThrowIfDisposed();
  6472. if (bgdModel != null) bgdModel.ThrowIfDisposed();
  6473. if (fgdModel != null) fgdModel.ThrowIfDisposed();
  6474. imgproc_Imgproc_grabCut_10(img.nativeObj, mask.nativeObj, rect.x, rect.y, rect.width, rect.height, bgdModel.nativeObj, fgdModel.nativeObj, iterCount, mode);
  6475. }
  6476. /**
  6477. * Runs the GrabCut algorithm.
  6478. *
  6479. * The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
  6480. *
  6481. * param img Input 8-bit 3-channel image.
  6482. * param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
  6483. * mode is set to #GC_INIT_WITH_RECT. Its elements may have one of the #GrabCutClasses.
  6484. * param rect ROI containing a segmented object. The pixels outside of the ROI are marked as
  6485. * "obvious background". The parameter is only used when mode==#GC_INIT_WITH_RECT .
  6486. * param bgdModel Temporary array for the background model. Do not modify it while you are
  6487. * processing the same image.
  6488. * param fgdModel Temporary arrays for the foreground model. Do not modify it while you are
  6489. * processing the same image.
  6490. * param iterCount Number of iterations the algorithm should make before returning the result. Note
  6491. * that the result can be refined with further calls with mode==#GC_INIT_WITH_MASK or
  6492. * mode==GC_EVAL .
  6493. */
  6494. public static void grabCut(Mat img, Mat mask, Rect rect, Mat bgdModel, Mat fgdModel, int iterCount)
  6495. {
  6496. if (img != null) img.ThrowIfDisposed();
  6497. if (mask != null) mask.ThrowIfDisposed();
  6498. if (bgdModel != null) bgdModel.ThrowIfDisposed();
  6499. if (fgdModel != null) fgdModel.ThrowIfDisposed();
  6500. imgproc_Imgproc_grabCut_11(img.nativeObj, mask.nativeObj, rect.x, rect.y, rect.width, rect.height, bgdModel.nativeObj, fgdModel.nativeObj, iterCount);
  6501. }
  6502. //
  6503. // C++: void cv::distanceTransform(Mat src, Mat& dst, Mat& labels, int distanceType, int maskSize, int labelType = DIST_LABEL_CCOMP)
  6504. //
  6505. /**
  6506. * Calculates the distance to the closest zero pixel for each pixel of the source image.
  6507. *
  6508. * The function cv::distanceTransform calculates the approximate or precise distance from every binary
  6509. * image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero.
  6510. *
  6511. * When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the
  6512. * algorithm described in CITE: Felzenszwalb04 . This algorithm is parallelized with the TBB library.
  6513. *
  6514. * In other cases, the algorithm CITE: Borgefors86 is used. This means that for a pixel the function
  6515. * finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical,
  6516. * diagonal, or knight's move (the latest is available for a \(5\times 5\) mask). The overall
  6517. * distance is calculated as a sum of these basic distances. Since the distance function should be
  6518. * symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all
  6519. * the diagonal shifts must have the same cost (denoted as {code b}), and all knight's moves must have the
  6520. * same cost (denoted as {code c}). For the #DIST_C and #DIST_L1 types, the distance is calculated
  6521. * precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a
  6522. * relative error (a \(5\times 5\) mask gives more accurate results). For {code a},{code b}, and {code c}, OpenCV
  6523. * uses the values suggested in the original paper:
  6524. * <ul>
  6525. * <li>
  6526. * DIST_L1: {code a = 1, b = 2}
  6527. * </li>
  6528. * <li>
  6529. * DIST_L2:
  6530. * <ul>
  6531. * <li>
  6532. * {code 3 x 3}: {code a=0.955, b=1.3693}
  6533. * </li>
  6534. * <li>
  6535. * {code 5 x 5}: {code a=1, b=1.4, c=2.1969}
  6536. * </li>
  6537. * </ul>
  6538. * <li>
  6539. * DIST_C: {code a = 1, b = 1}
  6540. * </li>
  6541. * </ul>
  6542. *
  6543. * Typically, for a fast, coarse distance estimation #DIST_L2, a \(3\times 3\) mask is used. For a
  6544. * more accurate distance estimation #DIST_L2, a \(5\times 5\) mask or the precise algorithm is used.
  6545. * Note that both the precise and the approximate algorithms are linear on the number of pixels.
  6546. *
  6547. * This variant of the function does not only compute the minimum distance for each pixel \((x, y)\)
  6548. * but also identifies the nearest connected component consisting of zero pixels
  6549. * (labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the
  6550. * component/pixel is stored in {code labels(x, y)}. When labelType==#DIST_LABEL_CCOMP, the function
  6551. * automatically finds connected components of zero pixels in the input image and marks them with
  6552. * distinct labels. When labelType==#DIST_LABEL_PIXEL, the function scans through the input image and
  6553. * marks all the zero pixels with distinct labels.
  6554. *
  6555. * In this mode, the complexity is still linear. That is, the function provides a very fast way to
  6556. * compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
  6557. * approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported
  6558. * yet.
  6559. *
  6560. * param src 8-bit, single-channel (binary) source image.
  6561. * param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
  6562. * single-channel image of the same size as src.
  6563. * param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type
  6564. * CV_32SC1 and the same size as src.
  6565. * param distanceType Type of distance, see #DistanceTypes
  6566. * param maskSize Size of the distance transform mask, see #DistanceTransformMasks.
  6567. * #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type,
  6568. * the parameter is forced to 3 because a \(3\times 3\) mask gives the same result as \(5\times
  6569. * 5\) or any larger aperture.
  6570. * param labelType Type of the label array to build, see #DistanceTransformLabelTypes.
  6571. */
  6572. public static void distanceTransformWithLabels(Mat src, Mat dst, Mat labels, int distanceType, int maskSize, int labelType)
  6573. {
  6574. if (src != null) src.ThrowIfDisposed();
  6575. if (dst != null) dst.ThrowIfDisposed();
  6576. if (labels != null) labels.ThrowIfDisposed();
  6577. imgproc_Imgproc_distanceTransformWithLabels_10(src.nativeObj, dst.nativeObj, labels.nativeObj, distanceType, maskSize, labelType);
  6578. }
  6579. /**
  6580. * Calculates the distance to the closest zero pixel for each pixel of the source image.
  6581. *
  6582. * The function cv::distanceTransform calculates the approximate or precise distance from every binary
  6583. * image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero.
  6584. *
  6585. * When maskSize == #DIST_MASK_PRECISE and distanceType == #DIST_L2 , the function runs the
  6586. * algorithm described in CITE: Felzenszwalb04 . This algorithm is parallelized with the TBB library.
  6587. *
  6588. * In other cases, the algorithm CITE: Borgefors86 is used. This means that for a pixel the function
  6589. * finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical,
  6590. * diagonal, or knight's move (the latest is available for a \(5\times 5\) mask). The overall
  6591. * distance is calculated as a sum of these basic distances. Since the distance function should be
  6592. * symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all
  6593. * the diagonal shifts must have the same cost (denoted as {code b}), and all knight's moves must have the
  6594. * same cost (denoted as {code c}). For the #DIST_C and #DIST_L1 types, the distance is calculated
  6595. * precisely, whereas for #DIST_L2 (Euclidean distance) the distance can be calculated only with a
  6596. * relative error (a \(5\times 5\) mask gives more accurate results). For {code a},{code b}, and {code c}, OpenCV
  6597. * uses the values suggested in the original paper:
  6598. * <ul>
  6599. * <li>
  6600. * DIST_L1: {code a = 1, b = 2}
  6601. * </li>
  6602. * <li>
  6603. * DIST_L2:
  6604. * <ul>
  6605. * <li>
  6606. * {code 3 x 3}: {code a=0.955, b=1.3693}
  6607. * </li>
  6608. * <li>
  6609. * {code 5 x 5}: {code a=1, b=1.4, c=2.1969}
  6610. * </li>
  6611. * </ul>
  6612. * <li>
  6613. * DIST_C: {code a = 1, b = 1}
  6614. * </li>
  6615. * </ul>
  6616. *
  6617. * Typically, for a fast, coarse distance estimation #DIST_L2, a \(3\times 3\) mask is used. For a
  6618. * more accurate distance estimation #DIST_L2, a \(5\times 5\) mask or the precise algorithm is used.
  6619. * Note that both the precise and the approximate algorithms are linear on the number of pixels.
  6620. *
  6621. * This variant of the function does not only compute the minimum distance for each pixel \((x, y)\)
  6622. * but also identifies the nearest connected component consisting of zero pixels
  6623. * (labelType==#DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==#DIST_LABEL_PIXEL). Index of the
  6624. * component/pixel is stored in {code labels(x, y)}. When labelType==#DIST_LABEL_CCOMP, the function
  6625. * automatically finds connected components of zero pixels in the input image and marks them with
  6626. * distinct labels. When labelType==#DIST_LABEL_PIXEL, the function scans through the input image and
  6627. * marks all the zero pixels with distinct labels.
  6628. *
  6629. * In this mode, the complexity is still linear. That is, the function provides a very fast way to
  6630. * compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
  6631. * approximate distance transform algorithm, i.e. maskSize=#DIST_MASK_PRECISE is not supported
  6632. * yet.
  6633. *
  6634. * param src 8-bit, single-channel (binary) source image.
  6635. * param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
  6636. * single-channel image of the same size as src.
  6637. * param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type
  6638. * CV_32SC1 and the same size as src.
  6639. * param distanceType Type of distance, see #DistanceTypes
  6640. * param maskSize Size of the distance transform mask, see #DistanceTransformMasks.
  6641. * #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type,
  6642. * the parameter is forced to 3 because a \(3\times 3\) mask gives the same result as \(5\times
  6643. * 5\) or any larger aperture.
  6644. */
  6645. public static void distanceTransformWithLabels(Mat src, Mat dst, Mat labels, int distanceType, int maskSize)
  6646. {
  6647. if (src != null) src.ThrowIfDisposed();
  6648. if (dst != null) dst.ThrowIfDisposed();
  6649. if (labels != null) labels.ThrowIfDisposed();
  6650. imgproc_Imgproc_distanceTransformWithLabels_11(src.nativeObj, dst.nativeObj, labels.nativeObj, distanceType, maskSize);
  6651. }
  6652. //
  6653. // C++: void cv::distanceTransform(Mat src, Mat& dst, int distanceType, int maskSize, int dstType = CV_32F)
  6654. //
  6655. /**
  6656. *
  6657. * param src 8-bit, single-channel (binary) source image.
  6658. * param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
  6659. * single-channel image of the same size as src .
  6660. * param distanceType Type of distance, see #DistanceTypes
  6661. * param maskSize Size of the distance transform mask, see #DistanceTransformMasks. In case of the
  6662. * #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \(3\times 3\) mask gives
  6663. * the same result as \(5\times 5\) or any larger aperture.
  6664. * param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for
  6665. * the first variant of the function and distanceType == #DIST_L1.
  6666. */
  6667. public static void distanceTransform(Mat src, Mat dst, int distanceType, int maskSize, int dstType)
  6668. {
  6669. if (src != null) src.ThrowIfDisposed();
  6670. if (dst != null) dst.ThrowIfDisposed();
  6671. imgproc_Imgproc_distanceTransform_10(src.nativeObj, dst.nativeObj, distanceType, maskSize, dstType);
  6672. }
  6673. /**
  6674. *
  6675. * param src 8-bit, single-channel (binary) source image.
  6676. * param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
  6677. * single-channel image of the same size as src .
  6678. * param distanceType Type of distance, see #DistanceTypes
  6679. * param maskSize Size of the distance transform mask, see #DistanceTransformMasks. In case of the
  6680. * #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a \(3\times 3\) mask gives
  6681. * the same result as \(5\times 5\) or any larger aperture.
  6682. * the first variant of the function and distanceType == #DIST_L1.
  6683. */
  6684. public static void distanceTransform(Mat src, Mat dst, int distanceType, int maskSize)
  6685. {
  6686. if (src != null) src.ThrowIfDisposed();
  6687. if (dst != null) dst.ThrowIfDisposed();
  6688. imgproc_Imgproc_distanceTransform_11(src.nativeObj, dst.nativeObj, distanceType, maskSize);
  6689. }
  6690. //
  6691. // C++: int cv::floodFill(Mat& image, Mat& mask, Point seedPoint, Scalar newVal, Rect* rect = 0, Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), int flags = 4)
  6692. //
  6693. /**
  6694. * Fills a connected component with the given color.
  6695. *
  6696. * The function cv::floodFill fills a connected component starting from the seed point with the specified
  6697. * color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
  6698. * pixel at \((x,y)\) is considered to belong to the repainted domain if:
  6699. *
  6700. * <ul>
  6701. * <li>
  6702. * in case of a grayscale image and floating range
  6703. * \(\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\)
  6704. * </li>
  6705. * </ul>
  6706. *
  6707. *
  6708. * <ul>
  6709. * <li>
  6710. * in case of a grayscale image and fixed range
  6711. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\)
  6712. * </li>
  6713. * </ul>
  6714. *
  6715. *
  6716. * <ul>
  6717. * <li>
  6718. * in case of a color image and floating range
  6719. * \(\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\)
  6720. * \(\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\)
  6721. * and
  6722. * \(\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\)
  6723. * </li>
  6724. * </ul>
  6725. *
  6726. *
  6727. * <ul>
  6728. * <li>
  6729. * in case of a color image and fixed range
  6730. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\)
  6731. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\)
  6732. * and
  6733. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\)
  6734. * </li>
  6735. * </ul>
  6736. *
  6737. *
  6738. * where \(src(x',y')\) is the value of one of pixel neighbors that is already known to belong to the
  6739. * component. That is, to be added to the connected component, a color/brightness of the pixel should
  6740. * be close enough to:
  6741. * <ul>
  6742. * <li>
  6743. * Color/brightness of one of its neighbors that already belong to the connected component in case
  6744. * of a floating range.
  6745. * </li>
  6746. * <li>
  6747. * Color/brightness of the seed point in case of a fixed range.
  6748. * </li>
  6749. * </ul>
  6750. *
  6751. * Use these functions to either mark a connected component with the specified color in-place, or build
  6752. * a mask and then extract the contour, or copy the region to another image, and so on.
  6753. *
  6754. * param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
  6755. * function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
  6756. * the details below.
  6757. * param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
  6758. * taller than image. If an empty Mat is passed it will be created automatically. Since this is both an
  6759. * input and output parameter, you must take responsibility of initializing it.
  6760. * Flood-filling cannot go across non-zero pixels in the input mask. For example,
  6761. * an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
  6762. * mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags
  6763. * as described below. Additionally, the function fills the border of the mask with ones to simplify
  6764. * internal processing. It is therefore possible to use the same mask in multiple calls to the function
  6765. * to make sure the filled areas do not overlap.
  6766. * param seedPoint Starting point.
  6767. * param newVal New value of the repainted domain pixels.
  6768. * param loDiff Maximal lower brightness/color difference between the currently observed pixel and
  6769. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6770. * param upDiff Maximal upper brightness/color difference between the currently observed pixel and
  6771. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6772. * param rect Optional output parameter set by the function to the minimum bounding rectangle of the
  6773. * repainted domain.
  6774. * param flags Operation flags. The first 8 bits contain a connectivity value. The default value of
  6775. * 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
  6776. * connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
  6777. * will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
  6778. * the mask (the default value is 1). For example, 4 | ( 255 &lt;&lt; 8 ) will consider 4 nearest
  6779. * neighbours and fill the mask with a value of 255. The following additional options occupy higher
  6780. * bits and therefore may be further combined with the connectivity and mask fill values using
  6781. * bit-wise or (|), see #FloodFillFlags.
  6782. *
  6783. * <b>Note:</b> Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
  6784. * pixel \((x+1, y+1)\) in the mask .
  6785. *
  6786. * SEE: findContours
  6787. * return automatically generated
  6788. */
  6789. public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff, int flags)
  6790. {
  6791. if (image != null) image.ThrowIfDisposed();
  6792. if (mask != null) mask.ThrowIfDisposed();
  6793. double[] rect_out = new double[4];
  6794. int retVal = imgproc_Imgproc_floodFill_10(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3], upDiff.val[0], upDiff.val[1], upDiff.val[2], upDiff.val[3], flags);
  6795. if (rect != null) { rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; }
  6796. return retVal;
  6797. }
  6798. /**
  6799. * Fills a connected component with the given color.
  6800. *
  6801. * The function cv::floodFill fills a connected component starting from the seed point with the specified
  6802. * color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
  6803. * pixel at \((x,y)\) is considered to belong to the repainted domain if:
  6804. *
  6805. * <ul>
  6806. * <li>
  6807. * in case of a grayscale image and floating range
  6808. * \(\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\)
  6809. * </li>
  6810. * </ul>
  6811. *
  6812. *
  6813. * <ul>
  6814. * <li>
  6815. * in case of a grayscale image and fixed range
  6816. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\)
  6817. * </li>
  6818. * </ul>
  6819. *
  6820. *
  6821. * <ul>
  6822. * <li>
  6823. * in case of a color image and floating range
  6824. * \(\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\)
  6825. * \(\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\)
  6826. * and
  6827. * \(\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\)
  6828. * </li>
  6829. * </ul>
  6830. *
  6831. *
  6832. * <ul>
  6833. * <li>
  6834. * in case of a color image and fixed range
  6835. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\)
  6836. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\)
  6837. * and
  6838. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\)
  6839. * </li>
  6840. * </ul>
  6841. *
  6842. *
  6843. * where \(src(x',y')\) is the value of one of pixel neighbors that is already known to belong to the
  6844. * component. That is, to be added to the connected component, a color/brightness of the pixel should
  6845. * be close enough to:
  6846. * <ul>
  6847. * <li>
  6848. * Color/brightness of one of its neighbors that already belong to the connected component in case
  6849. * of a floating range.
  6850. * </li>
  6851. * <li>
  6852. * Color/brightness of the seed point in case of a fixed range.
  6853. * </li>
  6854. * </ul>
  6855. *
  6856. * Use these functions to either mark a connected component with the specified color in-place, or build
  6857. * a mask and then extract the contour, or copy the region to another image, and so on.
  6858. *
  6859. * param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
  6860. * function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
  6861. * the details below.
  6862. * param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
  6863. * taller than image. If an empty Mat is passed it will be created automatically. Since this is both an
  6864. * input and output parameter, you must take responsibility of initializing it.
  6865. * Flood-filling cannot go across non-zero pixels in the input mask. For example,
  6866. * an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
  6867. * mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags
  6868. * as described below. Additionally, the function fills the border of the mask with ones to simplify
  6869. * internal processing. It is therefore possible to use the same mask in multiple calls to the function
  6870. * to make sure the filled areas do not overlap.
  6871. * param seedPoint Starting point.
  6872. * param newVal New value of the repainted domain pixels.
  6873. * param loDiff Maximal lower brightness/color difference between the currently observed pixel and
  6874. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6875. * param upDiff Maximal upper brightness/color difference between the currently observed pixel and
  6876. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6877. * param rect Optional output parameter set by the function to the minimum bounding rectangle of the
  6878. * repainted domain.
  6879. * 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
  6880. * connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
  6881. * will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
  6882. * the mask (the default value is 1). For example, 4 | ( 255 &lt;&lt; 8 ) will consider 4 nearest
  6883. * neighbours and fill the mask with a value of 255. The following additional options occupy higher
  6884. * bits and therefore may be further combined with the connectivity and mask fill values using
  6885. * bit-wise or (|), see #FloodFillFlags.
  6886. *
  6887. * <b>Note:</b> Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
  6888. * pixel \((x+1, y+1)\) in the mask .
  6889. *
  6890. * SEE: findContours
  6891. * return automatically generated
  6892. */
  6893. public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff, Scalar upDiff)
  6894. {
  6895. if (image != null) image.ThrowIfDisposed();
  6896. if (mask != null) mask.ThrowIfDisposed();
  6897. double[] rect_out = new double[4];
  6898. int retVal = imgproc_Imgproc_floodFill_11(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3], upDiff.val[0], upDiff.val[1], upDiff.val[2], upDiff.val[3]);
  6899. if (rect != null) { rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; }
  6900. return retVal;
  6901. }
  6902. /**
  6903. * Fills a connected component with the given color.
  6904. *
  6905. * The function cv::floodFill fills a connected component starting from the seed point with the specified
  6906. * color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
  6907. * pixel at \((x,y)\) is considered to belong to the repainted domain if:
  6908. *
  6909. * <ul>
  6910. * <li>
  6911. * in case of a grayscale image and floating range
  6912. * \(\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\)
  6913. * </li>
  6914. * </ul>
  6915. *
  6916. *
  6917. * <ul>
  6918. * <li>
  6919. * in case of a grayscale image and fixed range
  6920. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\)
  6921. * </li>
  6922. * </ul>
  6923. *
  6924. *
  6925. * <ul>
  6926. * <li>
  6927. * in case of a color image and floating range
  6928. * \(\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\)
  6929. * \(\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\)
  6930. * and
  6931. * \(\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\)
  6932. * </li>
  6933. * </ul>
  6934. *
  6935. *
  6936. * <ul>
  6937. * <li>
  6938. * in case of a color image and fixed range
  6939. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\)
  6940. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\)
  6941. * and
  6942. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\)
  6943. * </li>
  6944. * </ul>
  6945. *
  6946. *
  6947. * where \(src(x',y')\) is the value of one of pixel neighbors that is already known to belong to the
  6948. * component. That is, to be added to the connected component, a color/brightness of the pixel should
  6949. * be close enough to:
  6950. * <ul>
  6951. * <li>
  6952. * Color/brightness of one of its neighbors that already belong to the connected component in case
  6953. * of a floating range.
  6954. * </li>
  6955. * <li>
  6956. * Color/brightness of the seed point in case of a fixed range.
  6957. * </li>
  6958. * </ul>
  6959. *
  6960. * Use these functions to either mark a connected component with the specified color in-place, or build
  6961. * a mask and then extract the contour, or copy the region to another image, and so on.
  6962. *
  6963. * param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
  6964. * function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
  6965. * the details below.
  6966. * param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
  6967. * taller than image. If an empty Mat is passed it will be created automatically. Since this is both an
  6968. * input and output parameter, you must take responsibility of initializing it.
  6969. * Flood-filling cannot go across non-zero pixels in the input mask. For example,
  6970. * an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
  6971. * mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags
  6972. * as described below. Additionally, the function fills the border of the mask with ones to simplify
  6973. * internal processing. It is therefore possible to use the same mask in multiple calls to the function
  6974. * to make sure the filled areas do not overlap.
  6975. * param seedPoint Starting point.
  6976. * param newVal New value of the repainted domain pixels.
  6977. * param loDiff Maximal lower brightness/color difference between the currently observed pixel and
  6978. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6979. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  6980. * param rect Optional output parameter set by the function to the minimum bounding rectangle of the
  6981. * repainted domain.
  6982. * 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
  6983. * connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
  6984. * will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
  6985. * the mask (the default value is 1). For example, 4 | ( 255 &lt;&lt; 8 ) will consider 4 nearest
  6986. * neighbours and fill the mask with a value of 255. The following additional options occupy higher
  6987. * bits and therefore may be further combined with the connectivity and mask fill values using
  6988. * bit-wise or (|), see #FloodFillFlags.
  6989. *
  6990. * <b>Note:</b> Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
  6991. * pixel \((x+1, y+1)\) in the mask .
  6992. *
  6993. * SEE: findContours
  6994. * return automatically generated
  6995. */
  6996. public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect, Scalar loDiff)
  6997. {
  6998. if (image != null) image.ThrowIfDisposed();
  6999. if (mask != null) mask.ThrowIfDisposed();
  7000. double[] rect_out = new double[4];
  7001. int retVal = imgproc_Imgproc_floodFill_12(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out, loDiff.val[0], loDiff.val[1], loDiff.val[2], loDiff.val[3]);
  7002. if (rect != null) { rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; }
  7003. return retVal;
  7004. }
  7005. /**
  7006. * Fills a connected component with the given color.
  7007. *
  7008. * The function cv::floodFill fills a connected component starting from the seed point with the specified
  7009. * color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
  7010. * pixel at \((x,y)\) is considered to belong to the repainted domain if:
  7011. *
  7012. * <ul>
  7013. * <li>
  7014. * in case of a grayscale image and floating range
  7015. * \(\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\)
  7016. * </li>
  7017. * </ul>
  7018. *
  7019. *
  7020. * <ul>
  7021. * <li>
  7022. * in case of a grayscale image and fixed range
  7023. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\)
  7024. * </li>
  7025. * </ul>
  7026. *
  7027. *
  7028. * <ul>
  7029. * <li>
  7030. * in case of a color image and floating range
  7031. * \(\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\)
  7032. * \(\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\)
  7033. * and
  7034. * \(\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\)
  7035. * </li>
  7036. * </ul>
  7037. *
  7038. *
  7039. * <ul>
  7040. * <li>
  7041. * in case of a color image and fixed range
  7042. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\)
  7043. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\)
  7044. * and
  7045. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\)
  7046. * </li>
  7047. * </ul>
  7048. *
  7049. *
  7050. * where \(src(x',y')\) is the value of one of pixel neighbors that is already known to belong to the
  7051. * component. That is, to be added to the connected component, a color/brightness of the pixel should
  7052. * be close enough to:
  7053. * <ul>
  7054. * <li>
  7055. * Color/brightness of one of its neighbors that already belong to the connected component in case
  7056. * of a floating range.
  7057. * </li>
  7058. * <li>
  7059. * Color/brightness of the seed point in case of a fixed range.
  7060. * </li>
  7061. * </ul>
  7062. *
  7063. * Use these functions to either mark a connected component with the specified color in-place, or build
  7064. * a mask and then extract the contour, or copy the region to another image, and so on.
  7065. *
  7066. * param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
  7067. * function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
  7068. * the details below.
  7069. * param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
  7070. * taller than image. If an empty Mat is passed it will be created automatically. Since this is both an
  7071. * input and output parameter, you must take responsibility of initializing it.
  7072. * Flood-filling cannot go across non-zero pixels in the input mask. For example,
  7073. * an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
  7074. * mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags
  7075. * as described below. Additionally, the function fills the border of the mask with ones to simplify
  7076. * internal processing. It is therefore possible to use the same mask in multiple calls to the function
  7077. * to make sure the filled areas do not overlap.
  7078. * param seedPoint Starting point.
  7079. * param newVal New value of the repainted domain pixels.
  7080. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  7081. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  7082. * param rect Optional output parameter set by the function to the minimum bounding rectangle of the
  7083. * repainted domain.
  7084. * 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
  7085. * connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
  7086. * will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
  7087. * the mask (the default value is 1). For example, 4 | ( 255 &lt;&lt; 8 ) will consider 4 nearest
  7088. * neighbours and fill the mask with a value of 255. The following additional options occupy higher
  7089. * bits and therefore may be further combined with the connectivity and mask fill values using
  7090. * bit-wise or (|), see #FloodFillFlags.
  7091. *
  7092. * <b>Note:</b> Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
  7093. * pixel \((x+1, y+1)\) in the mask .
  7094. *
  7095. * SEE: findContours
  7096. * return automatically generated
  7097. */
  7098. public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal, Rect rect)
  7099. {
  7100. if (image != null) image.ThrowIfDisposed();
  7101. if (mask != null) mask.ThrowIfDisposed();
  7102. double[] rect_out = new double[4];
  7103. int retVal = imgproc_Imgproc_floodFill_13(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3], rect_out);
  7104. if (rect != null) { rect.x = (int)rect_out[0]; rect.y = (int)rect_out[1]; rect.width = (int)rect_out[2]; rect.height = (int)rect_out[3]; }
  7105. return retVal;
  7106. }
  7107. /**
  7108. * Fills a connected component with the given color.
  7109. *
  7110. * The function cv::floodFill fills a connected component starting from the seed point with the specified
  7111. * color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
  7112. * pixel at \((x,y)\) is considered to belong to the repainted domain if:
  7113. *
  7114. * <ul>
  7115. * <li>
  7116. * in case of a grayscale image and floating range
  7117. * \(\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\)
  7118. * </li>
  7119. * </ul>
  7120. *
  7121. *
  7122. * <ul>
  7123. * <li>
  7124. * in case of a grayscale image and fixed range
  7125. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\)
  7126. * </li>
  7127. * </ul>
  7128. *
  7129. *
  7130. * <ul>
  7131. * <li>
  7132. * in case of a color image and floating range
  7133. * \(\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\)
  7134. * \(\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\)
  7135. * and
  7136. * \(\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\)
  7137. * </li>
  7138. * </ul>
  7139. *
  7140. *
  7141. * <ul>
  7142. * <li>
  7143. * in case of a color image and fixed range
  7144. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\)
  7145. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\)
  7146. * and
  7147. * \(\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\)
  7148. * </li>
  7149. * </ul>
  7150. *
  7151. *
  7152. * where \(src(x',y')\) is the value of one of pixel neighbors that is already known to belong to the
  7153. * component. That is, to be added to the connected component, a color/brightness of the pixel should
  7154. * be close enough to:
  7155. * <ul>
  7156. * <li>
  7157. * Color/brightness of one of its neighbors that already belong to the connected component in case
  7158. * of a floating range.
  7159. * </li>
  7160. * <li>
  7161. * Color/brightness of the seed point in case of a fixed range.
  7162. * </li>
  7163. * </ul>
  7164. *
  7165. * Use these functions to either mark a connected component with the specified color in-place, or build
  7166. * a mask and then extract the contour, or copy the region to another image, and so on.
  7167. *
  7168. * param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
  7169. * function unless the #FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
  7170. * the details below.
  7171. * param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
  7172. * taller than image. If an empty Mat is passed it will be created automatically. Since this is both an
  7173. * input and output parameter, you must take responsibility of initializing it.
  7174. * Flood-filling cannot go across non-zero pixels in the input mask. For example,
  7175. * an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
  7176. * mask corresponding to filled pixels in the image are set to 1 or to the specified value in flags
  7177. * as described below. Additionally, the function fills the border of the mask with ones to simplify
  7178. * internal processing. It is therefore possible to use the same mask in multiple calls to the function
  7179. * to make sure the filled areas do not overlap.
  7180. * param seedPoint Starting point.
  7181. * param newVal New value of the repainted domain pixels.
  7182. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  7183. * one of its neighbors belonging to the component, or a seed pixel being added to the component.
  7184. * repainted domain.
  7185. * 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
  7186. * connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
  7187. * will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
  7188. * the mask (the default value is 1). For example, 4 | ( 255 &lt;&lt; 8 ) will consider 4 nearest
  7189. * neighbours and fill the mask with a value of 255. The following additional options occupy higher
  7190. * bits and therefore may be further combined with the connectivity and mask fill values using
  7191. * bit-wise or (|), see #FloodFillFlags.
  7192. *
  7193. * <b>Note:</b> Since the mask is larger than the filled image, a pixel \((x, y)\) in image corresponds to the
  7194. * pixel \((x+1, y+1)\) in the mask .
  7195. *
  7196. * SEE: findContours
  7197. * return automatically generated
  7198. */
  7199. public static int floodFill(Mat image, Mat mask, Point seedPoint, Scalar newVal)
  7200. {
  7201. if (image != null) image.ThrowIfDisposed();
  7202. if (mask != null) mask.ThrowIfDisposed();
  7203. return imgproc_Imgproc_floodFill_14(image.nativeObj, mask.nativeObj, seedPoint.x, seedPoint.y, newVal.val[0], newVal.val[1], newVal.val[2], newVal.val[3]);
  7204. }
  7205. //
  7206. // C++: void cv::blendLinear(Mat src1, Mat src2, Mat weights1, Mat weights2, Mat& dst)
  7207. //
  7208. /**
  7209. *
  7210. *
  7211. * variant without {code mask} parameter
  7212. * param src1 automatically generated
  7213. * param src2 automatically generated
  7214. * param weights1 automatically generated
  7215. * param weights2 automatically generated
  7216. * param dst automatically generated
  7217. */
  7218. public static void blendLinear(Mat src1, Mat src2, Mat weights1, Mat weights2, Mat dst)
  7219. {
  7220. if (src1 != null) src1.ThrowIfDisposed();
  7221. if (src2 != null) src2.ThrowIfDisposed();
  7222. if (weights1 != null) weights1.ThrowIfDisposed();
  7223. if (weights2 != null) weights2.ThrowIfDisposed();
  7224. if (dst != null) dst.ThrowIfDisposed();
  7225. imgproc_Imgproc_blendLinear_10(src1.nativeObj, src2.nativeObj, weights1.nativeObj, weights2.nativeObj, dst.nativeObj);
  7226. }
  7227. //
  7228. // C++: void cv::cvtColor(Mat src, Mat& dst, int code, int dstCn = 0)
  7229. //
  7230. /**
  7231. * Converts an image from one color space to another.
  7232. *
  7233. * The function converts an input image from one color space to another. In case of a transformation
  7234. * to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note
  7235. * that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the
  7236. * bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue
  7237. * component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and
  7238. * sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
  7239. *
  7240. * The conventional ranges for R, G, and B channel values are:
  7241. * <ul>
  7242. * <li>
  7243. * 0 to 255 for CV_8U images
  7244. * </li>
  7245. * <li>
  7246. * 0 to 65535 for CV_16U images
  7247. * </li>
  7248. * <li>
  7249. * 0 to 1 for CV_32F images
  7250. * </li>
  7251. * </ul>
  7252. *
  7253. * In case of linear transformations, the range does not matter. But in case of a non-linear
  7254. * transformation, an input RGB image should be normalized to the proper value range to get the correct
  7255. * results, for example, for RGB \(\rightarrow\) L\*u\*v\* transformation. For example, if you have a
  7256. * 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will
  7257. * have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor ,
  7258. * you need first to scale the image down:
  7259. * <code>
  7260. * img *= 1./255;
  7261. * cvtColor(img, img, COLOR_BGR2Luv);
  7262. * </code>
  7263. * If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many
  7264. * applications, this will not be noticeable but it is recommended to use 32-bit images in applications
  7265. * that need the full range of colors or that convert an image before an operation and then convert
  7266. * back.
  7267. *
  7268. * If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
  7269. * range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.
  7270. *
  7271. * param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
  7272. * floating-point.
  7273. * param dst output image of the same size and depth as src.
  7274. * param code color space conversion code (see #ColorConversionCodes).
  7275. * param dstCn number of channels in the destination image; if the parameter is 0, the number of the
  7276. * channels is derived automatically from src and code.
  7277. *
  7278. * SEE: REF: imgproc_color_conversions
  7279. */
  7280. public static void cvtColor(Mat src, Mat dst, int code, int dstCn)
  7281. {
  7282. if (src != null) src.ThrowIfDisposed();
  7283. if (dst != null) dst.ThrowIfDisposed();
  7284. imgproc_Imgproc_cvtColor_10(src.nativeObj, dst.nativeObj, code, dstCn);
  7285. }
  7286. /**
  7287. * Converts an image from one color space to another.
  7288. *
  7289. * The function converts an input image from one color space to another. In case of a transformation
  7290. * to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note
  7291. * that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the
  7292. * bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue
  7293. * component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and
  7294. * sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
  7295. *
  7296. * The conventional ranges for R, G, and B channel values are:
  7297. * <ul>
  7298. * <li>
  7299. * 0 to 255 for CV_8U images
  7300. * </li>
  7301. * <li>
  7302. * 0 to 65535 for CV_16U images
  7303. * </li>
  7304. * <li>
  7305. * 0 to 1 for CV_32F images
  7306. * </li>
  7307. * </ul>
  7308. *
  7309. * In case of linear transformations, the range does not matter. But in case of a non-linear
  7310. * transformation, an input RGB image should be normalized to the proper value range to get the correct
  7311. * results, for example, for RGB \(\rightarrow\) L\*u\*v\* transformation. For example, if you have a
  7312. * 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will
  7313. * have the 0..255 value range instead of 0..1 assumed by the function. So, before calling #cvtColor ,
  7314. * you need first to scale the image down:
  7315. * <code>
  7316. * img *= 1./255;
  7317. * cvtColor(img, img, COLOR_BGR2Luv);
  7318. * </code>
  7319. * If you use #cvtColor with 8-bit images, the conversion will have some information lost. For many
  7320. * applications, this will not be noticeable but it is recommended to use 32-bit images in applications
  7321. * that need the full range of colors or that convert an image before an operation and then convert
  7322. * back.
  7323. *
  7324. * If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
  7325. * range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.
  7326. *
  7327. * param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
  7328. * floating-point.
  7329. * param dst output image of the same size and depth as src.
  7330. * param code color space conversion code (see #ColorConversionCodes).
  7331. * channels is derived automatically from src and code.
  7332. *
  7333. * SEE: REF: imgproc_color_conversions
  7334. */
  7335. public static void cvtColor(Mat src, Mat dst, int code)
  7336. {
  7337. if (src != null) src.ThrowIfDisposed();
  7338. if (dst != null) dst.ThrowIfDisposed();
  7339. imgproc_Imgproc_cvtColor_11(src.nativeObj, dst.nativeObj, code);
  7340. }
  7341. //
  7342. // C++: void cv::cvtColorTwoPlane(Mat src1, Mat src2, Mat& dst, int code)
  7343. //
  7344. /**
  7345. * Converts an image from one color space to another where the source image is
  7346. * stored in two planes.
  7347. *
  7348. * This function only supports YUV420 to RGB conversion as of now.
  7349. *
  7350. * <ul>
  7351. * <li>
  7352. * #COLOR_YUV2BGR_NV12
  7353. * </li>
  7354. * <li>
  7355. * #COLOR_YUV2RGB_NV12
  7356. * </li>
  7357. * <li>
  7358. * #COLOR_YUV2BGRA_NV12
  7359. * </li>
  7360. * <li>
  7361. * #COLOR_YUV2RGBA_NV12
  7362. * </li>
  7363. * <li>
  7364. * #COLOR_YUV2BGR_NV21
  7365. * </li>
  7366. * <li>
  7367. * #COLOR_YUV2RGB_NV21
  7368. * </li>
  7369. * <li>
  7370. * #COLOR_YUV2BGRA_NV21
  7371. * </li>
  7372. * <li>
  7373. * #COLOR_YUV2RGBA_NV21
  7374. * </li>
  7375. * </ul>
  7376. * param src1 automatically generated
  7377. * param src2 automatically generated
  7378. * param dst automatically generated
  7379. * param code automatically generated
  7380. */
  7381. public static void cvtColorTwoPlane(Mat src1, Mat src2, Mat dst, int code)
  7382. {
  7383. if (src1 != null) src1.ThrowIfDisposed();
  7384. if (src2 != null) src2.ThrowIfDisposed();
  7385. if (dst != null) dst.ThrowIfDisposed();
  7386. imgproc_Imgproc_cvtColorTwoPlane_10(src1.nativeObj, src2.nativeObj, dst.nativeObj, code);
  7387. }
  7388. //
  7389. // C++: void cv::demosaicing(Mat src, Mat& dst, int code, int dstCn = 0)
  7390. //
  7391. /**
  7392. * main function for all demosaicing processes
  7393. *
  7394. * param src input image: 8-bit unsigned or 16-bit unsigned.
  7395. * param dst output image of the same size and depth as src.
  7396. * param code Color space conversion code (see the description below).
  7397. * param dstCn number of channels in the destination image; if the parameter is 0, the number of the
  7398. * channels is derived automatically from src and code.
  7399. *
  7400. * The function can do the following transformations:
  7401. *
  7402. * <ul>
  7403. * <li>
  7404. * Demosaicing using bilinear interpolation
  7405. * </li>
  7406. * </ul>
  7407. *
  7408. * #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR
  7409. *
  7410. * #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY
  7411. *
  7412. * <ul>
  7413. * <li>
  7414. * Demosaicing using Variable Number of Gradients.
  7415. * </li>
  7416. * </ul>
  7417. *
  7418. * #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG
  7419. *
  7420. * <ul>
  7421. * <li>
  7422. * Edge-Aware Demosaicing.
  7423. * </li>
  7424. * </ul>
  7425. *
  7426. * #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA
  7427. *
  7428. * <ul>
  7429. * <li>
  7430. * Demosaicing with alpha channel
  7431. * </li>
  7432. * </ul>
  7433. *
  7434. * #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA
  7435. *
  7436. * SEE: cvtColor
  7437. */
  7438. public static void demosaicing(Mat src, Mat dst, int code, int dstCn)
  7439. {
  7440. if (src != null) src.ThrowIfDisposed();
  7441. if (dst != null) dst.ThrowIfDisposed();
  7442. imgproc_Imgproc_demosaicing_10(src.nativeObj, dst.nativeObj, code, dstCn);
  7443. }
  7444. /**
  7445. * main function for all demosaicing processes
  7446. *
  7447. * param src input image: 8-bit unsigned or 16-bit unsigned.
  7448. * param dst output image of the same size and depth as src.
  7449. * param code Color space conversion code (see the description below).
  7450. * channels is derived automatically from src and code.
  7451. *
  7452. * The function can do the following transformations:
  7453. *
  7454. * <ul>
  7455. * <li>
  7456. * Demosaicing using bilinear interpolation
  7457. * </li>
  7458. * </ul>
  7459. *
  7460. * #COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR
  7461. *
  7462. * #COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY
  7463. *
  7464. * <ul>
  7465. * <li>
  7466. * Demosaicing using Variable Number of Gradients.
  7467. * </li>
  7468. * </ul>
  7469. *
  7470. * #COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG
  7471. *
  7472. * <ul>
  7473. * <li>
  7474. * Edge-Aware Demosaicing.
  7475. * </li>
  7476. * </ul>
  7477. *
  7478. * #COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA
  7479. *
  7480. * <ul>
  7481. * <li>
  7482. * Demosaicing with alpha channel
  7483. * </li>
  7484. * </ul>
  7485. *
  7486. * #COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA
  7487. *
  7488. * SEE: cvtColor
  7489. */
  7490. public static void demosaicing(Mat src, Mat dst, int code)
  7491. {
  7492. if (src != null) src.ThrowIfDisposed();
  7493. if (dst != null) dst.ThrowIfDisposed();
  7494. imgproc_Imgproc_demosaicing_11(src.nativeObj, dst.nativeObj, code);
  7495. }
  7496. //
  7497. // C++: Moments cv::moments(Mat array, bool binaryImage = false)
  7498. //
  7499. /**
  7500. * Calculates all of the moments up to the third order of a polygon or rasterized shape.
  7501. *
  7502. * The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The
  7503. * results are returned in the structure cv::Moments.
  7504. *
  7505. * param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
  7506. * \(1 \times N\) or \(N \times 1\) ) of 2D points (Point or Point2f ).
  7507. * param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is
  7508. * used for images only.
  7509. * return moments.
  7510. *
  7511. * <b>Note:</b> Only applicable to contour moments calculations from Python bindings: Note that the numpy
  7512. * type for the input array should be either np.int32 or np.float32.
  7513. *
  7514. * SEE: contourArea, arcLength
  7515. */
  7516. public static Moments moments(Mat array, bool binaryImage)
  7517. {
  7518. if (array != null) array.ThrowIfDisposed();
  7519. double[] tmpArray = new double[10];
  7520. imgproc_Imgproc_moments_10(array.nativeObj, binaryImage, tmpArray);
  7521. Moments retVal = new Moments(tmpArray);
  7522. return retVal;
  7523. }
  7524. /**
  7525. * Calculates all of the moments up to the third order of a polygon or rasterized shape.
  7526. *
  7527. * The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The
  7528. * results are returned in the structure cv::Moments.
  7529. *
  7530. * param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
  7531. * \(1 \times N\) or \(N \times 1\) ) of 2D points (Point or Point2f ).
  7532. * used for images only.
  7533. * return moments.
  7534. *
  7535. * <b>Note:</b> Only applicable to contour moments calculations from Python bindings: Note that the numpy
  7536. * type for the input array should be either np.int32 or np.float32.
  7537. *
  7538. * SEE: contourArea, arcLength
  7539. */
  7540. public static Moments moments(Mat array)
  7541. {
  7542. if (array != null) array.ThrowIfDisposed();
  7543. double[] tmpArray = new double[10];
  7544. imgproc_Imgproc_moments_11(array.nativeObj, tmpArray);
  7545. Moments retVal = new Moments(tmpArray);
  7546. return retVal;
  7547. }
  7548. //
  7549. // C++: void cv::HuMoments(Moments m, Mat& hu)
  7550. //
  7551. public static void HuMoments(Moments m, Mat hu)
  7552. {
  7553. if (hu != null) hu.ThrowIfDisposed();
  7554. imgproc_Imgproc_HuMoments_10(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03, hu.nativeObj);
  7555. }
  7556. //
  7557. // C++: void cv::matchTemplate(Mat image, Mat templ, Mat& result, int method, Mat mask = Mat())
  7558. //
  7559. /**
  7560. * Compares a template against overlapped image regions.
  7561. *
  7562. * The function slides through image , compares the overlapped patches of size \(w \times h\) against
  7563. * templ using the specified method and stores the comparison results in result . #TemplateMatchModes
  7564. * describes the formulae for the available comparison methods ( \(I\) denotes image, \(T\)
  7565. * template, \(R\) result, \(M\) the optional mask ). The summation is done over template and/or
  7566. * the image patch: \(x' = 0...w-1, y' = 0...h-1\)
  7567. *
  7568. * After the function finishes the comparison, the best matches can be found as global minimums (when
  7569. * #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the
  7570. * #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in
  7571. * the denominator is done over all of the channels and separate mean values are used for each channel.
  7572. * That is, the function can take a color template and a color image. The result will still be a
  7573. * single-channel image, which is easier to analyze.
  7574. *
  7575. * param image Image where the search is running. It must be 8-bit or 32-bit floating-point.
  7576. * param templ Searched template. It must be not greater than the source image and have the same
  7577. * data type.
  7578. * param result Map of comparison results. It must be single-channel 32-bit floating-point. If image
  7579. * is \(W \times H\) and templ is \(w \times h\) , then result is \((W-w+1) \times (H-h+1)\) .
  7580. * param method Parameter specifying the comparison method, see #TemplateMatchModes
  7581. * param mask Optional mask. It must have the same size as templ. It must either have the same number
  7582. * of channels as template or only one channel, which is then used for all template and
  7583. * image channels. If the data type is #CV_8U, the mask is interpreted as a binary mask,
  7584. * meaning only elements where mask is nonzero are used and are kept unchanged independent
  7585. * of the actual mask value (weight equals 1). For data tpye #CV_32F, the mask values are
  7586. * used as weights. The exact formulas are documented in #TemplateMatchModes.
  7587. */
  7588. public static void matchTemplate(Mat image, Mat templ, Mat result, int method, Mat mask)
  7589. {
  7590. if (image != null) image.ThrowIfDisposed();
  7591. if (templ != null) templ.ThrowIfDisposed();
  7592. if (result != null) result.ThrowIfDisposed();
  7593. if (mask != null) mask.ThrowIfDisposed();
  7594. imgproc_Imgproc_matchTemplate_10(image.nativeObj, templ.nativeObj, result.nativeObj, method, mask.nativeObj);
  7595. }
  7596. /**
  7597. * Compares a template against overlapped image regions.
  7598. *
  7599. * The function slides through image , compares the overlapped patches of size \(w \times h\) against
  7600. * templ using the specified method and stores the comparison results in result . #TemplateMatchModes
  7601. * describes the formulae for the available comparison methods ( \(I\) denotes image, \(T\)
  7602. * template, \(R\) result, \(M\) the optional mask ). The summation is done over template and/or
  7603. * the image patch: \(x' = 0...w-1, y' = 0...h-1\)
  7604. *
  7605. * After the function finishes the comparison, the best matches can be found as global minimums (when
  7606. * #TM_SQDIFF was used) or maximums (when #TM_CCORR or #TM_CCOEFF was used) using the
  7607. * #minMaxLoc function. In case of a color image, template summation in the numerator and each sum in
  7608. * the denominator is done over all of the channels and separate mean values are used for each channel.
  7609. * That is, the function can take a color template and a color image. The result will still be a
  7610. * single-channel image, which is easier to analyze.
  7611. *
  7612. * param image Image where the search is running. It must be 8-bit or 32-bit floating-point.
  7613. * param templ Searched template. It must be not greater than the source image and have the same
  7614. * data type.
  7615. * param result Map of comparison results. It must be single-channel 32-bit floating-point. If image
  7616. * is \(W \times H\) and templ is \(w \times h\) , then result is \((W-w+1) \times (H-h+1)\) .
  7617. * param method Parameter specifying the comparison method, see #TemplateMatchModes
  7618. * of channels as template or only one channel, which is then used for all template and
  7619. * image channels. If the data type is #CV_8U, the mask is interpreted as a binary mask,
  7620. * meaning only elements where mask is nonzero are used and are kept unchanged independent
  7621. * of the actual mask value (weight equals 1). For data tpye #CV_32F, the mask values are
  7622. * used as weights. The exact formulas are documented in #TemplateMatchModes.
  7623. */
  7624. public static void matchTemplate(Mat image, Mat templ, Mat result, int method)
  7625. {
  7626. if (image != null) image.ThrowIfDisposed();
  7627. if (templ != null) templ.ThrowIfDisposed();
  7628. if (result != null) result.ThrowIfDisposed();
  7629. imgproc_Imgproc_matchTemplate_11(image.nativeObj, templ.nativeObj, result.nativeObj, method);
  7630. }
  7631. //
  7632. // C++: int cv::connectedComponents(Mat image, Mat& labels, int connectivity, int ltype, int ccltype)
  7633. //
  7634. /**
  7635. * computes the connected components labeled image of boolean image
  7636. *
  7637. * image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
  7638. * represents the background label. ltype specifies the output label image type, an important
  7639. * consideration based on the total number of labels or alternatively the total number of pixels in
  7640. * the source image. ccltype specifies the connected components labeling algorithm to use, currently
  7641. * Bolelli (Spaghetti) CITE: Bolelli2019, Grana (BBDT) CITE: Grana2010 and Wu's (SAUF) CITE: Wu2009 algorithms
  7642. * are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces
  7643. * a row major ordering of labels while Spaghetti and BBDT do not.
  7644. * This function uses parallel version of the algorithms if at least one allowed
  7645. * parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
  7646. *
  7647. * param image the 8-bit single-channel image to be labeled
  7648. * param labels destination labeled image
  7649. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7650. * param ltype output image label type. Currently CV_32S and CV_16U are supported.
  7651. * param ccltype connected components algorithm type (see the #ConnectedComponentsAlgorithmsTypes).
  7652. * return automatically generated
  7653. */
  7654. public static int connectedComponentsWithAlgorithm(Mat image, Mat labels, int connectivity, int ltype, int ccltype)
  7655. {
  7656. if (image != null) image.ThrowIfDisposed();
  7657. if (labels != null) labels.ThrowIfDisposed();
  7658. return imgproc_Imgproc_connectedComponentsWithAlgorithm_10(image.nativeObj, labels.nativeObj, connectivity, ltype, ccltype);
  7659. }
  7660. //
  7661. // C++: int cv::connectedComponents(Mat image, Mat& labels, int connectivity = 8, int ltype = CV_32S)
  7662. //
  7663. /**
  7664. *
  7665. *
  7666. * param image the 8-bit single-channel image to be labeled
  7667. * param labels destination labeled image
  7668. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7669. * param ltype output image label type. Currently CV_32S and CV_16U are supported.
  7670. * return automatically generated
  7671. */
  7672. public static int connectedComponents(Mat image, Mat labels, int connectivity, int ltype)
  7673. {
  7674. if (image != null) image.ThrowIfDisposed();
  7675. if (labels != null) labels.ThrowIfDisposed();
  7676. return imgproc_Imgproc_connectedComponents_10(image.nativeObj, labels.nativeObj, connectivity, ltype);
  7677. }
  7678. /**
  7679. *
  7680. *
  7681. * param image the 8-bit single-channel image to be labeled
  7682. * param labels destination labeled image
  7683. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7684. * return automatically generated
  7685. */
  7686. public static int connectedComponents(Mat image, Mat labels, int connectivity)
  7687. {
  7688. if (image != null) image.ThrowIfDisposed();
  7689. if (labels != null) labels.ThrowIfDisposed();
  7690. return imgproc_Imgproc_connectedComponents_11(image.nativeObj, labels.nativeObj, connectivity);
  7691. }
  7692. /**
  7693. *
  7694. *
  7695. * param image the 8-bit single-channel image to be labeled
  7696. * param labels destination labeled image
  7697. * return automatically generated
  7698. */
  7699. public static int connectedComponents(Mat image, Mat labels)
  7700. {
  7701. if (image != null) image.ThrowIfDisposed();
  7702. if (labels != null) labels.ThrowIfDisposed();
  7703. return imgproc_Imgproc_connectedComponents_12(image.nativeObj, labels.nativeObj);
  7704. }
  7705. //
  7706. // C++: int cv::connectedComponentsWithStats(Mat image, Mat& labels, Mat& stats, Mat& centroids, int connectivity, int ltype, int ccltype)
  7707. //
  7708. /**
  7709. * computes the connected components labeled image of boolean image and also produces a statistics output for each label
  7710. *
  7711. * image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
  7712. * represents the background label. ltype specifies the output label image type, an important
  7713. * consideration based on the total number of labels or alternatively the total number of pixels in
  7714. * the source image. ccltype specifies the connected components labeling algorithm to use, currently
  7715. * Bolelli (Spaghetti) CITE: Bolelli2019, Grana (BBDT) CITE: Grana2010 and Wu's (SAUF) CITE: Wu2009 algorithms
  7716. * are supported, see the #ConnectedComponentsAlgorithmsTypes for details. Note that SAUF algorithm forces
  7717. * a row major ordering of labels while Spaghetti and BBDT do not.
  7718. * This function uses parallel version of the algorithms (statistics included) if at least one allowed
  7719. * parallel framework is enabled and if the rows of the image are at least twice the number returned by #getNumberOfCPUs.
  7720. *
  7721. * param image the 8-bit single-channel image to be labeled
  7722. * param labels destination labeled image
  7723. * param stats statistics output for each label, including the background label.
  7724. * Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
  7725. * #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
  7726. * param centroids centroid output for each label, including the background label. Centroids are
  7727. * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
  7728. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7729. * param ltype output image label type. Currently CV_32S and CV_16U are supported.
  7730. * param ccltype connected components algorithm type (see #ConnectedComponentsAlgorithmsTypes).
  7731. * return automatically generated
  7732. */
  7733. public static int connectedComponentsWithStatsWithAlgorithm(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity, int ltype, int ccltype)
  7734. {
  7735. if (image != null) image.ThrowIfDisposed();
  7736. if (labels != null) labels.ThrowIfDisposed();
  7737. if (stats != null) stats.ThrowIfDisposed();
  7738. if (centroids != null) centroids.ThrowIfDisposed();
  7739. return imgproc_Imgproc_connectedComponentsWithStatsWithAlgorithm_10(image.nativeObj, labels.nativeObj, stats.nativeObj, centroids.nativeObj, connectivity, ltype, ccltype);
  7740. }
  7741. //
  7742. // C++: int cv::connectedComponentsWithStats(Mat image, Mat& labels, Mat& stats, Mat& centroids, int connectivity = 8, int ltype = CV_32S)
  7743. //
  7744. /**
  7745. *
  7746. * param image the 8-bit single-channel image to be labeled
  7747. * param labels destination labeled image
  7748. * param stats statistics output for each label, including the background label.
  7749. * Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
  7750. * #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
  7751. * param centroids centroid output for each label, including the background label. Centroids are
  7752. * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
  7753. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7754. * param ltype output image label type. Currently CV_32S and CV_16U are supported.
  7755. * return automatically generated
  7756. */
  7757. public static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity, int ltype)
  7758. {
  7759. if (image != null) image.ThrowIfDisposed();
  7760. if (labels != null) labels.ThrowIfDisposed();
  7761. if (stats != null) stats.ThrowIfDisposed();
  7762. if (centroids != null) centroids.ThrowIfDisposed();
  7763. return imgproc_Imgproc_connectedComponentsWithStats_10(image.nativeObj, labels.nativeObj, stats.nativeObj, centroids.nativeObj, connectivity, ltype);
  7764. }
  7765. /**
  7766. *
  7767. * param image the 8-bit single-channel image to be labeled
  7768. * param labels destination labeled image
  7769. * param stats statistics output for each label, including the background label.
  7770. * Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
  7771. * #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
  7772. * param centroids centroid output for each label, including the background label. Centroids are
  7773. * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
  7774. * param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
  7775. * return automatically generated
  7776. */
  7777. public static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids, int connectivity)
  7778. {
  7779. if (image != null) image.ThrowIfDisposed();
  7780. if (labels != null) labels.ThrowIfDisposed();
  7781. if (stats != null) stats.ThrowIfDisposed();
  7782. if (centroids != null) centroids.ThrowIfDisposed();
  7783. return imgproc_Imgproc_connectedComponentsWithStats_11(image.nativeObj, labels.nativeObj, stats.nativeObj, centroids.nativeObj, connectivity);
  7784. }
  7785. /**
  7786. *
  7787. * param image the 8-bit single-channel image to be labeled
  7788. * param labels destination labeled image
  7789. * param stats statistics output for each label, including the background label.
  7790. * Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
  7791. * #ConnectedComponentsTypes, selecting the statistic. The data type is CV_32S.
  7792. * param centroids centroid output for each label, including the background label. Centroids are
  7793. * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
  7794. * return automatically generated
  7795. */
  7796. public static int connectedComponentsWithStats(Mat image, Mat labels, Mat stats, Mat centroids)
  7797. {
  7798. if (image != null) image.ThrowIfDisposed();
  7799. if (labels != null) labels.ThrowIfDisposed();
  7800. if (stats != null) stats.ThrowIfDisposed();
  7801. if (centroids != null) centroids.ThrowIfDisposed();
  7802. return imgproc_Imgproc_connectedComponentsWithStats_12(image.nativeObj, labels.nativeObj, stats.nativeObj, centroids.nativeObj);
  7803. }
  7804. //
  7805. // C++: void cv::findContours(Mat image, vector_vector_Point& contours, Mat& hierarchy, int mode, int method, Point offset = Point())
  7806. //
  7807. /**
  7808. * Finds contours in a binary image.
  7809. *
  7810. * The function retrieves contours from the binary image using the algorithm CITE: Suzuki85 . The contours
  7811. * are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the
  7812. * OpenCV sample directory.
  7813. * <b>Note:</b> Since opencv 3.2 source image is not modified by this function.
  7814. *
  7815. * param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
  7816. * pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
  7817. * #adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
  7818. * If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
  7819. * param contours Detected contours. Each contour is stored as a vector of points (e.g.
  7820. * std::vector&lt;std::vector&lt;cv::Point&gt; &gt;).
  7821. * param hierarchy Optional output vector (e.g. std::vector&lt;cv::Vec4i&gt;), containing information about the image topology. It has
  7822. * as many elements as the number of contours. For each i-th contour contours[i], the elements
  7823. * hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
  7824. * in contours of the next and previous contours at the same hierarchical level, the first child
  7825. * contour and the parent contour, respectively. If for the contour i there are no next, previous,
  7826. * parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
  7827. * <b>Note:</b> In Python, hierarchy is nested inside a top level array. Use hierarchy[0][i] to access hierarchical elements of i-th contour.
  7828. * param mode Contour retrieval mode, see #RetrievalModes
  7829. * param method Contour approximation method, see #ContourApproximationModes
  7830. * param offset Optional offset by which every contour point is shifted. This is useful if the
  7831. * contours are extracted from the image ROI and then they should be analyzed in the whole image
  7832. * context.
  7833. */
  7834. public static void findContours(Mat image, List<MatOfPoint> contours, Mat hierarchy, int mode, int method, Point offset)
  7835. {
  7836. if (image != null) image.ThrowIfDisposed();
  7837. if (hierarchy != null) hierarchy.ThrowIfDisposed();
  7838. Mat contours_mat = new Mat();
  7839. imgproc_Imgproc_findContours_10(image.nativeObj, contours_mat.nativeObj, hierarchy.nativeObj, mode, method, offset.x, offset.y);
  7840. Converters.Mat_to_vector_vector_Point(contours_mat, contours);
  7841. contours_mat.release();
  7842. }
  7843. /**
  7844. * Finds contours in a binary image.
  7845. *
  7846. * The function retrieves contours from the binary image using the algorithm CITE: Suzuki85 . The contours
  7847. * are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the
  7848. * OpenCV sample directory.
  7849. * <b>Note:</b> Since opencv 3.2 source image is not modified by this function.
  7850. *
  7851. * param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
  7852. * pixels remain 0's, so the image is treated as binary . You can use #compare, #inRange, #threshold ,
  7853. * #adaptiveThreshold, #Canny, and others to create a binary image out of a grayscale or color one.
  7854. * If mode equals to #RETR_CCOMP or #RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
  7855. * param contours Detected contours. Each contour is stored as a vector of points (e.g.
  7856. * std::vector&lt;std::vector&lt;cv::Point&gt; &gt;).
  7857. * param hierarchy Optional output vector (e.g. std::vector&lt;cv::Vec4i&gt;), containing information about the image topology. It has
  7858. * as many elements as the number of contours. For each i-th contour contours[i], the elements
  7859. * hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indices
  7860. * in contours of the next and previous contours at the same hierarchical level, the first child
  7861. * contour and the parent contour, respectively. If for the contour i there are no next, previous,
  7862. * parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
  7863. * <b>Note:</b> In Python, hierarchy is nested inside a top level array. Use hierarchy[0][i] to access hierarchical elements of i-th contour.
  7864. * param mode Contour retrieval mode, see #RetrievalModes
  7865. * param method Contour approximation method, see #ContourApproximationModes
  7866. * contours are extracted from the image ROI and then they should be analyzed in the whole image
  7867. * context.
  7868. */
  7869. public static void findContours(Mat image, List<MatOfPoint> contours, Mat hierarchy, int mode, int method)
  7870. {
  7871. if (image != null) image.ThrowIfDisposed();
  7872. if (hierarchy != null) hierarchy.ThrowIfDisposed();
  7873. Mat contours_mat = new Mat();
  7874. imgproc_Imgproc_findContours_11(image.nativeObj, contours_mat.nativeObj, hierarchy.nativeObj, mode, method);
  7875. Converters.Mat_to_vector_vector_Point(contours_mat, contours);
  7876. contours_mat.release();
  7877. }
  7878. //
  7879. // C++: void cv::approxPolyDP(vector_Point2f curve, vector_Point2f& approxCurve, double epsilon, bool closed)
  7880. //
  7881. /**
  7882. * Approximates a polygonal curve(s) with the specified precision.
  7883. *
  7884. * The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less
  7885. * vertices so that the distance between them is less or equal to the specified precision. It uses the
  7886. * Douglas-Peucker algorithm &lt;http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm&gt;
  7887. *
  7888. * param curve Input vector of a 2D point stored in std::vector or Mat
  7889. * param approxCurve Result of the approximation. The type should match the type of the input curve.
  7890. * param epsilon Parameter specifying the approximation accuracy. This is the maximum distance
  7891. * between the original curve and its approximation.
  7892. * param closed If true, the approximated curve is closed (its first and last vertices are
  7893. * connected). Otherwise, it is not closed.
  7894. */
  7895. public static void approxPolyDP(MatOfPoint2f curve, MatOfPoint2f approxCurve, double epsilon, bool closed)
  7896. {
  7897. if (curve != null) curve.ThrowIfDisposed();
  7898. if (approxCurve != null) approxCurve.ThrowIfDisposed();
  7899. Mat curve_mat = curve;
  7900. Mat approxCurve_mat = approxCurve;
  7901. imgproc_Imgproc_approxPolyDP_10(curve_mat.nativeObj, approxCurve_mat.nativeObj, epsilon, closed);
  7902. }
  7903. //
  7904. // C++: double cv::arcLength(vector_Point2f curve, bool closed)
  7905. //
  7906. /**
  7907. * Calculates a contour perimeter or a curve length.
  7908. *
  7909. * The function computes a curve length or a closed contour perimeter.
  7910. *
  7911. * param curve Input vector of 2D points, stored in std::vector or Mat.
  7912. * param closed Flag indicating whether the curve is closed or not.
  7913. * return automatically generated
  7914. */
  7915. public static double arcLength(MatOfPoint2f curve, bool closed)
  7916. {
  7917. if (curve != null) curve.ThrowIfDisposed();
  7918. Mat curve_mat = curve;
  7919. return imgproc_Imgproc_arcLength_10(curve_mat.nativeObj, closed);
  7920. }
  7921. //
  7922. // C++: Rect cv::boundingRect(Mat array)
  7923. //
  7924. /**
  7925. * Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image.
  7926. *
  7927. * The function calculates and returns the minimal up-right bounding rectangle for the specified point set or
  7928. * non-zero pixels of gray-scale image.
  7929. *
  7930. * param array Input gray-scale image or 2D point set, stored in std::vector or Mat.
  7931. * return automatically generated
  7932. */
  7933. public static Rect boundingRect(Mat array)
  7934. {
  7935. if (array != null) array.ThrowIfDisposed();
  7936. double[] tmpArray = new double[4];
  7937. imgproc_Imgproc_boundingRect_10(array.nativeObj, tmpArray);
  7938. Rect retVal = new Rect(tmpArray);
  7939. return retVal;
  7940. }
  7941. //
  7942. // C++: double cv::contourArea(Mat contour, bool oriented = false)
  7943. //
  7944. /**
  7945. * Calculates a contour area.
  7946. *
  7947. * The function computes a contour area. Similarly to moments , the area is computed using the Green
  7948. * formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
  7949. * #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong
  7950. * results for contours with self-intersections.
  7951. *
  7952. * Example:
  7953. * <code>
  7954. * vector&lt;Point&gt; contour;
  7955. * contour.push_back(Point2f(0, 0));
  7956. * contour.push_back(Point2f(10, 0));
  7957. * contour.push_back(Point2f(10, 10));
  7958. * contour.push_back(Point2f(5, 4));
  7959. *
  7960. * double area0 = contourArea(contour);
  7961. * vector&lt;Point&gt; approx;
  7962. * approxPolyDP(contour, approx, 5, true);
  7963. * double area1 = contourArea(approx);
  7964. *
  7965. * cout &lt;&lt; "area0 =" &lt;&lt; area0 &lt;&lt; endl &lt;&lt;
  7966. * "area1 =" &lt;&lt; area1 &lt;&lt; endl &lt;&lt;
  7967. * "approx poly vertices" &lt;&lt; approx.size() &lt;&lt; endl;
  7968. * </code>
  7969. * param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat.
  7970. * param oriented Oriented area flag. If it is true, the function returns a signed area value,
  7971. * depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
  7972. * determine orientation of a contour by taking the sign of an area. By default, the parameter is
  7973. * false, which means that the absolute value is returned.
  7974. * return automatically generated
  7975. */
  7976. public static double contourArea(Mat contour, bool oriented)
  7977. {
  7978. if (contour != null) contour.ThrowIfDisposed();
  7979. return imgproc_Imgproc_contourArea_10(contour.nativeObj, oriented);
  7980. }
  7981. /**
  7982. * Calculates a contour area.
  7983. *
  7984. * The function computes a contour area. Similarly to moments , the area is computed using the Green
  7985. * formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
  7986. * #drawContours or #fillPoly , can be different. Also, the function will most certainly give a wrong
  7987. * results for contours with self-intersections.
  7988. *
  7989. * Example:
  7990. * <code>
  7991. * vector&lt;Point&gt; contour;
  7992. * contour.push_back(Point2f(0, 0));
  7993. * contour.push_back(Point2f(10, 0));
  7994. * contour.push_back(Point2f(10, 10));
  7995. * contour.push_back(Point2f(5, 4));
  7996. *
  7997. * double area0 = contourArea(contour);
  7998. * vector&lt;Point&gt; approx;
  7999. * approxPolyDP(contour, approx, 5, true);
  8000. * double area1 = contourArea(approx);
  8001. *
  8002. * cout &lt;&lt; "area0 =" &lt;&lt; area0 &lt;&lt; endl &lt;&lt;
  8003. * "area1 =" &lt;&lt; area1 &lt;&lt; endl &lt;&lt;
  8004. * "approx poly vertices" &lt;&lt; approx.size() &lt;&lt; endl;
  8005. * </code>
  8006. * param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat.
  8007. * depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
  8008. * determine orientation of a contour by taking the sign of an area. By default, the parameter is
  8009. * false, which means that the absolute value is returned.
  8010. * return automatically generated
  8011. */
  8012. public static double contourArea(Mat contour)
  8013. {
  8014. if (contour != null) contour.ThrowIfDisposed();
  8015. return imgproc_Imgproc_contourArea_11(contour.nativeObj);
  8016. }
  8017. //
  8018. // C++: RotatedRect cv::minAreaRect(vector_Point2f points)
  8019. //
  8020. /**
  8021. * Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
  8022. *
  8023. * The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a
  8024. * specified point set. Developer should keep in mind that the returned RotatedRect can contain negative
  8025. * indices when data is close to the containing Mat element boundary.
  8026. *
  8027. * param points Input vector of 2D points, stored in std::vector&lt;&gt; or Mat
  8028. * return automatically generated
  8029. */
  8030. public static RotatedRect minAreaRect(MatOfPoint2f points)
  8031. {
  8032. if (points != null) points.ThrowIfDisposed();
  8033. Mat points_mat = points;
  8034. double[] tmpArray = new double[5];
  8035. imgproc_Imgproc_minAreaRect_10(points_mat.nativeObj, tmpArray);
  8036. RotatedRect retVal = new RotatedRect(tmpArray);
  8037. return retVal;
  8038. }
  8039. //
  8040. // C++: void cv::boxPoints(RotatedRect box, Mat& points)
  8041. //
  8042. /**
  8043. * Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
  8044. *
  8045. * The function finds the four vertices of a rotated rectangle. This function is useful to draw the
  8046. * rectangle. In C++, instead of using this function, you can directly use RotatedRect::points method. Please
  8047. * visit the REF: tutorial_bounding_rotated_ellipses "tutorial on Creating Bounding rotated boxes and ellipses for contours" for more information.
  8048. *
  8049. * param box The input rotated rectangle. It may be the output of REF: minAreaRect.
  8050. * param points The output array of four vertices of rectangles.
  8051. */
  8052. public static void boxPoints(RotatedRect box, Mat points)
  8053. {
  8054. if (points != null) points.ThrowIfDisposed();
  8055. imgproc_Imgproc_boxPoints_10(box.center.x, box.center.y, box.size.width, box.size.height, box.angle, points.nativeObj);
  8056. }
  8057. //
  8058. // C++: void cv::minEnclosingCircle(vector_Point2f points, Point2f& center, float& radius)
  8059. //
  8060. /**
  8061. * Finds a circle of the minimum area enclosing a 2D point set.
  8062. *
  8063. * The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm.
  8064. *
  8065. * param points Input vector of 2D points, stored in std::vector&lt;&gt; or Mat
  8066. * param center Output center of the circle.
  8067. * param radius Output radius of the circle.
  8068. */
  8069. public static void minEnclosingCircle(MatOfPoint2f points, Point center, float[] radius)
  8070. {
  8071. if (points != null) points.ThrowIfDisposed();
  8072. Mat points_mat = points;
  8073. double[] center_out = new double[2];
  8074. double[] radius_out = new double[1];
  8075. imgproc_Imgproc_minEnclosingCircle_10(points_mat.nativeObj, center_out, radius_out);
  8076. if (center != null) { center.x = center_out[0]; center.y = center_out[1]; }
  8077. if (radius != null) radius[0] = (float)radius_out[0];
  8078. }
  8079. //
  8080. // C++: double cv::minEnclosingTriangle(Mat points, Mat& triangle)
  8081. //
  8082. /**
  8083. * Finds a triangle of minimum area enclosing a 2D point set and returns its area.
  8084. *
  8085. * The function finds a triangle of minimum area enclosing the given set of 2D points and returns its
  8086. * area. The output for a given 2D point set is shown in the image below. 2D points are depicted in
  8087. * red* and the enclosing triangle in *yellow*.
  8088. *
  8089. * ![Sample output of the minimum enclosing triangle function](pics/minenclosingtriangle.png)
  8090. *
  8091. * The implementation of the algorithm is based on O'Rourke's CITE: ORourke86 and Klee and Laskowski's
  8092. * CITE: KleeLaskowski85 papers. O'Rourke provides a \(\theta(n)\) algorithm for finding the minimal
  8093. * enclosing triangle of a 2D convex polygon with n vertices. Since the #minEnclosingTriangle function
  8094. * takes a 2D point set as input an additional preprocessing step of computing the convex hull of the
  8095. * 2D point set is required. The complexity of the #convexHull function is \(O(n log(n))\) which is higher
  8096. * than \(\theta(n)\). Thus the overall complexity of the function is \(O(n log(n))\).
  8097. *
  8098. * param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector&lt;&gt; or Mat
  8099. * param triangle Output vector of three 2D points defining the vertices of the triangle. The depth
  8100. * of the OutputArray must be CV_32F.
  8101. * return automatically generated
  8102. */
  8103. public static double minEnclosingTriangle(Mat points, Mat triangle)
  8104. {
  8105. if (points != null) points.ThrowIfDisposed();
  8106. if (triangle != null) triangle.ThrowIfDisposed();
  8107. return imgproc_Imgproc_minEnclosingTriangle_10(points.nativeObj, triangle.nativeObj);
  8108. }
  8109. //
  8110. // C++: double cv::matchShapes(Mat contour1, Mat contour2, int method, double parameter)
  8111. //
  8112. /**
  8113. * Compares two shapes.
  8114. *
  8115. * The function compares two shapes. All three implemented methods use the Hu invariants (see #HuMoments)
  8116. *
  8117. * param contour1 First contour or grayscale image.
  8118. * param contour2 Second contour or grayscale image.
  8119. * param method Comparison method, see #ShapeMatchModes
  8120. * param parameter Method-specific parameter (not supported now).
  8121. * return automatically generated
  8122. */
  8123. public static double matchShapes(Mat contour1, Mat contour2, int method, double parameter)
  8124. {
  8125. if (contour1 != null) contour1.ThrowIfDisposed();
  8126. if (contour2 != null) contour2.ThrowIfDisposed();
  8127. return imgproc_Imgproc_matchShapes_10(contour1.nativeObj, contour2.nativeObj, method, parameter);
  8128. }
  8129. //
  8130. // C++: void cv::convexHull(vector_Point points, vector_int& hull, bool clockwise = false, _hidden_ returnPoints = true)
  8131. //
  8132. /**
  8133. * Finds the convex hull of a point set.
  8134. *
  8135. * The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm CITE: Sklansky82
  8136. * that has *O(N logN)* complexity in the current implementation.
  8137. *
  8138. * param points Input 2D point set, stored in std::vector or Mat.
  8139. * param hull Output convex hull. It is either an integer vector of indices or vector of points. In
  8140. * the first case, the hull elements are 0-based indices of the convex hull points in the original
  8141. * array (since the set of convex hull points is a subset of the original point set). In the second
  8142. * case, hull elements are the convex hull points themselves.
  8143. * param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise.
  8144. * Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
  8145. * to the right, and its Y axis pointing upwards.
  8146. * returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
  8147. * output array is std::vector, the flag is ignored, and the output depends on the type of the
  8148. * vector: std::vector&lt;int&gt; implies returnPoints=false, std::vector&lt;Point&gt; implies
  8149. * returnPoints=true.
  8150. *
  8151. * <b>Note:</b> {code points} and {code hull} should be different arrays, inplace processing isn't supported.
  8152. *
  8153. * Check REF: tutorial_hull "the corresponding tutorial" for more details.
  8154. *
  8155. * useful links:
  8156. *
  8157. * https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
  8158. */
  8159. public static void convexHull(MatOfPoint points, MatOfInt hull, bool clockwise)
  8160. {
  8161. if (points != null) points.ThrowIfDisposed();
  8162. if (hull != null) hull.ThrowIfDisposed();
  8163. Mat points_mat = points;
  8164. Mat hull_mat = hull;
  8165. imgproc_Imgproc_convexHull_10(points_mat.nativeObj, hull_mat.nativeObj, clockwise);
  8166. }
  8167. /**
  8168. * Finds the convex hull of a point set.
  8169. *
  8170. * The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm CITE: Sklansky82
  8171. * that has *O(N logN)* complexity in the current implementation.
  8172. *
  8173. * param points Input 2D point set, stored in std::vector or Mat.
  8174. * param hull Output convex hull. It is either an integer vector of indices or vector of points. In
  8175. * the first case, the hull elements are 0-based indices of the convex hull points in the original
  8176. * array (since the set of convex hull points is a subset of the original point set). In the second
  8177. * case, hull elements are the convex hull points themselves.
  8178. * Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
  8179. * to the right, and its Y axis pointing upwards.
  8180. * returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
  8181. * output array is std::vector, the flag is ignored, and the output depends on the type of the
  8182. * vector: std::vector&lt;int&gt; implies returnPoints=false, std::vector&lt;Point&gt; implies
  8183. * returnPoints=true.
  8184. *
  8185. * <b>Note:</b> {code points} and {code hull} should be different arrays, inplace processing isn't supported.
  8186. *
  8187. * Check REF: tutorial_hull "the corresponding tutorial" for more details.
  8188. *
  8189. * useful links:
  8190. *
  8191. * https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
  8192. */
  8193. public static void convexHull(MatOfPoint points, MatOfInt hull)
  8194. {
  8195. if (points != null) points.ThrowIfDisposed();
  8196. if (hull != null) hull.ThrowIfDisposed();
  8197. Mat points_mat = points;
  8198. Mat hull_mat = hull;
  8199. imgproc_Imgproc_convexHull_12(points_mat.nativeObj, hull_mat.nativeObj);
  8200. }
  8201. //
  8202. // C++: void cv::convexityDefects(vector_Point contour, vector_int convexhull, vector_Vec4i& convexityDefects)
  8203. //
  8204. /**
  8205. * Finds the convexity defects of a contour.
  8206. *
  8207. * The figure below displays convexity defects of a hand contour:
  8208. *
  8209. * ![image](pics/defects.png)
  8210. *
  8211. * param contour Input contour.
  8212. * param convexhull Convex hull obtained using convexHull that should contain indices of the contour
  8213. * points that make the hull.
  8214. * param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java
  8215. * interface each convexity defect is represented as 4-element integer vector (a.k.a. #Vec4i):
  8216. * (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
  8217. * in the original contour of the convexity defect beginning, end and the farthest point, and
  8218. * fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
  8219. * farthest contour point and the hull. That is, to get the floating-point value of the depth will be
  8220. * fixpt_depth/256.0.
  8221. */
  8222. public static void convexityDefects(MatOfPoint contour, MatOfInt convexhull, MatOfInt4 convexityDefects)
  8223. {
  8224. if (contour != null) contour.ThrowIfDisposed();
  8225. if (convexhull != null) convexhull.ThrowIfDisposed();
  8226. if (convexityDefects != null) convexityDefects.ThrowIfDisposed();
  8227. Mat contour_mat = contour;
  8228. Mat convexhull_mat = convexhull;
  8229. Mat convexityDefects_mat = convexityDefects;
  8230. imgproc_Imgproc_convexityDefects_10(contour_mat.nativeObj, convexhull_mat.nativeObj, convexityDefects_mat.nativeObj);
  8231. }
  8232. //
  8233. // C++: bool cv::isContourConvex(vector_Point contour)
  8234. //
  8235. /**
  8236. * Tests a contour convexity.
  8237. *
  8238. * The function tests whether the input contour is convex or not. The contour must be simple, that is,
  8239. * without self-intersections. Otherwise, the function output is undefined.
  8240. *
  8241. * param contour Input vector of 2D points, stored in std::vector&lt;&gt; or Mat
  8242. * return automatically generated
  8243. */
  8244. public static bool isContourConvex(MatOfPoint contour)
  8245. {
  8246. if (contour != null) contour.ThrowIfDisposed();
  8247. Mat contour_mat = contour;
  8248. return imgproc_Imgproc_isContourConvex_10(contour_mat.nativeObj);
  8249. }
  8250. //
  8251. // C++: float cv::intersectConvexConvex(Mat p1, Mat p2, Mat& p12, bool handleNested = true)
  8252. //
  8253. /**
  8254. * Finds intersection of two convex polygons
  8255. *
  8256. * param p1 First polygon
  8257. * param p2 Second polygon
  8258. * param p12 Output polygon describing the intersecting area
  8259. * param handleNested When true, an intersection is found if one of the polygons is fully enclosed in the other.
  8260. * When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
  8261. * of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.
  8262. *
  8263. * return Absolute value of area of intersecting polygon
  8264. *
  8265. * <b>Note:</b> intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.
  8266. */
  8267. public static float intersectConvexConvex(Mat p1, Mat p2, Mat p12, bool handleNested)
  8268. {
  8269. if (p1 != null) p1.ThrowIfDisposed();
  8270. if (p2 != null) p2.ThrowIfDisposed();
  8271. if (p12 != null) p12.ThrowIfDisposed();
  8272. return imgproc_Imgproc_intersectConvexConvex_10(p1.nativeObj, p2.nativeObj, p12.nativeObj, handleNested);
  8273. }
  8274. /**
  8275. * Finds intersection of two convex polygons
  8276. *
  8277. * param p1 First polygon
  8278. * param p2 Second polygon
  8279. * param p12 Output polygon describing the intersecting area
  8280. * When false, no intersection is found. If the polygons share a side or the vertex of one polygon lies on an edge
  8281. * of the other, they are not considered nested and an intersection will be found regardless of the value of handleNested.
  8282. *
  8283. * return Absolute value of area of intersecting polygon
  8284. *
  8285. * <b>Note:</b> intersectConvexConvex doesn't confirm that both polygons are convex and will return invalid results if they aren't.
  8286. */
  8287. public static float intersectConvexConvex(Mat p1, Mat p2, Mat p12)
  8288. {
  8289. if (p1 != null) p1.ThrowIfDisposed();
  8290. if (p2 != null) p2.ThrowIfDisposed();
  8291. if (p12 != null) p12.ThrowIfDisposed();
  8292. return imgproc_Imgproc_intersectConvexConvex_11(p1.nativeObj, p2.nativeObj, p12.nativeObj);
  8293. }
  8294. //
  8295. // C++: RotatedRect cv::fitEllipse(vector_Point2f points)
  8296. //
  8297. /**
  8298. * Fits an ellipse around a set of 2D points.
  8299. *
  8300. * The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of
  8301. * all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by CITE: Fitzgibbon95
  8302. * is used. Developer should keep in mind that it is possible that the returned
  8303. * ellipse/rotatedRect data contains negative indices, due to the data points being close to the
  8304. * border of the containing Mat element.
  8305. *
  8306. * param points Input 2D point set, stored in std::vector&lt;&gt; or Mat
  8307. * return automatically generated
  8308. */
  8309. public static RotatedRect fitEllipse(MatOfPoint2f points)
  8310. {
  8311. if (points != null) points.ThrowIfDisposed();
  8312. Mat points_mat = points;
  8313. double[] tmpArray = new double[5];
  8314. imgproc_Imgproc_fitEllipse_10(points_mat.nativeObj, tmpArray);
  8315. RotatedRect retVal = new RotatedRect(tmpArray);
  8316. return retVal;
  8317. }
  8318. //
  8319. // C++: RotatedRect cv::fitEllipseAMS(Mat points)
  8320. //
  8321. /**
  8322. * Fits an ellipse around a set of 2D points.
  8323. *
  8324. * The function calculates the ellipse that fits a set of 2D points.
  8325. * It returns the rotated rectangle in which the ellipse is inscribed.
  8326. * The Approximate Mean Square (AMS) proposed by CITE: Taubin1991 is used.
  8327. *
  8328. * For an ellipse, this basis set is \( \chi= \left(x^2, x y, y^2, x, y, 1\right) \),
  8329. * which is a set of six free coefficients \( A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \).
  8330. * However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \( (a,b) \),
  8331. * the position \( (x_0,y_0) \), and the orientation \( \theta \). This is because the basis set includes lines,
  8332. * quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits.
  8333. * If the fit is found to be a parabolic or hyperbolic function then the standard #fitEllipse method is used.
  8334. * The AMS method restricts the fit to parabolic, hyperbolic and elliptical curves
  8335. * by imposing the condition that \( A^T ( D_x^T D_x + D_y^T D_y) A = 1 \) where
  8336. * the matrices \( Dx \) and \( Dy \) are the partial derivatives of the design matrix \( D \) with
  8337. * respect to x and y. The matrices are formed row by row applying the following to
  8338. * each of the points in the set:
  8339. * \(align*}{
  8340. * D(i,:)&amp;=\left\{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\right\} &amp;
  8341. * D_x(i,:)&amp;=\left\{2 x_i,y_i,0,1,0,0\right\} &amp;
  8342. * D_y(i,:)&amp;=\left\{0,x_i,2 y_i,0,1,0\right\}
  8343. * \)
  8344. * The AMS method minimizes the cost function
  8345. * \(equation*}{
  8346. * \epsilon ^2=\frac{ A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T }
  8347. * \)
  8348. *
  8349. * The minimum cost is found by solving the generalized eigenvalue problem.
  8350. *
  8351. * \(equation*}{
  8352. * D^T D A = \lambda \left( D_x^T D_x + D_y^T D_y\right) A
  8353. * \)
  8354. *
  8355. * param points Input 2D point set, stored in std::vector&lt;&gt; or Mat
  8356. * return automatically generated
  8357. */
  8358. public static RotatedRect fitEllipseAMS(Mat points)
  8359. {
  8360. if (points != null) points.ThrowIfDisposed();
  8361. double[] tmpArray = new double[5];
  8362. imgproc_Imgproc_fitEllipseAMS_10(points.nativeObj, tmpArray);
  8363. RotatedRect retVal = new RotatedRect(tmpArray);
  8364. return retVal;
  8365. }
  8366. //
  8367. // C++: RotatedRect cv::fitEllipseDirect(Mat points)
  8368. //
  8369. /**
  8370. * Fits an ellipse around a set of 2D points.
  8371. *
  8372. * The function calculates the ellipse that fits a set of 2D points.
  8373. * It returns the rotated rectangle in which the ellipse is inscribed.
  8374. * The Direct least square (Direct) method by CITE: Fitzgibbon1999 is used.
  8375. *
  8376. * For an ellipse, this basis set is \( \chi= \left(x^2, x y, y^2, x, y, 1\right) \),
  8377. * which is a set of six free coefficients \( A^T=\left\{A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \).
  8378. * However, to specify an ellipse, all that is needed is five numbers; the major and minor axes lengths \( (a,b) \),
  8379. * the position \( (x_0,y_0) \), and the orientation \( \theta \). This is because the basis set includes lines,
  8380. * quadratics, parabolic and hyperbolic functions as well as elliptical functions as possible fits.
  8381. * The Direct method confines the fit to ellipses by ensuring that \( 4 A_{xx} A_{yy}- A_{xy}^2 &gt; 0 \).
  8382. * The condition imposed is that \( 4 A_{xx} A_{yy}- A_{xy}^2=1 \) which satisfies the inequality
  8383. * and as the coefficients can be arbitrarily scaled is not overly restrictive.
  8384. *
  8385. * \(equation*}{
  8386. * \epsilon ^2= A^T D^T D A \quad \text{with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin{matrix}
  8387. * 0 &amp; 0 &amp; 2 &amp; 0 &amp; 0 &amp; 0 \\
  8388. * 0 &amp; -1 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\
  8389. * 2 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\
  8390. * 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\
  8391. * 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\
  8392. * 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0
  8393. * \end{matrix} \right)
  8394. * \)
  8395. *
  8396. * The minimum cost is found by solving the generalized eigenvalue problem.
  8397. *
  8398. * \(equation*}{
  8399. * D^T D A = \lambda \left( C\right) A
  8400. * \)
  8401. *
  8402. * The system produces only one positive eigenvalue \( \lambda\) which is chosen as the solution
  8403. * with its eigenvector \(\mathbf{u}\). These are used to find the coefficients
  8404. *
  8405. * \(equation*}{
  8406. * A = \sqrt{\frac{1}{\mathbf{u}^T C \mathbf{u}}} \mathbf{u}
  8407. * \)
  8408. * The scaling factor guarantees that \(A^T C A =1\).
  8409. *
  8410. * param points Input 2D point set, stored in std::vector&lt;&gt; or Mat
  8411. * return automatically generated
  8412. */
  8413. public static RotatedRect fitEllipseDirect(Mat points)
  8414. {
  8415. if (points != null) points.ThrowIfDisposed();
  8416. double[] tmpArray = new double[5];
  8417. imgproc_Imgproc_fitEllipseDirect_10(points.nativeObj, tmpArray);
  8418. RotatedRect retVal = new RotatedRect(tmpArray);
  8419. return retVal;
  8420. }
  8421. //
  8422. // C++: void cv::fitLine(Mat points, Mat& line, int distType, double param, double reps, double aeps)
  8423. //
  8424. /**
  8425. * Fits a line to a 2D or 3D point set.
  8426. *
  8427. * The function fitLine fits a line to a 2D or 3D point set by minimizing \(\sum_i \rho(r_i)\) where
  8428. * \(r_i\) is a distance between the \(i^{th}\) point, the line and \(\rho(r)\) is a distance function, one
  8429. * of the following:
  8430. * <ul>
  8431. * <li>
  8432. * DIST_L2
  8433. * \(\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\)
  8434. * </li>
  8435. * <li>
  8436. * DIST_L1
  8437. * \(\rho (r) = r\)
  8438. * </li>
  8439. * <li>
  8440. * DIST_L12
  8441. * \(\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\)
  8442. * </li>
  8443. * <li>
  8444. * DIST_FAIR
  8445. * \(\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\)
  8446. * </li>
  8447. * <li>
  8448. * DIST_WELSCH
  8449. * \(\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\)
  8450. * </li>
  8451. * <li>
  8452. * DIST_HUBER
  8453. * \(\rho (r) = \fork{r^2/2}{if \(r &lt; C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\)
  8454. * </li>
  8455. * </ul>
  8456. *
  8457. * The algorithm is based on the M-estimator ( &lt;http://en.wikipedia.org/wiki/M-estimator&gt; ) technique
  8458. * that iteratively fits the line using the weighted least-squares algorithm. After each iteration the
  8459. * weights \(w_i\) are adjusted to be inversely proportional to \(\rho(r_i)\) .
  8460. *
  8461. * param points Input vector of 2D or 3D points, stored in std::vector&lt;&gt; or Mat.
  8462. * param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements
  8463. * (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and
  8464. * (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like
  8465. * Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line
  8466. * and (x0, y0, z0) is a point on the line.
  8467. * param distType Distance used by the M-estimator, see #DistanceTypes
  8468. * param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value
  8469. * is chosen.
  8470. * param reps Sufficient accuracy for the radius (distance between the coordinate origin and the line).
  8471. * param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
  8472. */
  8473. public static void fitLine(Mat points, Mat line, int distType, double param, double reps, double aeps)
  8474. {
  8475. if (points != null) points.ThrowIfDisposed();
  8476. if (line != null) line.ThrowIfDisposed();
  8477. imgproc_Imgproc_fitLine_10(points.nativeObj, line.nativeObj, distType, param, reps, aeps);
  8478. }
  8479. //
  8480. // C++: double cv::pointPolygonTest(vector_Point2f contour, Point2f pt, bool measureDist)
  8481. //
  8482. /**
  8483. * Performs a point-in-contour test.
  8484. *
  8485. * The function determines whether the point is inside a contour, outside, or lies on an edge (or
  8486. * coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge)
  8487. * value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively.
  8488. * Otherwise, the return value is a signed distance between the point and the nearest contour edge.
  8489. *
  8490. * See below a sample output of the function where each image pixel is tested against the contour:
  8491. *
  8492. * ![sample output](pics/pointpolygon.png)
  8493. *
  8494. * param contour Input contour.
  8495. * param pt Point tested against the contour.
  8496. * param measureDist If true, the function estimates the signed distance from the point to the
  8497. * nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.
  8498. * return automatically generated
  8499. */
  8500. public static double pointPolygonTest(MatOfPoint2f contour, Point pt, bool measureDist)
  8501. {
  8502. if (contour != null) contour.ThrowIfDisposed();
  8503. Mat contour_mat = contour;
  8504. return imgproc_Imgproc_pointPolygonTest_10(contour_mat.nativeObj, pt.x, pt.y, measureDist);
  8505. }
  8506. //
  8507. // C++: int cv::rotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, Mat& intersectingRegion)
  8508. //
  8509. /**
  8510. * Finds out if there is any intersection between two rotated rectangles.
  8511. *
  8512. * If there is then the vertices of the intersecting region are returned as well.
  8513. *
  8514. * Below are some examples of intersection configurations. The hatched pattern indicates the
  8515. * intersecting region and the red vertices are returned by the function.
  8516. *
  8517. * ![intersection examples](pics/intersection.png)
  8518. *
  8519. * param rect1 First rectangle
  8520. * param rect2 Second rectangle
  8521. * param intersectingRegion The output array of the vertices of the intersecting region. It returns
  8522. * at most 8 vertices. Stored as std::vector&lt;cv::Point2f&gt; or cv::Mat as Mx1 of type CV_32FC2.
  8523. * return One of #RectanglesIntersectTypes
  8524. */
  8525. public static int rotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, Mat intersectingRegion)
  8526. {
  8527. if (intersectingRegion != null) intersectingRegion.ThrowIfDisposed();
  8528. return imgproc_Imgproc_rotatedRectangleIntersection_10(rect1.center.x, rect1.center.y, rect1.size.width, rect1.size.height, rect1.angle, rect2.center.x, rect2.center.y, rect2.size.width, rect2.size.height, rect2.angle, intersectingRegion.nativeObj);
  8529. }
  8530. //
  8531. // C++: Ptr_GeneralizedHoughBallard cv::createGeneralizedHoughBallard()
  8532. //
  8533. /**
  8534. * Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.
  8535. * return automatically generated
  8536. */
  8537. public static GeneralizedHoughBallard createGeneralizedHoughBallard()
  8538. {
  8539. return GeneralizedHoughBallard.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createGeneralizedHoughBallard_10()));
  8540. }
  8541. //
  8542. // C++: Ptr_GeneralizedHoughGuil cv::createGeneralizedHoughGuil()
  8543. //
  8544. /**
  8545. * Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it.
  8546. * return automatically generated
  8547. */
  8548. public static GeneralizedHoughGuil createGeneralizedHoughGuil()
  8549. {
  8550. return GeneralizedHoughGuil.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(imgproc_Imgproc_createGeneralizedHoughGuil_10()));
  8551. }
  8552. //
  8553. // C++: void cv::applyColorMap(Mat src, Mat& dst, int colormap)
  8554. //
  8555. /**
  8556. * Applies a GNU Octave/MATLAB equivalent colormap on a given image.
  8557. *
  8558. * param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.
  8559. * param dst The result is the colormapped source image. Note: Mat::create is called on dst.
  8560. * param colormap The colormap to apply, see #ColormapTypes
  8561. */
  8562. public static void applyColorMap(Mat src, Mat dst, int colormap)
  8563. {
  8564. if (src != null) src.ThrowIfDisposed();
  8565. if (dst != null) dst.ThrowIfDisposed();
  8566. imgproc_Imgproc_applyColorMap_10(src.nativeObj, dst.nativeObj, colormap);
  8567. }
  8568. //
  8569. // C++: void cv::applyColorMap(Mat src, Mat& dst, Mat userColor)
  8570. //
  8571. /**
  8572. * Applies a user colormap on a given image.
  8573. *
  8574. * param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3.
  8575. * param dst The result is the colormapped source image. Note: Mat::create is called on dst.
  8576. * param userColor The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256
  8577. */
  8578. public static void applyColorMap(Mat src, Mat dst, Mat userColor)
  8579. {
  8580. if (src != null) src.ThrowIfDisposed();
  8581. if (dst != null) dst.ThrowIfDisposed();
  8582. if (userColor != null) userColor.ThrowIfDisposed();
  8583. imgproc_Imgproc_applyColorMap_11(src.nativeObj, dst.nativeObj, userColor.nativeObj);
  8584. }
  8585. //
  8586. // C++: void cv::line(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  8587. //
  8588. /**
  8589. * Draws a line segment connecting two points.
  8590. *
  8591. * The function line draws the line segment between pt1 and pt2 points in the image. The line is
  8592. * clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
  8593. * or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
  8594. * lines are drawn using Gaussian filtering.
  8595. *
  8596. * param img Image.
  8597. * param pt1 First point of the line segment.
  8598. * param pt2 Second point of the line segment.
  8599. * param color Line color.
  8600. * param thickness Line thickness.
  8601. * param lineType Type of the line. See #LineTypes.
  8602. * param shift Number of fractional bits in the point coordinates.
  8603. */
  8604. public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift)
  8605. {
  8606. if (img != null) img.ThrowIfDisposed();
  8607. imgproc_Imgproc_line_10(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  8608. }
  8609. /**
  8610. * Draws a line segment connecting two points.
  8611. *
  8612. * The function line draws the line segment between pt1 and pt2 points in the image. The line is
  8613. * clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
  8614. * or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
  8615. * lines are drawn using Gaussian filtering.
  8616. *
  8617. * param img Image.
  8618. * param pt1 First point of the line segment.
  8619. * param pt2 Second point of the line segment.
  8620. * param color Line color.
  8621. * param thickness Line thickness.
  8622. * param lineType Type of the line. See #LineTypes.
  8623. */
  8624. public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType)
  8625. {
  8626. if (img != null) img.ThrowIfDisposed();
  8627. imgproc_Imgproc_line_11(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  8628. }
  8629. /**
  8630. * Draws a line segment connecting two points.
  8631. *
  8632. * The function line draws the line segment between pt1 and pt2 points in the image. The line is
  8633. * clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
  8634. * or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
  8635. * lines are drawn using Gaussian filtering.
  8636. *
  8637. * param img Image.
  8638. * param pt1 First point of the line segment.
  8639. * param pt2 Second point of the line segment.
  8640. * param color Line color.
  8641. * param thickness Line thickness.
  8642. */
  8643. public static void line(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
  8644. {
  8645. if (img != null) img.ThrowIfDisposed();
  8646. imgproc_Imgproc_line_12(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  8647. }
  8648. /**
  8649. * Draws a line segment connecting two points.
  8650. *
  8651. * The function line draws the line segment between pt1 and pt2 points in the image. The line is
  8652. * clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
  8653. * or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
  8654. * lines are drawn using Gaussian filtering.
  8655. *
  8656. * param img Image.
  8657. * param pt1 First point of the line segment.
  8658. * param pt2 Second point of the line segment.
  8659. * param color Line color.
  8660. */
  8661. public static void line(Mat img, Point pt1, Point pt2, Scalar color)
  8662. {
  8663. if (img != null) img.ThrowIfDisposed();
  8664. imgproc_Imgproc_line_13(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3]);
  8665. }
  8666. //
  8667. // C++: void cv::arrowedLine(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int line_type = 8, int shift = 0, double tipLength = 0.1)
  8668. //
  8669. /**
  8670. * Draws an arrow segment pointing from the first point to the second one.
  8671. *
  8672. * The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
  8673. *
  8674. * param img Image.
  8675. * param pt1 The point the arrow starts from.
  8676. * param pt2 The point the arrow points to.
  8677. * param color Line color.
  8678. * param thickness Line thickness.
  8679. * param line_type Type of the line. See #LineTypes
  8680. * param shift Number of fractional bits in the point coordinates.
  8681. * param tipLength The length of the arrow tip in relation to the arrow length
  8682. */
  8683. public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type, int shift, double tipLength)
  8684. {
  8685. if (img != null) img.ThrowIfDisposed();
  8686. imgproc_Imgproc_arrowedLine_10(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, line_type, shift, tipLength);
  8687. }
  8688. /**
  8689. * Draws an arrow segment pointing from the first point to the second one.
  8690. *
  8691. * The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
  8692. *
  8693. * param img Image.
  8694. * param pt1 The point the arrow starts from.
  8695. * param pt2 The point the arrow points to.
  8696. * param color Line color.
  8697. * param thickness Line thickness.
  8698. * param line_type Type of the line. See #LineTypes
  8699. * param shift Number of fractional bits in the point coordinates.
  8700. */
  8701. public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type, int shift)
  8702. {
  8703. if (img != null) img.ThrowIfDisposed();
  8704. imgproc_Imgproc_arrowedLine_11(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, line_type, shift);
  8705. }
  8706. /**
  8707. * Draws an arrow segment pointing from the first point to the second one.
  8708. *
  8709. * The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
  8710. *
  8711. * param img Image.
  8712. * param pt1 The point the arrow starts from.
  8713. * param pt2 The point the arrow points to.
  8714. * param color Line color.
  8715. * param thickness Line thickness.
  8716. * param line_type Type of the line. See #LineTypes
  8717. */
  8718. public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int line_type)
  8719. {
  8720. if (img != null) img.ThrowIfDisposed();
  8721. imgproc_Imgproc_arrowedLine_12(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, line_type);
  8722. }
  8723. /**
  8724. * Draws an arrow segment pointing from the first point to the second one.
  8725. *
  8726. * The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
  8727. *
  8728. * param img Image.
  8729. * param pt1 The point the arrow starts from.
  8730. * param pt2 The point the arrow points to.
  8731. * param color Line color.
  8732. * param thickness Line thickness.
  8733. */
  8734. public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
  8735. {
  8736. if (img != null) img.ThrowIfDisposed();
  8737. imgproc_Imgproc_arrowedLine_13(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  8738. }
  8739. /**
  8740. * Draws an arrow segment pointing from the first point to the second one.
  8741. *
  8742. * The function cv::arrowedLine draws an arrow between pt1 and pt2 points in the image. See also #line.
  8743. *
  8744. * param img Image.
  8745. * param pt1 The point the arrow starts from.
  8746. * param pt2 The point the arrow points to.
  8747. * param color Line color.
  8748. */
  8749. public static void arrowedLine(Mat img, Point pt1, Point pt2, Scalar color)
  8750. {
  8751. if (img != null) img.ThrowIfDisposed();
  8752. imgproc_Imgproc_arrowedLine_14(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3]);
  8753. }
  8754. //
  8755. // C++: void cv::rectangle(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  8756. //
  8757. /**
  8758. * Draws a simple, thick, or filled up-right rectangle.
  8759. *
  8760. * The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
  8761. * are pt1 and pt2.
  8762. *
  8763. * param img Image.
  8764. * param pt1 Vertex of the rectangle.
  8765. * param pt2 Vertex of the rectangle opposite to pt1 .
  8766. * param color Rectangle color or brightness (grayscale image).
  8767. * param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED,
  8768. * mean that the function has to draw a filled rectangle.
  8769. * param lineType Type of the line. See #LineTypes
  8770. * param shift Number of fractional bits in the point coordinates.
  8771. */
  8772. public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType, int shift)
  8773. {
  8774. if (img != null) img.ThrowIfDisposed();
  8775. imgproc_Imgproc_rectangle_10(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  8776. }
  8777. /**
  8778. * Draws a simple, thick, or filled up-right rectangle.
  8779. *
  8780. * The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
  8781. * are pt1 and pt2.
  8782. *
  8783. * param img Image.
  8784. * param pt1 Vertex of the rectangle.
  8785. * param pt2 Vertex of the rectangle opposite to pt1 .
  8786. * param color Rectangle color or brightness (grayscale image).
  8787. * param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED,
  8788. * mean that the function has to draw a filled rectangle.
  8789. * param lineType Type of the line. See #LineTypes
  8790. */
  8791. public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness, int lineType)
  8792. {
  8793. if (img != null) img.ThrowIfDisposed();
  8794. imgproc_Imgproc_rectangle_11(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  8795. }
  8796. /**
  8797. * Draws a simple, thick, or filled up-right rectangle.
  8798. *
  8799. * The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
  8800. * are pt1 and pt2.
  8801. *
  8802. * param img Image.
  8803. * param pt1 Vertex of the rectangle.
  8804. * param pt2 Vertex of the rectangle opposite to pt1 .
  8805. * param color Rectangle color or brightness (grayscale image).
  8806. * param thickness Thickness of lines that make up the rectangle. Negative values, like #FILLED,
  8807. * mean that the function has to draw a filled rectangle.
  8808. */
  8809. public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color, int thickness)
  8810. {
  8811. if (img != null) img.ThrowIfDisposed();
  8812. imgproc_Imgproc_rectangle_12(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  8813. }
  8814. /**
  8815. * Draws a simple, thick, or filled up-right rectangle.
  8816. *
  8817. * The function cv::rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
  8818. * are pt1 and pt2.
  8819. *
  8820. * param img Image.
  8821. * param pt1 Vertex of the rectangle.
  8822. * param pt2 Vertex of the rectangle opposite to pt1 .
  8823. * param color Rectangle color or brightness (grayscale image).
  8824. * mean that the function has to draw a filled rectangle.
  8825. */
  8826. public static void rectangle(Mat img, Point pt1, Point pt2, Scalar color)
  8827. {
  8828. if (img != null) img.ThrowIfDisposed();
  8829. imgproc_Imgproc_rectangle_13(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3]);
  8830. }
  8831. //
  8832. // C++: void cv::rectangle(Mat& img, Rect rec, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  8833. //
  8834. /**
  8835. *
  8836. *
  8837. * use {code rec} parameter as alternative specification of the drawn rectangle: `r.tl() and
  8838. * r.br()-Point(1,1)` are opposite corners
  8839. * param img automatically generated
  8840. * param rec automatically generated
  8841. * param color automatically generated
  8842. * param thickness automatically generated
  8843. * param lineType automatically generated
  8844. * param shift automatically generated
  8845. */
  8846. public static void rectangle(Mat img, Rect rec, Scalar color, int thickness, int lineType, int shift)
  8847. {
  8848. if (img != null) img.ThrowIfDisposed();
  8849. imgproc_Imgproc_rectangle_14(img.nativeObj, rec.x, rec.y, rec.width, rec.height, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  8850. }
  8851. /**
  8852. *
  8853. *
  8854. * use {code rec} parameter as alternative specification of the drawn rectangle: `r.tl() and
  8855. * r.br()-Point(1,1)` are opposite corners
  8856. * param img automatically generated
  8857. * param rec automatically generated
  8858. * param color automatically generated
  8859. * param thickness automatically generated
  8860. * param lineType automatically generated
  8861. */
  8862. public static void rectangle(Mat img, Rect rec, Scalar color, int thickness, int lineType)
  8863. {
  8864. if (img != null) img.ThrowIfDisposed();
  8865. imgproc_Imgproc_rectangle_15(img.nativeObj, rec.x, rec.y, rec.width, rec.height, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  8866. }
  8867. /**
  8868. *
  8869. *
  8870. * use {code rec} parameter as alternative specification of the drawn rectangle: `r.tl() and
  8871. * r.br()-Point(1,1)` are opposite corners
  8872. * param img automatically generated
  8873. * param rec automatically generated
  8874. * param color automatically generated
  8875. * param thickness automatically generated
  8876. */
  8877. public static void rectangle(Mat img, Rect rec, Scalar color, int thickness)
  8878. {
  8879. if (img != null) img.ThrowIfDisposed();
  8880. imgproc_Imgproc_rectangle_16(img.nativeObj, rec.x, rec.y, rec.width, rec.height, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  8881. }
  8882. /**
  8883. *
  8884. *
  8885. * use {code rec} parameter as alternative specification of the drawn rectangle: `r.tl() and
  8886. * r.br()-Point(1,1)` are opposite corners
  8887. * param img automatically generated
  8888. * param rec automatically generated
  8889. * param color automatically generated
  8890. */
  8891. public static void rectangle(Mat img, Rect rec, Scalar color)
  8892. {
  8893. if (img != null) img.ThrowIfDisposed();
  8894. imgproc_Imgproc_rectangle_17(img.nativeObj, rec.x, rec.y, rec.width, rec.height, color.val[0], color.val[1], color.val[2], color.val[3]);
  8895. }
  8896. //
  8897. // C++: void cv::circle(Mat& img, Point center, int radius, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  8898. //
  8899. /**
  8900. * Draws a circle.
  8901. *
  8902. * The function cv::circle draws a simple or filled circle with a given center and radius.
  8903. * param img Image where the circle is drawn.
  8904. * param center Center of the circle.
  8905. * param radius Radius of the circle.
  8906. * param color Circle color.
  8907. * param thickness Thickness of the circle outline, if positive. Negative values, like #FILLED,
  8908. * mean that a filled circle is to be drawn.
  8909. * param lineType Type of the circle boundary. See #LineTypes
  8910. * param shift Number of fractional bits in the coordinates of the center and in the radius value.
  8911. */
  8912. public static void circle(Mat img, Point center, int radius, Scalar color, int thickness, int lineType, int shift)
  8913. {
  8914. if (img != null) img.ThrowIfDisposed();
  8915. imgproc_Imgproc_circle_10(img.nativeObj, center.x, center.y, radius, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  8916. }
  8917. /**
  8918. * Draws a circle.
  8919. *
  8920. * The function cv::circle draws a simple or filled circle with a given center and radius.
  8921. * param img Image where the circle is drawn.
  8922. * param center Center of the circle.
  8923. * param radius Radius of the circle.
  8924. * param color Circle color.
  8925. * param thickness Thickness of the circle outline, if positive. Negative values, like #FILLED,
  8926. * mean that a filled circle is to be drawn.
  8927. * param lineType Type of the circle boundary. See #LineTypes
  8928. */
  8929. public static void circle(Mat img, Point center, int radius, Scalar color, int thickness, int lineType)
  8930. {
  8931. if (img != null) img.ThrowIfDisposed();
  8932. imgproc_Imgproc_circle_11(img.nativeObj, center.x, center.y, radius, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  8933. }
  8934. /**
  8935. * Draws a circle.
  8936. *
  8937. * The function cv::circle draws a simple or filled circle with a given center and radius.
  8938. * param img Image where the circle is drawn.
  8939. * param center Center of the circle.
  8940. * param radius Radius of the circle.
  8941. * param color Circle color.
  8942. * param thickness Thickness of the circle outline, if positive. Negative values, like #FILLED,
  8943. * mean that a filled circle is to be drawn.
  8944. */
  8945. public static void circle(Mat img, Point center, int radius, Scalar color, int thickness)
  8946. {
  8947. if (img != null) img.ThrowIfDisposed();
  8948. imgproc_Imgproc_circle_12(img.nativeObj, center.x, center.y, radius, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  8949. }
  8950. /**
  8951. * Draws a circle.
  8952. *
  8953. * The function cv::circle draws a simple or filled circle with a given center and radius.
  8954. * param img Image where the circle is drawn.
  8955. * param center Center of the circle.
  8956. * param radius Radius of the circle.
  8957. * param color Circle color.
  8958. * mean that a filled circle is to be drawn.
  8959. */
  8960. public static void circle(Mat img, Point center, int radius, Scalar color)
  8961. {
  8962. if (img != null) img.ThrowIfDisposed();
  8963. imgproc_Imgproc_circle_13(img.nativeObj, center.x, center.y, radius, color.val[0], color.val[1], color.val[2], color.val[3]);
  8964. }
  8965. //
  8966. // C++: void cv::ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  8967. //
  8968. /**
  8969. * Draws a simple or thick elliptic arc or fills an ellipse sector.
  8970. *
  8971. * The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic
  8972. * arc, or a filled ellipse sector. The drawing code uses general parametric form.
  8973. * A piecewise-linear curve is used to approximate the elliptic arc
  8974. * boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
  8975. * #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first
  8976. * variant of the function and want to draw the whole ellipse, not an arc, pass {code startAngle=0} and
  8977. * {code endAngle=360}. If {code startAngle} is greater than {code endAngle}, they are swapped. The figure below explains
  8978. * the meaning of the parameters to draw the blue arc.
  8979. *
  8980. * ![Parameters of Elliptic Arc](pics/ellipse.svg)
  8981. *
  8982. * param img Image.
  8983. * param center Center of the ellipse.
  8984. * param axes Half of the size of the ellipse main axes.
  8985. * param angle Ellipse rotation angle in degrees.
  8986. * param startAngle Starting angle of the elliptic arc in degrees.
  8987. * param endAngle Ending angle of the elliptic arc in degrees.
  8988. * param color Ellipse color.
  8989. * param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
  8990. * a filled ellipse sector is to be drawn.
  8991. * param lineType Type of the ellipse boundary. See #LineTypes
  8992. * param shift Number of fractional bits in the coordinates of the center and values of axes.
  8993. */
  8994. public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType, int shift)
  8995. {
  8996. if (img != null) img.ThrowIfDisposed();
  8997. imgproc_Imgproc_ellipse_10(img.nativeObj, center.x, center.y, axes.width, axes.height, angle, startAngle, endAngle, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  8998. }
  8999. /**
  9000. * Draws a simple or thick elliptic arc or fills an ellipse sector.
  9001. *
  9002. * The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic
  9003. * arc, or a filled ellipse sector. The drawing code uses general parametric form.
  9004. * A piecewise-linear curve is used to approximate the elliptic arc
  9005. * boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
  9006. * #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first
  9007. * variant of the function and want to draw the whole ellipse, not an arc, pass {code startAngle=0} and
  9008. * {code endAngle=360}. If {code startAngle} is greater than {code endAngle}, they are swapped. The figure below explains
  9009. * the meaning of the parameters to draw the blue arc.
  9010. *
  9011. * ![Parameters of Elliptic Arc](pics/ellipse.svg)
  9012. *
  9013. * param img Image.
  9014. * param center Center of the ellipse.
  9015. * param axes Half of the size of the ellipse main axes.
  9016. * param angle Ellipse rotation angle in degrees.
  9017. * param startAngle Starting angle of the elliptic arc in degrees.
  9018. * param endAngle Ending angle of the elliptic arc in degrees.
  9019. * param color Ellipse color.
  9020. * param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
  9021. * a filled ellipse sector is to be drawn.
  9022. * param lineType Type of the ellipse boundary. See #LineTypes
  9023. */
  9024. public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness, int lineType)
  9025. {
  9026. if (img != null) img.ThrowIfDisposed();
  9027. imgproc_Imgproc_ellipse_11(img.nativeObj, center.x, center.y, axes.width, axes.height, angle, startAngle, endAngle, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  9028. }
  9029. /**
  9030. * Draws a simple or thick elliptic arc or fills an ellipse sector.
  9031. *
  9032. * The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic
  9033. * arc, or a filled ellipse sector. The drawing code uses general parametric form.
  9034. * A piecewise-linear curve is used to approximate the elliptic arc
  9035. * boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
  9036. * #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first
  9037. * variant of the function and want to draw the whole ellipse, not an arc, pass {code startAngle=0} and
  9038. * {code endAngle=360}. If {code startAngle} is greater than {code endAngle}, they are swapped. The figure below explains
  9039. * the meaning of the parameters to draw the blue arc.
  9040. *
  9041. * ![Parameters of Elliptic Arc](pics/ellipse.svg)
  9042. *
  9043. * param img Image.
  9044. * param center Center of the ellipse.
  9045. * param axes Half of the size of the ellipse main axes.
  9046. * param angle Ellipse rotation angle in degrees.
  9047. * param startAngle Starting angle of the elliptic arc in degrees.
  9048. * param endAngle Ending angle of the elliptic arc in degrees.
  9049. * param color Ellipse color.
  9050. * param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
  9051. * a filled ellipse sector is to be drawn.
  9052. */
  9053. public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness)
  9054. {
  9055. if (img != null) img.ThrowIfDisposed();
  9056. imgproc_Imgproc_ellipse_12(img.nativeObj, center.x, center.y, axes.width, axes.height, angle, startAngle, endAngle, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  9057. }
  9058. /**
  9059. * Draws a simple or thick elliptic arc or fills an ellipse sector.
  9060. *
  9061. * The function cv::ellipse with more parameters draws an ellipse outline, a filled ellipse, an elliptic
  9062. * arc, or a filled ellipse sector. The drawing code uses general parametric form.
  9063. * A piecewise-linear curve is used to approximate the elliptic arc
  9064. * boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
  9065. * #ellipse2Poly and then render it with #polylines or fill it with #fillPoly. If you use the first
  9066. * variant of the function and want to draw the whole ellipse, not an arc, pass {code startAngle=0} and
  9067. * {code endAngle=360}. If {code startAngle} is greater than {code endAngle}, they are swapped. The figure below explains
  9068. * the meaning of the parameters to draw the blue arc.
  9069. *
  9070. * ![Parameters of Elliptic Arc](pics/ellipse.svg)
  9071. *
  9072. * param img Image.
  9073. * param center Center of the ellipse.
  9074. * param axes Half of the size of the ellipse main axes.
  9075. * param angle Ellipse rotation angle in degrees.
  9076. * param startAngle Starting angle of the elliptic arc in degrees.
  9077. * param endAngle Ending angle of the elliptic arc in degrees.
  9078. * param color Ellipse color.
  9079. * a filled ellipse sector is to be drawn.
  9080. */
  9081. public static void ellipse(Mat img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color)
  9082. {
  9083. if (img != null) img.ThrowIfDisposed();
  9084. imgproc_Imgproc_ellipse_13(img.nativeObj, center.x, center.y, axes.width, axes.height, angle, startAngle, endAngle, color.val[0], color.val[1], color.val[2], color.val[3]);
  9085. }
  9086. //
  9087. // C++: void cv::ellipse(Mat& img, RotatedRect box, Scalar color, int thickness = 1, int lineType = LINE_8)
  9088. //
  9089. /**
  9090. *
  9091. * param img Image.
  9092. * param box Alternative ellipse representation via RotatedRect. This means that the function draws
  9093. * an ellipse inscribed in the rotated rectangle.
  9094. * param color Ellipse color.
  9095. * param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
  9096. * a filled ellipse sector is to be drawn.
  9097. * param lineType Type of the ellipse boundary. See #LineTypes
  9098. */
  9099. public static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness, int lineType)
  9100. {
  9101. if (img != null) img.ThrowIfDisposed();
  9102. imgproc_Imgproc_ellipse_14(img.nativeObj, box.center.x, box.center.y, box.size.width, box.size.height, box.angle, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  9103. }
  9104. /**
  9105. *
  9106. * param img Image.
  9107. * param box Alternative ellipse representation via RotatedRect. This means that the function draws
  9108. * an ellipse inscribed in the rotated rectangle.
  9109. * param color Ellipse color.
  9110. * param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
  9111. * a filled ellipse sector is to be drawn.
  9112. */
  9113. public static void ellipse(Mat img, RotatedRect box, Scalar color, int thickness)
  9114. {
  9115. if (img != null) img.ThrowIfDisposed();
  9116. imgproc_Imgproc_ellipse_15(img.nativeObj, box.center.x, box.center.y, box.size.width, box.size.height, box.angle, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  9117. }
  9118. /**
  9119. *
  9120. * param img Image.
  9121. * param box Alternative ellipse representation via RotatedRect. This means that the function draws
  9122. * an ellipse inscribed in the rotated rectangle.
  9123. * param color Ellipse color.
  9124. * a filled ellipse sector is to be drawn.
  9125. */
  9126. public static void ellipse(Mat img, RotatedRect box, Scalar color)
  9127. {
  9128. if (img != null) img.ThrowIfDisposed();
  9129. imgproc_Imgproc_ellipse_16(img.nativeObj, box.center.x, box.center.y, box.size.width, box.size.height, box.angle, color.val[0], color.val[1], color.val[2], color.val[3]);
  9130. }
  9131. //
  9132. // C++: void cv::drawMarker(Mat& img, Point position, Scalar color, int markerType = MARKER_CROSS, int markerSize = 20, int thickness = 1, int line_type = 8)
  9133. //
  9134. /**
  9135. * Draws a marker on a predefined position in an image.
  9136. *
  9137. * The function cv::drawMarker draws a marker on a given position in the image. For the moment several
  9138. * marker types are supported, see #MarkerTypes for more information.
  9139. *
  9140. * param img Image.
  9141. * param position The point where the crosshair is positioned.
  9142. * param color Line color.
  9143. * param markerType The specific type of marker you want to use, see #MarkerTypes
  9144. * param thickness Line thickness.
  9145. * param line_type Type of the line, See #LineTypes
  9146. * param markerSize The length of the marker axis [default = 20 pixels]
  9147. */
  9148. public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize, int thickness, int line_type)
  9149. {
  9150. if (img != null) img.ThrowIfDisposed();
  9151. imgproc_Imgproc_drawMarker_10(img.nativeObj, position.x, position.y, color.val[0], color.val[1], color.val[2], color.val[3], markerType, markerSize, thickness, line_type);
  9152. }
  9153. /**
  9154. * Draws a marker on a predefined position in an image.
  9155. *
  9156. * The function cv::drawMarker draws a marker on a given position in the image. For the moment several
  9157. * marker types are supported, see #MarkerTypes for more information.
  9158. *
  9159. * param img Image.
  9160. * param position The point where the crosshair is positioned.
  9161. * param color Line color.
  9162. * param markerType The specific type of marker you want to use, see #MarkerTypes
  9163. * param thickness Line thickness.
  9164. * param markerSize The length of the marker axis [default = 20 pixels]
  9165. */
  9166. public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize, int thickness)
  9167. {
  9168. if (img != null) img.ThrowIfDisposed();
  9169. imgproc_Imgproc_drawMarker_11(img.nativeObj, position.x, position.y, color.val[0], color.val[1], color.val[2], color.val[3], markerType, markerSize, thickness);
  9170. }
  9171. /**
  9172. * Draws a marker on a predefined position in an image.
  9173. *
  9174. * The function cv::drawMarker draws a marker on a given position in the image. For the moment several
  9175. * marker types are supported, see #MarkerTypes for more information.
  9176. *
  9177. * param img Image.
  9178. * param position The point where the crosshair is positioned.
  9179. * param color Line color.
  9180. * param markerType The specific type of marker you want to use, see #MarkerTypes
  9181. * param markerSize The length of the marker axis [default = 20 pixels]
  9182. */
  9183. public static void drawMarker(Mat img, Point position, Scalar color, int markerType, int markerSize)
  9184. {
  9185. if (img != null) img.ThrowIfDisposed();
  9186. imgproc_Imgproc_drawMarker_12(img.nativeObj, position.x, position.y, color.val[0], color.val[1], color.val[2], color.val[3], markerType, markerSize);
  9187. }
  9188. /**
  9189. * Draws a marker on a predefined position in an image.
  9190. *
  9191. * The function cv::drawMarker draws a marker on a given position in the image. For the moment several
  9192. * marker types are supported, see #MarkerTypes for more information.
  9193. *
  9194. * param img Image.
  9195. * param position The point where the crosshair is positioned.
  9196. * param color Line color.
  9197. * param markerType The specific type of marker you want to use, see #MarkerTypes
  9198. */
  9199. public static void drawMarker(Mat img, Point position, Scalar color, int markerType)
  9200. {
  9201. if (img != null) img.ThrowIfDisposed();
  9202. imgproc_Imgproc_drawMarker_13(img.nativeObj, position.x, position.y, color.val[0], color.val[1], color.val[2], color.val[3], markerType);
  9203. }
  9204. /**
  9205. * Draws a marker on a predefined position in an image.
  9206. *
  9207. * The function cv::drawMarker draws a marker on a given position in the image. For the moment several
  9208. * marker types are supported, see #MarkerTypes for more information.
  9209. *
  9210. * param img Image.
  9211. * param position The point where the crosshair is positioned.
  9212. * param color Line color.
  9213. */
  9214. public static void drawMarker(Mat img, Point position, Scalar color)
  9215. {
  9216. if (img != null) img.ThrowIfDisposed();
  9217. imgproc_Imgproc_drawMarker_14(img.nativeObj, position.x, position.y, color.val[0], color.val[1], color.val[2], color.val[3]);
  9218. }
  9219. //
  9220. // C++: void cv::fillConvexPoly(Mat& img, vector_Point points, Scalar color, int lineType = LINE_8, int shift = 0)
  9221. //
  9222. /**
  9223. * Fills a convex polygon.
  9224. *
  9225. * The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the
  9226. * function #fillPoly . It can fill not only convex polygons but any monotonic polygon without
  9227. * self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
  9228. * twice at the most (though, its top-most and/or the bottom edge could be horizontal).
  9229. *
  9230. * param img Image.
  9231. * param points Polygon vertices.
  9232. * param color Polygon color.
  9233. * param lineType Type of the polygon boundaries. See #LineTypes
  9234. * param shift Number of fractional bits in the vertex coordinates.
  9235. */
  9236. public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color, int lineType, int shift)
  9237. {
  9238. if (img != null) img.ThrowIfDisposed();
  9239. if (points != null) points.ThrowIfDisposed();
  9240. Mat points_mat = points;
  9241. imgproc_Imgproc_fillConvexPoly_10(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType, shift);
  9242. }
  9243. /**
  9244. * Fills a convex polygon.
  9245. *
  9246. * The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the
  9247. * function #fillPoly . It can fill not only convex polygons but any monotonic polygon without
  9248. * self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
  9249. * twice at the most (though, its top-most and/or the bottom edge could be horizontal).
  9250. *
  9251. * param img Image.
  9252. * param points Polygon vertices.
  9253. * param color Polygon color.
  9254. * param lineType Type of the polygon boundaries. See #LineTypes
  9255. */
  9256. public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color, int lineType)
  9257. {
  9258. if (img != null) img.ThrowIfDisposed();
  9259. if (points != null) points.ThrowIfDisposed();
  9260. Mat points_mat = points;
  9261. imgproc_Imgproc_fillConvexPoly_11(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType);
  9262. }
  9263. /**
  9264. * Fills a convex polygon.
  9265. *
  9266. * The function cv::fillConvexPoly draws a filled convex polygon. This function is much faster than the
  9267. * function #fillPoly . It can fill not only convex polygons but any monotonic polygon without
  9268. * self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
  9269. * twice at the most (though, its top-most and/or the bottom edge could be horizontal).
  9270. *
  9271. * param img Image.
  9272. * param points Polygon vertices.
  9273. * param color Polygon color.
  9274. */
  9275. public static void fillConvexPoly(Mat img, MatOfPoint points, Scalar color)
  9276. {
  9277. if (img != null) img.ThrowIfDisposed();
  9278. if (points != null) points.ThrowIfDisposed();
  9279. Mat points_mat = points;
  9280. imgproc_Imgproc_fillConvexPoly_12(img.nativeObj, points_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);
  9281. }
  9282. //
  9283. // C++: void cv::fillPoly(Mat& img, vector_vector_Point pts, Scalar color, int lineType = LINE_8, int shift = 0, Point offset = Point())
  9284. //
  9285. /**
  9286. * Fills the area bounded by one or more polygons.
  9287. *
  9288. * The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill
  9289. * complex areas, for example, areas with holes, contours with self-intersections (some of their
  9290. * parts), and so forth.
  9291. *
  9292. * param img Image.
  9293. * param pts Array of polygons where each polygon is represented as an array of points.
  9294. * param color Polygon color.
  9295. * param lineType Type of the polygon boundaries. See #LineTypes
  9296. * param shift Number of fractional bits in the vertex coordinates.
  9297. * param offset Optional offset of all points of the contours.
  9298. */
  9299. public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType, int shift, Point offset)
  9300. {
  9301. if (img != null) img.ThrowIfDisposed();
  9302. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9303. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9304. imgproc_Imgproc_fillPoly_10(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType, shift, offset.x, offset.y);
  9305. }
  9306. /**
  9307. * Fills the area bounded by one or more polygons.
  9308. *
  9309. * The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill
  9310. * complex areas, for example, areas with holes, contours with self-intersections (some of their
  9311. * parts), and so forth.
  9312. *
  9313. * param img Image.
  9314. * param pts Array of polygons where each polygon is represented as an array of points.
  9315. * param color Polygon color.
  9316. * param lineType Type of the polygon boundaries. See #LineTypes
  9317. * param shift Number of fractional bits in the vertex coordinates.
  9318. */
  9319. public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType, int shift)
  9320. {
  9321. if (img != null) img.ThrowIfDisposed();
  9322. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9323. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9324. imgproc_Imgproc_fillPoly_11(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType, shift);
  9325. }
  9326. /**
  9327. * Fills the area bounded by one or more polygons.
  9328. *
  9329. * The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill
  9330. * complex areas, for example, areas with holes, contours with self-intersections (some of their
  9331. * parts), and so forth.
  9332. *
  9333. * param img Image.
  9334. * param pts Array of polygons where each polygon is represented as an array of points.
  9335. * param color Polygon color.
  9336. * param lineType Type of the polygon boundaries. See #LineTypes
  9337. */
  9338. public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color, int lineType)
  9339. {
  9340. if (img != null) img.ThrowIfDisposed();
  9341. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9342. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9343. imgproc_Imgproc_fillPoly_12(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], lineType);
  9344. }
  9345. /**
  9346. * Fills the area bounded by one or more polygons.
  9347. *
  9348. * The function cv::fillPoly fills an area bounded by several polygonal contours. The function can fill
  9349. * complex areas, for example, areas with holes, contours with self-intersections (some of their
  9350. * parts), and so forth.
  9351. *
  9352. * param img Image.
  9353. * param pts Array of polygons where each polygon is represented as an array of points.
  9354. * param color Polygon color.
  9355. */
  9356. public static void fillPoly(Mat img, List<MatOfPoint> pts, Scalar color)
  9357. {
  9358. if (img != null) img.ThrowIfDisposed();
  9359. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9360. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9361. imgproc_Imgproc_fillPoly_13(img.nativeObj, pts_mat.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);
  9362. }
  9363. //
  9364. // C++: void cv::polylines(Mat& img, vector_vector_Point pts, bool isClosed, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  9365. //
  9366. /**
  9367. * Draws several polygonal curves.
  9368. *
  9369. * param img Image.
  9370. * param pts Array of polygonal curves.
  9371. * param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
  9372. * the function draws a line from the last vertex of each curve to its first vertex.
  9373. * param color Polyline color.
  9374. * param thickness Thickness of the polyline edges.
  9375. * param lineType Type of the line segments. See #LineTypes
  9376. * param shift Number of fractional bits in the vertex coordinates.
  9377. *
  9378. * The function cv::polylines draws one or more polygonal curves.
  9379. */
  9380. public static void polylines(Mat img, List<MatOfPoint> pts, bool isClosed, Scalar color, int thickness, int lineType, int shift)
  9381. {
  9382. if (img != null) img.ThrowIfDisposed();
  9383. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9384. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9385. imgproc_Imgproc_polylines_10(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, shift);
  9386. }
  9387. /**
  9388. * Draws several polygonal curves.
  9389. *
  9390. * param img Image.
  9391. * param pts Array of polygonal curves.
  9392. * param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
  9393. * the function draws a line from the last vertex of each curve to its first vertex.
  9394. * param color Polyline color.
  9395. * param thickness Thickness of the polyline edges.
  9396. * param lineType Type of the line segments. See #LineTypes
  9397. *
  9398. * The function cv::polylines draws one or more polygonal curves.
  9399. */
  9400. public static void polylines(Mat img, List<MatOfPoint> pts, bool isClosed, Scalar color, int thickness, int lineType)
  9401. {
  9402. if (img != null) img.ThrowIfDisposed();
  9403. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9404. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9405. imgproc_Imgproc_polylines_11(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  9406. }
  9407. /**
  9408. * Draws several polygonal curves.
  9409. *
  9410. * param img Image.
  9411. * param pts Array of polygonal curves.
  9412. * param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
  9413. * the function draws a line from the last vertex of each curve to its first vertex.
  9414. * param color Polyline color.
  9415. * param thickness Thickness of the polyline edges.
  9416. *
  9417. * The function cv::polylines draws one or more polygonal curves.
  9418. */
  9419. public static void polylines(Mat img, List<MatOfPoint> pts, bool isClosed, Scalar color, int thickness)
  9420. {
  9421. if (img != null) img.ThrowIfDisposed();
  9422. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9423. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9424. imgproc_Imgproc_polylines_12(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  9425. }
  9426. /**
  9427. * Draws several polygonal curves.
  9428. *
  9429. * param img Image.
  9430. * param pts Array of polygonal curves.
  9431. * param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
  9432. * the function draws a line from the last vertex of each curve to its first vertex.
  9433. * param color Polyline color.
  9434. *
  9435. * The function cv::polylines draws one or more polygonal curves.
  9436. */
  9437. public static void polylines(Mat img, List<MatOfPoint> pts, bool isClosed, Scalar color)
  9438. {
  9439. if (img != null) img.ThrowIfDisposed();
  9440. List<Mat> pts_tmplm = new List<Mat>((pts != null) ? pts.Count : 0);
  9441. Mat pts_mat = Converters.vector_vector_Point_to_Mat(pts, pts_tmplm);
  9442. imgproc_Imgproc_polylines_13(img.nativeObj, pts_mat.nativeObj, isClosed, color.val[0], color.val[1], color.val[2], color.val[3]);
  9443. }
  9444. //
  9445. // C++: void cv::drawContours(Mat& image, vector_vector_Point contours, int contourIdx, Scalar color, int thickness = 1, int lineType = LINE_8, Mat hierarchy = Mat(), int maxLevel = INT_MAX, Point offset = Point())
  9446. //
  9447. /**
  9448. * Draws contours outlines or filled contours.
  9449. *
  9450. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9451. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9452. * connected components from the binary image and label them: :
  9453. * INCLUDE: snippets/imgproc_drawContours.cpp
  9454. *
  9455. * param image Destination image.
  9456. * param contours All the input contours. Each contour is stored as a point vector.
  9457. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9458. * param color Color of the contours.
  9459. * param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
  9460. * thickness=#FILLED ), the contour interiors are drawn.
  9461. * param lineType Line connectivity. See #LineTypes
  9462. * param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
  9463. * some of the contours (see maxLevel ).
  9464. * param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
  9465. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9466. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9467. * parameter is only taken into account when there is hierarchy available.
  9468. * param offset Optional contour shift parameter. Shift all the drawn contours by the specified
  9469. * \(\texttt{offset}=(dx,dy)\) .
  9470. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9471. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9472. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9473. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9474. * of contours, or iterate over the collection using contourIdx parameter.
  9475. */
  9476. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel, Point offset)
  9477. {
  9478. if (image != null) image.ThrowIfDisposed();
  9479. if (hierarchy != null) hierarchy.ThrowIfDisposed();
  9480. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9481. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9482. imgproc_Imgproc_drawContours_10(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj, maxLevel, offset.x, offset.y);
  9483. }
  9484. /**
  9485. * Draws contours outlines or filled contours.
  9486. *
  9487. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9488. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9489. * connected components from the binary image and label them: :
  9490. * INCLUDE: snippets/imgproc_drawContours.cpp
  9491. *
  9492. * param image Destination image.
  9493. * param contours All the input contours. Each contour is stored as a point vector.
  9494. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9495. * param color Color of the contours.
  9496. * param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
  9497. * thickness=#FILLED ), the contour interiors are drawn.
  9498. * param lineType Line connectivity. See #LineTypes
  9499. * param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
  9500. * some of the contours (see maxLevel ).
  9501. * param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
  9502. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9503. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9504. * parameter is only taken into account when there is hierarchy available.
  9505. * \(\texttt{offset}=(dx,dy)\) .
  9506. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9507. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9508. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9509. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9510. * of contours, or iterate over the collection using contourIdx parameter.
  9511. */
  9512. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy, int maxLevel)
  9513. {
  9514. if (image != null) image.ThrowIfDisposed();
  9515. if (hierarchy != null) hierarchy.ThrowIfDisposed();
  9516. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9517. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9518. imgproc_Imgproc_drawContours_11(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj, maxLevel);
  9519. }
  9520. /**
  9521. * Draws contours outlines or filled contours.
  9522. *
  9523. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9524. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9525. * connected components from the binary image and label them: :
  9526. * INCLUDE: snippets/imgproc_drawContours.cpp
  9527. *
  9528. * param image Destination image.
  9529. * param contours All the input contours. Each contour is stored as a point vector.
  9530. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9531. * param color Color of the contours.
  9532. * param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
  9533. * thickness=#FILLED ), the contour interiors are drawn.
  9534. * param lineType Line connectivity. See #LineTypes
  9535. * param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
  9536. * some of the contours (see maxLevel ).
  9537. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9538. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9539. * parameter is only taken into account when there is hierarchy available.
  9540. * \(\texttt{offset}=(dx,dy)\) .
  9541. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9542. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9543. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9544. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9545. * of contours, or iterate over the collection using contourIdx parameter.
  9546. */
  9547. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType, Mat hierarchy)
  9548. {
  9549. if (image != null) image.ThrowIfDisposed();
  9550. if (hierarchy != null) hierarchy.ThrowIfDisposed();
  9551. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9552. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9553. imgproc_Imgproc_drawContours_12(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, hierarchy.nativeObj);
  9554. }
  9555. /**
  9556. * Draws contours outlines or filled contours.
  9557. *
  9558. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9559. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9560. * connected components from the binary image and label them: :
  9561. * INCLUDE: snippets/imgproc_drawContours.cpp
  9562. *
  9563. * param image Destination image.
  9564. * param contours All the input contours. Each contour is stored as a point vector.
  9565. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9566. * param color Color of the contours.
  9567. * param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
  9568. * thickness=#FILLED ), the contour interiors are drawn.
  9569. * param lineType Line connectivity. See #LineTypes
  9570. * some of the contours (see maxLevel ).
  9571. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9572. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9573. * parameter is only taken into account when there is hierarchy available.
  9574. * \(\texttt{offset}=(dx,dy)\) .
  9575. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9576. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9577. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9578. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9579. * of contours, or iterate over the collection using contourIdx parameter.
  9580. */
  9581. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness, int lineType)
  9582. {
  9583. if (image != null) image.ThrowIfDisposed();
  9584. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9585. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9586. imgproc_Imgproc_drawContours_13(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  9587. }
  9588. /**
  9589. * Draws contours outlines or filled contours.
  9590. *
  9591. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9592. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9593. * connected components from the binary image and label them: :
  9594. * INCLUDE: snippets/imgproc_drawContours.cpp
  9595. *
  9596. * param image Destination image.
  9597. * param contours All the input contours. Each contour is stored as a point vector.
  9598. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9599. * param color Color of the contours.
  9600. * param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
  9601. * thickness=#FILLED ), the contour interiors are drawn.
  9602. * some of the contours (see maxLevel ).
  9603. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9604. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9605. * parameter is only taken into account when there is hierarchy available.
  9606. * \(\texttt{offset}=(dx,dy)\) .
  9607. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9608. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9609. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9610. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9611. * of contours, or iterate over the collection using contourIdx parameter.
  9612. */
  9613. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color, int thickness)
  9614. {
  9615. if (image != null) image.ThrowIfDisposed();
  9616. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9617. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9618. imgproc_Imgproc_drawContours_14(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  9619. }
  9620. /**
  9621. * Draws contours outlines or filled contours.
  9622. *
  9623. * The function draws contour outlines in the image if \(\texttt{thickness} \ge 0\) or fills the area
  9624. * bounded by the contours if \(\texttt{thickness}&lt;0\) . The example below shows how to retrieve
  9625. * connected components from the binary image and label them: :
  9626. * INCLUDE: snippets/imgproc_drawContours.cpp
  9627. *
  9628. * param image Destination image.
  9629. * param contours All the input contours. Each contour is stored as a point vector.
  9630. * param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
  9631. * param color Color of the contours.
  9632. * thickness=#FILLED ), the contour interiors are drawn.
  9633. * some of the contours (see maxLevel ).
  9634. * If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
  9635. * draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
  9636. * parameter is only taken into account when there is hierarchy available.
  9637. * \(\texttt{offset}=(dx,dy)\) .
  9638. * <b>Note:</b> When thickness=#FILLED, the function is designed to handle connected components with holes correctly
  9639. * even when no hierarchy data is provided. This is done by analyzing all the outlines together
  9640. * using even-odd rule. This may give incorrect results if you have a joint collection of separately retrieved
  9641. * contours. In order to solve this problem, you need to call #drawContours separately for each sub-group
  9642. * of contours, or iterate over the collection using contourIdx parameter.
  9643. */
  9644. public static void drawContours(Mat image, List<MatOfPoint> contours, int contourIdx, Scalar color)
  9645. {
  9646. if (image != null) image.ThrowIfDisposed();
  9647. List<Mat> contours_tmplm = new List<Mat>((contours != null) ? contours.Count : 0);
  9648. Mat contours_mat = Converters.vector_vector_Point_to_Mat(contours, contours_tmplm);
  9649. imgproc_Imgproc_drawContours_15(image.nativeObj, contours_mat.nativeObj, contourIdx, color.val[0], color.val[1], color.val[2], color.val[3]);
  9650. }
  9651. //
  9652. // C++: bool cv::clipLine(Rect imgRect, Point& pt1, Point& pt2)
  9653. //
  9654. /**
  9655. *
  9656. * param imgRect Image rectangle.
  9657. * param pt1 First line point.
  9658. * param pt2 Second line point.
  9659. * return automatically generated
  9660. */
  9661. public static bool clipLine(Rect imgRect, Point pt1, Point pt2)
  9662. {
  9663. double[] pt1_out = new double[2];
  9664. double[] pt2_out = new double[2];
  9665. bool retVal = imgproc_Imgproc_clipLine_10(imgRect.x, imgRect.y, imgRect.width, imgRect.height, pt1.x, pt1.y, pt1_out, pt2.x, pt2.y, pt2_out);
  9666. if (pt1 != null) { pt1.x = pt1_out[0]; pt1.y = pt1_out[1]; }
  9667. if (pt2 != null) { pt2.x = pt2_out[0]; pt2.y = pt2_out[1]; }
  9668. return retVal;
  9669. }
  9670. //
  9671. // C++: void cv::ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, vector_Point& pts)
  9672. //
  9673. /**
  9674. * Approximates an elliptic arc with a polyline.
  9675. *
  9676. * The function ellipse2Poly computes the vertices of a polyline that approximates the specified
  9677. * elliptic arc. It is used by #ellipse. If {code arcStart} is greater than {code arcEnd}, they are swapped.
  9678. *
  9679. * param center Center of the arc.
  9680. * param axes Half of the size of the ellipse main axes. See #ellipse for details.
  9681. * param angle Rotation angle of the ellipse in degrees. See #ellipse for details.
  9682. * param arcStart Starting angle of the elliptic arc in degrees.
  9683. * param arcEnd Ending angle of the elliptic arc in degrees.
  9684. * param delta Angle between the subsequent polyline vertices. It defines the approximation
  9685. * accuracy.
  9686. * param pts Output vector of polyline vertices.
  9687. */
  9688. public static void ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, MatOfPoint pts)
  9689. {
  9690. if (pts != null) pts.ThrowIfDisposed();
  9691. Mat pts_mat = pts;
  9692. imgproc_Imgproc_ellipse2Poly_10(center.x, center.y, axes.width, axes.height, angle, arcStart, arcEnd, delta, pts_mat.nativeObj);
  9693. }
  9694. //
  9695. // C++: void cv::putText(Mat& img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness = 1, int lineType = LINE_8, bool bottomLeftOrigin = false)
  9696. //
  9697. /**
  9698. * Draws a text string.
  9699. *
  9700. * The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered
  9701. * using the specified font are replaced by question marks. See #getTextSize for a text rendering code
  9702. * example.
  9703. *
  9704. * param img Image.
  9705. * param text Text string to be drawn.
  9706. * param org Bottom-left corner of the text string in the image.
  9707. * param fontFace Font type, see #HersheyFonts.
  9708. * param fontScale Font scale factor that is multiplied by the font-specific base size.
  9709. * param color Text color.
  9710. * param thickness Thickness of the lines used to draw a text.
  9711. * param lineType Line type. See #LineTypes
  9712. * param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise,
  9713. * it is at the top-left corner.
  9714. */
  9715. public static void putText(Mat img, string text, Point org, int fontFace, double fontScale, Scalar color, int thickness, int lineType, bool bottomLeftOrigin)
  9716. {
  9717. if (img != null) img.ThrowIfDisposed();
  9718. imgproc_Imgproc_putText_10(img.nativeObj, text, org.x, org.y, fontFace, fontScale, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType, bottomLeftOrigin);
  9719. }
  9720. /**
  9721. * Draws a text string.
  9722. *
  9723. * The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered
  9724. * using the specified font are replaced by question marks. See #getTextSize for a text rendering code
  9725. * example.
  9726. *
  9727. * param img Image.
  9728. * param text Text string to be drawn.
  9729. * param org Bottom-left corner of the text string in the image.
  9730. * param fontFace Font type, see #HersheyFonts.
  9731. * param fontScale Font scale factor that is multiplied by the font-specific base size.
  9732. * param color Text color.
  9733. * param thickness Thickness of the lines used to draw a text.
  9734. * param lineType Line type. See #LineTypes
  9735. * it is at the top-left corner.
  9736. */
  9737. public static void putText(Mat img, string text, Point org, int fontFace, double fontScale, Scalar color, int thickness, int lineType)
  9738. {
  9739. if (img != null) img.ThrowIfDisposed();
  9740. imgproc_Imgproc_putText_11(img.nativeObj, text, org.x, org.y, fontFace, fontScale, color.val[0], color.val[1], color.val[2], color.val[3], thickness, lineType);
  9741. }
  9742. /**
  9743. * Draws a text string.
  9744. *
  9745. * The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered
  9746. * using the specified font are replaced by question marks. See #getTextSize for a text rendering code
  9747. * example.
  9748. *
  9749. * param img Image.
  9750. * param text Text string to be drawn.
  9751. * param org Bottom-left corner of the text string in the image.
  9752. * param fontFace Font type, see #HersheyFonts.
  9753. * param fontScale Font scale factor that is multiplied by the font-specific base size.
  9754. * param color Text color.
  9755. * param thickness Thickness of the lines used to draw a text.
  9756. * it is at the top-left corner.
  9757. */
  9758. public static void putText(Mat img, string text, Point org, int fontFace, double fontScale, Scalar color, int thickness)
  9759. {
  9760. if (img != null) img.ThrowIfDisposed();
  9761. imgproc_Imgproc_putText_12(img.nativeObj, text, org.x, org.y, fontFace, fontScale, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
  9762. }
  9763. /**
  9764. * Draws a text string.
  9765. *
  9766. * The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered
  9767. * using the specified font are replaced by question marks. See #getTextSize for a text rendering code
  9768. * example.
  9769. *
  9770. * param img Image.
  9771. * param text Text string to be drawn.
  9772. * param org Bottom-left corner of the text string in the image.
  9773. * param fontFace Font type, see #HersheyFonts.
  9774. * param fontScale Font scale factor that is multiplied by the font-specific base size.
  9775. * param color Text color.
  9776. * it is at the top-left corner.
  9777. */
  9778. public static void putText(Mat img, string text, Point org, int fontFace, double fontScale, Scalar color)
  9779. {
  9780. if (img != null) img.ThrowIfDisposed();
  9781. imgproc_Imgproc_putText_13(img.nativeObj, text, org.x, org.y, fontFace, fontScale, color.val[0], color.val[1], color.val[2], color.val[3]);
  9782. }
  9783. //
  9784. // C++: double cv::getFontScaleFromHeight(int fontFace, int pixelHeight, int thickness = 1)
  9785. //
  9786. /**
  9787. * Calculates the font-specific size to use to achieve a given height in pixels.
  9788. *
  9789. * param fontFace Font to use, see cv::HersheyFonts.
  9790. * param pixelHeight Pixel height to compute the fontScale for
  9791. * param thickness Thickness of lines used to render the text.See putText for details.
  9792. * return The fontSize to use for cv::putText
  9793. *
  9794. * SEE: cv::putText
  9795. */
  9796. public static double getFontScaleFromHeight(int fontFace, int pixelHeight, int thickness)
  9797. {
  9798. return imgproc_Imgproc_getFontScaleFromHeight_10(fontFace, pixelHeight, thickness);
  9799. }
  9800. /**
  9801. * Calculates the font-specific size to use to achieve a given height in pixels.
  9802. *
  9803. * param fontFace Font to use, see cv::HersheyFonts.
  9804. * param pixelHeight Pixel height to compute the fontScale for
  9805. * return The fontSize to use for cv::putText
  9806. *
  9807. * SEE: cv::putText
  9808. */
  9809. public static double getFontScaleFromHeight(int fontFace, int pixelHeight)
  9810. {
  9811. return imgproc_Imgproc_getFontScaleFromHeight_11(fontFace, pixelHeight);
  9812. }
  9813. //
  9814. // C++: void cv::HoughLinesWithAccumulator(Mat image, Mat& lines, double rho, double theta, int threshold, double srn = 0, double stn = 0, double min_theta = 0, double max_theta = CV_PI)
  9815. //
  9816. /**
  9817. * Finds lines in a binary image using the standard Hough transform and get accumulator.
  9818. *
  9819. * <b>Note:</b> This function is for bindings use only. Use original function in C++ code
  9820. *
  9821. * SEE: HoughLines
  9822. * param image automatically generated
  9823. * param lines automatically generated
  9824. * param rho automatically generated
  9825. * param theta automatically generated
  9826. * param threshold automatically generated
  9827. * param srn automatically generated
  9828. * param stn automatically generated
  9829. * param min_theta automatically generated
  9830. * param max_theta automatically generated
  9831. */
  9832. public static void HoughLinesWithAccumulator(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta)
  9833. {
  9834. if (image != null) image.ThrowIfDisposed();
  9835. if (lines != null) lines.ThrowIfDisposed();
  9836. imgproc_Imgproc_HoughLinesWithAccumulator_10(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn, min_theta, max_theta);
  9837. }
  9838. /**
  9839. * Finds lines in a binary image using the standard Hough transform and get accumulator.
  9840. *
  9841. * <b>Note:</b> This function is for bindings use only. Use original function in C++ code
  9842. *
  9843. * SEE: HoughLines
  9844. * param image automatically generated
  9845. * param lines automatically generated
  9846. * param rho automatically generated
  9847. * param theta automatically generated
  9848. * param threshold automatically generated
  9849. * param srn automatically generated
  9850. * param stn automatically generated
  9851. * param min_theta automatically generated
  9852. */
  9853. public static void HoughLinesWithAccumulator(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn, double min_theta)
  9854. {
  9855. if (image != null) image.ThrowIfDisposed();
  9856. if (lines != null) lines.ThrowIfDisposed();
  9857. imgproc_Imgproc_HoughLinesWithAccumulator_11(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn, min_theta);
  9858. }
  9859. /**
  9860. * Finds lines in a binary image using the standard Hough transform and get accumulator.
  9861. *
  9862. * <b>Note:</b> This function is for bindings use only. Use original function in C++ code
  9863. *
  9864. * SEE: HoughLines
  9865. * param image automatically generated
  9866. * param lines automatically generated
  9867. * param rho automatically generated
  9868. * param theta automatically generated
  9869. * param threshold automatically generated
  9870. * param srn automatically generated
  9871. * param stn automatically generated
  9872. */
  9873. public static void HoughLinesWithAccumulator(Mat image, Mat lines, double rho, double theta, int threshold, double srn, double stn)
  9874. {
  9875. if (image != null) image.ThrowIfDisposed();
  9876. if (lines != null) lines.ThrowIfDisposed();
  9877. imgproc_Imgproc_HoughLinesWithAccumulator_12(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn, stn);
  9878. }
  9879. /**
  9880. * Finds lines in a binary image using the standard Hough transform and get accumulator.
  9881. *
  9882. * <b>Note:</b> This function is for bindings use only. Use original function in C++ code
  9883. *
  9884. * SEE: HoughLines
  9885. * param image automatically generated
  9886. * param lines automatically generated
  9887. * param rho automatically generated
  9888. * param theta automatically generated
  9889. * param threshold automatically generated
  9890. * param srn automatically generated
  9891. */
  9892. public static void HoughLinesWithAccumulator(Mat image, Mat lines, double rho, double theta, int threshold, double srn)
  9893. {
  9894. if (image != null) image.ThrowIfDisposed();
  9895. if (lines != null) lines.ThrowIfDisposed();
  9896. imgproc_Imgproc_HoughLinesWithAccumulator_13(image.nativeObj, lines.nativeObj, rho, theta, threshold, srn);
  9897. }
  9898. /**
  9899. * Finds lines in a binary image using the standard Hough transform and get accumulator.
  9900. *
  9901. * <b>Note:</b> This function is for bindings use only. Use original function in C++ code
  9902. *
  9903. * SEE: HoughLines
  9904. * param image automatically generated
  9905. * param lines automatically generated
  9906. * param rho automatically generated
  9907. * param theta automatically generated
  9908. * param threshold automatically generated
  9909. */
  9910. public static void HoughLinesWithAccumulator(Mat image, Mat lines, double rho, double theta, int threshold)
  9911. {
  9912. if (image != null) image.ThrowIfDisposed();
  9913. if (lines != null) lines.ThrowIfDisposed();
  9914. imgproc_Imgproc_HoughLinesWithAccumulator_14(image.nativeObj, lines.nativeObj, rho, theta, threshold);
  9915. }
  9916. // C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);
  9917. //javadoc:getTextSize(text, fontFace, fontScale, thickness, baseLine)
  9918. public static Size getTextSize(string text, int fontFace, double fontScale, int thickness, int[] baseLine)
  9919. {
  9920. if (baseLine != null && baseLine.Length != 1)
  9921. throw new CvException("'baseLine' must be 'int[1]' or 'null'.");
  9922. double[] tmpArray = new double[2];
  9923. imgproc_Imgproc_n_1getTextSize(text, fontFace, fontScale, thickness, baseLine, tmpArray);
  9924. Size retVal = new Size(tmpArray);
  9925. return retVal;
  9926. }
  9927. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  9928. const string LIBNAME = "__Internal";
  9929. #else
  9930. const string LIBNAME = "opencvforunity";
  9931. #endif
  9932. // C++: Ptr_LineSegmentDetector cv::createLineSegmentDetector(int refine = LSD_REFINE_STD, double scale = 0.8, double sigma_scale = 0.6, double quant = 2.0, double ang_th = 22.5, double log_eps = 0, double density_th = 0.7, int n_bins = 1024)
  9933. [DllImport(LIBNAME)]
  9934. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_10(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps, double density_th, int n_bins);
  9935. [DllImport(LIBNAME)]
  9936. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_11(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps, double density_th);
  9937. [DllImport(LIBNAME)]
  9938. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_12(int refine, double scale, double sigma_scale, double quant, double ang_th, double log_eps);
  9939. [DllImport(LIBNAME)]
  9940. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_13(int refine, double scale, double sigma_scale, double quant, double ang_th);
  9941. [DllImport(LIBNAME)]
  9942. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_14(int refine, double scale, double sigma_scale, double quant);
  9943. [DllImport(LIBNAME)]
  9944. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_15(int refine, double scale, double sigma_scale);
  9945. [DllImport(LIBNAME)]
  9946. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_16(int refine, double scale);
  9947. [DllImport(LIBNAME)]
  9948. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_17(int refine);
  9949. [DllImport(LIBNAME)]
  9950. private static extern IntPtr imgproc_Imgproc_createLineSegmentDetector_18();
  9951. // C++: Mat cv::getGaussianKernel(int ksize, double sigma, int ktype = CV_64F)
  9952. [DllImport(LIBNAME)]
  9953. private static extern IntPtr imgproc_Imgproc_getGaussianKernel_10(int ksize, double sigma, int ktype);
  9954. [DllImport(LIBNAME)]
  9955. private static extern IntPtr imgproc_Imgproc_getGaussianKernel_11(int ksize, double sigma);
  9956. // C++: void cv::getDerivKernels(Mat& kx, Mat& ky, int dx, int dy, int ksize, bool normalize = false, int ktype = CV_32F)
  9957. [DllImport(LIBNAME)]
  9958. private static extern void imgproc_Imgproc_getDerivKernels_10(IntPtr kx_nativeObj, IntPtr ky_nativeObj, int dx, int dy, int ksize, [MarshalAs(UnmanagedType.U1)] bool normalize, int ktype);
  9959. [DllImport(LIBNAME)]
  9960. private static extern void imgproc_Imgproc_getDerivKernels_11(IntPtr kx_nativeObj, IntPtr ky_nativeObj, int dx, int dy, int ksize, [MarshalAs(UnmanagedType.U1)] bool normalize);
  9961. [DllImport(LIBNAME)]
  9962. private static extern void imgproc_Imgproc_getDerivKernels_12(IntPtr kx_nativeObj, IntPtr ky_nativeObj, int dx, int dy, int ksize);
  9963. // C++: Mat cv::getGaborKernel(Size ksize, double sigma, double theta, double lambd, double gamma, double psi = CV_PI*0.5, int ktype = CV_64F)
  9964. [DllImport(LIBNAME)]
  9965. private static extern IntPtr imgproc_Imgproc_getGaborKernel_10(double ksize_width, double ksize_height, double sigma, double theta, double lambd, double gamma, double psi, int ktype);
  9966. [DllImport(LIBNAME)]
  9967. private static extern IntPtr imgproc_Imgproc_getGaborKernel_11(double ksize_width, double ksize_height, double sigma, double theta, double lambd, double gamma, double psi);
  9968. [DllImport(LIBNAME)]
  9969. private static extern IntPtr imgproc_Imgproc_getGaborKernel_12(double ksize_width, double ksize_height, double sigma, double theta, double lambd, double gamma);
  9970. // C++: Mat cv::getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1))
  9971. [DllImport(LIBNAME)]
  9972. private static extern IntPtr imgproc_Imgproc_getStructuringElement_10(int shape, double ksize_width, double ksize_height, double anchor_x, double anchor_y);
  9973. [DllImport(LIBNAME)]
  9974. private static extern IntPtr imgproc_Imgproc_getStructuringElement_11(int shape, double ksize_width, double ksize_height);
  9975. // C++: void cv::medianBlur(Mat src, Mat& dst, int ksize)
  9976. [DllImport(LIBNAME)]
  9977. private static extern void imgproc_Imgproc_medianBlur_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ksize);
  9978. // C++: void cv::GaussianBlur(Mat src, Mat& dst, Size ksize, double sigmaX, double sigmaY = 0, int borderType = BORDER_DEFAULT)
  9979. [DllImport(LIBNAME)]
  9980. private static extern void imgproc_Imgproc_GaussianBlur_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height, double sigmaX, double sigmaY, int borderType);
  9981. [DllImport(LIBNAME)]
  9982. private static extern void imgproc_Imgproc_GaussianBlur_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height, double sigmaX, double sigmaY);
  9983. [DllImport(LIBNAME)]
  9984. private static extern void imgproc_Imgproc_GaussianBlur_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height, double sigmaX);
  9985. // C++: void cv::bilateralFilter(Mat src, Mat& dst, int d, double sigmaColor, double sigmaSpace, int borderType = BORDER_DEFAULT)
  9986. [DllImport(LIBNAME)]
  9987. private static extern void imgproc_Imgproc_bilateralFilter_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int d, double sigmaColor, double sigmaSpace, int borderType);
  9988. [DllImport(LIBNAME)]
  9989. private static extern void imgproc_Imgproc_bilateralFilter_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int d, double sigmaColor, double sigmaSpace);
  9990. // C++: void cv::boxFilter(Mat src, Mat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), bool normalize = true, int borderType = BORDER_DEFAULT)
  9991. [DllImport(LIBNAME)]
  9992. private static extern void imgproc_Imgproc_boxFilter_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y, [MarshalAs(UnmanagedType.U1)] bool normalize, int borderType);
  9993. [DllImport(LIBNAME)]
  9994. private static extern void imgproc_Imgproc_boxFilter_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y, [MarshalAs(UnmanagedType.U1)] bool normalize);
  9995. [DllImport(LIBNAME)]
  9996. private static extern void imgproc_Imgproc_boxFilter_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y);
  9997. [DllImport(LIBNAME)]
  9998. private static extern void imgproc_Imgproc_boxFilter_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height);
  9999. // C++: void cv::sqrBoxFilter(Mat src, Mat& dst, int ddepth, Size ksize, Point anchor = Point(-1, -1), bool normalize = true, int borderType = BORDER_DEFAULT)
  10000. [DllImport(LIBNAME)]
  10001. private static extern void imgproc_Imgproc_sqrBoxFilter_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y, [MarshalAs(UnmanagedType.U1)] bool normalize, int borderType);
  10002. [DllImport(LIBNAME)]
  10003. private static extern void imgproc_Imgproc_sqrBoxFilter_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y, [MarshalAs(UnmanagedType.U1)] bool normalize);
  10004. [DllImport(LIBNAME)]
  10005. private static extern void imgproc_Imgproc_sqrBoxFilter_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height, double anchor_x, double anchor_y);
  10006. [DllImport(LIBNAME)]
  10007. private static extern void imgproc_Imgproc_sqrBoxFilter_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, double ksize_width, double ksize_height);
  10008. // C++: void cv::blur(Mat src, Mat& dst, Size ksize, Point anchor = Point(-1,-1), int borderType = BORDER_DEFAULT)
  10009. [DllImport(LIBNAME)]
  10010. private static extern void imgproc_Imgproc_blur_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height, double anchor_x, double anchor_y, int borderType);
  10011. [DllImport(LIBNAME)]
  10012. private static extern void imgproc_Imgproc_blur_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height, double anchor_x, double anchor_y);
  10013. [DllImport(LIBNAME)]
  10014. private static extern void imgproc_Imgproc_blur_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height);
  10015. // C++: void cv::stackBlur(Mat src, Mat& dst, Size ksize)
  10016. [DllImport(LIBNAME)]
  10017. private static extern void imgproc_Imgproc_stackBlur_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double ksize_width, double ksize_height);
  10018. // C++: void cv::filter2D(Mat src, Mat& dst, int ddepth, Mat kernel, Point anchor = Point(-1,-1), double delta = 0, int borderType = BORDER_DEFAULT)
  10019. [DllImport(LIBNAME)]
  10020. private static extern void imgproc_Imgproc_filter2D_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, double delta, int borderType);
  10021. [DllImport(LIBNAME)]
  10022. private static extern void imgproc_Imgproc_filter2D_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, double delta);
  10023. [DllImport(LIBNAME)]
  10024. private static extern void imgproc_Imgproc_filter2D_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernel_nativeObj, double anchor_x, double anchor_y);
  10025. [DllImport(LIBNAME)]
  10026. private static extern void imgproc_Imgproc_filter2D_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernel_nativeObj);
  10027. // C++: void cv::sepFilter2D(Mat src, Mat& dst, int ddepth, Mat kernelX, Mat kernelY, Point anchor = Point(-1,-1), double delta = 0, int borderType = BORDER_DEFAULT)
  10028. [DllImport(LIBNAME)]
  10029. private static extern void imgproc_Imgproc_sepFilter2D_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernelX_nativeObj, IntPtr kernelY_nativeObj, double anchor_x, double anchor_y, double delta, int borderType);
  10030. [DllImport(LIBNAME)]
  10031. private static extern void imgproc_Imgproc_sepFilter2D_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernelX_nativeObj, IntPtr kernelY_nativeObj, double anchor_x, double anchor_y, double delta);
  10032. [DllImport(LIBNAME)]
  10033. private static extern void imgproc_Imgproc_sepFilter2D_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernelX_nativeObj, IntPtr kernelY_nativeObj, double anchor_x, double anchor_y);
  10034. [DllImport(LIBNAME)]
  10035. private static extern void imgproc_Imgproc_sepFilter2D_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, IntPtr kernelX_nativeObj, IntPtr kernelY_nativeObj);
  10036. // C++: void cv::Sobel(Mat src, Mat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  10037. [DllImport(LIBNAME)]
  10038. private static extern void imgproc_Imgproc_Sobel_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType);
  10039. [DllImport(LIBNAME)]
  10040. private static extern void imgproc_Imgproc_Sobel_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, int ksize, double scale, double delta);
  10041. [DllImport(LIBNAME)]
  10042. private static extern void imgproc_Imgproc_Sobel_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, int ksize, double scale);
  10043. [DllImport(LIBNAME)]
  10044. private static extern void imgproc_Imgproc_Sobel_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, int ksize);
  10045. [DllImport(LIBNAME)]
  10046. private static extern void imgproc_Imgproc_Sobel_14(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy);
  10047. // C++: void cv::spatialGradient(Mat src, Mat& dx, Mat& dy, int ksize = 3, int borderType = BORDER_DEFAULT)
  10048. [DllImport(LIBNAME)]
  10049. private static extern void imgproc_Imgproc_spatialGradient_10(IntPtr src_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj, int ksize, int borderType);
  10050. [DllImport(LIBNAME)]
  10051. private static extern void imgproc_Imgproc_spatialGradient_11(IntPtr src_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj, int ksize);
  10052. [DllImport(LIBNAME)]
  10053. private static extern void imgproc_Imgproc_spatialGradient_12(IntPtr src_nativeObj, IntPtr dx_nativeObj, IntPtr dy_nativeObj);
  10054. // C++: void cv::Scharr(Mat src, Mat& dst, int ddepth, int dx, int dy, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  10055. [DllImport(LIBNAME)]
  10056. private static extern void imgproc_Imgproc_Scharr_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, double scale, double delta, int borderType);
  10057. [DllImport(LIBNAME)]
  10058. private static extern void imgproc_Imgproc_Scharr_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, double scale, double delta);
  10059. [DllImport(LIBNAME)]
  10060. private static extern void imgproc_Imgproc_Scharr_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy, double scale);
  10061. [DllImport(LIBNAME)]
  10062. private static extern void imgproc_Imgproc_Scharr_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int dx, int dy);
  10063. // C++: void cv::Laplacian(Mat src, Mat& dst, int ddepth, int ksize = 1, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)
  10064. [DllImport(LIBNAME)]
  10065. private static extern void imgproc_Imgproc_Laplacian_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int ksize, double scale, double delta, int borderType);
  10066. [DllImport(LIBNAME)]
  10067. private static extern void imgproc_Imgproc_Laplacian_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int ksize, double scale, double delta);
  10068. [DllImport(LIBNAME)]
  10069. private static extern void imgproc_Imgproc_Laplacian_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int ksize, double scale);
  10070. [DllImport(LIBNAME)]
  10071. private static extern void imgproc_Imgproc_Laplacian_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth, int ksize);
  10072. [DllImport(LIBNAME)]
  10073. private static extern void imgproc_Imgproc_Laplacian_14(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ddepth);
  10074. // C++: void cv::Canny(Mat image, Mat& edges, double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)
  10075. [DllImport(LIBNAME)]
  10076. private static extern void imgproc_Imgproc_Canny_10(IntPtr image_nativeObj, IntPtr edges_nativeObj, double threshold1, double threshold2, int apertureSize, [MarshalAs(UnmanagedType.U1)] bool L2gradient);
  10077. [DllImport(LIBNAME)]
  10078. private static extern void imgproc_Imgproc_Canny_11(IntPtr image_nativeObj, IntPtr edges_nativeObj, double threshold1, double threshold2, int apertureSize);
  10079. [DllImport(LIBNAME)]
  10080. private static extern void imgproc_Imgproc_Canny_12(IntPtr image_nativeObj, IntPtr edges_nativeObj, double threshold1, double threshold2);
  10081. // C++: void cv::Canny(Mat dx, Mat dy, Mat& edges, double threshold1, double threshold2, bool L2gradient = false)
  10082. [DllImport(LIBNAME)]
  10083. private static extern void imgproc_Imgproc_Canny_13(IntPtr dx_nativeObj, IntPtr dy_nativeObj, IntPtr edges_nativeObj, double threshold1, double threshold2, [MarshalAs(UnmanagedType.U1)] bool L2gradient);
  10084. [DllImport(LIBNAME)]
  10085. private static extern void imgproc_Imgproc_Canny_14(IntPtr dx_nativeObj, IntPtr dy_nativeObj, IntPtr edges_nativeObj, double threshold1, double threshold2);
  10086. // C++: void cv::cornerMinEigenVal(Mat src, Mat& dst, int blockSize, int ksize = 3, int borderType = BORDER_DEFAULT)
  10087. [DllImport(LIBNAME)]
  10088. private static extern void imgproc_Imgproc_cornerMinEigenVal_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize, int borderType);
  10089. [DllImport(LIBNAME)]
  10090. private static extern void imgproc_Imgproc_cornerMinEigenVal_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize);
  10091. [DllImport(LIBNAME)]
  10092. private static extern void imgproc_Imgproc_cornerMinEigenVal_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize);
  10093. // C++: void cv::cornerHarris(Mat src, Mat& dst, int blockSize, int ksize, double k, int borderType = BORDER_DEFAULT)
  10094. [DllImport(LIBNAME)]
  10095. private static extern void imgproc_Imgproc_cornerHarris_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize, double k, int borderType);
  10096. [DllImport(LIBNAME)]
  10097. private static extern void imgproc_Imgproc_cornerHarris_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize, double k);
  10098. // C++: void cv::cornerEigenValsAndVecs(Mat src, Mat& dst, int blockSize, int ksize, int borderType = BORDER_DEFAULT)
  10099. [DllImport(LIBNAME)]
  10100. private static extern void imgproc_Imgproc_cornerEigenValsAndVecs_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize, int borderType);
  10101. [DllImport(LIBNAME)]
  10102. private static extern void imgproc_Imgproc_cornerEigenValsAndVecs_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int blockSize, int ksize);
  10103. // C++: void cv::preCornerDetect(Mat src, Mat& dst, int ksize, int borderType = BORDER_DEFAULT)
  10104. [DllImport(LIBNAME)]
  10105. private static extern void imgproc_Imgproc_preCornerDetect_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ksize, int borderType);
  10106. [DllImport(LIBNAME)]
  10107. private static extern void imgproc_Imgproc_preCornerDetect_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int ksize);
  10108. // C++: void cv::cornerSubPix(Mat image, Mat& corners, Size winSize, Size zeroZone, TermCriteria criteria)
  10109. [DllImport(LIBNAME)]
  10110. private static extern void imgproc_Imgproc_cornerSubPix_10(IntPtr image_nativeObj, IntPtr corners_nativeObj, double winSize_width, double winSize_height, double zeroZone_width, double zeroZone_height, int criteria_type, int criteria_maxCount, double criteria_epsilon);
  10111. // C++: void cv::goodFeaturesToTrack(Mat image, vector_Point& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask = Mat(), int blockSize = 3, bool useHarrisDetector = false, double k = 0.04)
  10112. [DllImport(LIBNAME)]
  10113. private static extern void imgproc_Imgproc_goodFeaturesToTrack_10(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector, double k);
  10114. [DllImport(LIBNAME)]
  10115. private static extern void imgproc_Imgproc_goodFeaturesToTrack_11(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector);
  10116. [DllImport(LIBNAME)]
  10117. private static extern void imgproc_Imgproc_goodFeaturesToTrack_12(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize);
  10118. [DllImport(LIBNAME)]
  10119. private static extern void imgproc_Imgproc_goodFeaturesToTrack_13(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj);
  10120. [DllImport(LIBNAME)]
  10121. private static extern void imgproc_Imgproc_goodFeaturesToTrack_14(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance);
  10122. // C++: void cv::goodFeaturesToTrack(Mat image, vector_Point& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, int blockSize, int gradientSize, bool useHarrisDetector = false, double k = 0.04)
  10123. [DllImport(LIBNAME)]
  10124. private static extern void imgproc_Imgproc_goodFeaturesToTrack_15(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize, int gradientSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector, double k);
  10125. [DllImport(LIBNAME)]
  10126. private static extern void imgproc_Imgproc_goodFeaturesToTrack_16(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize, int gradientSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector);
  10127. [DllImport(LIBNAME)]
  10128. private static extern void imgproc_Imgproc_goodFeaturesToTrack_17(IntPtr image_nativeObj, IntPtr corners_mat_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, int blockSize, int gradientSize);
  10129. // C++: void cv::goodFeaturesToTrack(Mat image, Mat& corners, int maxCorners, double qualityLevel, double minDistance, Mat mask, Mat& cornersQuality, int blockSize = 3, int gradientSize = 3, bool useHarrisDetector = false, double k = 0.04)
  10130. [DllImport(LIBNAME)]
  10131. private static extern void imgproc_Imgproc_goodFeaturesToTrackWithQuality_10(IntPtr image_nativeObj, IntPtr corners_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, IntPtr cornersQuality_nativeObj, int blockSize, int gradientSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector, double k);
  10132. [DllImport(LIBNAME)]
  10133. private static extern void imgproc_Imgproc_goodFeaturesToTrackWithQuality_11(IntPtr image_nativeObj, IntPtr corners_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, IntPtr cornersQuality_nativeObj, int blockSize, int gradientSize, [MarshalAs(UnmanagedType.U1)] bool useHarrisDetector);
  10134. [DllImport(LIBNAME)]
  10135. private static extern void imgproc_Imgproc_goodFeaturesToTrackWithQuality_12(IntPtr image_nativeObj, IntPtr corners_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, IntPtr cornersQuality_nativeObj, int blockSize, int gradientSize);
  10136. [DllImport(LIBNAME)]
  10137. private static extern void imgproc_Imgproc_goodFeaturesToTrackWithQuality_13(IntPtr image_nativeObj, IntPtr corners_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, IntPtr cornersQuality_nativeObj, int blockSize);
  10138. [DllImport(LIBNAME)]
  10139. private static extern void imgproc_Imgproc_goodFeaturesToTrackWithQuality_14(IntPtr image_nativeObj, IntPtr corners_nativeObj, int maxCorners, double qualityLevel, double minDistance, IntPtr mask_nativeObj, IntPtr cornersQuality_nativeObj);
  10140. // C++: void cv::HoughLines(Mat image, Mat& lines, double rho, double theta, int threshold, double srn = 0, double stn = 0, double min_theta = 0, double max_theta = CV_PI)
  10141. [DllImport(LIBNAME)]
  10142. private static extern void imgproc_Imgproc_HoughLines_10(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta);
  10143. [DllImport(LIBNAME)]
  10144. private static extern void imgproc_Imgproc_HoughLines_11(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn, double min_theta);
  10145. [DllImport(LIBNAME)]
  10146. private static extern void imgproc_Imgproc_HoughLines_12(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn);
  10147. [DllImport(LIBNAME)]
  10148. private static extern void imgproc_Imgproc_HoughLines_13(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn);
  10149. [DllImport(LIBNAME)]
  10150. private static extern void imgproc_Imgproc_HoughLines_14(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold);
  10151. // C++: void cv::HoughLinesP(Mat image, Mat& lines, double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0)
  10152. [DllImport(LIBNAME)]
  10153. private static extern void imgproc_Imgproc_HoughLinesP_10(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double minLineLength, double maxLineGap);
  10154. [DllImport(LIBNAME)]
  10155. private static extern void imgproc_Imgproc_HoughLinesP_11(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double minLineLength);
  10156. [DllImport(LIBNAME)]
  10157. private static extern void imgproc_Imgproc_HoughLinesP_12(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold);
  10158. // C++: void cv::HoughLinesPointSet(Mat point, Mat& lines, int lines_max, int threshold, double min_rho, double max_rho, double rho_step, double min_theta, double max_theta, double theta_step)
  10159. [DllImport(LIBNAME)]
  10160. private static extern void imgproc_Imgproc_HoughLinesPointSet_10(IntPtr point_nativeObj, IntPtr lines_nativeObj, int lines_max, int threshold, double min_rho, double max_rho, double rho_step, double min_theta, double max_theta, double theta_step);
  10161. // C++: void cv::HoughCircles(Mat image, Mat& circles, int method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
  10162. [DllImport(LIBNAME)]
  10163. private static extern void imgproc_Imgproc_HoughCircles_10(IntPtr image_nativeObj, IntPtr circles_nativeObj, int method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius);
  10164. [DllImport(LIBNAME)]
  10165. private static extern void imgproc_Imgproc_HoughCircles_11(IntPtr image_nativeObj, IntPtr circles_nativeObj, int method, double dp, double minDist, double param1, double param2, int minRadius);
  10166. [DllImport(LIBNAME)]
  10167. private static extern void imgproc_Imgproc_HoughCircles_12(IntPtr image_nativeObj, IntPtr circles_nativeObj, int method, double dp, double minDist, double param1, double param2);
  10168. [DllImport(LIBNAME)]
  10169. private static extern void imgproc_Imgproc_HoughCircles_13(IntPtr image_nativeObj, IntPtr circles_nativeObj, int method, double dp, double minDist, double param1);
  10170. [DllImport(LIBNAME)]
  10171. private static extern void imgproc_Imgproc_HoughCircles_14(IntPtr image_nativeObj, IntPtr circles_nativeObj, int method, double dp, double minDist);
  10172. // C++: void cv::erode(Mat src, Mat& dst, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  10173. [DllImport(LIBNAME)]
  10174. private static extern void imgproc_Imgproc_erode_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10175. [DllImport(LIBNAME)]
  10176. private static extern void imgproc_Imgproc_erode_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType);
  10177. [DllImport(LIBNAME)]
  10178. private static extern void imgproc_Imgproc_erode_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations);
  10179. [DllImport(LIBNAME)]
  10180. private static extern void imgproc_Imgproc_erode_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y);
  10181. [DllImport(LIBNAME)]
  10182. private static extern void imgproc_Imgproc_erode_14(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj);
  10183. // C++: void cv::dilate(Mat src, Mat& dst, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  10184. [DllImport(LIBNAME)]
  10185. private static extern void imgproc_Imgproc_dilate_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10186. [DllImport(LIBNAME)]
  10187. private static extern void imgproc_Imgproc_dilate_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType);
  10188. [DllImport(LIBNAME)]
  10189. private static extern void imgproc_Imgproc_dilate_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations);
  10190. [DllImport(LIBNAME)]
  10191. private static extern void imgproc_Imgproc_dilate_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj, double anchor_x, double anchor_y);
  10192. [DllImport(LIBNAME)]
  10193. private static extern void imgproc_Imgproc_dilate_14(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr kernel_nativeObj);
  10194. // C++: void cv::morphologyEx(Mat src, Mat& dst, int op, Mat kernel, Point anchor = Point(-1,-1), int iterations = 1, int borderType = BORDER_CONSTANT, Scalar borderValue = morphologyDefaultBorderValue())
  10195. [DllImport(LIBNAME)]
  10196. private static extern void imgproc_Imgproc_morphologyEx_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int op, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10197. [DllImport(LIBNAME)]
  10198. private static extern void imgproc_Imgproc_morphologyEx_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int op, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations, int borderType);
  10199. [DllImport(LIBNAME)]
  10200. private static extern void imgproc_Imgproc_morphologyEx_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, int op, IntPtr kernel_nativeObj, double anchor_x, double anchor_y, int iterations);
  10201. [DllImport(LIBNAME)]
  10202. private static extern void imgproc_Imgproc_morphologyEx_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, int op, IntPtr kernel_nativeObj, double anchor_x, double anchor_y);
  10203. [DllImport(LIBNAME)]
  10204. private static extern void imgproc_Imgproc_morphologyEx_14(IntPtr src_nativeObj, IntPtr dst_nativeObj, int op, IntPtr kernel_nativeObj);
  10205. // C++: void cv::resize(Mat src, Mat& dst, Size dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR)
  10206. [DllImport(LIBNAME)]
  10207. private static extern void imgproc_Imgproc_resize_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dsize_width, double dsize_height, double fx, double fy, int interpolation);
  10208. [DllImport(LIBNAME)]
  10209. private static extern void imgproc_Imgproc_resize_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dsize_width, double dsize_height, double fx, double fy);
  10210. [DllImport(LIBNAME)]
  10211. private static extern void imgproc_Imgproc_resize_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dsize_width, double dsize_height, double fx);
  10212. [DllImport(LIBNAME)]
  10213. private static extern void imgproc_Imgproc_resize_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dsize_width, double dsize_height);
  10214. // C++: void cv::warpAffine(Mat src, Mat& dst, Mat M, Size dsize, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  10215. [DllImport(LIBNAME)]
  10216. private static extern void imgproc_Imgproc_warpAffine_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags, int borderMode, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10217. [DllImport(LIBNAME)]
  10218. private static extern void imgproc_Imgproc_warpAffine_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags, int borderMode);
  10219. [DllImport(LIBNAME)]
  10220. private static extern void imgproc_Imgproc_warpAffine_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags);
  10221. [DllImport(LIBNAME)]
  10222. private static extern void imgproc_Imgproc_warpAffine_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height);
  10223. // C++: void cv::warpPerspective(Mat src, Mat& dst, Mat M, Size dsize, int flags = INTER_LINEAR, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  10224. [DllImport(LIBNAME)]
  10225. private static extern void imgproc_Imgproc_warpPerspective_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags, int borderMode, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10226. [DllImport(LIBNAME)]
  10227. private static extern void imgproc_Imgproc_warpPerspective_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags, int borderMode);
  10228. [DllImport(LIBNAME)]
  10229. private static extern void imgproc_Imgproc_warpPerspective_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height, int flags);
  10230. [DllImport(LIBNAME)]
  10231. private static extern void imgproc_Imgproc_warpPerspective_13(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr M_nativeObj, double dsize_width, double dsize_height);
  10232. // C++: void cv::remap(Mat src, Mat& dst, Mat map1, Mat map2, int interpolation, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar())
  10233. [DllImport(LIBNAME)]
  10234. private static extern void imgproc_Imgproc_remap_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr map1_nativeObj, IntPtr map2_nativeObj, int interpolation, int borderMode, double borderValue_val0, double borderValue_val1, double borderValue_val2, double borderValue_val3);
  10235. [DllImport(LIBNAME)]
  10236. private static extern void imgproc_Imgproc_remap_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr map1_nativeObj, IntPtr map2_nativeObj, int interpolation, int borderMode);
  10237. [DllImport(LIBNAME)]
  10238. private static extern void imgproc_Imgproc_remap_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr map1_nativeObj, IntPtr map2_nativeObj, int interpolation);
  10239. // C++: void cv::convertMaps(Mat map1, Mat map2, Mat& dstmap1, Mat& dstmap2, int dstmap1type, bool nninterpolation = false)
  10240. [DllImport(LIBNAME)]
  10241. private static extern void imgproc_Imgproc_convertMaps_10(IntPtr map1_nativeObj, IntPtr map2_nativeObj, IntPtr dstmap1_nativeObj, IntPtr dstmap2_nativeObj, int dstmap1type, [MarshalAs(UnmanagedType.U1)] bool nninterpolation);
  10242. [DllImport(LIBNAME)]
  10243. private static extern void imgproc_Imgproc_convertMaps_11(IntPtr map1_nativeObj, IntPtr map2_nativeObj, IntPtr dstmap1_nativeObj, IntPtr dstmap2_nativeObj, int dstmap1type);
  10244. // C++: Mat cv::getRotationMatrix2D(Point2f center, double angle, double scale)
  10245. [DllImport(LIBNAME)]
  10246. private static extern IntPtr imgproc_Imgproc_getRotationMatrix2D_10(double center_x, double center_y, double angle, double scale);
  10247. // C++: void cv::invertAffineTransform(Mat M, Mat& iM)
  10248. [DllImport(LIBNAME)]
  10249. private static extern void imgproc_Imgproc_invertAffineTransform_10(IntPtr M_nativeObj, IntPtr iM_nativeObj);
  10250. // C++: Mat cv::getPerspectiveTransform(Mat src, Mat dst, int solveMethod = DECOMP_LU)
  10251. [DllImport(LIBNAME)]
  10252. private static extern IntPtr imgproc_Imgproc_getPerspectiveTransform_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int solveMethod);
  10253. [DllImport(LIBNAME)]
  10254. private static extern IntPtr imgproc_Imgproc_getPerspectiveTransform_11(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10255. // C++: Mat cv::getAffineTransform(vector_Point2f src, vector_Point2f dst)
  10256. [DllImport(LIBNAME)]
  10257. private static extern IntPtr imgproc_Imgproc_getAffineTransform_10(IntPtr src_mat_nativeObj, IntPtr dst_mat_nativeObj);
  10258. // C++: void cv::getRectSubPix(Mat image, Size patchSize, Point2f center, Mat& patch, int patchType = -1)
  10259. [DllImport(LIBNAME)]
  10260. private static extern void imgproc_Imgproc_getRectSubPix_10(IntPtr image_nativeObj, double patchSize_width, double patchSize_height, double center_x, double center_y, IntPtr patch_nativeObj, int patchType);
  10261. [DllImport(LIBNAME)]
  10262. private static extern void imgproc_Imgproc_getRectSubPix_11(IntPtr image_nativeObj, double patchSize_width, double patchSize_height, double center_x, double center_y, IntPtr patch_nativeObj);
  10263. // C++: void cv::logPolar(Mat src, Mat& dst, Point2f center, double M, int flags)
  10264. [DllImport(LIBNAME)]
  10265. private static extern void imgproc_Imgproc_logPolar_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double center_x, double center_y, double M, int flags);
  10266. // C++: void cv::linearPolar(Mat src, Mat& dst, Point2f center, double maxRadius, int flags)
  10267. [DllImport(LIBNAME)]
  10268. private static extern void imgproc_Imgproc_linearPolar_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double center_x, double center_y, double maxRadius, int flags);
  10269. // C++: void cv::warpPolar(Mat src, Mat& dst, Size dsize, Point2f center, double maxRadius, int flags)
  10270. [DllImport(LIBNAME)]
  10271. private static extern void imgproc_Imgproc_warpPolar_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dsize_width, double dsize_height, double center_x, double center_y, double maxRadius, int flags);
  10272. // C++: void cv::integral(Mat src, Mat& sum, Mat& sqsum, Mat& tilted, int sdepth = -1, int sqdepth = -1)
  10273. [DllImport(LIBNAME)]
  10274. private static extern void imgproc_Imgproc_integral3_10(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj, IntPtr tilted_nativeObj, int sdepth, int sqdepth);
  10275. [DllImport(LIBNAME)]
  10276. private static extern void imgproc_Imgproc_integral3_11(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj, IntPtr tilted_nativeObj, int sdepth);
  10277. [DllImport(LIBNAME)]
  10278. private static extern void imgproc_Imgproc_integral3_12(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj, IntPtr tilted_nativeObj);
  10279. // C++: void cv::integral(Mat src, Mat& sum, int sdepth = -1)
  10280. [DllImport(LIBNAME)]
  10281. private static extern void imgproc_Imgproc_integral_10(IntPtr src_nativeObj, IntPtr sum_nativeObj, int sdepth);
  10282. [DllImport(LIBNAME)]
  10283. private static extern void imgproc_Imgproc_integral_11(IntPtr src_nativeObj, IntPtr sum_nativeObj);
  10284. // C++: void cv::integral(Mat src, Mat& sum, Mat& sqsum, int sdepth = -1, int sqdepth = -1)
  10285. [DllImport(LIBNAME)]
  10286. private static extern void imgproc_Imgproc_integral2_10(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj, int sdepth, int sqdepth);
  10287. [DllImport(LIBNAME)]
  10288. private static extern void imgproc_Imgproc_integral2_11(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj, int sdepth);
  10289. [DllImport(LIBNAME)]
  10290. private static extern void imgproc_Imgproc_integral2_12(IntPtr src_nativeObj, IntPtr sum_nativeObj, IntPtr sqsum_nativeObj);
  10291. // C++: void cv::accumulate(Mat src, Mat& dst, Mat mask = Mat())
  10292. [DllImport(LIBNAME)]
  10293. private static extern void imgproc_Imgproc_accumulate_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr mask_nativeObj);
  10294. [DllImport(LIBNAME)]
  10295. private static extern void imgproc_Imgproc_accumulate_11(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10296. // C++: void cv::accumulateSquare(Mat src, Mat& dst, Mat mask = Mat())
  10297. [DllImport(LIBNAME)]
  10298. private static extern void imgproc_Imgproc_accumulateSquare_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr mask_nativeObj);
  10299. [DllImport(LIBNAME)]
  10300. private static extern void imgproc_Imgproc_accumulateSquare_11(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10301. // C++: void cv::accumulateProduct(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
  10302. [DllImport(LIBNAME)]
  10303. private static extern void imgproc_Imgproc_accumulateProduct_10(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr dst_nativeObj, IntPtr mask_nativeObj);
  10304. [DllImport(LIBNAME)]
  10305. private static extern void imgproc_Imgproc_accumulateProduct_11(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr dst_nativeObj);
  10306. // C++: void cv::accumulateWeighted(Mat src, Mat& dst, double alpha, Mat mask = Mat())
  10307. [DllImport(LIBNAME)]
  10308. private static extern void imgproc_Imgproc_accumulateWeighted_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double alpha, IntPtr mask_nativeObj);
  10309. [DllImport(LIBNAME)]
  10310. private static extern void imgproc_Imgproc_accumulateWeighted_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double alpha);
  10311. // C++: Point2d cv::phaseCorrelate(Mat src1, Mat src2, Mat window = Mat(), double* response = 0)
  10312. [DllImport(LIBNAME)]
  10313. private static extern void imgproc_Imgproc_phaseCorrelate_10(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr window_nativeObj, double[] response_out, double[] retVal);
  10314. [DllImport(LIBNAME)]
  10315. private static extern void imgproc_Imgproc_phaseCorrelate_11(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr window_nativeObj, double[] retVal);
  10316. [DllImport(LIBNAME)]
  10317. private static extern void imgproc_Imgproc_phaseCorrelate_12(IntPtr src1_nativeObj, IntPtr src2_nativeObj, double[] retVal);
  10318. // C++: void cv::createHanningWindow(Mat& dst, Size winSize, int type)
  10319. [DllImport(LIBNAME)]
  10320. private static extern void imgproc_Imgproc_createHanningWindow_10(IntPtr dst_nativeObj, double winSize_width, double winSize_height, int type);
  10321. // C++: void cv::divSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
  10322. [DllImport(LIBNAME)]
  10323. private static extern void imgproc_Imgproc_divSpectrums_10(IntPtr a_nativeObj, IntPtr b_nativeObj, IntPtr c_nativeObj, int flags, [MarshalAs(UnmanagedType.U1)] bool conjB);
  10324. [DllImport(LIBNAME)]
  10325. private static extern void imgproc_Imgproc_divSpectrums_11(IntPtr a_nativeObj, IntPtr b_nativeObj, IntPtr c_nativeObj, int flags);
  10326. // C++: double cv::threshold(Mat src, Mat& dst, double thresh, double maxval, int type)
  10327. [DllImport(LIBNAME)]
  10328. private static extern double imgproc_Imgproc_threshold_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double thresh, double maxval, int type);
  10329. // C++: void cv::adaptiveThreshold(Mat src, Mat& dst, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C)
  10330. [DllImport(LIBNAME)]
  10331. private static extern void imgproc_Imgproc_adaptiveThreshold_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C);
  10332. // C++: void cv::pyrDown(Mat src, Mat& dst, Size dstsize = Size(), int borderType = BORDER_DEFAULT)
  10333. [DllImport(LIBNAME)]
  10334. private static extern void imgproc_Imgproc_pyrDown_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dstsize_width, double dstsize_height, int borderType);
  10335. [DllImport(LIBNAME)]
  10336. private static extern void imgproc_Imgproc_pyrDown_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dstsize_width, double dstsize_height);
  10337. [DllImport(LIBNAME)]
  10338. private static extern void imgproc_Imgproc_pyrDown_12(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10339. // C++: void cv::pyrUp(Mat src, Mat& dst, Size dstsize = Size(), int borderType = BORDER_DEFAULT)
  10340. [DllImport(LIBNAME)]
  10341. private static extern void imgproc_Imgproc_pyrUp_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dstsize_width, double dstsize_height, int borderType);
  10342. [DllImport(LIBNAME)]
  10343. private static extern void imgproc_Imgproc_pyrUp_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double dstsize_width, double dstsize_height);
  10344. [DllImport(LIBNAME)]
  10345. private static extern void imgproc_Imgproc_pyrUp_12(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10346. // C++: void cv::calcHist(vector_Mat images, vector_int channels, Mat mask, Mat& hist, vector_int histSize, vector_float ranges, bool accumulate = false)
  10347. [DllImport(LIBNAME)]
  10348. private static extern void imgproc_Imgproc_calcHist_10(IntPtr images_mat_nativeObj, IntPtr channels_mat_nativeObj, IntPtr mask_nativeObj, IntPtr hist_nativeObj, IntPtr histSize_mat_nativeObj, IntPtr ranges_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool accumulate);
  10349. [DllImport(LIBNAME)]
  10350. private static extern void imgproc_Imgproc_calcHist_11(IntPtr images_mat_nativeObj, IntPtr channels_mat_nativeObj, IntPtr mask_nativeObj, IntPtr hist_nativeObj, IntPtr histSize_mat_nativeObj, IntPtr ranges_mat_nativeObj);
  10351. // C++: void cv::calcBackProject(vector_Mat images, vector_int channels, Mat hist, Mat& dst, vector_float ranges, double scale)
  10352. [DllImport(LIBNAME)]
  10353. private static extern void imgproc_Imgproc_calcBackProject_10(IntPtr images_mat_nativeObj, IntPtr channels_mat_nativeObj, IntPtr hist_nativeObj, IntPtr dst_nativeObj, IntPtr ranges_mat_nativeObj, double scale);
  10354. // C++: double cv::compareHist(Mat H1, Mat H2, int method)
  10355. [DllImport(LIBNAME)]
  10356. private static extern double imgproc_Imgproc_compareHist_10(IntPtr H1_nativeObj, IntPtr H2_nativeObj, int method);
  10357. // C++: void cv::equalizeHist(Mat src, Mat& dst)
  10358. [DllImport(LIBNAME)]
  10359. private static extern void imgproc_Imgproc_equalizeHist_10(IntPtr src_nativeObj, IntPtr dst_nativeObj);
  10360. // C++: Ptr_CLAHE cv::createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8))
  10361. [DllImport(LIBNAME)]
  10362. private static extern IntPtr imgproc_Imgproc_createCLAHE_10(double clipLimit, double tileGridSize_width, double tileGridSize_height);
  10363. [DllImport(LIBNAME)]
  10364. private static extern IntPtr imgproc_Imgproc_createCLAHE_11(double clipLimit);
  10365. [DllImport(LIBNAME)]
  10366. private static extern IntPtr imgproc_Imgproc_createCLAHE_12();
  10367. // C++: float cv::wrapperEMD(Mat signature1, Mat signature2, int distType, Mat cost = Mat(), Ptr_float& lowerBound = Ptr<float>(), Mat& flow = Mat())
  10368. [DllImport(LIBNAME)]
  10369. private static extern float imgproc_Imgproc_EMD_10(IntPtr signature1_nativeObj, IntPtr signature2_nativeObj, int distType, IntPtr cost_nativeObj, IntPtr flow_nativeObj);
  10370. [DllImport(LIBNAME)]
  10371. private static extern float imgproc_Imgproc_EMD_11(IntPtr signature1_nativeObj, IntPtr signature2_nativeObj, int distType, IntPtr cost_nativeObj);
  10372. [DllImport(LIBNAME)]
  10373. private static extern float imgproc_Imgproc_EMD_13(IntPtr signature1_nativeObj, IntPtr signature2_nativeObj, int distType);
  10374. // C++: void cv::watershed(Mat image, Mat& markers)
  10375. [DllImport(LIBNAME)]
  10376. private static extern void imgproc_Imgproc_watershed_10(IntPtr image_nativeObj, IntPtr markers_nativeObj);
  10377. // C++: void cv::pyrMeanShiftFiltering(Mat src, Mat& dst, double sp, double sr, int maxLevel = 1, TermCriteria termcrit = TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1))
  10378. [DllImport(LIBNAME)]
  10379. private static extern void imgproc_Imgproc_pyrMeanShiftFiltering_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, double sp, double sr, int maxLevel, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon);
  10380. [DllImport(LIBNAME)]
  10381. private static extern void imgproc_Imgproc_pyrMeanShiftFiltering_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, double sp, double sr, int maxLevel);
  10382. [DllImport(LIBNAME)]
  10383. private static extern void imgproc_Imgproc_pyrMeanShiftFiltering_12(IntPtr src_nativeObj, IntPtr dst_nativeObj, double sp, double sr);
  10384. // C++: void cv::grabCut(Mat img, Mat& mask, Rect rect, Mat& bgdModel, Mat& fgdModel, int iterCount, int mode = GC_EVAL)
  10385. [DllImport(LIBNAME)]
  10386. private static extern void imgproc_Imgproc_grabCut_10(IntPtr img_nativeObj, IntPtr mask_nativeObj, int rect_x, int rect_y, int rect_width, int rect_height, IntPtr bgdModel_nativeObj, IntPtr fgdModel_nativeObj, int iterCount, int mode);
  10387. [DllImport(LIBNAME)]
  10388. private static extern void imgproc_Imgproc_grabCut_11(IntPtr img_nativeObj, IntPtr mask_nativeObj, int rect_x, int rect_y, int rect_width, int rect_height, IntPtr bgdModel_nativeObj, IntPtr fgdModel_nativeObj, int iterCount);
  10389. // C++: void cv::distanceTransform(Mat src, Mat& dst, Mat& labels, int distanceType, int maskSize, int labelType = DIST_LABEL_CCOMP)
  10390. [DllImport(LIBNAME)]
  10391. private static extern void imgproc_Imgproc_distanceTransformWithLabels_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr labels_nativeObj, int distanceType, int maskSize, int labelType);
  10392. [DllImport(LIBNAME)]
  10393. private static extern void imgproc_Imgproc_distanceTransformWithLabels_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr labels_nativeObj, int distanceType, int maskSize);
  10394. // C++: void cv::distanceTransform(Mat src, Mat& dst, int distanceType, int maskSize, int dstType = CV_32F)
  10395. [DllImport(LIBNAME)]
  10396. private static extern void imgproc_Imgproc_distanceTransform_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int distanceType, int maskSize, int dstType);
  10397. [DllImport(LIBNAME)]
  10398. private static extern void imgproc_Imgproc_distanceTransform_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int distanceType, int maskSize);
  10399. // C++: int cv::floodFill(Mat& image, Mat& mask, Point seedPoint, Scalar newVal, Rect* rect = 0, Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), int flags = 4)
  10400. [DllImport(LIBNAME)]
  10401. private static extern int imgproc_Imgproc_floodFill_10(IntPtr image_nativeObj, IntPtr mask_nativeObj, double seedPoint_x, double seedPoint_y, double newVal_val0, double newVal_val1, double newVal_val2, double newVal_val3, double[] rect_out, double loDiff_val0, double loDiff_val1, double loDiff_val2, double loDiff_val3, double upDiff_val0, double upDiff_val1, double upDiff_val2, double upDiff_val3, int flags);
  10402. [DllImport(LIBNAME)]
  10403. private static extern int imgproc_Imgproc_floodFill_11(IntPtr image_nativeObj, IntPtr mask_nativeObj, double seedPoint_x, double seedPoint_y, double newVal_val0, double newVal_val1, double newVal_val2, double newVal_val3, double[] rect_out, double loDiff_val0, double loDiff_val1, double loDiff_val2, double loDiff_val3, double upDiff_val0, double upDiff_val1, double upDiff_val2, double upDiff_val3);
  10404. [DllImport(LIBNAME)]
  10405. private static extern int imgproc_Imgproc_floodFill_12(IntPtr image_nativeObj, IntPtr mask_nativeObj, double seedPoint_x, double seedPoint_y, double newVal_val0, double newVal_val1, double newVal_val2, double newVal_val3, double[] rect_out, double loDiff_val0, double loDiff_val1, double loDiff_val2, double loDiff_val3);
  10406. [DllImport(LIBNAME)]
  10407. private static extern int imgproc_Imgproc_floodFill_13(IntPtr image_nativeObj, IntPtr mask_nativeObj, double seedPoint_x, double seedPoint_y, double newVal_val0, double newVal_val1, double newVal_val2, double newVal_val3, double[] rect_out);
  10408. [DllImport(LIBNAME)]
  10409. private static extern int imgproc_Imgproc_floodFill_14(IntPtr image_nativeObj, IntPtr mask_nativeObj, double seedPoint_x, double seedPoint_y, double newVal_val0, double newVal_val1, double newVal_val2, double newVal_val3);
  10410. // C++: void cv::blendLinear(Mat src1, Mat src2, Mat weights1, Mat weights2, Mat& dst)
  10411. [DllImport(LIBNAME)]
  10412. private static extern void imgproc_Imgproc_blendLinear_10(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr weights1_nativeObj, IntPtr weights2_nativeObj, IntPtr dst_nativeObj);
  10413. // C++: void cv::cvtColor(Mat src, Mat& dst, int code, int dstCn = 0)
  10414. [DllImport(LIBNAME)]
  10415. private static extern void imgproc_Imgproc_cvtColor_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int code, int dstCn);
  10416. [DllImport(LIBNAME)]
  10417. private static extern void imgproc_Imgproc_cvtColor_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int code);
  10418. // C++: void cv::cvtColorTwoPlane(Mat src1, Mat src2, Mat& dst, int code)
  10419. [DllImport(LIBNAME)]
  10420. private static extern void imgproc_Imgproc_cvtColorTwoPlane_10(IntPtr src1_nativeObj, IntPtr src2_nativeObj, IntPtr dst_nativeObj, int code);
  10421. // C++: void cv::demosaicing(Mat src, Mat& dst, int code, int dstCn = 0)
  10422. [DllImport(LIBNAME)]
  10423. private static extern void imgproc_Imgproc_demosaicing_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int code, int dstCn);
  10424. [DllImport(LIBNAME)]
  10425. private static extern void imgproc_Imgproc_demosaicing_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, int code);
  10426. // C++: Moments cv::moments(Mat array, bool binaryImage = false)
  10427. [DllImport(LIBNAME)]
  10428. private static extern void imgproc_Imgproc_moments_10(IntPtr array_nativeObj, [MarshalAs(UnmanagedType.U1)] bool binaryImage, double[] retVal);
  10429. [DllImport(LIBNAME)]
  10430. private static extern void imgproc_Imgproc_moments_11(IntPtr array_nativeObj, double[] retVal);
  10431. // C++: void cv::HuMoments(Moments m, Mat& hu)
  10432. [DllImport(LIBNAME)]
  10433. private static extern void imgproc_Imgproc_HuMoments_10(double m_m00, double m_m10, double m_m01, double m_m20, double m_m11, double m_m02, double m_m30, double m_m21, double m_m12, double m_m03, IntPtr hu_nativeObj);
  10434. // C++: void cv::matchTemplate(Mat image, Mat templ, Mat& result, int method, Mat mask = Mat())
  10435. [DllImport(LIBNAME)]
  10436. private static extern void imgproc_Imgproc_matchTemplate_10(IntPtr image_nativeObj, IntPtr templ_nativeObj, IntPtr result_nativeObj, int method, IntPtr mask_nativeObj);
  10437. [DllImport(LIBNAME)]
  10438. private static extern void imgproc_Imgproc_matchTemplate_11(IntPtr image_nativeObj, IntPtr templ_nativeObj, IntPtr result_nativeObj, int method);
  10439. // C++: int cv::connectedComponents(Mat image, Mat& labels, int connectivity, int ltype, int ccltype)
  10440. [DllImport(LIBNAME)]
  10441. private static extern int imgproc_Imgproc_connectedComponentsWithAlgorithm_10(IntPtr image_nativeObj, IntPtr labels_nativeObj, int connectivity, int ltype, int ccltype);
  10442. // C++: int cv::connectedComponents(Mat image, Mat& labels, int connectivity = 8, int ltype = CV_32S)
  10443. [DllImport(LIBNAME)]
  10444. private static extern int imgproc_Imgproc_connectedComponents_10(IntPtr image_nativeObj, IntPtr labels_nativeObj, int connectivity, int ltype);
  10445. [DllImport(LIBNAME)]
  10446. private static extern int imgproc_Imgproc_connectedComponents_11(IntPtr image_nativeObj, IntPtr labels_nativeObj, int connectivity);
  10447. [DllImport(LIBNAME)]
  10448. private static extern int imgproc_Imgproc_connectedComponents_12(IntPtr image_nativeObj, IntPtr labels_nativeObj);
  10449. // C++: int cv::connectedComponentsWithStats(Mat image, Mat& labels, Mat& stats, Mat& centroids, int connectivity, int ltype, int ccltype)
  10450. [DllImport(LIBNAME)]
  10451. private static extern int imgproc_Imgproc_connectedComponentsWithStatsWithAlgorithm_10(IntPtr image_nativeObj, IntPtr labels_nativeObj, IntPtr stats_nativeObj, IntPtr centroids_nativeObj, int connectivity, int ltype, int ccltype);
  10452. // C++: int cv::connectedComponentsWithStats(Mat image, Mat& labels, Mat& stats, Mat& centroids, int connectivity = 8, int ltype = CV_32S)
  10453. [DllImport(LIBNAME)]
  10454. private static extern int imgproc_Imgproc_connectedComponentsWithStats_10(IntPtr image_nativeObj, IntPtr labels_nativeObj, IntPtr stats_nativeObj, IntPtr centroids_nativeObj, int connectivity, int ltype);
  10455. [DllImport(LIBNAME)]
  10456. private static extern int imgproc_Imgproc_connectedComponentsWithStats_11(IntPtr image_nativeObj, IntPtr labels_nativeObj, IntPtr stats_nativeObj, IntPtr centroids_nativeObj, int connectivity);
  10457. [DllImport(LIBNAME)]
  10458. private static extern int imgproc_Imgproc_connectedComponentsWithStats_12(IntPtr image_nativeObj, IntPtr labels_nativeObj, IntPtr stats_nativeObj, IntPtr centroids_nativeObj);
  10459. // C++: void cv::findContours(Mat image, vector_vector_Point& contours, Mat& hierarchy, int mode, int method, Point offset = Point())
  10460. [DllImport(LIBNAME)]
  10461. private static extern void imgproc_Imgproc_findContours_10(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, IntPtr hierarchy_nativeObj, int mode, int method, double offset_x, double offset_y);
  10462. [DllImport(LIBNAME)]
  10463. private static extern void imgproc_Imgproc_findContours_11(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, IntPtr hierarchy_nativeObj, int mode, int method);
  10464. // C++: void cv::approxPolyDP(vector_Point2f curve, vector_Point2f& approxCurve, double epsilon, bool closed)
  10465. [DllImport(LIBNAME)]
  10466. private static extern void imgproc_Imgproc_approxPolyDP_10(IntPtr curve_mat_nativeObj, IntPtr approxCurve_mat_nativeObj, double epsilon, [MarshalAs(UnmanagedType.U1)] bool closed);
  10467. // C++: double cv::arcLength(vector_Point2f curve, bool closed)
  10468. [DllImport(LIBNAME)]
  10469. private static extern double imgproc_Imgproc_arcLength_10(IntPtr curve_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool closed);
  10470. // C++: Rect cv::boundingRect(Mat array)
  10471. [DllImport(LIBNAME)]
  10472. private static extern void imgproc_Imgproc_boundingRect_10(IntPtr array_nativeObj, double[] retVal);
  10473. // C++: double cv::contourArea(Mat contour, bool oriented = false)
  10474. [DllImport(LIBNAME)]
  10475. private static extern double imgproc_Imgproc_contourArea_10(IntPtr contour_nativeObj, [MarshalAs(UnmanagedType.U1)] bool oriented);
  10476. [DllImport(LIBNAME)]
  10477. private static extern double imgproc_Imgproc_contourArea_11(IntPtr contour_nativeObj);
  10478. // C++: RotatedRect cv::minAreaRect(vector_Point2f points)
  10479. [DllImport(LIBNAME)]
  10480. private static extern void imgproc_Imgproc_minAreaRect_10(IntPtr points_mat_nativeObj, double[] retVal);
  10481. // C++: void cv::boxPoints(RotatedRect box, Mat& points)
  10482. [DllImport(LIBNAME)]
  10483. private static extern void imgproc_Imgproc_boxPoints_10(double box_center_x, double box_center_y, double box_size_width, double box_size_height, double box_angle, IntPtr points_nativeObj);
  10484. // C++: void cv::minEnclosingCircle(vector_Point2f points, Point2f& center, float& radius)
  10485. [DllImport(LIBNAME)]
  10486. private static extern void imgproc_Imgproc_minEnclosingCircle_10(IntPtr points_mat_nativeObj, double[] center_out, double[] radius_out);
  10487. // C++: double cv::minEnclosingTriangle(Mat points, Mat& triangle)
  10488. [DllImport(LIBNAME)]
  10489. private static extern double imgproc_Imgproc_minEnclosingTriangle_10(IntPtr points_nativeObj, IntPtr triangle_nativeObj);
  10490. // C++: double cv::matchShapes(Mat contour1, Mat contour2, int method, double parameter)
  10491. [DllImport(LIBNAME)]
  10492. private static extern double imgproc_Imgproc_matchShapes_10(IntPtr contour1_nativeObj, IntPtr contour2_nativeObj, int method, double parameter);
  10493. // C++: void cv::convexHull(vector_Point points, vector_int& hull, bool clockwise = false, _hidden_ returnPoints = true)
  10494. [DllImport(LIBNAME)]
  10495. private static extern void imgproc_Imgproc_convexHull_10(IntPtr points_mat_nativeObj, IntPtr hull_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool clockwise);
  10496. [DllImport(LIBNAME)]
  10497. private static extern void imgproc_Imgproc_convexHull_12(IntPtr points_mat_nativeObj, IntPtr hull_mat_nativeObj);
  10498. // C++: void cv::convexityDefects(vector_Point contour, vector_int convexhull, vector_Vec4i& convexityDefects)
  10499. [DllImport(LIBNAME)]
  10500. private static extern void imgproc_Imgproc_convexityDefects_10(IntPtr contour_mat_nativeObj, IntPtr convexhull_mat_nativeObj, IntPtr convexityDefects_mat_nativeObj);
  10501. // C++: bool cv::isContourConvex(vector_Point contour)
  10502. [DllImport(LIBNAME)]
  10503. [return: MarshalAs(UnmanagedType.U1)]
  10504. private static extern bool imgproc_Imgproc_isContourConvex_10(IntPtr contour_mat_nativeObj);
  10505. // C++: float cv::intersectConvexConvex(Mat p1, Mat p2, Mat& p12, bool handleNested = true)
  10506. [DllImport(LIBNAME)]
  10507. private static extern float imgproc_Imgproc_intersectConvexConvex_10(IntPtr p1_nativeObj, IntPtr p2_nativeObj, IntPtr p12_nativeObj, [MarshalAs(UnmanagedType.U1)] bool handleNested);
  10508. [DllImport(LIBNAME)]
  10509. private static extern float imgproc_Imgproc_intersectConvexConvex_11(IntPtr p1_nativeObj, IntPtr p2_nativeObj, IntPtr p12_nativeObj);
  10510. // C++: RotatedRect cv::fitEllipse(vector_Point2f points)
  10511. [DllImport(LIBNAME)]
  10512. private static extern void imgproc_Imgproc_fitEllipse_10(IntPtr points_mat_nativeObj, double[] retVal);
  10513. // C++: RotatedRect cv::fitEllipseAMS(Mat points)
  10514. [DllImport(LIBNAME)]
  10515. private static extern void imgproc_Imgproc_fitEllipseAMS_10(IntPtr points_nativeObj, double[] retVal);
  10516. // C++: RotatedRect cv::fitEllipseDirect(Mat points)
  10517. [DllImport(LIBNAME)]
  10518. private static extern void imgproc_Imgproc_fitEllipseDirect_10(IntPtr points_nativeObj, double[] retVal);
  10519. // C++: void cv::fitLine(Mat points, Mat& line, int distType, double param, double reps, double aeps)
  10520. [DllImport(LIBNAME)]
  10521. private static extern void imgproc_Imgproc_fitLine_10(IntPtr points_nativeObj, IntPtr line_nativeObj, int distType, double param, double reps, double aeps);
  10522. // C++: double cv::pointPolygonTest(vector_Point2f contour, Point2f pt, bool measureDist)
  10523. [DllImport(LIBNAME)]
  10524. private static extern double imgproc_Imgproc_pointPolygonTest_10(IntPtr contour_mat_nativeObj, double pt_x, double pt_y, [MarshalAs(UnmanagedType.U1)] bool measureDist);
  10525. // C++: int cv::rotatedRectangleIntersection(RotatedRect rect1, RotatedRect rect2, Mat& intersectingRegion)
  10526. [DllImport(LIBNAME)]
  10527. private static extern int imgproc_Imgproc_rotatedRectangleIntersection_10(double rect1_center_x, double rect1_center_y, double rect1_size_width, double rect1_size_height, double rect1_angle, double rect2_center_x, double rect2_center_y, double rect2_size_width, double rect2_size_height, double rect2_angle, IntPtr intersectingRegion_nativeObj);
  10528. // C++: Ptr_GeneralizedHoughBallard cv::createGeneralizedHoughBallard()
  10529. [DllImport(LIBNAME)]
  10530. private static extern IntPtr imgproc_Imgproc_createGeneralizedHoughBallard_10();
  10531. // C++: Ptr_GeneralizedHoughGuil cv::createGeneralizedHoughGuil()
  10532. [DllImport(LIBNAME)]
  10533. private static extern IntPtr imgproc_Imgproc_createGeneralizedHoughGuil_10();
  10534. // C++: void cv::applyColorMap(Mat src, Mat& dst, int colormap)
  10535. [DllImport(LIBNAME)]
  10536. private static extern void imgproc_Imgproc_applyColorMap_10(IntPtr src_nativeObj, IntPtr dst_nativeObj, int colormap);
  10537. // C++: void cv::applyColorMap(Mat src, Mat& dst, Mat userColor)
  10538. [DllImport(LIBNAME)]
  10539. private static extern void imgproc_Imgproc_applyColorMap_11(IntPtr src_nativeObj, IntPtr dst_nativeObj, IntPtr userColor_nativeObj);
  10540. // C++: void cv::line(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10541. [DllImport(LIBNAME)]
  10542. private static extern void imgproc_Imgproc_line_10(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10543. [DllImport(LIBNAME)]
  10544. private static extern void imgproc_Imgproc_line_11(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10545. [DllImport(LIBNAME)]
  10546. private static extern void imgproc_Imgproc_line_12(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10547. [DllImport(LIBNAME)]
  10548. private static extern void imgproc_Imgproc_line_13(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3);
  10549. // C++: void cv::arrowedLine(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int line_type = 8, int shift = 0, double tipLength = 0.1)
  10550. [DllImport(LIBNAME)]
  10551. private static extern void imgproc_Imgproc_arrowedLine_10(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int line_type, int shift, double tipLength);
  10552. [DllImport(LIBNAME)]
  10553. private static extern void imgproc_Imgproc_arrowedLine_11(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int line_type, int shift);
  10554. [DllImport(LIBNAME)]
  10555. private static extern void imgproc_Imgproc_arrowedLine_12(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int line_type);
  10556. [DllImport(LIBNAME)]
  10557. private static extern void imgproc_Imgproc_arrowedLine_13(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10558. [DllImport(LIBNAME)]
  10559. private static extern void imgproc_Imgproc_arrowedLine_14(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3);
  10560. // C++: void cv::rectangle(Mat& img, Point pt1, Point pt2, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10561. [DllImport(LIBNAME)]
  10562. private static extern void imgproc_Imgproc_rectangle_10(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10563. [DllImport(LIBNAME)]
  10564. private static extern void imgproc_Imgproc_rectangle_11(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10565. [DllImport(LIBNAME)]
  10566. private static extern void imgproc_Imgproc_rectangle_12(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10567. [DllImport(LIBNAME)]
  10568. private static extern void imgproc_Imgproc_rectangle_13(IntPtr img_nativeObj, double pt1_x, double pt1_y, double pt2_x, double pt2_y, double color_val0, double color_val1, double color_val2, double color_val3);
  10569. // C++: void cv::rectangle(Mat& img, Rect rec, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10570. [DllImport(LIBNAME)]
  10571. private static extern void imgproc_Imgproc_rectangle_14(IntPtr img_nativeObj, int rec_x, int rec_y, int rec_width, int rec_height, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10572. [DllImport(LIBNAME)]
  10573. private static extern void imgproc_Imgproc_rectangle_15(IntPtr img_nativeObj, int rec_x, int rec_y, int rec_width, int rec_height, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10574. [DllImport(LIBNAME)]
  10575. private static extern void imgproc_Imgproc_rectangle_16(IntPtr img_nativeObj, int rec_x, int rec_y, int rec_width, int rec_height, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10576. [DllImport(LIBNAME)]
  10577. private static extern void imgproc_Imgproc_rectangle_17(IntPtr img_nativeObj, int rec_x, int rec_y, int rec_width, int rec_height, double color_val0, double color_val1, double color_val2, double color_val3);
  10578. // C++: void cv::circle(Mat& img, Point center, int radius, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10579. [DllImport(LIBNAME)]
  10580. private static extern void imgproc_Imgproc_circle_10(IntPtr img_nativeObj, double center_x, double center_y, int radius, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10581. [DllImport(LIBNAME)]
  10582. private static extern void imgproc_Imgproc_circle_11(IntPtr img_nativeObj, double center_x, double center_y, int radius, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10583. [DllImport(LIBNAME)]
  10584. private static extern void imgproc_Imgproc_circle_12(IntPtr img_nativeObj, double center_x, double center_y, int radius, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10585. [DllImport(LIBNAME)]
  10586. private static extern void imgproc_Imgproc_circle_13(IntPtr img_nativeObj, double center_x, double center_y, int radius, double color_val0, double color_val1, double color_val2, double color_val3);
  10587. // C++: void cv::ellipse(Mat& img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10588. [DllImport(LIBNAME)]
  10589. private static extern void imgproc_Imgproc_ellipse_10(IntPtr img_nativeObj, double center_x, double center_y, double axes_width, double axes_height, double angle, double startAngle, double endAngle, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10590. [DllImport(LIBNAME)]
  10591. private static extern void imgproc_Imgproc_ellipse_11(IntPtr img_nativeObj, double center_x, double center_y, double axes_width, double axes_height, double angle, double startAngle, double endAngle, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10592. [DllImport(LIBNAME)]
  10593. private static extern void imgproc_Imgproc_ellipse_12(IntPtr img_nativeObj, double center_x, double center_y, double axes_width, double axes_height, double angle, double startAngle, double endAngle, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10594. [DllImport(LIBNAME)]
  10595. private static extern void imgproc_Imgproc_ellipse_13(IntPtr img_nativeObj, double center_x, double center_y, double axes_width, double axes_height, double angle, double startAngle, double endAngle, double color_val0, double color_val1, double color_val2, double color_val3);
  10596. // C++: void cv::ellipse(Mat& img, RotatedRect box, Scalar color, int thickness = 1, int lineType = LINE_8)
  10597. [DllImport(LIBNAME)]
  10598. private static extern void imgproc_Imgproc_ellipse_14(IntPtr img_nativeObj, double box_center_x, double box_center_y, double box_size_width, double box_size_height, double box_angle, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10599. [DllImport(LIBNAME)]
  10600. private static extern void imgproc_Imgproc_ellipse_15(IntPtr img_nativeObj, double box_center_x, double box_center_y, double box_size_width, double box_size_height, double box_angle, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10601. [DllImport(LIBNAME)]
  10602. private static extern void imgproc_Imgproc_ellipse_16(IntPtr img_nativeObj, double box_center_x, double box_center_y, double box_size_width, double box_size_height, double box_angle, double color_val0, double color_val1, double color_val2, double color_val3);
  10603. // C++: void cv::drawMarker(Mat& img, Point position, Scalar color, int markerType = MARKER_CROSS, int markerSize = 20, int thickness = 1, int line_type = 8)
  10604. [DllImport(LIBNAME)]
  10605. private static extern void imgproc_Imgproc_drawMarker_10(IntPtr img_nativeObj, double position_x, double position_y, double color_val0, double color_val1, double color_val2, double color_val3, int markerType, int markerSize, int thickness, int line_type);
  10606. [DllImport(LIBNAME)]
  10607. private static extern void imgproc_Imgproc_drawMarker_11(IntPtr img_nativeObj, double position_x, double position_y, double color_val0, double color_val1, double color_val2, double color_val3, int markerType, int markerSize, int thickness);
  10608. [DllImport(LIBNAME)]
  10609. private static extern void imgproc_Imgproc_drawMarker_12(IntPtr img_nativeObj, double position_x, double position_y, double color_val0, double color_val1, double color_val2, double color_val3, int markerType, int markerSize);
  10610. [DllImport(LIBNAME)]
  10611. private static extern void imgproc_Imgproc_drawMarker_13(IntPtr img_nativeObj, double position_x, double position_y, double color_val0, double color_val1, double color_val2, double color_val3, int markerType);
  10612. [DllImport(LIBNAME)]
  10613. private static extern void imgproc_Imgproc_drawMarker_14(IntPtr img_nativeObj, double position_x, double position_y, double color_val0, double color_val1, double color_val2, double color_val3);
  10614. // C++: void cv::fillConvexPoly(Mat& img, vector_Point points, Scalar color, int lineType = LINE_8, int shift = 0)
  10615. [DllImport(LIBNAME)]
  10616. private static extern void imgproc_Imgproc_fillConvexPoly_10(IntPtr img_nativeObj, IntPtr points_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int lineType, int shift);
  10617. [DllImport(LIBNAME)]
  10618. private static extern void imgproc_Imgproc_fillConvexPoly_11(IntPtr img_nativeObj, IntPtr points_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int lineType);
  10619. [DllImport(LIBNAME)]
  10620. private static extern void imgproc_Imgproc_fillConvexPoly_12(IntPtr img_nativeObj, IntPtr points_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3);
  10621. // C++: void cv::fillPoly(Mat& img, vector_vector_Point pts, Scalar color, int lineType = LINE_8, int shift = 0, Point offset = Point())
  10622. [DllImport(LIBNAME)]
  10623. private static extern void imgproc_Imgproc_fillPoly_10(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int lineType, int shift, double offset_x, double offset_y);
  10624. [DllImport(LIBNAME)]
  10625. private static extern void imgproc_Imgproc_fillPoly_11(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int lineType, int shift);
  10626. [DllImport(LIBNAME)]
  10627. private static extern void imgproc_Imgproc_fillPoly_12(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int lineType);
  10628. [DllImport(LIBNAME)]
  10629. private static extern void imgproc_Imgproc_fillPoly_13(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3);
  10630. // C++: void cv::polylines(Mat& img, vector_vector_Point pts, bool isClosed, Scalar color, int thickness = 1, int lineType = LINE_8, int shift = 0)
  10631. [DllImport(LIBNAME)]
  10632. private static extern void imgproc_Imgproc_polylines_10(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool isClosed, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, int shift);
  10633. [DllImport(LIBNAME)]
  10634. private static extern void imgproc_Imgproc_polylines_11(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool isClosed, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10635. [DllImport(LIBNAME)]
  10636. private static extern void imgproc_Imgproc_polylines_12(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool isClosed, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10637. [DllImport(LIBNAME)]
  10638. private static extern void imgproc_Imgproc_polylines_13(IntPtr img_nativeObj, IntPtr pts_mat_nativeObj, [MarshalAs(UnmanagedType.U1)] bool isClosed, double color_val0, double color_val1, double color_val2, double color_val3);
  10639. // C++: void cv::drawContours(Mat& image, vector_vector_Point contours, int contourIdx, Scalar color, int thickness = 1, int lineType = LINE_8, Mat hierarchy = Mat(), int maxLevel = INT_MAX, Point offset = Point())
  10640. [DllImport(LIBNAME)]
  10641. private static extern void imgproc_Imgproc_drawContours_10(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, IntPtr hierarchy_nativeObj, int maxLevel, double offset_x, double offset_y);
  10642. [DllImport(LIBNAME)]
  10643. private static extern void imgproc_Imgproc_drawContours_11(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, IntPtr hierarchy_nativeObj, int maxLevel);
  10644. [DllImport(LIBNAME)]
  10645. private static extern void imgproc_Imgproc_drawContours_12(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, IntPtr hierarchy_nativeObj);
  10646. [DllImport(LIBNAME)]
  10647. private static extern void imgproc_Imgproc_drawContours_13(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10648. [DllImport(LIBNAME)]
  10649. private static extern void imgproc_Imgproc_drawContours_14(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10650. [DllImport(LIBNAME)]
  10651. private static extern void imgproc_Imgproc_drawContours_15(IntPtr image_nativeObj, IntPtr contours_mat_nativeObj, int contourIdx, double color_val0, double color_val1, double color_val2, double color_val3);
  10652. // C++: bool cv::clipLine(Rect imgRect, Point& pt1, Point& pt2)
  10653. [DllImport(LIBNAME)]
  10654. [return: MarshalAs(UnmanagedType.U1)]
  10655. private static extern bool imgproc_Imgproc_clipLine_10(int imgRect_x, int imgRect_y, int imgRect_width, int imgRect_height, double pt1_x, double pt1_y, double[] pt1_out, double pt2_x, double pt2_y, double[] pt2_out);
  10656. // C++: void cv::ellipse2Poly(Point center, Size axes, int angle, int arcStart, int arcEnd, int delta, vector_Point& pts)
  10657. [DllImport(LIBNAME)]
  10658. private static extern void imgproc_Imgproc_ellipse2Poly_10(double center_x, double center_y, double axes_width, double axes_height, int angle, int arcStart, int arcEnd, int delta, IntPtr pts_mat_nativeObj);
  10659. // C++: void cv::putText(Mat& img, String text, Point org, int fontFace, double fontScale, Scalar color, int thickness = 1, int lineType = LINE_8, bool bottomLeftOrigin = false)
  10660. [DllImport(LIBNAME)]
  10661. private static extern void imgproc_Imgproc_putText_10(IntPtr img_nativeObj, string text, double org_x, double org_y, int fontFace, double fontScale, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType, [MarshalAs(UnmanagedType.U1)] bool bottomLeftOrigin);
  10662. [DllImport(LIBNAME)]
  10663. private static extern void imgproc_Imgproc_putText_11(IntPtr img_nativeObj, string text, double org_x, double org_y, int fontFace, double fontScale, double color_val0, double color_val1, double color_val2, double color_val3, int thickness, int lineType);
  10664. [DllImport(LIBNAME)]
  10665. private static extern void imgproc_Imgproc_putText_12(IntPtr img_nativeObj, string text, double org_x, double org_y, int fontFace, double fontScale, double color_val0, double color_val1, double color_val2, double color_val3, int thickness);
  10666. [DllImport(LIBNAME)]
  10667. private static extern void imgproc_Imgproc_putText_13(IntPtr img_nativeObj, string text, double org_x, double org_y, int fontFace, double fontScale, double color_val0, double color_val1, double color_val2, double color_val3);
  10668. // C++: double cv::getFontScaleFromHeight(int fontFace, int pixelHeight, int thickness = 1)
  10669. [DllImport(LIBNAME)]
  10670. private static extern double imgproc_Imgproc_getFontScaleFromHeight_10(int fontFace, int pixelHeight, int thickness);
  10671. [DllImport(LIBNAME)]
  10672. private static extern double imgproc_Imgproc_getFontScaleFromHeight_11(int fontFace, int pixelHeight);
  10673. // C++: void cv::HoughLinesWithAccumulator(Mat image, Mat& lines, double rho, double theta, int threshold, double srn = 0, double stn = 0, double min_theta = 0, double max_theta = CV_PI)
  10674. [DllImport(LIBNAME)]
  10675. private static extern void imgproc_Imgproc_HoughLinesWithAccumulator_10(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn, double min_theta, double max_theta);
  10676. [DllImport(LIBNAME)]
  10677. private static extern void imgproc_Imgproc_HoughLinesWithAccumulator_11(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn, double min_theta);
  10678. [DllImport(LIBNAME)]
  10679. private static extern void imgproc_Imgproc_HoughLinesWithAccumulator_12(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn, double stn);
  10680. [DllImport(LIBNAME)]
  10681. private static extern void imgproc_Imgproc_HoughLinesWithAccumulator_13(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold, double srn);
  10682. [DllImport(LIBNAME)]
  10683. private static extern void imgproc_Imgproc_HoughLinesWithAccumulator_14(IntPtr image_nativeObj, IntPtr lines_nativeObj, double rho, double theta, int threshold);
  10684. [DllImport(LIBNAME)]
  10685. private static extern void imgproc_Imgproc_n_1getTextSize(string text, int fontFace, double fontScale, int thickness, int[] baseLine, double[] vals);
  10686. }
  10687. }