vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0"?>
|
||||
<opencv_storage>
|
||||
<transition_probabilities type_id="opencv-matrix">
|
||||
<rows>62</rows>
|
||||
<cols>62</cols>
|
||||
<dt>d</dt>
|
||||
<data>
|
||||
8.50520944078e-05 0.0544758664682 0.0617478205401 0.0385285987667 0.00146714862853 0.00848394641718 0.0317882202849 0.000893046991282 0.0399106953009 0.000786731873272 0.013140548586 0.118371252392 0.0354667233681 0.116691473528 0.000233893259622 0.034509887306 0.000403997448437 0.113565809058 0.0640442270891 0.196980650649 0.0180948330853 0.0160748458431 0.00967467573889 0.00372102913034 0.0153519030406 0.00550712311291 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.100866163733 0.0314799292167 0.00242153301667 0.00502933780386 0.126292260408 0.00204898947564 0.00130390239359 0.00130390239359 0.112973828816 0.00614696842693 0.0 0.289000651951 0.00484306603334 0.00186271770513 0.0848467914688 0.00186271770513 0.0 0.0757194747136 0.053366862252 0.0113625780013 0.0739498928937 0.0027940765577 0.00111763062308 0.0 0.00940672441092 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.123990600299 0.0 0.0241828669088 0.00046998504593 0.136594744713 0.0 0.0 0.107583849605 0.0869472334971 0.0 0.0763939329203 0.0394787438581 0.000299081392865 0.00128177739799 0.152574236274 0.000341807306131 0.00290536210211 0.0535355693228 0.0138431958983 0.115274513993 0.053407391583 0.0 0.0 0.0 0.0107242042299 0.000170903653066 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0556214577567 0.00263608804534 0.00263608804534 0.0282061420851 0.318834849084 0.00355871886121 0.0217477263741 0.00329511005668 0.226110452089 0.00724924212469 0.000527217609068 0.0645841571108 0.00948991696323 0.0267562936602 0.0452089099776 0.00237247924081 0.000131804402267 0.0322261763543 0.067615658363 0.00105443521814 0.0506787926717 0.011862396204 0.00546988269408 0.0 0.0119942006063 0.000131804402267 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0467747490338 0.00432414505657 0.0376672576757 0.147403599628 0.0215824585124 0.0132020357922 0.0106891845351 0.00250009566693 0.00761508731201 0.000982180440578 0.00145413727566 0.0484584869319 0.0227814839854 0.112134392898 0.00517876959578 0.0174496473079 0.00329094225544 0.22472798704 0.197022845262 0.0348482722553 0.0022194726839 0.0134061252344 0.00769162085284 0.0118626988278 0.00371187672998 0.00102044721099 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0729166666667 0.0 0.000508130081301 0.0 0.146214430894 0.111788617886 0.000762195121951 0.0 0.21468495935 0.0 0.0 0.0782520325203 0.0 0.00279471544715 0.111280487805 0.0 0.0 0.0581808943089 0.0162601626016 0.0429369918699 0.114456300813 0.0 0.000762195121951 0.0 0.0282012195122 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0787207872079 0.0 0.0 0.000351432085749 0.212440695836 0.000527148128624 0.0419961342471 0.0789843612722 0.107977508347 0.0 0.0 0.125812686698 0.00773150588649 0.0492883500264 0.0347917764892 0.000615006150062 0.0 0.110964681075 0.081356527851 0.00404146898612 0.0533298190125 0.0 0.000527148128624 0.0 0.0103672465296 0.000175716042875 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.154653160894 0.00144704711947 0.000542642669802 0.00271321334901 0.298996111061 0.00614995025776 0.0 0.00271321334901 0.184136745953 0.0 0.0 0.016460160984 0.0103102107262 0.0121190196256 0.133309215881 0.00090440444967 0.000361761779868 0.0371710228814 0.0124807814054 0.0618612643574 0.0365379397667 0.0 0.00614995025776 0.0 0.0205299810075 0.000452202224835 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0319377484564 0.0157151315233 0.0745496066988 0.0267783134568 0.0643998985029 0.0226507654572 0.0288928359976 0.000439820688489 0.000473653049142 0.000405988327836 0.00314640954073 0.0478558741436 0.0279116975387 0.299247229975 0.0865431785503 0.0175928275395 0.00182694747526 0.0263554089487 0.0856297048127 0.0803856889114 0.00159012095069 0.0491584200288 6.76647213059e-05 0.00296033155713 0.0 0.00348473314726 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.125310173697 0.0 0.0 0.0 0.263027295285 0.0 0.0 0.0 0.014888337469 0.0 0.00248138957816 0.0 0.0 0.0 0.233250620347 0.0 0.0 0.00124069478908 0.0 0.0 0.359801488834 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0458695168114 0.00668002672011 0.000890670229348 0.00267201068804 0.422845691383 0.00400801603206 0.000890670229348 0.0060120240481 0.197951458473 0.000890670229348 0.00222667557337 0.0721442885772 0.00668002672011 0.0334001336005 0.0106880427522 0.00534402137609 0.0 0.00489868626141 0.135381874861 0.00668002672011 0.00935203740815 0.0 0.00801603206413 0.0 0.0164773992429 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.10850279394 0.00172821015035 0.00357163431073 0.0179157785587 0.21712080189 0.00385966933579 0.0033988132957 0.000460856040094 0.153148222824 0.0 0.00558787948615 0.111066305663 0.00483898842099 0.0107149029322 0.0684659254565 0.00397488334581 0.0 0.00138256812028 0.0326055648367 0.0247710121551 0.0354859150873 0.00639437755631 0.000806498070165 0.0 0.18414079152 5.76070050118e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.142847308275 0.0638854467851 0.000619578686493 0.000275368305108 0.226215062646 0.00385515627151 0.0 0.000481894533939 0.159920143192 0.0 0.0 0.00530083987333 0.0549359768691 0.00901831199229 0.0927991188214 0.153242461793 0.0 0.000963789067878 0.037518931571 0.000413052457662 0.0410298774611 0.00068842076277 0.000275368305108 0.0 0.00571389233099 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0555165707641 0.00324799005554 0.0619123042685 0.0696914409447 0.155843374702 0.016380295527 0.238707219761 0.00453114662069 0.0559175571907 0.00272670770094 0.0130721575075 0.0076989393909 0.00364897648215 0.0156384706378 0.0215730697516 0.00425045612206 0.00272670770094 0.00411011087275 0.0990837460152 0.134691340698 0.00978406880927 0.011588507729 0.00312769412755 0.000280690498627 0.0034885819115 0.000761874210558 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0216214746118 0.0155565829911 0.0320378579782 0.0258913758873 0.00579292338655 0.00976365960456 0.0219206396693 0.00244771410699 0.0185754303897 0.000815904702331 0.0101444151323 0.0608664907939 0.0677744839403 0.23911447143 0.0419103048764 0.0337512578531 0.000435149174576 0.141885827735 0.0423726508744 0.0431341619299 0.0949985041747 0.0226005602546 0.0346215562022 0.00329081563273 0.00709837091028 0.00157741575784 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0966494041305 0.00112310476072 0.000623947089287 0.000686341798216 0.202595619891 0.00124789417857 0.000748736507144 0.0483558994197 0.0851687776877 0.0 0.000873525925002 0.101516191427 0.00174705185 0.00118549946964 0.104760716291 0.0722530729394 0.0 0.145878829475 0.0374992200661 0.0552817121108 0.0366880888501 0.0 0.000998315342859 0.0 0.00411805078929 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.000904977375566 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.999095022624 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.143023601179 0.00941305490187 0.0207224291165 0.0281934702643 0.211610957527 0.00680847174941 0.0125659713496 0.0013479860175 0.139322351436 9.13888825424e-05 0.0106924992575 0.0147136100893 0.0268683314675 0.021065137426 0.0920742991615 0.0123831935845 0.00036555553017 0.029153053531 0.110146450684 0.050538052046 0.0292215951929 0.00959583266696 0.00228472206356 0.0 0.0177065959926 9.13888825424e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0315670455934 0.00171128223934 0.0422320009779 0.001466813348 0.125473658477 0.00409485392984 0.002933626696 0.0628896222956 0.108330277472 0.000733406674001 0.00928981787068 0.0301002322454 0.0154626573768 0.0203825938149 0.0375565334311 0.0439738418286 0.00443099865542 0.00161960640508 0.200647842562 0.199425498105 0.0422931182007 0.0 0.00589781200342 6.11172228334e-05 0.00742574257426 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0828099447776 0.000805820870761 0.011542198943 0.000237006138459 0.250088877302 0.00355509207688 0.000805820870761 0.0456473822672 0.276775768492 0.0 4.74012276918e-05 0.028914748892 0.00312848102766 0.006920579243 0.055056525964 0.00109022823691 0.0 0.0702723200531 0.0615741947716 0.0335126679781 0.0341762851658 0.000189604910767 0.0037683976015 0.0 0.0284170360012 0.000663617187685 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0407358156028 0.0375886524823 0.0419769503546 0.0322695035461 0.043085106383 0.0132092198582 0.0246010638298 8.86524822695e-05 0.0436170212766 0.0 0.000886524822695 0.105230496454 0.0573581560284 0.148670212766 0.00833333333333 0.0339095744681 0.000177304964539 0.131826241135 0.144060283688 0.0859485815603 0.000487588652482 0.000531914893617 0.0 0.00168439716312 0.000975177304965 0.00274822695035 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.131552670994 0.0 0.000124812780829 0.0 0.623689465801 0.0 0.0 0.0 0.18072890664 0.0 0.0 0.0 0.000124812780829 0.0 0.0567898152771 0.0 0.0 0.0 0.0 0.0 0.00399400898652 0.0 0.0 0.0 0.00299550673989 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.196585140748 0.00646054453161 0.00230733733272 0.0133825565298 0.193124134749 0.00599907706507 0.000922934933087 0.0539916935856 0.174665436087 0.0 0.0073834794647 0.0535302261191 0.00323027226581 0.0779880018459 0.095062298108 0.000922934933087 0.0 0.03737886479 0.0673742501154 0.00553760959852 0.00138440239963 0.0 0.0 0.0 0.00276880479926 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.092132505176 0.0 0.123188405797 0.0 0.15734989648 0.0 0.0 0.0310559006211 0.166149068323 0.0 0.0 0.00621118012422 0.0 0.00103519668737 0.0207039337474 0.230848861284 0.00310559006211 0.0 0.0 0.142857142857 0.0175983436853 0.00207039337474 0.00103519668737 0.000517598343685 0.00414078674948 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0538403614458 0.0143072289157 0.042921686747 0.0143072289157 0.140436746988 0.00753012048193 0.00978915662651 0.00451807228916 0.181852409639 0.0 0.0 0.0504518072289 0.0730421686747 0.0557228915663 0.0368975903614 0.0798192771084 0.0 0.0286144578313 0.157379518072 0.0316265060241 0.00263554216867 0.0 0.0135542168675 0.000753012048193 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.104328523862 0.0 0.0 0.0 0.369589345172 0.0 0.0 0.0 0.19089900111 0.0 0.00221975582686 0.0732519422863 0.00443951165372 0.0 0.0532741398446 0.0 0.0 0.0 0.0 0.0 0.00887902330744 0.00887902330744 0.00443951165372 0.0 0.0332963374029 0.146503884573 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0 0.0094510076442 0.0116747741487 0.012022237665 0.000799166087561 0.00371785962474 0.00357887421821 6.94927032662e-05 0.00267546907575 3.47463516331e-05 6.94927032662e-05 0.0102501737318 0.00681028492008 0.0127171646977 3.47463516331e-05 0.0097637248089 0.00045170257123 0.0105281445448 0.0102849200834 0.00535093815149 0.00615010423905 0.00277970813065 0.00156358582349 0.000868658790827 0.000138985406532 0.000173731758165 6.94927032662e-05 0.0492355802641 0.0562890896456 0.0374913134121 0.00159833217512 0.00879082696317 0.0277623349548 0.000764419735928 0.0339471855455 0.000660180681028 0.0107713690063 0.101841556637 0.032383599722 0.10170257123 0.000208478109798 0.0330785267547 0.000555941626129 0.0980542043085 0.0574704656011 0.16362056984 0.0178596247394 0.0145239749826 0.00868658790827 0.00347463516331 0.0126129256428 0.00458651841557 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0593910159783 0.0 0.0 0.0 0.0530599939705 0.0 0.0 0.0 0.0276354135263 0.0 0.0 0.0354738217265 0.0 0.0 0.0400964727163 0.0 0.0 0.0477338960908 0.000100492412823 0.0 0.0410009044317 0.0 0.0 0.0 0.00251231032057 0.0 0.0841121495327 0.0169832177671 0.0013064013667 0.00271329514622 0.0946638528791 0.00110541654105 0.00070344688976 0.00070344688976 0.0747663551402 0.00331624962315 0.0 0.173650889358 0.00261280273339 0.00100492412823 0.065822530399 0.00100492412823 0.0 0.0647171138579 0.0288413224802 0.00613003718219 0.0603959401065 0.00150738619234 0.000602954476937 0.0 0.00633102200784 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0294084251164 0.0 0.0 5.67730214602e-05 0.00573407516748 0.0 0.0 0.0255478596571 0.00482570682412 0.0 0.0 0.0181673668673 5.67730214602e-05 0.0 0.106335869195 0.00011354604292 0.0 0.0204950607471 0.0 0.0 0.0112410582491 0.0 0.0 0.0 0.00164641762235 0.00011354604292 0.0970818666969 0.0 0.0160667650732 0.000340638128761 0.0936187123879 0.0 0.0 0.0842511638469 0.0601794027478 0.0 0.0507550811854 0.0353128193482 0.000227092085841 0.000851595321903 0.154536164415 0.000283865107301 0.00193028272965 0.0458158283184 0.00919722947655 0.0765868059498 0.0411036675372 0.0 0.0 0.0 0.00794822300443 0.000170319064381 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0157669237361 0.0 0.0 0.0 0.0894601542416 0.0 0.0 0.0 0.0814910025707 0.0 0.0 0.0 0.0 0.0 0.0176520994002 0.0 0.0 0.0177377892031 0.0 0.0 0.0083119108826 0.0 0.0012853470437 0.0 0.00154241645244 0.0 0.0440445586975 0.00171379605827 0.00171379605827 0.0183376178235 0.252013710368 0.00231362467866 0.0141388174807 0.00214224507284 0.187746358183 0.00471293916024 0.000342759211654 0.0419880034276 0.00616966580977 0.0173950299914 0.0382176520994 0.00154241645244 8.56898029135e-05 0.0298200514139 0.0439588688946 0.000685518423308 0.0371036846615 0.00771208226221 0.00419880034276 0.0 0.00856898029135 8.56898029135e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0019322058157 0.000119271963932 0.000596359819661 0.00100188449703 9.54175711457e-05 0.000548651034088 0.000190835142291 0.0 0.000310107106224 0.000262398320651 9.54175711457e-05 0.00388826602419 0.00329190620453 0.00970873786408 0.0 0.000763340569166 0.000811049354739 0.00114501085375 0.00166980749505 0.000429379070156 0.000190835142291 0.00236158488586 7.15631783593e-05 0.0133107511748 0.000500942248515 0.0 0.0447031320818 0.00410295555927 0.035519190859 0.138331623769 0.0202285250829 0.012618973784 0.0100904081487 0.00233773049307 0.00727558979986 0.0010495932826 0.0014074091744 0.0472555521099 0.0229479258605 0.109706352425 0.00484244173565 0.0166980749505 0.00348274134682 0.210705851483 0.185062379237 0.0327997900813 0.00217074974357 0.0137162758522 0.00722788101429 0.0177476682331 0.00372128527468 0.000954175711457 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0470732080086 0.0 0.0 0.0 0.0255234601865 0.0 0.0 0.0 0.0354577410974 0.0 0.0 0.0409598043711 0.0 0.0 0.0602170258291 0.0 0.0 0.038820113098 0.0 0.0 0.0175760354577 0.0 0.0 0.0 0.0 0.0 0.0674002751032 0.0 0.000305670181874 0.0 0.100718324927 0.0672474400122 0.000458505272811 0.0 0.14687452239 0.0 0.0 0.0675531101941 0.0 0.00168118600031 0.0970502827449 0.0 0.0 0.0544092923735 0.00978144581996 0.0258291303683 0.0776402261959 0.0 0.000458505272811 0.0 0.016964695094 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0279106858054 0.0 0.0 0.0 0.0154173312068 0.0 0.0 0.00146198830409 0.0104997341839 0.0 0.0 0.0204678362573 0.0 0.000930356193514 0.0151515151515 0.000132908027645 0.0 0.0530303030303 0.0 0.0 0.0152844231792 0.0 0.0 0.0 0.00212652844232 0.0 0.0734981392876 0.0 0.0 0.00026581605529 0.168394471026 0.000398724082935 0.0317650186071 0.0604731525784 0.0869218500797 0.0 0.0 0.105396065922 0.00584795321637 0.0377458798511 0.0338915470494 0.000531632110579 0.0 0.110446570973 0.0615364167996 0.00305688463583 0.0479797979798 0.0 0.000398724082935 0.0 0.00890483785221 0.000132908027645 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0484241850399 0.0 0.0 0.0 0.0346273501961 0.0 0.0 0.0 0.0175842012715 0.0 0.0 0.0 0.0 0.0 0.0416610307047 0.0 0.0 0.000135263086704 0.0 0.0 0.020559989179 0.0 0.0 0.0 0.00500473420803 0.000135263086704 0.139862031652 0.00108210469363 0.000405789260111 0.00202894630055 0.240903557419 0.00459894494792 0.0 0.00202894630055 0.1464899229 0.0 0.0 0.01230894089 0.00770999594211 0.00906262680914 0.120519410253 0.000676315433518 0.000270526173407 0.0278641958609 0.00933315298255 0.0462599756526 0.0376031381036 0.0 0.00459894494792 0.0 0.0178547274449 0.000405789260111 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0 3.0466441215e-05 0.000396063735795 0.00143192273711 3.0466441215e-05 3.0466441215e-05 0.00036559729458 0.0 6.093288243e-05 0.0 0.0 0.00137098985468 0.010480455778 0.0476495140603 0.00012186576486 0.0 0.0 0.00225451664991 0.00109679188374 0.00079212747159 0.0 0.00018279864729 0.0 3.0466441215e-05 0.0 0.0 0.028760320507 0.014166895165 0.0673308350852 0.0248301495902 0.0580081040734 0.0204125156141 0.0262011394449 0.000396063735795 0.000456996618225 0.00036559729458 0.002833379033 0.043780276026 0.0303750418914 0.293300429577 0.0779940895104 0.0158425494318 0.00164518782561 0.0248606160314 0.077658958657 0.0727843280626 0.00143192273711 0.044359138409 6.093288243e-05 0.00268104682692 0.0 0.00313804344515 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0665859564165 0.0 0.0 0.0 0.0556900726392 0.0 0.0 0.0 0.00968523002421 0.0 0.0 0.0 0.0 0.0 0.089588377724 0.0 0.0 0.00121065375303 0.0 0.0 0.118644067797 0.0 0.0 0.0 0.0 0.0 0.0944309927361 0.0 0.0 0.0 0.15617433414 0.0 0.0 0.0 0.0121065375303 0.0 0.00121065375303 0.0 0.0 0.0 0.158595641646 0.0 0.0 0.00121065375303 0.0 0.0 0.234866828087 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0 0.0 0.0 0.0 0.017523364486 0.0 0.0 0.000389408099688 0.0323208722741 0.0 0.0 0.00545171339564 0.0 0.0272585669782 0.0 0.0 0.0 0.0 0.0 0.0 0.000778816199377 0.0 0.0 0.0 0.0 0.0 0.0401090342679 0.00584112149533 0.000778816199377 0.00233644859813 0.378504672897 0.0035046728972 0.000778816199377 0.00545171339564 0.189252336449 0.000778816199377 0.00194704049844 0.0658099688474 0.00584112149533 0.0428348909657 0.00934579439252 0.00467289719626 0.0 0.00428348909657 0.118380062305 0.00584112149533 0.00856697819315 0.0 0.00700934579439 0.0 0.0144080996885 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0148755154236 0.0 0.0 0.0 0.0127355289942 0.0 0.0 0.0 0.0153974633332 0.0 0.0 0.0 0.0 0.0 0.0140403987682 0.0 0.0 0.0 0.0 0.0 0.00480192076831 0.0 0.0 0.0 0.000782921864398 0.0 0.105746646485 0.0015658437288 0.00323607703951 0.0162325799885 0.203089931625 0.00349705099431 0.00307949266663 0.000417558327679 0.146458583433 0.0 0.00506289472311 0.100631556971 0.00438436244063 0.00970823111853 0.0690537084399 0.00360144057623 0.0 0.00125267498304 0.0295422516833 0.0224437601127 0.0345529516154 0.00579362179654 0.000730727073438 0.0 0.167232110235 5.21947909599e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0529742527375 0.0 0.00029594554602 0.0 0.0317648219394 0.0 0.0 9.86485153398e-05 0.0415310249581 0.0 0.0 9.86485153398e-05 0.0 0.00029594554602 0.0378810298905 0.0 0.0 0.00019729703068 9.86485153398e-05 0.0 0.0217026733748 0.0 0.0 0.0 0.00207161882214 0.0 0.128834961034 0.0457729111177 0.000591891092039 0.00019729703068 0.177961921673 0.00276215842952 0.0 0.000394594061359 0.135345763046 0.0 0.0 0.00384729209825 0.0393607576206 0.00660945052777 0.0854296142843 0.109795797573 0.0 0.000789188122719 0.0269310446878 0.00029594554602 0.0402485942587 0.000493242576699 0.00019729703068 0.0 0.00512972279767 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.00405734379226 0.0 0.0 0.0 0.00676223965377 3.86413694501e-05 0.0 0.0 0.00274353723096 0.0 0.0 0.0 0.0 0.0 0.00811468758453 0.0 0.0 3.86413694501e-05 0.0 0.0 0.00239576490591 0.0 0.0 0.0 7.72827389003e-05 0.0 0.0555276478998 0.00312995092546 0.059662274431 0.0671587001043 0.153560802195 0.0158043201051 0.230032072337 0.00436647474787 0.0552571583137 0.00262761312261 0.0125970864407 0.00741914293443 0.00351636461996 0.0150701340856 0.0248464005564 0.00409598516171 0.00262761312261 0.00398006105336 0.0954828239113 0.129796359983 0.0106263765988 0.0111673557711 0.00301402681711 0.000270489586151 0.00340044051161 0.000734186019553 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.000760726239984 0.00699868140785 0.00213003347195 0.00101430165331 0.000152145247997 0.00238360888528 0.0 0.000101430165331 0.000659296074653 0.0 0.000253575413328 0.000405720661325 0.000811441322649 0.00121716198397 0.000253575413328 0.0047165026879 0.0 0.00583223450654 0.000710011157318 0.000304290495994 0.00542651384522 0.00968658078913 0.000760726239984 0.000355005578659 0.000152145247997 0.0 0.0205396084796 0.0180038543463 0.030936200426 0.0246475301755 0.00547722892788 0.0102951617811 0.0204381783142 0.00233289380262 0.0176488487676 0.000760726239984 0.0095851506238 0.0569530378335 0.0635967136626 0.22355208439 0.0392027589005 0.0338269601379 0.000405720661325 0.135206410386 0.0398620549751 0.0403692058018 0.0912871487981 0.0259154072421 0.0326605132366 0.0032457652906 0.00669439091186 0.0014707373973 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0404912836767 0.0 0.000158478605388 7.92393026941e-05 0.0355784469097 0.0 0.0 0.00625990491284 0.01735340729 0.0 0.0 0.0184627575277 0.0 7.92393026941e-05 0.0282884310618 0.0 0.0 0.0790808240887 0.00118858954041 0.0 0.0160063391442 0.0 0.0 0.0 0.000316957210777 0.0 0.081616481775 0.000713153724247 0.000475435816165 0.000475435816165 0.146434231379 0.000792393026941 0.000475435816165 0.0338351822504 0.0627575277338 0.0 0.000554675118859 0.0736925515055 0.00110935023772 0.000792393026941 0.0806656101426 0.0458795562599 0.0 0.132171156894 0.0244057052298 0.0351030110935 0.0312995245642 0.0 0.000633914421553 0.0 0.00277337559429 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.00115473441109 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.240184757506 0.0 0.0 0.0 0.0 0.0 0.00115473441109 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.757505773672 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0120088165995 0.0 3.80025841757e-05 0.0 0.0800334422741 0.0 0.0 0.000570038762636 0.00646043930987 0.0 0.0 0.0 0.0 0.0 0.00805654784525 0.0 0.0 0.0 3.80025841757e-05 0.0 0.00497833852702 0.0 0.0 0.0 3.80025841757e-05 0.0 0.12495249677 0.0078285323402 0.0172531732158 0.0234475944364 0.216006688455 0.00566238504218 0.0104507106483 0.0014060956145 0.119100098807 7.60051683514e-05 0.00889260469712 0.0122368321046 0.0223455194953 0.017519191305 0.0806034810367 0.0102987003116 0.000304020673406 0.0242456487041 0.0916242304477 0.0420308580984 0.0267918218439 0.0079805426769 0.00190012920879 0.0 0.0147450026602 7.60051683514e-05 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0124152054269 0.0 0.0137377874483 0.0 0.0185161482998 0.0 0.0 0.0170655744699 0.0123298775545 0.0 0.00435172148982 0.00908741840522 0.00443704936217 0.00482102478775 0.0107086479799 0.0176202056402 0.00285848372371 4.26639361748e-05 0.0 0.0348990997909 0.0287554929818 0.0 0.00627159861769 0.0 0.00337045095781 0.0 0.0282435257477 0.00119459021289 0.0363496736209 0.00102393446819 0.0968471351167 0.00285848372371 0.00204786893639 0.0524339775588 0.081786765647 0.000511967234097 0.00866077904347 0.0255556977687 0.0130125005333 0.0166389351082 0.0315713127693 0.0395068048978 0.00452237723452 0.00115192627672 0.140065702462 0.156661973634 0.0439011903238 0.0 0.00725286914971 4.26639361748e-05 0.00686889372413 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.010395010395 0.0 4.158004158e-05 0.0 0.0128898128898 0.0 0.0 0.0122245322245 0.00756756756757 0.0 0.0 0.0 0.0 0.0 0.00935550935551 0.0 0.0 0.0216632016632 0.0 8.31600831601e-05 0.00390852390852 0.0 0.00253638253638 0.0 0.00120582120582 0.0 0.0778378378378 0.000706860706861 0.0101455301455 0.0002079002079 0.225821205821 0.0031185031185 0.000706860706861 0.0461538461538 0.24656964657 0.0 4.158004158e-05 0.0253638253638 0.00274428274428 0.00607068607069 0.052972972973 0.000956340956341 0.0 0.072474012474 0.0540124740125 0.0294386694387 0.0319334719335 0.00016632016632 0.0045738045738 0.0 0.0255301455301 0.000582120582121 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
7.35672772751e-05 0.0002942691091 7.35672772751e-05 0.0 0.0 0.0 0.000367836386375 0.0 0.0 0.0 0.0 0.000588538218201 0.00044140366365 0.101081438976 0.0 0.00537041124108 0.0 0.0014713455455 0.0023541528728 0.00125064371368 7.35672772751e-05 0.0 0.0 0.0 0.0 0.0 0.0338409475465 0.0313396601192 0.0348708894284 0.0267784889281 0.0357536967557 0.010961524314 0.020598837637 7.35672772751e-05 0.0361951004193 0.0 0.000735672772751 0.0876186272346 0.0478187302288 0.173913043478 0.00691532406386 0.0308246891783 0.00014713455455 0.110130214081 0.120723902008 0.071948797175 0.00044140366365 0.00044140366365 0.0 0.00139777826823 0.000809240050026 0.00228058559553 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0331849453662 0.0 0.000202347227843 0.0 0.0333872925941 0.0 0.0 0.0 0.0400647511129 0.0 0.0 0.0 0.000202347227843 0.0 0.0176042088223 0.0 0.0 0.0 0.0 0.0 0.00161877782274 0.0 0.0 0.0 0.0 0.0 0.123229461756 0.0 0.000202347227843 0.0 0.522258195063 0.0 0.0 0.0 0.166531768515 0.0 0.0 0.0 0.000202347227843 0.0 0.0548360987454 0.0 0.0 0.0 0.0 0.0 0.00404694455686 0.0 0.0 0.0 0.00242816673412 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0719386405713 0.0 0.0 0.0 0.0409944459138 0.0 0.0 0.0444326897646 0.0573922242793 0.0 0.0 0.0 0.0 0.0 0.0454906109495 0.0 0.0 0.024332187252 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.148637926474 0.00370272414705 0.00132240148109 0.00766992859032 0.131182226924 0.00343824385083 0.000528960592436 0.0531605395398 0.128801904258 0.0 0.00423168473949 0.0306797143613 0.00185136207353 0.0446971700608 0.0772282464956 0.000528960592436 0.0 0.0335889976197 0.0386141232478 0.00317376355462 0.000793440888654 0.0 0.0 0.0 0.00158688177731 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0 0.0 0.0 0.0 0.00405268490375 0.0 0.0 0.0 0.00506585612969 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00405268490375 0.0 0.00101317122594 0.0 0.0 0.0901722391084 0.0 0.120567375887 0.0 0.156028368794 0.0 0.0 0.0303951367781 0.165146909828 0.0 0.0 0.00607902735562 0.0 0.00101317122594 0.0202634245187 0.225937183384 0.00303951367781 0.0 0.0 0.139817629179 0.0172239108409 0.00405268490375 0.00101317122594 0.00101317122594 0.00405268490375 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0142083897158 0.0 0.0 0.0 0.0290933694181 0.0 0.0 0.0 0.00338294993234 0.0 0.0 0.0 0.0 0.0 0.0175913396482 0.0 0.0 0.0 0.0 0.0 0.00338294993234 0.0 0.0 0.0 0.0 0.0 0.0554803788904 0.0128552097429 0.0385656292287 0.0128552097429 0.140730717185 0.00676589986468 0.00879566982409 0.00405953991881 0.165087956698 0.0 0.0 0.0453315290934 0.0656292286874 0.0500676589986 0.041948579161 0.0717185385656 0.0 0.0257104194858 0.141407307172 0.0284167794317 0.00405953991881 0.0 0.0121786197564 0.000676589986468 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0078125 0.0 0.0 0.0 0.029296875 0.0 0.0 0.0 0.00390625 0.0 0.0 0.0 0.0 0.0 0.03515625 0.0 0.0 0.0 0.0 0.0 0.00390625 0.0 0.0 0.0 0.0 0.0 0.095703125 0.0 0.0 0.0 0.33984375 0.0 0.0 0.0 0.169921875 0.0 0.001953125 0.064453125 0.00390625 0.0 0.064453125 0.0 0.0 0.0 0.0 0.0 0.009765625 0.0078125 0.00390625 0.0 0.029296875 0.12890625 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
|
||||
</data></transition_probabilities>
|
||||
</opencv_storage>
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* cropped_word_recognition.cpp
|
||||
*
|
||||
* A demo program of text recognition in a given cropped word.
|
||||
* Shows the use of the OCRBeamSearchDecoder class API using the provided default classifier.
|
||||
*
|
||||
* Created on: Jul 9, 2015
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
cout << endl << argv[0] << endl << endl;
|
||||
cout << "A demo program of Scene Text Character Recognition: " << endl;
|
||||
cout << "Shows the use of the OCRBeamSearchDecoder::ClassifierCallback class using the Single Layer CNN character classifier described in:" << endl;
|
||||
cout << "Coates, Adam, et al. \"Text detection and character recognition in scene images with unsupervised feature learning.\" ICDAR 2011." << endl << endl;
|
||||
|
||||
Mat image;
|
||||
if(argc>1)
|
||||
image = imread(argv[1]);
|
||||
else
|
||||
{
|
||||
cout << " Usage: " << argv[0] << " <input_image>" << endl;
|
||||
cout << " the input image must contain a single character (e.g. scenetext_char01.jpg)." << endl << endl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the classifier output classes
|
||||
|
||||
Ptr<OCRHMMDecoder::ClassifierCallback> ocr = loadOCRHMMClassifierCNN("OCRBeamSearch_CNN_model_data.xml.gz");
|
||||
|
||||
double t_r = (double)getTickCount();
|
||||
vector<int> out_classes;
|
||||
vector<double> out_confidences;
|
||||
|
||||
ocr->eval(image, out_classes, out_confidences);
|
||||
|
||||
cout << "OCR output = \"" << vocabulary[out_classes[0]] << "\" with confidence "
|
||||
<< out_confidences[0] << ". Evaluated in "
|
||||
<< ((double)getTickCount() - t_r)*1000/getTickFrequency() << " ms." << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* cropped_word_recognition.cpp
|
||||
*
|
||||
* A demo program of text recognition in a given cropped word.
|
||||
* Shows the use of the OCRBeamSearchDecoder class API using the provided default classifier.
|
||||
*
|
||||
* Created on: Jul 9, 2015
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
cout << endl << argv[0] << endl << endl;
|
||||
cout << "A demo program of Scene Text cropped word Recognition: " << endl;
|
||||
cout << "Shows the use of the OCRBeamSearchDecoder class using the Single Layer CNN character classifier described in:" << endl;
|
||||
cout << "Coates, Adam, et al. \"Text detection and character recognition in scene images with unsupervised feature learning.\" ICDAR 2011." << endl << endl;
|
||||
|
||||
Mat image;
|
||||
if(argc>1)
|
||||
image = imread(argv[1]);
|
||||
else
|
||||
{
|
||||
cout << " Usage: " << argv[0] << " <input_image>" << endl << endl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // must have the same order as the classifier output classes
|
||||
vector<string> lexicon; // a list of words expected to be found on the input image
|
||||
lexicon.push_back(string("abb"));
|
||||
lexicon.push_back(string("riser"));
|
||||
lexicon.push_back(string("CHINA"));
|
||||
lexicon.push_back(string("HERE"));
|
||||
lexicon.push_back(string("President"));
|
||||
lexicon.push_back(string("smash"));
|
||||
lexicon.push_back(string("KUALA"));
|
||||
lexicon.push_back(string("Produkt"));
|
||||
lexicon.push_back(string("NINTENDO"));
|
||||
|
||||
// Create tailored language model a small given lexicon
|
||||
Mat transition_p;
|
||||
createOCRHMMTransitionsTable(vocabulary,lexicon,transition_p);
|
||||
|
||||
// An alternative would be to load the default generic language model
|
||||
// (created from ispell 42869 English words list)
|
||||
/*Mat transition_p;
|
||||
string filename = "OCRHMM_transitions_table.xml";
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
fs["transition_probabilities"] >> transition_p;
|
||||
fs.release();*/
|
||||
|
||||
Mat emission_p = Mat::eye(62,62,CV_64FC1);
|
||||
|
||||
// Notice we set here a beam size of 50. This is much faster than using the default value (500).
|
||||
// 50 works well with our tiny lexicon example, but may not with larger dictionaries.
|
||||
Ptr<OCRBeamSearchDecoder> ocr = OCRBeamSearchDecoder::create(
|
||||
loadOCRBeamSearchClassifierCNN("OCRBeamSearch_CNN_model_data.xml.gz"),
|
||||
vocabulary, transition_p, emission_p, OCR_DECODER_VITERBI, 50);
|
||||
|
||||
double t_r = (double)getTickCount();
|
||||
string output;
|
||||
|
||||
vector<Rect> boxes;
|
||||
vector<string> words;
|
||||
vector<float> confidences;
|
||||
ocr->run(image, output, &boxes, &words, &confidences, OCR_LEVEL_WORD);
|
||||
|
||||
cout << "OCR output = \"" << output << "\". Decoded in "
|
||||
<< ((double)getTickCount() - t_r)*1000/getTickFrequency() << " ms." << endl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import os
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
def main():
|
||||
print('\nDeeptextdetection.py')
|
||||
print(' A demo script of text box alogorithm of the paper:')
|
||||
print(' * Minghui Liao et al.: TextBoxes: A Fast Text Detector with a Single Deep Neural Network https://arxiv.org/abs/1611.06779\n')
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print(' (ERROR) You must call this script with an argument (path_to_image_to_be_processed)\n')
|
||||
quit()
|
||||
|
||||
if not os.path.isfile('TextBoxes_icdar13.caffemodel') or not os.path.isfile('textbox.prototxt'):
|
||||
print " Model files not found in current directory. Aborting"
|
||||
print " See the documentation of text::TextDetectorCNN class to get download links."
|
||||
quit()
|
||||
|
||||
img = cv.imread(str(sys.argv[1]))
|
||||
textSpotter = cv.text.TextDetectorCNN_create("textbox.prototxt", "TextBoxes_icdar13.caffemodel")
|
||||
rects, outProbs = textSpotter.detect(img);
|
||||
vis = img.copy()
|
||||
thres = 0.6
|
||||
|
||||
for r in range(np.shape(rects)[0]):
|
||||
if outProbs[r] > thres:
|
||||
rect = rects[r]
|
||||
cv.rectangle(vis, (rect[0],rect[1]), (rect[0] + rect[2], rect[1] + rect[3]), (255, 0, 0), 2)
|
||||
|
||||
cv.imshow("Text detection result", vis)
|
||||
cv.waitKey()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
print('\ndetect_er_chars.py')
|
||||
print(' A simple demo script using the Extremal Region Filter algorithm described in:')
|
||||
print(' Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012\n')
|
||||
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print(' (ERROR) You must call this script with an argument (path_to_image_to_be_processed)\n')
|
||||
quit()
|
||||
|
||||
pathname = os.path.dirname(sys.argv[0])
|
||||
|
||||
img = cv.imread(str(sys.argv[1]))
|
||||
gray = cv.imread(str(sys.argv[1]),0)
|
||||
|
||||
erc1 = cv.text.loadClassifierNM1(pathname+'/trained_classifierNM1.xml')
|
||||
er1 = cv.text.createERFilterNM1(erc1)
|
||||
|
||||
erc2 = cv.text.loadClassifierNM2(pathname+'/trained_classifierNM2.xml')
|
||||
er2 = cv.text.createERFilterNM2(erc2)
|
||||
|
||||
regions = cv.text.detectRegions(gray,er1,er2)
|
||||
|
||||
#Visualization
|
||||
rects = [cv.boundingRect(p.reshape(-1, 1, 2)) for p in regions]
|
||||
for rect in rects:
|
||||
cv.rectangle(img, rect[0:2], (rect[0]+rect[2],rect[1]+rect[3]), (0, 0, 0), 2)
|
||||
for rect in rects:
|
||||
cv.rectangle(img, rect[0:2], (rect[0]+rect[2],rect[1]+rect[3]), (255, 255, 255), 1)
|
||||
cv.imshow("Text detection result", img)
|
||||
cv.waitKey(0)
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
inline void printHelp()
|
||||
{
|
||||
cout << " Demo of wordspotting CNN for text recognition." << endl;
|
||||
cout << " Max Jaderberg et al.: Reading Text in the Wild with Convolutional Neural Networks, IJCV 2015"<<std::endl<<std::endl;
|
||||
|
||||
cout << " Usage: program <input_image>" << endl;
|
||||
cout << " Caffe Model files (dictnet_vgg.caffemodel, dictnet_vgg_deploy.prototxt, dictnet_vgg_labels.txt)"<<endl;
|
||||
cout << " must be in the current directory." << endl << endl;
|
||||
|
||||
cout << " Obtaining Caffe Model files in linux shell:"<<endl;
|
||||
cout << " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg.caffemodel"<<endl;
|
||||
cout << " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg_deploy.prototxt"<<endl;
|
||||
cout << " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg_labels.txt"<<endl<<endl;
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
printHelp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Mat image = imread(argv[1], IMREAD_GRAYSCALE);
|
||||
|
||||
cout << "Read image (" << argv[1] << "): " << image.size << ", channels: " << image.channels() << ", depth: " << image.depth() << endl;
|
||||
|
||||
if (image.empty())
|
||||
{
|
||||
printHelp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Ptr<OCRHolisticWordRecognizer> wordSpotter = OCRHolisticWordRecognizer::create("dictnet_vgg_deploy.prototxt", "dictnet_vgg.caffemodel", "dictnet_vgg_labels.txt");
|
||||
|
||||
std::string word;
|
||||
vector<float> confs;
|
||||
wordSpotter->run(image, word, 0, 0, &confs);
|
||||
|
||||
cout << "Detected word: '" << word << "', confidence: " << confs[0] << endl;
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* textdetection.cpp
|
||||
*
|
||||
* A demo program of End-to-end Scene Text Detection and Recognition:
|
||||
* Shows the use of the Tesseract OCR API with the Extremal Region Filter algorithm described in:
|
||||
* Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012
|
||||
*
|
||||
* Created on: Jul 31, 2014
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
//Calculate edit distance between two words
|
||||
size_t edit_distance(const string& A, const string& B);
|
||||
size_t min(size_t x, size_t y, size_t z);
|
||||
bool isRepetitive(const string& s);
|
||||
bool sort_by_length(const string &a, const string &b);
|
||||
//Draw ER's in an image via floodFill
|
||||
void er_draw(vector<Mat> &channels, vector<vector<ERStat> > ®ions, vector<Vec2i> group, Mat& segmentation);
|
||||
|
||||
//Perform text detection and recognition and evaluate results using edit distance
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
cout << endl << argv[0] << endl << endl;
|
||||
cout << "A demo program of End-to-end Scene Text Detection and Recognition: " << endl;
|
||||
cout << "Shows the use of the Tesseract OCR API with the Extremal Region Filter algorithm described in:" << endl;
|
||||
cout << "Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012" << endl << endl;
|
||||
|
||||
Mat image;
|
||||
if(argc>1)
|
||||
image = imread(argv[1]);
|
||||
else
|
||||
{
|
||||
cout << " Usage: " << argv[0] << " <input_image> [<gt_word1> ... <gt_wordN>]" << endl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
cout << "IMG_W=" << image.cols << endl;
|
||||
cout << "IMG_H=" << image.rows << endl;
|
||||
|
||||
/*Text Detection*/
|
||||
|
||||
// Extract channels to be processed individually
|
||||
vector<Mat> channels;
|
||||
|
||||
Mat grey;
|
||||
cvtColor(image,grey,COLOR_RGB2GRAY);
|
||||
|
||||
// Notice here we are only using grey channel, see textdetection.cpp for example with more channels
|
||||
channels.push_back(grey);
|
||||
channels.push_back(255-grey);
|
||||
|
||||
double t_d = (double)getTickCount();
|
||||
// Create ERFilter objects with the 1st and 2nd stage default classifiers
|
||||
Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"),8,0.00015f,0.13f,0.2f,true,0.1f);
|
||||
Ptr<ERFilter> er_filter2 = createERFilterNM2(loadClassifierNM2("trained_classifierNM2.xml"),0.5);
|
||||
|
||||
vector<vector<ERStat> > regions(channels.size());
|
||||
// Apply the default cascade classifier to each independent channel (could be done in parallel)
|
||||
for (int c=0; c<(int)channels.size(); c++)
|
||||
{
|
||||
er_filter1->run(channels[c], regions[c]);
|
||||
er_filter2->run(channels[c], regions[c]);
|
||||
}
|
||||
cout << "TIME_REGION_DETECTION = " << ((double)getTickCount() - t_d)*1000/getTickFrequency() << endl;
|
||||
|
||||
Mat out_img_decomposition= Mat::zeros(image.rows+2, image.cols+2, CV_8UC1);
|
||||
vector<Vec2i> tmp_group;
|
||||
for (int i=0; i<(int)regions.size(); i++)
|
||||
{
|
||||
for (int j=0; j<(int)regions[i].size();j++)
|
||||
{
|
||||
tmp_group.push_back(Vec2i(i,j));
|
||||
}
|
||||
Mat tmp= Mat::zeros(image.rows+2, image.cols+2, CV_8UC1);
|
||||
er_draw(channels, regions, tmp_group, tmp);
|
||||
if (i > 0)
|
||||
tmp = tmp / 2;
|
||||
out_img_decomposition = out_img_decomposition | tmp;
|
||||
tmp_group.clear();
|
||||
}
|
||||
|
||||
double t_g = (double)getTickCount();
|
||||
// Detect character groups
|
||||
vector< vector<Vec2i> > nm_region_groups;
|
||||
vector<Rect> nm_boxes;
|
||||
erGrouping(image, channels, regions, nm_region_groups, nm_boxes,ERGROUPING_ORIENTATION_HORIZ);
|
||||
cout << "TIME_GROUPING = " << ((double)getTickCount() - t_g)*1000/getTickFrequency() << endl;
|
||||
|
||||
|
||||
|
||||
/*Text Recognition (OCR)*/
|
||||
|
||||
double t_r = (double)getTickCount();
|
||||
Ptr<OCRTesseract> ocr = OCRTesseract::create();
|
||||
cout << "TIME_OCR_INITIALIZATION = " << ((double)getTickCount() - t_r)*1000/getTickFrequency() << endl;
|
||||
string output;
|
||||
|
||||
Mat out_img;
|
||||
Mat out_img_detection;
|
||||
Mat out_img_segmentation = Mat::zeros(image.rows+2, image.cols+2, CV_8UC1);
|
||||
image.copyTo(out_img);
|
||||
image.copyTo(out_img_detection);
|
||||
float scale_img = 600.f/image.rows;
|
||||
float scale_font = (float)(2-scale_img)/1.4f;
|
||||
vector<string> words_detection;
|
||||
|
||||
t_r = (double)getTickCount();
|
||||
|
||||
for (int i=0; i<(int)nm_boxes.size(); i++)
|
||||
{
|
||||
|
||||
rectangle(out_img_detection, nm_boxes[i].tl(), nm_boxes[i].br(), Scalar(0,255,255), 3);
|
||||
|
||||
Mat group_img = Mat::zeros(image.rows+2, image.cols+2, CV_8UC1);
|
||||
er_draw(channels, regions, nm_region_groups[i], group_img);
|
||||
Mat group_segmentation;
|
||||
group_img.copyTo(group_segmentation);
|
||||
//image(nm_boxes[i]).copyTo(group_img);
|
||||
group_img(nm_boxes[i]).copyTo(group_img);
|
||||
copyMakeBorder(group_img,group_img,15,15,15,15,BORDER_CONSTANT,Scalar(0));
|
||||
|
||||
vector<Rect> boxes;
|
||||
vector<string> words;
|
||||
vector<float> confidences;
|
||||
ocr->run(group_img, output, &boxes, &words, &confidences, OCR_LEVEL_WORD);
|
||||
|
||||
output.erase(remove(output.begin(), output.end(), '\n'), output.end());
|
||||
//cout << "OCR output = \"" << output << "\" length = " << output.size() << endl;
|
||||
if (output.size() < 3)
|
||||
continue;
|
||||
|
||||
for (int j=0; j<(int)boxes.size(); j++)
|
||||
{
|
||||
boxes[j].x += nm_boxes[i].x-15;
|
||||
boxes[j].y += nm_boxes[i].y-15;
|
||||
|
||||
//cout << " word = " << words[j] << "\t confidence = " << confidences[j] << endl;
|
||||
if ((words[j].size() < 2) || (confidences[j] < 51) ||
|
||||
((words[j].size()==2) && (words[j][0] == words[j][1])) ||
|
||||
((words[j].size()< 4) && (confidences[j] < 60)) ||
|
||||
isRepetitive(words[j]))
|
||||
continue;
|
||||
words_detection.push_back(words[j]);
|
||||
rectangle(out_img, boxes[j].tl(), boxes[j].br(), Scalar(255,0,255),3);
|
||||
Size word_size = getTextSize(words[j], FONT_HERSHEY_SIMPLEX, (double)scale_font, (int)(3*scale_font), NULL);
|
||||
rectangle(out_img, boxes[j].tl()-Point(3,word_size.height+3), boxes[j].tl()+Point(word_size.width,0), Scalar(255,0,255),-1);
|
||||
putText(out_img, words[j], boxes[j].tl()-Point(1,1), FONT_HERSHEY_SIMPLEX, scale_font, Scalar(255,255,255),(int)(3*scale_font));
|
||||
out_img_segmentation = out_img_segmentation | group_segmentation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cout << "TIME_OCR = " << ((double)getTickCount() - t_r)*1000/getTickFrequency() << endl;
|
||||
|
||||
|
||||
/* Recognition evaluation with (approximate) Hungarian matching and edit distances */
|
||||
|
||||
if(argc>2)
|
||||
{
|
||||
int num_gt_characters = 0;
|
||||
vector<string> words_gt;
|
||||
for (int i=2; i<argc; i++)
|
||||
{
|
||||
string s = string(argv[i]);
|
||||
if (s.size() > 0)
|
||||
{
|
||||
words_gt.push_back(string(argv[i]));
|
||||
//cout << " GT word " << words_gt[words_gt.size()-1] << endl;
|
||||
num_gt_characters += (int)(words_gt[words_gt.size()-1].size());
|
||||
}
|
||||
}
|
||||
|
||||
if (words_detection.empty())
|
||||
{
|
||||
//cout << endl << "number of characters in gt = " << num_gt_characters << endl;
|
||||
cout << "TOTAL_EDIT_DISTANCE = " << num_gt_characters << endl;
|
||||
cout << "EDIT_DISTANCE_RATIO = 1" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
sort(words_gt.begin(),words_gt.end(),sort_by_length);
|
||||
|
||||
int max_dist=0;
|
||||
vector< vector<int> > assignment_mat;
|
||||
for (int i=0; i<(int)words_gt.size(); i++)
|
||||
{
|
||||
vector<int> assignment_row(words_detection.size(),0);
|
||||
assignment_mat.push_back(assignment_row);
|
||||
for (int j=0; j<(int)words_detection.size(); j++)
|
||||
{
|
||||
assignment_mat[i][j] = (int)(edit_distance(words_gt[i],words_detection[j]));
|
||||
max_dist = max(max_dist,assignment_mat[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
vector<int> words_detection_matched;
|
||||
|
||||
int total_edit_distance = 0;
|
||||
int tp=0, fp=0, fn=0;
|
||||
for (int search_dist=0; search_dist<=max_dist; search_dist++)
|
||||
{
|
||||
for (int i=0; i<(int)assignment_mat.size(); i++)
|
||||
{
|
||||
int min_dist_idx = (int)distance(assignment_mat[i].begin(),
|
||||
min_element(assignment_mat[i].begin(),assignment_mat[i].end()));
|
||||
if (assignment_mat[i][min_dist_idx] == search_dist)
|
||||
{
|
||||
//cout << " GT word \"" << words_gt[i] << "\" best match \"" << words_detection[min_dist_idx] << "\" with dist " << assignment_mat[i][min_dist_idx] << endl;
|
||||
if(search_dist == 0)
|
||||
tp++;
|
||||
else { fp++; fn++; }
|
||||
|
||||
total_edit_distance += assignment_mat[i][min_dist_idx];
|
||||
words_detection_matched.push_back(min_dist_idx);
|
||||
words_gt.erase(words_gt.begin()+i);
|
||||
assignment_mat.erase(assignment_mat.begin()+i);
|
||||
for (int j=0; j<(int)assignment_mat.size(); j++)
|
||||
{
|
||||
assignment_mat[j][min_dist_idx]=INT_MAX;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j=0; j<(int)words_gt.size(); j++)
|
||||
{
|
||||
//cout << " GT word \"" << words_gt[j] << "\" no match found" << endl;
|
||||
fn++;
|
||||
total_edit_distance += (int)words_gt[j].size();
|
||||
}
|
||||
for (int j=0; j<(int)words_detection.size(); j++)
|
||||
{
|
||||
if (find(words_detection_matched.begin(),words_detection_matched.end(),j) == words_detection_matched.end())
|
||||
{
|
||||
//cout << " Detection word \"" << words_detection[j] << "\" no match found" << endl;
|
||||
fp++;
|
||||
total_edit_distance += (int)words_detection[j].size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//cout << endl << "number of characters in gt = " << num_gt_characters << endl;
|
||||
cout << "TOTAL_EDIT_DISTANCE = " << total_edit_distance << endl;
|
||||
cout << "EDIT_DISTANCE_RATIO = " << (float)total_edit_distance / num_gt_characters << endl;
|
||||
cout << "TP = " << tp << endl;
|
||||
cout << "FP = " << fp << endl;
|
||||
cout << "FN = " << fn << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//resize(out_img_detection,out_img_detection,Size(image.cols*scale_img,image.rows*scale_img),0,0,INTER_LINEAR_EXACT);
|
||||
//imshow("detection", out_img_detection);
|
||||
//imwrite("detection.jpg", out_img_detection);
|
||||
//resize(out_img,out_img,Size(image.cols*scale_img,image.rows*scale_img),0,0,INTER_LINEAR_EXACT);
|
||||
namedWindow("recognition",WINDOW_NORMAL);
|
||||
imshow("recognition", out_img);
|
||||
waitKey(0);
|
||||
//imwrite("recognition.jpg", out_img);
|
||||
//imwrite("segmentation.jpg", out_img_segmentation);
|
||||
//imwrite("decomposition.jpg", out_img_decomposition);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t min(size_t x, size_t y, size_t z)
|
||||
{
|
||||
return x < y ? min(x,z) : min(y,z);
|
||||
}
|
||||
|
||||
size_t edit_distance(const string& A, const string& B)
|
||||
{
|
||||
size_t NA = A.size();
|
||||
size_t NB = B.size();
|
||||
|
||||
vector< vector<size_t> > M(NA + 1, vector<size_t>(NB + 1));
|
||||
|
||||
for (size_t a = 0; a <= NA; ++a)
|
||||
M[a][0] = a;
|
||||
|
||||
for (size_t b = 0; b <= NB; ++b)
|
||||
M[0][b] = b;
|
||||
|
||||
for (size_t a = 1; a <= NA; ++a)
|
||||
for (size_t b = 1; b <= NB; ++b)
|
||||
{
|
||||
size_t x = M[a-1][b] + 1;
|
||||
size_t y = M[a][b-1] + 1;
|
||||
size_t z = M[a-1][b-1] + (A[a-1] == B[b-1] ? 0 : 1);
|
||||
M[a][b] = min(x,y,z);
|
||||
}
|
||||
|
||||
return M[A.size()][B.size()];
|
||||
}
|
||||
|
||||
bool isRepetitive(const string& s)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i=0; i<(int)s.size(); i++)
|
||||
{
|
||||
if ((s[i] == 'i') ||
|
||||
(s[i] == 'l') ||
|
||||
(s[i] == 'I'))
|
||||
count++;
|
||||
}
|
||||
if (count > ((int)s.size()+1)/2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void er_draw(vector<Mat> &channels, vector<vector<ERStat> > ®ions, vector<Vec2i> group, Mat& segmentation)
|
||||
{
|
||||
for (int r=0; r<(int)group.size(); r++)
|
||||
{
|
||||
ERStat er = regions[group[r][0]][group[r][1]];
|
||||
if (er.parent != NULL) // deprecate the root region
|
||||
{
|
||||
int newMaskVal = 255;
|
||||
int flags = 4 + (newMaskVal << 8) + FLOODFILL_FIXED_RANGE + FLOODFILL_MASK_ONLY;
|
||||
floodFill(channels[group[r][0]],segmentation,Point(er.pixel%channels[group[r][0]].cols,er.pixel/channels[group[r][0]].cols),
|
||||
Scalar(255),0,Scalar(er.level),Scalar(0),flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool sort_by_length(const string &a, const string &b){return (a.size()>b.size());}
|
||||
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 538 B |
|
After Width: | Height: | Size: 523 B |
|
After Width: | Height: | Size: 541 B |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 528 B |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 682 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* segmented_word_recognition.cpp
|
||||
*
|
||||
* A demo program on segmented word recognition.
|
||||
* Shows the use of the OCRHMMDecoder API with the two provided default character classifiers.
|
||||
*
|
||||
* Created on: Jul 31, 2015
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace text;
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
const String keys =
|
||||
"{help h usage ? | | print this message.}"
|
||||
"{@image | | source image for recognition.}"
|
||||
"{@mask | | binary segmentation mask where each contour is a character.}"
|
||||
"{lexicon lex l | | (optional) lexicon provided as a list of comma separated words.}"
|
||||
;
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
|
||||
parser.about("\nSegmented word recognition.\nA demo program on segmented word recognition. Shows the use of the OCRHMMDecoder API with the two provided default character classifiers.\n");
|
||||
|
||||
String filename1 = parser.get<String>(0);
|
||||
String filename2 = parser.get<String>(1);
|
||||
|
||||
parser.printMessage();
|
||||
cout << endl << endl;
|
||||
if ((parser.has("help")) || (filename1.size()==0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (!parser.check())
|
||||
{
|
||||
parser.printErrors();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Mat image = imread(filename1);
|
||||
Mat mask;
|
||||
if (filename2.size() > 0)
|
||||
mask = imread(filename2);
|
||||
else
|
||||
image.copyTo(mask);
|
||||
|
||||
// be sure the mask is a binary image
|
||||
cvtColor(mask, mask, COLOR_BGR2GRAY);
|
||||
threshold(mask, mask, 128., 255, THRESH_BINARY);
|
||||
|
||||
// character recognition vocabulary
|
||||
string voc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
// Emission probabilities for the HMM language model (identity matrix by default)
|
||||
Mat emissionProbabilities = Mat::eye((int)voc.size(), (int)voc.size(), CV_64FC1);
|
||||
// Bigram transition probabilities for the HMM language model
|
||||
Mat transitionProbabilities;
|
||||
|
||||
string lex = parser.get<string>("lex");
|
||||
if (lex.size()>0)
|
||||
{
|
||||
// Build tailored language model for the provided lexicon
|
||||
vector<string> lexicon;
|
||||
size_t pos = 0;
|
||||
string delimiter = ",";
|
||||
std::string token;
|
||||
while ((pos = lex.find(delimiter)) != std::string::npos) {
|
||||
token = lex.substr(0, pos);
|
||||
lexicon.push_back(token);
|
||||
lex.erase(0, pos + delimiter.length());
|
||||
}
|
||||
lexicon.push_back(lex);
|
||||
createOCRHMMTransitionsTable(voc,lexicon,transitionProbabilities);
|
||||
} else {
|
||||
// Or load the generic language model (from Aspell English dictionary)
|
||||
FileStorage fs("./OCRHMM_transitions_table.xml", FileStorage::READ);
|
||||
fs["transition_probabilities"] >> transitionProbabilities;
|
||||
fs.release();
|
||||
}
|
||||
|
||||
Ptr<OCRTesseract> ocrTes = OCRTesseract::create();
|
||||
|
||||
Ptr<OCRHMMDecoder> ocrNM = OCRHMMDecoder::create(
|
||||
loadOCRHMMClassifierNM("./OCRHMM_knn_model_data.xml.gz"),
|
||||
voc, transitionProbabilities, emissionProbabilities);
|
||||
|
||||
Ptr<OCRHMMDecoder> ocrCNN = OCRHMMDecoder::create(
|
||||
loadOCRHMMClassifierCNN("OCRBeamSearch_CNN_model_data.xml.gz"),
|
||||
voc, transitionProbabilities, emissionProbabilities);
|
||||
|
||||
std::string output;
|
||||
double t_r = (double)getTickCount();
|
||||
ocrTes->run(mask, output);
|
||||
output.erase(remove(output.begin(), output.end(), '\n'), output.end());
|
||||
cout << " OCR_Tesseract output \"" << output << "\". Done in "
|
||||
<< ((double)getTickCount() - t_r)*1000/getTickFrequency() << " ms." << endl;
|
||||
|
||||
t_r = (double)getTickCount();
|
||||
ocrNM->run(mask, output);
|
||||
cout << " OCR_NM output \"" << output << "\". Done in "
|
||||
<< ((double)getTickCount() - t_r)*1000/getTickFrequency() << " ms." << endl;
|
||||
|
||||
t_r = (double)getTickCount();
|
||||
ocrCNN->run(image, mask, output);
|
||||
cout << " OCR_CNN output \"" << output << "\". Done in "
|
||||
<< ((double)getTickCount() - t_r)*1000/getTickFrequency() << " ms." << endl;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
#include <opencv2/text.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/dnn.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
void printHelpStr(const string& progFname)
|
||||
{
|
||||
cout << " Demo of text recognition CNN for text detection." << endl
|
||||
<< " Max Jaderberg et al.: Reading Text in the Wild with Convolutional Neural Networks, IJCV 2015"<<endl<<endl
|
||||
<< " Usage: " << progFname << " <output_file> <input_image>" << endl
|
||||
<< " Caffe Model files (textbox.prototxt, TextBoxes_icdar13.caffemodel)"<<endl
|
||||
<< " must be in the current directory. See the documentation of text::TextDetectorCNN class to get download links." << endl
|
||||
<< " Obtaining text recognition Caffe Model files in linux shell:" << endl
|
||||
<< " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg.caffemodel" << endl
|
||||
<< " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg_deploy.prototxt" << endl
|
||||
<< " wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg_labels.txt" <<endl << endl;
|
||||
}
|
||||
|
||||
bool fileExists (const string& filename)
|
||||
{
|
||||
ifstream f(filename.c_str());
|
||||
return f.good();
|
||||
}
|
||||
|
||||
void textbox_draw(Mat src, std::vector<Rect>& groups, std::vector<float>& probs, std::vector<int>& indexes)
|
||||
{
|
||||
for (size_t i = 0; i < indexes.size(); i++)
|
||||
{
|
||||
if (src.type() == CV_8UC3)
|
||||
{
|
||||
Rect currrentBox = groups[indexes[i]];
|
||||
rectangle(src, currrentBox, Scalar( 0, 255, 255 ), 2, LINE_AA);
|
||||
String label = format("%.2f", probs[indexes[i]]);
|
||||
std::cout << "text box: " << currrentBox << " confidence: " << probs[indexes[i]] << "\n";
|
||||
|
||||
int baseLine = 0;
|
||||
Size labelSize = getTextSize(label, FONT_HERSHEY_PLAIN, 1, 1, &baseLine);
|
||||
int yLeftBottom = std::max(currrentBox.y, labelSize.height);
|
||||
rectangle(src, Point(currrentBox.x, yLeftBottom - labelSize.height),
|
||||
Point(currrentBox.x + labelSize.width, yLeftBottom + baseLine), Scalar( 255, 255, 255 ), FILLED);
|
||||
|
||||
putText(src, label, Point(currrentBox.x, yLeftBottom), FONT_HERSHEY_PLAIN, 1, Scalar( 0,0,0 ), 1, LINE_AA);
|
||||
}
|
||||
else
|
||||
rectangle(src, groups[i], Scalar( 255 ), 3, 8 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
printHelpStr(argv[0]);
|
||||
cout << "Insufiecient parameters. Aborting!" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const string modelArch = "textbox.prototxt";
|
||||
const string moddelWeights = "TextBoxes_icdar13.caffemodel";
|
||||
|
||||
if (!fileExists(modelArch) || !fileExists(moddelWeights))
|
||||
{
|
||||
printHelpStr(argv[0]);
|
||||
cout << "Model files not found in the current directory. Aborting!" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Mat image = imread(String(argv[1]), IMREAD_COLOR);
|
||||
|
||||
cout << "Starting Text Box Demo" << endl;
|
||||
Ptr<text::TextDetectorCNN> textSpotter =
|
||||
text::TextDetectorCNN::create(modelArch, moddelWeights);
|
||||
|
||||
vector<Rect> bbox;
|
||||
vector<float> outProbabillities;
|
||||
textSpotter->detect(image, bbox, outProbabillities);
|
||||
std::vector<int> indexes;
|
||||
cv::dnn::NMSBoxes(bbox, outProbabillities, 0.4f, 0.5f, indexes);
|
||||
|
||||
Mat image_copy = image.clone();
|
||||
textbox_draw(image_copy, bbox, outProbabillities, indexes);
|
||||
imshow("Text detection", image_copy);
|
||||
image_copy = image.clone();
|
||||
|
||||
Ptr<text::OCRHolisticWordRecognizer> wordSpotter =
|
||||
text::OCRHolisticWordRecognizer::create("dictnet_vgg_deploy.prototxt", "dictnet_vgg.caffemodel", "dictnet_vgg_labels.txt");
|
||||
|
||||
for(size_t i = 0; i < indexes.size(); i++)
|
||||
{
|
||||
Mat wordImg;
|
||||
cvtColor(image(bbox[indexes[i]]), wordImg, COLOR_BGR2GRAY);
|
||||
string word;
|
||||
vector<float> confs;
|
||||
wordSpotter->run(wordImg, word, NULL, NULL, &confs);
|
||||
|
||||
Rect currrentBox = bbox[indexes[i]];
|
||||
rectangle(image_copy, currrentBox, Scalar( 0, 255, 255 ), 2, LINE_AA);
|
||||
|
||||
int baseLine = 0;
|
||||
Size labelSize = getTextSize(word, FONT_HERSHEY_PLAIN, 1, 1, &baseLine);
|
||||
int yLeftBottom = std::max(currrentBox.y, labelSize.height);
|
||||
rectangle(image_copy, Point(currrentBox.x, yLeftBottom - labelSize.height),
|
||||
Point(currrentBox.x + labelSize.width, yLeftBottom + baseLine), Scalar( 255, 255, 255 ), FILLED);
|
||||
|
||||
putText(image_copy, word, Point(currrentBox.x, yLeftBottom), FONT_HERSHEY_PLAIN, 1, Scalar( 0,0,0 ), 1, LINE_AA);
|
||||
|
||||
}
|
||||
imshow("Text recognition", image_copy);
|
||||
cout << "Recognition finished. Press any key to exit.\n";
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
#include <opencv2/text.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/dnn.hpp>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string getHelpStr(const std::string& progFname)
|
||||
{
|
||||
std::stringstream out;
|
||||
out << " Demo of text detection CNN for text detection." << std::endl
|
||||
<< " Minghui Liao, Baoguang Shi, Xiang Bai, Xinggang Wang, Wenyu Liu: TextBoxes: A Fast Text Detector with a Single Deep Neural Network, AAAI2017\n\n"
|
||||
<< " Usage: " << progFname << " <output_file> <input_image>" << std::endl
|
||||
<< " Caffe Model files (textbox.prototxt, TextBoxes_icdar13.caffemodel)"<<std::endl
|
||||
<< " must be in the current directory. See the documentation of text::TextDetectorCNN class to get download links." << std::endl;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
bool fileExists (const std::string& filename)
|
||||
{
|
||||
std::ifstream f(filename.c_str());
|
||||
return f.good();
|
||||
}
|
||||
|
||||
void textbox_draw(Mat src, std::vector<Rect>& groups, std::vector<float>& probs, std::vector<int>& indexes)
|
||||
{
|
||||
for (size_t i = 0; i < indexes.size(); i++)
|
||||
{
|
||||
if (src.type() == CV_8UC3)
|
||||
{
|
||||
Rect currrentBox = groups[indexes[i]];
|
||||
rectangle(src, currrentBox, Scalar( 0, 255, 255 ), 2, LINE_AA);
|
||||
String label = format("%.2f", probs[indexes[i]]);
|
||||
std::cout << "text box: " << currrentBox << " confidence: " << probs[indexes[i]] << "\n";
|
||||
|
||||
int baseLine = 0;
|
||||
Size labelSize = getTextSize(label, FONT_HERSHEY_PLAIN, 1, 1, &baseLine);
|
||||
int yLeftBottom = std::max(currrentBox.y, labelSize.height);
|
||||
rectangle(src, Point(currrentBox.x, yLeftBottom - labelSize.height),
|
||||
Point(currrentBox.x + labelSize.width, yLeftBottom + baseLine), Scalar( 255, 255, 255 ), FILLED);
|
||||
|
||||
putText(src, label, Point(currrentBox.x, yLeftBottom), FONT_HERSHEY_PLAIN, 1, Scalar( 0,0,0 ), 1, LINE_AA);
|
||||
}
|
||||
else
|
||||
rectangle(src, groups[i], Scalar( 255 ), 3, 8 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cout << getHelpStr(argv[0]);
|
||||
std::cout << "Insufiecient parameters. Aborting!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const std::string modelArch = "textbox.prototxt";
|
||||
const std::string moddelWeights = "TextBoxes_icdar13.caffemodel";
|
||||
|
||||
if (!fileExists(modelArch) || !fileExists(moddelWeights))
|
||||
{
|
||||
std::cout << getHelpStr(argv[0]);
|
||||
std::cout << "Model files not found in the current directory. Aborting!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Mat image = imread(String(argv[1]), IMREAD_COLOR);
|
||||
|
||||
std::cout << "Starting Text Box Demo" << std::endl;
|
||||
Ptr<text::TextDetectorCNN> textSpotter =
|
||||
text::TextDetectorCNN::create(modelArch, moddelWeights);
|
||||
|
||||
std::vector<Rect> bbox;
|
||||
std::vector<float> outProbabillities;
|
||||
textSpotter->detect(image, bbox, outProbabillities);
|
||||
|
||||
std::vector<int> indexes;
|
||||
cv::dnn::NMSBoxes(bbox, outProbabillities, 0.3f, 0.4f, indexes);
|
||||
|
||||
textbox_draw(image, bbox, outProbabillities, indexes);
|
||||
|
||||
imshow("TextBox Demo",image);
|
||||
std::cout << "Done!" << std::endl << std::endl;
|
||||
std::cout << "Press any key to exit." << std::endl << std::endl;
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* textdetection.cpp
|
||||
*
|
||||
* A demo program of the Extremal Region Filter algorithm described in
|
||||
* Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012
|
||||
*
|
||||
* Created on: Sep 23, 2013
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
void show_help_and_exit(const char *cmd);
|
||||
void groups_draw(Mat &src, vector<Rect> &groups);
|
||||
void er_show(vector<Mat> &channels, vector<vector<ERStat> > ®ions);
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
cout << endl << argv[0] << endl << endl;
|
||||
cout << "Demo program of the Extremal Region Filter algorithm described in " << endl;
|
||||
cout << "Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012" << endl << endl;
|
||||
|
||||
if (argc < 2) show_help_and_exit(argv[0]);
|
||||
|
||||
Mat src = imread(argv[1]);
|
||||
|
||||
// Extract channels to be processed individually
|
||||
vector<Mat> channels;
|
||||
computeNMChannels(src, channels);
|
||||
|
||||
int cn = (int)channels.size();
|
||||
// Append negative channels to detect ER- (bright regions over dark background)
|
||||
for (int c = 0; c < cn-1; c++)
|
||||
channels.push_back(255-channels[c]);
|
||||
|
||||
// Create ERFilter objects with the 1st and 2nd stage default classifiers
|
||||
Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"),16,0.00015f,0.13f,0.2f,true,0.1f);
|
||||
Ptr<ERFilter> er_filter2 = createERFilterNM2(loadClassifierNM2("trained_classifierNM2.xml"),0.5);
|
||||
|
||||
vector<vector<ERStat> > regions(channels.size());
|
||||
// Apply the default cascade classifier to each independent channel (could be done in parallel)
|
||||
cout << "Extracting Class Specific Extremal Regions from " << (int)channels.size() << " channels ..." << endl;
|
||||
cout << " (...) this may take a while (...)" << endl << endl;
|
||||
for (int c=0; c<(int)channels.size(); c++)
|
||||
{
|
||||
er_filter1->run(channels[c], regions[c]);
|
||||
er_filter2->run(channels[c], regions[c]);
|
||||
}
|
||||
|
||||
// Detect character groups
|
||||
cout << "Grouping extracted ERs ... ";
|
||||
vector< vector<Vec2i> > region_groups;
|
||||
vector<Rect> groups_boxes;
|
||||
erGrouping(src, channels, regions, region_groups, groups_boxes, ERGROUPING_ORIENTATION_HORIZ);
|
||||
//erGrouping(src, channels, regions, region_groups, groups_boxes, ERGROUPING_ORIENTATION_ANY, "./trained_classifier_erGrouping.xml", 0.5);
|
||||
|
||||
// draw groups
|
||||
groups_draw(src, groups_boxes);
|
||||
imshow("grouping",src);
|
||||
|
||||
cout << "Done!" << endl << endl;
|
||||
cout << "Press 'space' to show the extracted Extremal Regions, any other key to exit." << endl << endl;
|
||||
if ((waitKey()&0xff) == ' ')
|
||||
er_show(channels,regions);
|
||||
|
||||
// memory clean-up
|
||||
er_filter1.release();
|
||||
er_filter2.release();
|
||||
regions.clear();
|
||||
if (!groups_boxes.empty())
|
||||
{
|
||||
groups_boxes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// helper functions
|
||||
|
||||
void show_help_and_exit(const char *cmd)
|
||||
{
|
||||
cout << " Usage: " << cmd << " <input_image> " << endl;
|
||||
cout << " Default classifier files (trained_classifierNM*.xml) must be in current directory" << endl << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void groups_draw(Mat &src, vector<Rect> &groups)
|
||||
{
|
||||
for (int i=(int)groups.size()-1; i>=0; i--)
|
||||
{
|
||||
if (src.type() == CV_8UC3)
|
||||
rectangle(src,groups.at(i).tl(),groups.at(i).br(),Scalar( 0, 255, 255 ), 3, 8 );
|
||||
else
|
||||
rectangle(src,groups.at(i).tl(),groups.at(i).br(),Scalar( 255 ), 3, 8 );
|
||||
}
|
||||
}
|
||||
|
||||
void er_show(vector<Mat> &channels, vector<vector<ERStat> > ®ions)
|
||||
{
|
||||
for (int c=0; c<(int)channels.size(); c++)
|
||||
{
|
||||
Mat dst = Mat::zeros(channels[0].rows+2,channels[0].cols+2,CV_8UC1);
|
||||
for (int r=0; r<(int)regions[c].size(); r++)
|
||||
{
|
||||
ERStat er = regions[c][r];
|
||||
if (er.parent != NULL) // deprecate the root region
|
||||
{
|
||||
int newMaskVal = 255;
|
||||
int flags = 4 + (newMaskVal << 8) + FLOODFILL_FIXED_RANGE + FLOODFILL_MASK_ONLY;
|
||||
floodFill(channels[c],dst,Point(er.pixel%channels[c].cols,er.pixel/channels[c].cols),
|
||||
Scalar(255),0,Scalar(er.level),Scalar(0),flags);
|
||||
}
|
||||
}
|
||||
char buff[20]; char *buff_ptr = buff;
|
||||
sprintf(buff, "channel %d", c);
|
||||
imshow(buff_ptr, dst);
|
||||
}
|
||||
waitKey(-1);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
print('\ntextdetection.py')
|
||||
print(' A demo script of the Extremal Region Filter algorithm described in:')
|
||||
print(' Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012\n')
|
||||
|
||||
|
||||
if (len(sys.argv) < 2):
|
||||
print(' (ERROR) You must call this script with an argument (path_to_image_to_be_processed)\n')
|
||||
quit()
|
||||
|
||||
pathname = os.path.dirname(sys.argv[0])
|
||||
|
||||
img = cv.imread(str(sys.argv[1]))
|
||||
# for visualization
|
||||
vis = img.copy()
|
||||
|
||||
|
||||
# Extract channels to be processed individually
|
||||
channels = list(cv.text.computeNMChannels(img))
|
||||
# Append negative channels to detect ER- (bright regions over dark background)
|
||||
cn = len(channels)-1
|
||||
for c in range(0,cn):
|
||||
channels.append(255-channels[c])
|
||||
|
||||
# Apply the default cascade classifier to each independent channel (could be done in parallel)
|
||||
|
||||
erc1 = cv.text.loadClassifierNM1('trained_classifierNM1.xml')
|
||||
er1 = cv.text.createERFilterNM1(erc1,16,0.00015,0.13,0.2,True,0.1)
|
||||
|
||||
erc2 = cv.text.loadClassifierNM2('trained_classifierNM2.xml')
|
||||
er2 = cv.text.createERFilterNM2(erc2,0.5)
|
||||
|
||||
print("Extracting Class Specific Extremal Regions from "+str(len(channels))+" channels ...")
|
||||
print(" (...) this may take a while (...)")
|
||||
for channel in channels:
|
||||
|
||||
regions = cv.text.detectRegions(channel,er1,er2)
|
||||
|
||||
rects = cv.text.erGrouping(img,channel,[r.tolist() for r in regions])
|
||||
#rects = cv.text.erGrouping(img,channel,[x.tolist() for x in regions], cv.text.ERGROUPING_ORIENTATION_ANY,'../../GSoC2014/opencv_contrib/modules/text/samples/trained_classifier_erGrouping.xml',0.5)
|
||||
|
||||
#Visualization
|
||||
for rect in rects:
|
||||
cv.rectangle(vis, (rect[0],rect[1]), (rect[0]+rect[2],rect[1]+rect[3]), (0, 0, 0), 2)
|
||||
cv.rectangle(vis, (rect[0],rect[1]), (rect[0]+rect[2],rect[1]+rect[3]), (255, 255, 255), 1)
|
||||
|
||||
#Visualization
|
||||
cv.imshow("Text detection result", vis)
|
||||
cv.waitKey(0)
|
||||
@@ -0,0 +1,89 @@
|
||||
// Sample code which demonstrates the working of
|
||||
// stroke width transform in the text module of OpenCV
|
||||
#include <opencv2/text.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/imgcodecs.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
static void help(const CommandLineParser& cmd, const string& errorMessage)
|
||||
{
|
||||
cout << errorMessage << endl;
|
||||
cout << "Avaible options:" << endl;
|
||||
cmd.printMessage();
|
||||
}
|
||||
|
||||
static bool fileExists (const string& filename)
|
||||
{
|
||||
ifstream f(filename.c_str());
|
||||
return f.good();
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
const char* keys =
|
||||
"{help h usage ? |false | print this message }"
|
||||
"{@image | | path to image }"
|
||||
"{@darkOnLight |false | indicates whether text to be extracted is dark on a light brackground. Defaults to false. }"
|
||||
;
|
||||
|
||||
CommandLineParser cmd(argc, argv, keys);
|
||||
|
||||
if(cmd.get<bool>("help"))
|
||||
{
|
||||
help(cmd, "Usage: ./textdetection_swt [options] \nExample: ./textdetection_swt scenetext_segmented_word03.jpg true");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
string filepath = cmd.get<string>("@image");
|
||||
|
||||
if (!fileExists(filepath)) {
|
||||
help(cmd, "ERROR: Could not find the image file. Please check the path.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
bool dark_on_light = cmd.get<bool>("@darkOnLight");
|
||||
|
||||
Mat image = imread(filepath, IMREAD_COLOR);
|
||||
|
||||
if (image.empty())
|
||||
{
|
||||
help(cmd, "ERROR: Could not load the image file");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
cout << "Starting SWT Text Detection Demo with dark_on_light variable set to " << dark_on_light << endl;
|
||||
|
||||
imshow("Input Image", image);
|
||||
waitKey(1);
|
||||
|
||||
vector<cv::Rect> components;
|
||||
Mat out;
|
||||
vector<cv::Rect> regions;
|
||||
cv::text::detectTextSWT(image, components, dark_on_light, out, regions);
|
||||
|
||||
imshow ("Letter Candidates", out);
|
||||
waitKey(1);
|
||||
|
||||
cout << components.size() << " letter candidates found." << endl;
|
||||
|
||||
Mat image_copy = image.clone();
|
||||
|
||||
for (unsigned int i = 0; i < regions.size(); i++) {
|
||||
rectangle(image_copy, regions[i], cv::Scalar(0, 0, 0), 3);
|
||||
}
|
||||
cout << regions.size() << " chains were obtained after merging suitable pairs" << endl;
|
||||
cout << "Recognition finished. Press any key to exit..." << endl;
|
||||
|
||||
imshow ("Chains After Merging", image_copy);
|
||||
waitKey();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,408 @@
|
||||
/*
|
||||
* webcam-demo.cpp
|
||||
*
|
||||
* A demo program of End-to-end Scene Text Detection and Recognition using webcam or video.
|
||||
*
|
||||
* Created on: Jul 31, 2014
|
||||
* Author: Lluis Gomez i Bigorda <lgomez AT cvc.uab.es>
|
||||
*/
|
||||
|
||||
#include "opencv2/text.hpp"
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/features.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::text;
|
||||
|
||||
//ERStat extraction is done in parallel for different channels
|
||||
class Parallel_extractCSER: public cv::ParallelLoopBody
|
||||
{
|
||||
private:
|
||||
vector<Mat> &channels;
|
||||
vector< vector<ERStat> > ®ions;
|
||||
vector< Ptr<ERFilter> > er_filter1;
|
||||
vector< Ptr<ERFilter> > er_filter2;
|
||||
|
||||
public:
|
||||
Parallel_extractCSER(vector<Mat> &_channels, vector< vector<ERStat> > &_regions,
|
||||
vector<Ptr<ERFilter> >_er_filter1, vector<Ptr<ERFilter> >_er_filter2)
|
||||
: channels(_channels),regions(_regions),er_filter1(_er_filter1),er_filter2(_er_filter2) {}
|
||||
|
||||
virtual void operator()( const cv::Range &r ) const CV_OVERRIDE
|
||||
{
|
||||
for (int c=r.start; c < r.end; c++)
|
||||
{
|
||||
er_filter1[c]->run(channels[c], regions[c]);
|
||||
er_filter2[c]->run(channels[c], regions[c]);
|
||||
}
|
||||
}
|
||||
Parallel_extractCSER & operator=(const Parallel_extractCSER &a);
|
||||
};
|
||||
|
||||
//OCR recognition is done in parallel for different detections
|
||||
template <class T>
|
||||
class Parallel_OCR: public cv::ParallelLoopBody
|
||||
{
|
||||
private:
|
||||
vector<Mat> &detections;
|
||||
vector<string> &outputs;
|
||||
vector< vector<Rect> > &boxes;
|
||||
vector< vector<string> > &words;
|
||||
vector< vector<float> > &confidences;
|
||||
vector< Ptr<T> > &ocrs;
|
||||
|
||||
public:
|
||||
Parallel_OCR(vector<Mat> &_detections, vector<string> &_outputs, vector< vector<Rect> > &_boxes,
|
||||
vector< vector<string> > &_words, vector< vector<float> > &_confidences,
|
||||
vector< Ptr<T> > &_ocrs)
|
||||
: detections(_detections), outputs(_outputs), boxes(_boxes), words(_words),
|
||||
confidences(_confidences), ocrs(_ocrs)
|
||||
{}
|
||||
|
||||
virtual void operator()( const cv::Range &r ) const CV_OVERRIDE
|
||||
{
|
||||
for (int c=r.start; c < r.end; c++)
|
||||
{
|
||||
ocrs[c%ocrs.size()]->run(detections[c], outputs[c], &boxes[c], &words[c], &confidences[c], OCR_LEVEL_WORD);
|
||||
}
|
||||
}
|
||||
Parallel_OCR & operator=(const Parallel_OCR &a);
|
||||
};
|
||||
|
||||
//Discard wrongly recognised strings
|
||||
bool isRepetitive(const string& s);
|
||||
//Draw ER's in an image via floodFill
|
||||
void er_draw(vector<Mat> &channels, vector<vector<ERStat> > ®ions, vector<Vec2i> group, Mat& segmentation);
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{@input | 0 | camera index or video file name}"
|
||||
"{ image i | | specify input image}"
|
||||
};
|
||||
|
||||
//Perform text detection and recognition from webcam or video
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
|
||||
cout << "A demo program of End-to-end Scene Text Detection and Recognition using webcam or video." << endl << endl;
|
||||
cout << " Keys: " << endl;
|
||||
cout << " Press 'r' to switch between MSER/CSER regions." << endl;
|
||||
cout << " Press 'g' to switch between Horizontal and Arbitrary oriented grouping." << endl;
|
||||
cout << " Press 'o' to switch between OCRTesseract/OCRHMMDecoder recognition." << endl;
|
||||
cout << " Press 's' to scale down frame size to 320x240." << endl;
|
||||
cout << " Press 'ESC' to exit." << endl << endl;
|
||||
parser.printMessage();
|
||||
|
||||
VideoCapture cap;
|
||||
Mat frame, image, gray, out_img;
|
||||
String input = parser.get<String>("@input");
|
||||
String image_file_name = parser.get<String>("image");
|
||||
if (image_file_name != "")
|
||||
{
|
||||
image = imread(image_file_name);
|
||||
if (image.empty())
|
||||
{
|
||||
cout << "\nunable to open " << image_file_name << "\nprogram terminated!\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nimage " << image_file_name << " loaded!\n";
|
||||
frame = image.clone();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nInitializing capturing... ";
|
||||
if (input.size() == 1 && isdigit(input[0]))
|
||||
cap.open(input[0] - '0');
|
||||
else
|
||||
cap.open(input);
|
||||
|
||||
if (!cap.isOpened())
|
||||
{
|
||||
cout << "\nCould not initialize capturing!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
cout << " Done!" << endl;
|
||||
|
||||
cap.read(frame);
|
||||
}
|
||||
|
||||
namedWindow("recognition",WINDOW_NORMAL);
|
||||
imshow("recognition", frame);
|
||||
waitKey(1);
|
||||
|
||||
bool downsize = false;
|
||||
int REGION_TYPE = 1;
|
||||
int GROUPING_ALGORITHM = 0;
|
||||
int RECOGNITION = 0;
|
||||
|
||||
String region_types_str[2] = {"ERStats", "MSER"};
|
||||
String grouping_algorithms_str[2] = {"exhaustive_search", "multioriented"};
|
||||
String recognitions_str[2] = {"Tesseract", "NM_chain_features + KNN"};
|
||||
|
||||
vector<Mat> channels;
|
||||
vector<vector<ERStat> > regions(2); //two channels
|
||||
|
||||
// Create ERFilter objects with the 1st and 2nd stage default classifiers
|
||||
// since er algorithm is not reentrant we need one filter for channel
|
||||
vector< Ptr<ERFilter> > er_filters1;
|
||||
vector< Ptr<ERFilter> > er_filters2;
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
Ptr<ERFilter> er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"),8,0.00015f,0.13f,0.2f,true,0.1f);
|
||||
Ptr<ERFilter> er_filter2 = createERFilterNM2(loadClassifierNM2("trained_classifierNM2.xml"),0.5);
|
||||
er_filters1.push_back(er_filter1);
|
||||
er_filters2.push_back(er_filter2);
|
||||
}
|
||||
|
||||
//Initialize OCR engine (we initialize 10 instances in order to work several recognitions in parallel)
|
||||
cout << "Initializing OCR engines ... ";
|
||||
int num_ocrs = 10;
|
||||
vector< Ptr<OCRTesseract> > ocrs;
|
||||
for (int o=0; o<num_ocrs; o++)
|
||||
{
|
||||
ocrs.push_back(OCRTesseract::create());
|
||||
}
|
||||
|
||||
Mat transition_p;
|
||||
string filename = "OCRHMM_transitions_table.xml";
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
fs["transition_probabilities"] >> transition_p;
|
||||
fs.release();
|
||||
Mat emission_p = Mat::eye(62,62,CV_64FC1);
|
||||
string voc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
vector< Ptr<OCRHMMDecoder> > decoders;
|
||||
for (int o=0; o<num_ocrs; o++)
|
||||
{
|
||||
decoders.push_back(OCRHMMDecoder::create(loadOCRHMMClassifierNM("OCRHMM_knn_model_data.xml.gz"),
|
||||
voc, transition_p, emission_p));
|
||||
}
|
||||
cout << " Done!" << endl;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
double t_all = (double)getTickCount();
|
||||
|
||||
if (downsize)
|
||||
resize(frame,frame,Size(320,240),0,0,INTER_LINEAR_EXACT);
|
||||
|
||||
/*Text Detection*/
|
||||
cvtColor(frame,gray,COLOR_BGR2GRAY);
|
||||
// Extract channels to be processed individually
|
||||
channels.clear();
|
||||
channels.push_back(gray);
|
||||
channels.push_back(255-gray);
|
||||
|
||||
regions[0].clear();
|
||||
regions[1].clear();
|
||||
|
||||
switch (REGION_TYPE)
|
||||
{
|
||||
case 0: // ERStats
|
||||
parallel_for_(cv::Range(0, (int)channels.size()), Parallel_extractCSER(channels, regions, er_filters1, er_filters2));
|
||||
break;
|
||||
case 1: // MSER
|
||||
vector<vector<Point> > contours;
|
||||
vector<Rect> bboxes;
|
||||
Ptr<MSER> mser = MSER::create(21, (int)(0.00002*gray.cols*gray.rows), (int)(0.05*gray.cols*gray.rows), 1, 0.7);
|
||||
mser->detectRegions(gray, contours, bboxes);
|
||||
|
||||
//Convert the output of MSER to suitable input for the grouping/recognition algorithms
|
||||
if (contours.size() > 0)
|
||||
MSERsToERStats(gray, contours, regions);
|
||||
break;
|
||||
}
|
||||
|
||||
// Detect character groups
|
||||
vector< vector<Vec2i> > nm_region_groups;
|
||||
vector<Rect> nm_boxes;
|
||||
switch (GROUPING_ALGORITHM)
|
||||
{
|
||||
case 0: // exhaustive_search
|
||||
erGrouping(frame, channels, regions, nm_region_groups, nm_boxes, ERGROUPING_ORIENTATION_HORIZ);
|
||||
break;
|
||||
case 1: //multioriented
|
||||
erGrouping(frame, channels, regions, nm_region_groups, nm_boxes, ERGROUPING_ORIENTATION_ANY, "./trained_classifier_erGrouping.xml", 0.5);
|
||||
break;
|
||||
}
|
||||
|
||||
/*Text Recognition (OCR)*/
|
||||
|
||||
int bottom_bar_height= out_img.rows/7 ;
|
||||
copyMakeBorder(frame, out_img, 0, bottom_bar_height, 0, 0, BORDER_CONSTANT, Scalar(150, 150, 150));
|
||||
float scale_font = (float)(bottom_bar_height /85.0);
|
||||
vector<string> words_detection;
|
||||
float min_confidence1 = 0.f, min_confidence2 = 0.f;
|
||||
|
||||
if (RECOGNITION == 0)
|
||||
{
|
||||
min_confidence1 = 51.f;
|
||||
min_confidence2 = 60.f;
|
||||
}
|
||||
|
||||
vector<Mat> detections;
|
||||
|
||||
for (int i=0; i<(int)nm_boxes.size(); i++)
|
||||
{
|
||||
rectangle(out_img, nm_boxes[i].tl(), nm_boxes[i].br(), Scalar(255,255,0),3);
|
||||
|
||||
Mat group_img = Mat::zeros(frame.rows+2, frame.cols+2, CV_8UC1);
|
||||
er_draw(channels, regions, nm_region_groups[i], group_img);
|
||||
group_img(nm_boxes[i]).copyTo(group_img);
|
||||
copyMakeBorder(group_img,group_img,15,15,15,15,BORDER_CONSTANT,Scalar(0));
|
||||
detections.push_back(group_img);
|
||||
}
|
||||
vector<string> outputs((int)detections.size());
|
||||
vector< vector<Rect> > boxes((int)detections.size());
|
||||
vector< vector<string> > words((int)detections.size());
|
||||
vector< vector<float> > confidences((int)detections.size());
|
||||
|
||||
// parallel process detections in batches of ocrs.size() (== num_ocrs)
|
||||
for (int i=0; i<(int)detections.size(); i=i+(int)num_ocrs)
|
||||
{
|
||||
Range r;
|
||||
if (i+(int)num_ocrs <= (int)detections.size())
|
||||
r = Range(i,i+(int)num_ocrs);
|
||||
else
|
||||
r = Range(i,(int)detections.size());
|
||||
|
||||
switch(RECOGNITION)
|
||||
{
|
||||
case 0: // Tesseract
|
||||
parallel_for_(r, Parallel_OCR<OCRTesseract>(detections, outputs, boxes, words, confidences, ocrs));
|
||||
break;
|
||||
case 1: // NM_chain_features + KNN
|
||||
parallel_for_(r, Parallel_OCR<OCRHMMDecoder>(detections, outputs, boxes, words, confidences, decoders));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<(int)detections.size(); i++)
|
||||
{
|
||||
outputs[i].erase(remove(outputs[i].begin(), outputs[i].end(), '\n'), outputs[i].end());
|
||||
//cout << "OCR output = \"" << outputs[i] << "\" length = " << outputs[i].size() << endl;
|
||||
if (outputs[i].size() < 3)
|
||||
continue;
|
||||
|
||||
for (int j=0; j<(int)boxes[i].size(); j++)
|
||||
{
|
||||
boxes[i][j].x += nm_boxes[i].x-15;
|
||||
boxes[i][j].y += nm_boxes[i].y-15;
|
||||
|
||||
//cout << " word = " << words[j] << "\t confidence = " << confidences[j] << endl;
|
||||
if ((words[i][j].size() < 2) || (confidences[i][j] < min_confidence1) ||
|
||||
((words[i][j].size()==2) && (words[i][j][0] == words[i][j][1])) ||
|
||||
((words[i][j].size()< 4) && (confidences[i][j] < min_confidence2)) ||
|
||||
isRepetitive(words[i][j]))
|
||||
continue;
|
||||
words_detection.push_back(words[i][j]);
|
||||
rectangle(out_img, boxes[i][j].tl(), boxes[i][j].br(), Scalar(255,0,255),3);
|
||||
Size word_size = getTextSize(words[i][j], FONT_HERSHEY_SIMPLEX, (double)scale_font, (int)(3*scale_font), NULL);
|
||||
rectangle(out_img, boxes[i][j].tl()-Point(3,word_size.height+3), boxes[i][j].tl()+Point(word_size.width,0), Scalar(255,0,255),-1);
|
||||
putText(out_img, words[i][j], boxes[i][j].tl()-Point(1,1), FONT_HERSHEY_SIMPLEX, scale_font, Scalar(255,255,255),(int)(3*scale_font));
|
||||
}
|
||||
}
|
||||
|
||||
t_all = ((double)getTickCount() - t_all)*1000/getTickFrequency();
|
||||
int text_thickness = 1+(out_img.rows/500);
|
||||
string fps_info = format("%2.1f Fps. %dx%d", (float)(1000 / t_all), frame.cols, frame.rows);
|
||||
putText(out_img, fps_info, Point( 10,out_img.rows-5 ), FONT_HERSHEY_DUPLEX, scale_font, Scalar(255,0,0), text_thickness);
|
||||
putText(out_img, region_types_str[REGION_TYPE], Point((int)(out_img.cols*0.5), out_img.rows - (int)(bottom_bar_height / 1.5)), FONT_HERSHEY_DUPLEX, scale_font, Scalar(255,0,0), text_thickness);
|
||||
putText(out_img, grouping_algorithms_str[GROUPING_ALGORITHM], Point((int)(out_img.cols*0.5),out_img.rows-((int)(bottom_bar_height /3)+4) ), FONT_HERSHEY_DUPLEX, scale_font, Scalar(255,0,0), text_thickness);
|
||||
putText(out_img, recognitions_str[RECOGNITION], Point((int)(out_img.cols*0.5),out_img.rows-5 ), FONT_HERSHEY_DUPLEX, scale_font, Scalar(255,0,0), text_thickness);
|
||||
|
||||
imshow("recognition", out_img);
|
||||
|
||||
if ((image_file_name == "") && !cap.read(frame))
|
||||
{
|
||||
cout << "Capturing ended! press any key to exit." << endl;
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int key = waitKey(30); //wait for a key press
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 27: //ESC
|
||||
cout << "ESC key pressed and exited." << endl;
|
||||
return 0;
|
||||
case 32: //SPACE
|
||||
imwrite("recognition_alt.jpg", out_img);
|
||||
break;
|
||||
case 103: //'g'
|
||||
GROUPING_ALGORITHM = (GROUPING_ALGORITHM+1)%2;
|
||||
cout << "Grouping switched to " << grouping_algorithms_str[GROUPING_ALGORITHM] << endl;
|
||||
break;
|
||||
case 111: //'o'
|
||||
RECOGNITION = (RECOGNITION+1)%2;
|
||||
cout << "OCR switched to " << recognitions_str[RECOGNITION] << endl;
|
||||
break;
|
||||
case 114: //'r'
|
||||
REGION_TYPE = (REGION_TYPE+1)%2;
|
||||
cout << "Regions switched to " << region_types_str[REGION_TYPE] << endl;
|
||||
break;
|
||||
case 115: //'s'
|
||||
downsize = !downsize;
|
||||
if (!image.empty())
|
||||
{
|
||||
frame = image.clone();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool isRepetitive(const string& s)
|
||||
{
|
||||
int count = 0;
|
||||
int count2 = 0;
|
||||
int count3 = 0;
|
||||
int first=(int)s[0];
|
||||
int last=(int)s[(int)s.size()-1];
|
||||
for (int i=0; i<(int)s.size(); i++)
|
||||
{
|
||||
if ((s[i] == 'i') ||
|
||||
(s[i] == 'l') ||
|
||||
(s[i] == 'I'))
|
||||
count++;
|
||||
if((int)s[i]==first)
|
||||
count2++;
|
||||
if((int)s[i]==last)
|
||||
count3++;
|
||||
}
|
||||
if ((count > ((int)s.size()+1)/2) || (count2 == (int)s.size()) || (count3 > ((int)s.size()*2)/3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void er_draw(vector<Mat> &channels, vector<vector<ERStat> > ®ions, vector<Vec2i> group, Mat& segmentation)
|
||||
{
|
||||
for (int r=0; r<(int)group.size(); r++)
|
||||
{
|
||||
ERStat er = regions[group[r][0]][group[r][1]];
|
||||
if (er.parent != NULL) // deprecate the root region
|
||||
{
|
||||
int newMaskVal = 255;
|
||||
int flags = 4 + (newMaskVal << 8) + FLOODFILL_FIXED_RANGE + FLOODFILL_MASK_ONLY;
|
||||
floodFill(channels[group[r][0]],segmentation,Point(er.pixel%channels[group[r][0]].cols,er.pixel/channels[group[r][0]].cols),
|
||||
Scalar(255),0,Scalar(er.level),Scalar(0),flags);
|
||||
}
|
||||
}
|
||||
}
|
||||