Commit 43bc73fd authored by Julien Osman's avatar Julien Osman
Browse files

Merge branch '2151-SAR-in-factory' into 'develop'

Resolve "Implement otb::SarTransformBase, otb::SarForwardTransform and otb::SarInverseTransform"

Closes #2151

See merge request !830
parents ba8de7c0 0af058fc
Pipeline #8388 passed with stages
in 6 minutes and 47 seconds
0.000000000000000 0.000000000000000 1.520858440286144 43.645444007319746 0.000031333072473
0.000000000000000 200.000000000000000 1.520537694800652 43.644201219278401 0.000031306095271
0.000000000000000 400.000000000000000 1.520216957048652 43.642958431181881 0.000031282394313
0.000000000000000 600.000000000000000 1.519896227025308 43.641715643014308 0.000031260010085
0.000000000000000 800.000000000000000 1.519575504665215 43.640472854525278 0.000031230399538
0.000000000000000 1000.000000000000000 1.519254790037906 43.639230065986034 0.000031209332062
0.000000000000000 1200.000000000000000 1.518934083137350 43.637987277376936 0.000031182997724
0.000000000000000 1400.000000000000000 1.518613383899481 43.636744488451555 0.000031159939523
0.000000000000000 1600.000000000000000 1.518292692393742 43.635501699482127 0.000031140188772
0.000000000000000 1800.000000000000000 1.517972008574187 43.634258910292438 0.000031114528507
200.000000000000000 0.000000000000000 1.519424251082173 43.645636169785242 0.000027838524188
200.000000000000000 200.000000000000000 1.519103536543384 43.644393381107520 0.000027808239611
200.000000000000000 400.000000000000000 1.518782829695121 43.643150592215534 0.000027781231256
200.000000000000000 600.000000000000000 1.518462130583586 43.641907803291168 0.000027752937385
200.000000000000000 800.000000000000000 1.518141439164628 43.640665014167553 0.000027729236451
200.000000000000000 1000.000000000000000 1.517820755442571 43.639422224861583 0.000027702228097
200.000000000000000 1200.000000000000000 1.517500079416898 43.638179435375186 0.000027678558474
200.000000000000000 1400.000000000000000 1.517179411110262 43.636936645798592 0.000027652866850
200.000000000000000 1600.000000000000000 1.516858750507654 43.635693856077133 0.000027628491927
200.000000000000000 1800.000000000000000 1.516538097628399 43.634451066286381 0.000027602831660
400.000000000000000 0.000000000000000 1.517990381053837 43.645828270448845 0.000024618009536
400.000000000000000 200.000000000000000 1.517669697424554 43.644585481020727 0.000024587051029
400.000000000000000 400.000000000000000 1.517349021484231 43.643342691379459 0.000024563350064
400.000000000000000 600.000000000000000 1.517028353270273 43.642099901673973 0.000024534382236
400.000000000000000 800.000000000000000 1.516707692745153 43.640857111760695 0.000024502780989
400.000000000000000 1000.000000000000000 1.516387039953535 43.639614321815209 0.000024475772641
400.000000000000000 1200.000000000000000 1.516066394824392 43.638371531565205 0.000024450755005
400.000000000000000 1400.000000000000000 1.515745757420679 43.637128741257541 0.000024426411404
400.000000000000000 1600.000000000000000 1.515425127738304 43.635885950879313 0.000024400719775
400.000000000000000 1800.000000000000000 1.515104505718240 43.634643160202963 0.000024376376232
600.000000000000000 0.000000000000000 1.516556829826498 43.646020309087064 0.000021664913785
600.000000000000000 200.000000000000000 1.516236177091168 43.644777518877376 0.000021635945922
600.000000000000000 400.000000000000000 1.515915532077885 43.643534728590510 0.000021601037249
600.000000000000000 600.000000000000000 1.515594894762235 43.642291938135514 0.000021574028889
600.000000000000000 800.000000000000000 1.515274265168283 43.641049147607418 0.000021547051754
600.000000000000000 1000.000000000000000 1.514953643236784 43.639806356779545 0.000021516093246
600.000000000000000 1200.000000000000000 1.514633029027705 43.638563565887239 0.000021488442172
600.000000000000000 1400.000000000000000 1.514312422505345 43.637320774794006 0.000021462107832
600.000000000000000 1600.000000000000000 1.513991823711633 43.636077983666311 0.000021434456794
600.000000000000000 1800.000000000000000 1.513671232605707 43.634835192347481 0.000021405489059
800.000000000000000 0.000000000000000 1.515123597134570 43.646212285895174 0.000018963467410
800.000000000000000 200.000000000000000 1.514802975319727 43.644969495036214 0.000018928558729
800.000000000000000 400.000000000000000 1.514482361199399 43.643726704001779 0.000018893007274
800.000000000000000 600.000000000000000 1.514161754766434 43.642483912765975 0.000018864682201
800.000000000000000 800.000000000000000 1.513841156061354 43.641241121489287 0.000018837705070
800.000000000000000 1000.000000000000000 1.513520565043109 43.639998330014329 0.000018806103844
800.000000000000000 1200.000000000000000 1.513199981718438 43.638755538370795 0.000018775788070
800.000000000000000 1400.000000000000000 1.512879406073793 43.637512746508335 0.000018748137012
800.000000000000000 1600.000000000000000 1.512558838160808 43.636269954630109 0.000018719811942
800.000000000000000 1800.000000000000000 1.512238277934674 43.635027162564555 0.000018693477625
1000.000000000000000 0.000000000000000 1.513690682698583 43.646404201014455 0.000016496521910
1000.000000000000000 200.000000000000000 1.513370091778589 43.645161409436795 0.000016462961085
1000.000000000000000 400.000000000000000 1.513049508536814 43.643918617627634 0.000016427378481
1000.000000000000000 600.000000000000000 1.512728932983022 43.642675825627720 0.000016394460486
1000.000000000000000 800.000000000000000 1.512408365158373 43.641433033598709 0.000016363501981
1000.000000000000000 1000.000000000000000 1.512087805020060 43.640190241377425 0.000016333860191
1000.000000000000000 1200.000000000000000 1.511767252597894 43.638947449082373 0.000016302258960
1000.000000000000000 1400.000000000000000 1.511446707830398 43.637704656477844 0.000016271300456
1000.000000000000000 1600.000000000000000 1.511126170784455 43.636461863825772 0.000016243006722
1000.000000000000000 1800.000000000000000 1.510805641460712 43.635219071131203 0.000016215998383
1200.000000000000000 0.000000000000000 1.512258086171882 43.646596054323950 0.000014254217430
1200.000000000000000 200.000000000000000 1.511937526119021 43.645353261949758 0.000014221299401
1200.000000000000000 400.000000000000000 1.511616973789543 43.644110469526666 0.000014186390735
1200.000000000000000 600.000000000000000 1.511296429115917 43.642867676795433 0.000014148848631
1200.000000000000000 800.000000000000000 1.510975892187119 43.641624884103820 0.000014116573406
1200.000000000000000 1000.000000000000000 1.510655362915028 43.640382091112727 0.000014085614897
1200.000000000000000 1200.000000000000000 1.510334841328367 43.639139297935643 0.000014053339667
1200.000000000000000 1400.000000000000000 1.510014327465999 43.637896504726818 0.000014020421731
1200.000000000000000 1600.000000000000000 1.509693821315895 43.636653711442207 0.000013992770687
1200.000000000000000 1800.000000000000000 1.509373322814459 43.635410917837405 0.000013961138153
1400.000000000000000 0.000000000000000 1.510825807300858 43.646787846060775 0.000012227305810
1400.000000000000000 200.000000000000000 1.510505278122084 43.645545052946851 0.000012189120891
1400.000000000000000 400.000000000000000 1.510184756652315 43.644302259735589 0.000012153538284
1400.000000000000000 600.000000000000000 1.509864242879260 43.643059466381757 0.000012118629607
1400.000000000000000 800.000000000000000 1.509543736785828 43.641816672822380 0.000012083078180
1400.000000000000000 1000.000000000000000 1.509223238374063 43.640573879067873 0.000012050160221
1400.000000000000000 1200.000000000000000 1.508902747685426 43.639331085281633 0.000012017211014
1400.000000000000000 1400.000000000000000 1.508582264673041 43.638088291284504 0.000011984935790
1400.000000000000000 1600.000000000000000 1.508261789381170 43.636845497250462 0.000011952660564
1400.000000000000000 1800.000000000000000 1.507941321738972 43.635602702908201 0.000011923692807
1600.000000000000000 0.000000000000000 1.509393845730824 43.646979576070592 0.000010400017491
1600.000000000000000 200.000000000000000 1.509073347438049 43.645736782291728 0.000010358494097
1600.000000000000000 400.000000000000000 1.508752856812796 43.644493988263036 0.000010320951973
1600.000000000000000 600.000000000000000 1.508432373918403 43.643251194231247 0.000010281450367
1600.000000000000000 800.000000000000000 1.508111898684678 43.642008399928166 0.000010246541706
1600.000000000000000 1000.000000000000000 1.507791431157842 43.640765605535137 0.000010213592504
1600.000000000000000 1200.000000000000000 1.507470971318245 43.639522810978612 0.000010176724393
1600.000000000000000 1400.000000000000000 1.507150519162254 43.638280016247890 0.000010143132457
1600.000000000000000 1600.000000000000000 1.506830074717253 43.637037221450342 0.000010110857239
1600.000000000000000 1800.000000000000000 1.506509637949709 43.635794426459562 0.000010081215452
1800.000000000000000 0.000000000000000 1.507962201189858 43.647171244516386 0.000008754498978
1800.000000000000000 200.000000000000000 1.507641733755214 43.645928449995139 0.000008715640140
1800.000000000000000 400.000000000000000 1.507321274004972 43.644685655295703 0.000008672831148
1800.000000000000000 600.000000000000000 1.507000821963078 43.643442860514767 0.000008633298376
1800.000000000000000 800.000000000000000 1.506680377578658 43.642200065456848 0.000008599063670
1800.000000000000000 1000.000000000000000 1.506359940908117 43.640957270343932 0.000008560847601
1800.000000000000000 1200.000000000000000 1.506039511938590 43.639714475128009 0.000008525938938
1800.000000000000000 1400.000000000000000 1.505719090625044 43.638471679638300 0.000008493663713
1800.000000000000000 1600.000000000000000 1.505398677024514 43.637228884098022 0.000008458112360
1800.000000000000000 1800.000000000000000 1.505078271100506 43.635986088367886 0.000008428470584
0.000000000000000 0.000000000000000 -24.455125896586335 14.499533609171017 -0.000000487687658
0.000000000000000 200.000000000000000 -24.456566385925885 14.506791874595692 0.000085982913062
0.000000000000000 400.000000000000000 -24.458006859377232 14.514050148560882 0.000189879677474
0.000000000000000 600.000000000000000 -24.459447319239448 14.521308430309615 0.000024460286937
0.000000000000000 800.000000000000000 -24.460887764572526 14.528566719650337 0.000012533069765
0.000000000000000 1000.000000000000000 -24.462328195412688 14.535825016638503 0.000154095928913
0.000000000000000 1200.000000000000000 -24.463768610116716 14.543083321601511 0.000132863385074
0.000000000000000 1400.000000000000000 -24.465209011320308 14.550341633145051 0.000004346081715
0.000000000000000 1600.000000000000000 -24.466649397955265 14.557599951476684 0.000046277786742
0.000000000000000 1800.000000000000000 -24.468089757500817 14.564858213364255 0.000258727681578
200.000000000000000 0.000000000000000 -24.446520012882207 14.501153678770418 0.000660943484722
200.000000000000000 200.000000000000000 -24.447960207469382 14.508411867630763 0.001172055457867
200.000000000000000 400.000000000000000 -24.449400384304997 14.515670064726264 0.000138495044734
200.000000000000000 600.000000000000000 -24.450840549019883 14.522928269455111 0.000422166749850
200.000000000000000 800.000000000000000 -24.452280699170856 14.530186482434409 0.000859470838054
200.000000000000000 1000.000000000000000 -24.453720834481967 14.537444702151115 0.001450414893396
200.000000000000000 1200.000000000000000 -24.455160952084626 14.544702931293109 0.000237554845842
200.000000000000000 1400.000000000000000 -24.456601057592174 14.551961166125508 0.000608018973151
200.000000000000000 1600.000000000000000 -24.458041148400920 14.559219407926548 0.001149083571461
200.000000000000000 1800.000000000000000 -24.459481211960931 14.566477593303807 0.001860909218350
400.000000000000000 0.000000000000000 -24.437922535931541 14.502771827851427 0.002564162806009
400.000000000000000 200.000000000000000 -24.439362435598664 14.510029938051753 0.003500314188937
400.000000000000000 400.000000000000000 -24.440802316372459 14.517288059453637 0.001401116696022
400.000000000000000 600.000000000000000 -24.442242186212130 14.524546187278176 0.002134270660743
400.000000000000000 800.000000000000000 -24.443682041461997 14.531804324060070 0.003021247338465
400.000000000000000 1000.000000000000000 -24.445121881683050 14.539062467465534 0.004061954326502
400.000000000000000 1200.000000000000000 -24.446561702347225 14.546320619590682 0.001802762114926
400.000000000000000 1400.000000000000000 -24.448001512240285 14.553578776861498 0.002672634542799
400.000000000000000 1600.000000000000000 -24.449441307450076 14.560836942017289 0.003713320195997
400.000000000000000 1800.000000000000000 -24.450881075205348 14.568095050539036 0.004924977617439
600.000000000000000 0.000000000000000 -24.429333413590207 14.504388066716627 0.000935162420577
600.000000000000000 200.000000000000000 -24.430773017334982 14.511646101711326 0.000528044671851
600.000000000000000 400.000000000000000 -24.432212606669815 14.518904144628703 0.001998615937263
600.000000000000000 600.000000000000000 -24.433652179986879 14.526162196059866 0.001358929023809
600.000000000000000 800.000000000000000 -24.435091738370126 14.533420255717552 0.000842200133773
600.000000000000000 1000.000000000000000 -24.436531281670259 14.540678322720931 0.000448454597986
600.000000000000000 1200.000000000000000 -24.437970810706489 14.547936397918575 0.002000717180771
600.000000000000000 1400.000000000000000 -24.439410323249536 14.555194478899594 0.001326073329512
600.000000000000000 1600.000000000000000 -24.440849820903161 14.562452567735189 0.000789632366530
600.000000000000000 1800.000000000000000 -24.442289290881046 14.569710599818663 0.000391375089157
800.000000000000000 0.000000000000000 -24.420752615879376 14.506002400765016 0.000070356076467
800.000000000000000 200.000000000000000 -24.422191925442934 14.513260358836611 -0.000000363620409
800.000000000000000 400.000000000000000 -24.423631219154267 14.520518325412091 0.000476974061177
800.000000000000000 600.000000000000000 -24.425070497970289 14.527776299867059 0.000195436828611
800.000000000000000 800.000000000000000 -24.426509761632484 14.535034282265068 0.000037021202856
800.000000000000000 1000.000000000000000 -24.427949010106271 14.542292272305282 0.000001715504082
800.000000000000000 1200.000000000000000 -24.429388242626338 14.549550270624309 0.000419279012040
800.000000000000000 1400.000000000000000 -24.430827460160778 14.556808275158959 0.000147406806450
800.000000000000000 1600.000000000000000 -24.432266662532392 14.564066286998598 0.000013880339140
800.000000000000000 1800.000000000000000 -24.433705837036715 14.571324241934359 0.000018729678146
1000.000000000000000 0.000000000000000 -24.412180096796710 14.507614841480418 0.000186149090491
1000.000000000000000 200.000000000000000 -24.413619112316525 14.514872722094236 0.000452176210661
1000.000000000000000 400.000000000000000 -24.415058110597617 14.522130611753447 -0.000000070193176
1000.000000000000000 600.000000000000000 -24.416497095148440 14.529388509182375 0.000076954824620
1000.000000000000000 800.000000000000000 -24.417936064369002 14.536646414494966 0.000277210629420
1000.000000000000000 1000.000000000000000 -24.419375018227015 14.543904327401894 0.000600710460279
1000.000000000000000 1200.000000000000000 -24.420813954592585 14.551162248755871 0.000012866356195
1000.000000000000000 1400.000000000000000 -24.422252877303499 14.558420176537705 0.000144148857656
1000.000000000000000 1600.000000000000000 -24.423691784609908 14.565678111234270 0.000413919187642
1000.000000000000000 1800.000000000000000 -24.425130663910110 14.572935989145801 0.000822303780967
1200.000000000000000 0.000000000000000 -24.403615814209925 14.509225396932715 0.001282580554878
1200.000000000000000 200.000000000000000 -24.405054535935260 14.516483200125776 0.001885750189664
1200.000000000000000 400.000000000000000 -24.406493239066450 14.523741012735032 0.000567577937611
1200.000000000000000 600.000000000000000 -24.407931929541999 14.530998832864240 0.001003534706185
1200.000000000000000 800.000000000000000 -24.409370604489190 14.538256660713337 0.001562837398954
1200.000000000000000 1000.000000000000000 -24.410809263976606 14.545514496498795 0.002245524783145
1200.000000000000000 1200.000000000000000 -24.412247904652197 14.552772341318940 0.000781530634322
1200.000000000000000 1400.000000000000000 -24.413686532697543 14.560030191910235 0.001316361828128
1200.000000000000000 1600.000000000000000 -24.415125145358925 14.567288050352285 0.001989808390729
1200.000000000000000 1800.000000000000000 -24.416563729651326 14.574545850997275 0.002802141237842
1400.000000000000000 0.000000000000000 -24.395059720543149 14.510834077161450 0.001213955245646
1400.000000000000000 200.000000000000000 -24.396498147377489 14.518091803785214 0.000792532176953
1400.000000000000000 400.000000000000000 -24.397936559442414 14.525349538950447 0.002279717946441
1400.000000000000000 600.000000000000000 -24.399374954650721 14.532607282412346 0.001665656094412
1400.000000000000000 800.000000000000000 -24.400813334109174 14.539865033460043 0.001147785809948
1400.000000000000000 1000.000000000000000 -24.402251697941896 14.547122792589279 0.000726082035437
1400.000000000000000 1200.000000000000000 -24.403690047008929 14.554380559406138 0.002365631212978
1400.000000000000000 1400.000000000000000 -24.405128378967472 14.561638333343828 0.001700094941028
1400.000000000000000 1600.000000000000000 -24.406566695105489 14.568896113924140 0.001144296571708
1400.000000000000000 1800.000000000000000 -24.408004982900461 14.576153837823025 0.000698046832200
1600.000000000000000 0.000000000000000 -24.386511782184630 14.512440889009607 0.000237234461942
1600.000000000000000 200.000000000000000 -24.387949915636611 14.519698538295778 0.000075434267541
1600.000000000000000 400.000000000000000 -24.389388033034859 14.526956196067317 0.000762386253706
1600.000000000000000 600.000000000000000 -24.390826134528027 14.534213862080708 0.000427154661609
1600.000000000000000 800.000000000000000 -24.392264220159223 14.541471535933066 0.000188203971593
1600.000000000000000 1000.000000000000000 -24.393702289966445 14.548729217694408 0.000045527262678
1600.000000000000000 1200.000000000000000 -24.395140343613331 14.555986907316434 0.000735731352224
1600.000000000000000 1400.000000000000000 -24.396578381244574 14.563244603820197 0.000388417235718
1600.000000000000000 1600.000000000000000 -24.398016403052100 14.570502307773721 0.000150918627562
1600.000000000000000 1800.000000000000000 -24.399454396258466 14.577759954553335 0.000023218394253
1800.000000000000000 0.000000000000000 -24.377971956108656 14.514045842039890 0.000014662254231
1800.000000000000000 200.000000000000000 -24.379409796311396 14.521303413458126 0.000112818298294
1800.000000000000000 400.000000000000000 -24.380847619408833 14.528560994198598 0.000055269016449
1800.000000000000000 600.000000000000000 -24.382285427390666 14.535818582577573 -0.000000819746402
1800.000000000000000 800.000000000000000 -24.383723219409642 14.543076179114561 0.000039484724699
1800.000000000000000 1000.000000000000000 -24.385160995445940 14.550333783584410 0.000176181341368
1800.000000000000000 1200.000000000000000 -24.386598754036914 14.557591396041582 0.000030736051761
1800.000000000000000 1400.000000000000000 -24.388036497641348 14.564849015412006 0.000001981326888
1800.000000000000000 1600.000000000000000 -24.389474225164548 14.572106641759074 0.000083161973084
1800.000000000000000 1800.000000000000000 -24.390911923980322 14.579364211209159 0.000274356317804
......@@ -13,11 +13,11 @@ and implement the methods:
- ``TransformPoint`` that process the transformation.
.. image:: /Art/C++/UmlSensorModel.png
RPC sensor model
----------------
.. image:: /Art/C++/UmlRPCSensorModel.png
The structure ``otb::Projection::RPCParam`` is used to store the
parameters of the RPC model. It is based on `GDAL's RPC structure
<https://gdal.org/development/rfc/rfc22_rpc.html>`_.
......@@ -36,6 +36,30 @@ The classes ``otb::RPCForwardTransform`` and
``otb::RPCInverseTransform`` each implement a version of the
``TransformPoint`` method which uses the ``otb::GDALRPCTransformer``.
SAR sensor model
----------------
.. image:: /Art/C++/UmlSARSensorModel.png
The structure ``otb::SARParam`` is used to store the parameters of the
SAR model. For an exhaustive list of the paramaters available in the
``otb::SARParam``, see the `Doxygen
<https://www.orfeo-toolbox.org/doxygen/structotb_1_1SARParam.html>`_.
The SAR model is stored in the ``otb::ImageMetadata`` object, using
the key ``MDGeom::SAR``. The classes ``otb::SarTransformBase``,
``otb::SarForwardTransform`` and ``otb::SarInverseTransform`` are used
to perform forward and inverse transformation using this model.
The abstract class ``otb::SarTransformBase`` contains the
implementation of the SetMetadataModel method, which receives the
``otb::SARParam`` description from the ``otb::ImageMetadata`` and
instantiates an ``otb::SarSensorModel``.
The classes ``otb::SarForwardTransform`` and
``otb::SarInverseTransform`` each implement a version of the
``TransformPoint`` method which uses the ``otb::SarSensorModel``.
Sensor Transform Factory
------------------------
......
......@@ -183,6 +183,8 @@ struct OTBMetadata_EXPORT SARParam
/** Conversion coefficients from ground range to slant range */
std::vector<CoordinateConversionRecord> groundRangeToSlantRangeRecords;
/** JSON export */
std::string ToJSON(bool multiline=false) const;
};
/** \struct SARCalib
......
......@@ -71,6 +71,7 @@ set(OTBMetadata_SRC
otbImageMetadata.cxx
otbGeometryMetadata.cxx
otbSARMetadata.cxx
otbGeomMetadataSupplier.cxx
otbXMLMetadataSupplier.cxx
......
/*
* Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbSARMetadata.h"
namespace otb
{
std::string SARParam::ToJSON(bool multiline) const
{
// TODO
return "SARParam";
}
}
......@@ -618,7 +618,7 @@ double Sentinel1ImageMetadataInterface::getBandTerrainHeight(const XMLMetadataSu
void ReadGCP(const XMLMetadataSupplier &AnnotationMS,
Projection::GCPParam &gcp,
std::unordered_map<std::string, GCPTime> & gcpTimes)
SARParam& sarParam)
{
std::stringstream ss;
......@@ -655,18 +655,58 @@ void ReadGCP(const XMLMetadataSupplier &AnnotationMS,
{
ss.str("");
ss << "product.geolocationGrid.geolocationGridPointList.geolocationGridPoint_" << i << ".";
const auto azimuthTime = MetaData::ReadFormattedDate(AnnotationMS.GetAs<std::string>(ss.str() + "azimuthTime"));
double line = 0.;
// In TOPSAR products, GCPs are weird (they fall in black lines
// between burst. This code allows moving them to a valid area of
// the image.
if (sarParam.burstRecords.size() >= 2)
{
otb::MetaData::TimeType acqStart;
unsigned long acqStartLine = 0;
auto doesContain = [&azimuthTime](const BurstRecord & br)
{return br.azimuthStartTime <= azimuthTime && azimuthTime < br.azimuthStopTime;};
const auto bIt = std::find_if(sarParam.burstRecords.crbegin(), sarParam.burstRecords.crend(), doesContain);
if (bIt != sarParam.burstRecords.crend())
{
acqStart = bIt->azimuthStartTime;
acqStartLine = bIt->startLine;
}
else if(azimuthTime < sarParam.burstRecords.front().azimuthStartTime)
{
acqStart = sarParam.burstRecords.front().azimuthStartTime;
acqStartLine = sarParam.burstRecords.front().startLine;
}
else if (azimuthTime >= sarParam.burstRecords.front().azimuthStopTime)
{
acqStart = sarParam.burstRecords.back().azimuthStartTime;
acqStartLine = sarParam.burstRecords.back().startLine;
}
auto timeSinceStart = azimuthTime - acqStart;
line = timeSinceStart/sarParam.azimuthTimeInterval + acqStartLine;
}
else
{
line = AnnotationMS.GetAs<double>(ss.str() + "line");
}
gcp.GCPs.emplace_back(std::to_string(i), // id
"", // info
AnnotationMS.GetAs<double>(ss.str() + "pixel"), // col
AnnotationMS.GetAs<double>(ss.str() + "line"), // row
line, // row
AnnotationMS.GetAs<double>(ss.str() + "longitude"), // px
AnnotationMS.GetAs<double>(ss.str() + "latitude"), // py
AnnotationMS.GetAs<double>(ss.str() + "height")); // pz
GCPTime time;
time.azimuthTime = MetaData::ReadFormattedDate(AnnotationMS.GetAs<std::string>(ss.str() + "azimuthTime"));
time.azimuthTime = azimuthTime;
time.slantRangeTime = AnnotationMS.GetAs<double>(ss.str() + "slantRangeTime");
gcpTimes[std::to_string(i)] = time;
sarParam.gcpTimes[std::to_string(i)] = time;
}
}
......@@ -675,9 +715,6 @@ void Sentinel1ImageMetadataInterface::ReadSarParamAndGCPs(const XMLMetadataSuppl
Projection::GCPParam &gcp)
{
std::unordered_map<std::string, GCPTime> gcpTimes;
// Fetch the GCP
ReadGCP(AnnotationMS, gcp, gcpTimes);
sarParam.gcpTimes = gcpTimes;
sarParam.azimuthFmRates = this->GetAzimuthFmRate(AnnotationMS);
sarParam.dopplerCentroids = this->GetDopplerCentroid(AnnotationMS);
......@@ -699,6 +736,8 @@ void Sentinel1ImageMetadataInterface::ReadSarParamAndGCPs(const XMLMetadataSuppl
sarParam.numberOfLinesPerBurst = AnnotationMS.GetAs<unsigned long>("product.swathTiming.linesPerBurst");
sarParam.numberOfSamplesPerBurst = AnnotationMS.GetAs<unsigned long>("product.swathTiming.samplesPerBurst");
// Fetch the GCP
ReadGCP(AnnotationMS, gcp, sarParam);
}
void Sentinel1ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
......
......@@ -49,14 +49,6 @@ BOOST_AUTO_TEST_CASE(Duration)
== 3);
BOOST_TEST(otb::MetaData::Duration::Seconds(5.5) + otb::MetaData::Duration::Nanoseconds(10)
== otb::MetaData::Duration::Seconds(5.50000001) );
// debug windows
std::cout << "otb::MetaData::Duration::Seconds(5.5) * 3.5 "
<< otb::MetaData::Duration::Seconds(5.5) * 3.5 << std::endl;
std::cout << "otb::MetaData::Duration::Seconds(5.5) / 2 "
<< otb::MetaData::Duration::Seconds(5.5) / 2 << std::endl;
}
BOOST_AUTO_TEST_CASE(TimePoint)
......
......@@ -117,8 +117,8 @@ void GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::Insta
}
}
// If not, try to make a RPC sensor model
if ((m_InputTransform.IsNull()) && (m_InputImd != nullptr) && (m_InputImd->Has(MDGeom::RPC)))
// If not, try to make a sensor model
if ((m_InputTransform.IsNull()) && (m_InputImd != nullptr))
{
auto sensorModel = otb::SensorTransformFactory::GetInstance().CreateTransform
<double, InputSpaceDimension, OutputSpaceDimension>(*m_InputImd,TransformDirection::FORWARD);
......@@ -147,8 +147,8 @@ void GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::Insta
}
}
// If not, try to make a RPC sensor model
if ((m_OutputTransform.IsNull()) && (m_OutputImd != nullptr) && (m_OutputImd->Has(MDGeom::RPC)))
// If not, try to make a sensor model
if ((m_OutputTransform.IsNull()) && (m_OutputImd != nullptr))
{
auto sensorModel = otb::SensorTransformFactory::GetInstance().CreateTransform
<double, InputSpaceDimension, OutputSpaceDimension>(*m_OutputImd,TransformDirection::INVERSE);
......
......@@ -36,7 +36,7 @@ namespace otb
* - Forward Transformation of a point in the sensor geometry (i, j)
* to a geographic point in (lat, long)
*
* - Inverse Transformation of a a geographic point in (lat, long) to
* - Inverse Transformation of a geographic point in (lat, long) to
* a point in the sensor geometry (i, j).
*
* \ingroup OTBTransform
......
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbSarForwardTransform_h
#define otbSarForwardTransform_h
#include "otbSarTransformBase.h"
namespace otb
{
/** \class SarForwardTransform
* \brief Projection class based on the Sar model.
*
* This is a projection class, based on a Sar sensor model. This
* class computes a forward transformation of a point in the sensor
* geometry (i, j) to a geographic point in (lat, long)
*
* \ingroup OTBTransform
*/
template <class TScalarType, unsigned int NInputDimensions = 3, unsigned int NOutputDimensions = 2>
class ITK_EXPORT SarForwardTransform : public SarTransformBase<TScalarType, NInputDimensions, NOutputDimensions>
{
public:
/** @name Standard class type definitions */
//@{
using Self = SarForwardTransform;
using Superclass = SarTransformBase<TScalarType, NInputDimensions, NOutputDimensions>;
using Pointer = itk::SmartPointer<Self>;
using ConstPointer = itk::SmartPointer<const Self> ;
typedef itk::Point<TScalarType, NInputDimensions> InputPointType;
typedef itk::Point<TScalarType, NOutputDimensions> OutputPointType;
using PixelType =TScalarType;
//@}
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(SarForwardTransform, SarTransformBase);
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
/** Method to transform a point. */
OutputPointType TransformPoint(const InputPointType& point) const override;
SarForwardTransform();
~SarForwardTransform() = default;
protected:
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
SarForwardTransform(const Self&) = delete;
void operator=(const Self&) = delete;
};
}
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbSarForwardTransform.hxx"
#endif
#endif
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbSarForwardTransform_hxx
#define otbSarForwardTransform_hxx
#include "otbSarForwardTransform.h"
namespace otb
{
template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
SarForwardTransform<TScalarType, NInputDimensions, NOutputDimensions>::SarForwardTransform() : Superclass(TransformDirection::FORWARD)
{}
template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename SarForwardTransform<TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType
SarForwardTransform<TScalarType, NInputDimensions, NOutputDimensions>::TransformPoint(const InputPointType& point) const
{
SarSensorModel::Point2DType sensorPoint;
SarSensorModel::Point3DType worldPoint;
// from upper left corner to centered pixel convention
sensorPoint[0] = static_cast<double>(point[0]) - 0.5;
sensorPoint[1] = static_cast<double>(point[1]) - 0.5;
if (NInputDimensions > 2)
this->m_Transformer->LineSampleHeightToWorld(sensorPoint, static_cast<double>(point[2]), worldPoint);
else
this->m_Transformer->LineSampleToWorld(sensorPoint, worldPoint);
OutputPointType pOut;
pOut[0] = static_cast<TScalarType>(worldPoint[0]);
pOut[1] = static_cast<TScalarType>(worldPoint[1]);
if (NOutputDimensions > 2)
pOut[2] = static_cast<TScalarType>(worldPoint[2]);
return pOut;
}
/**
* PrintSelf method
*/
template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void SarForwardTransform<TScalarType, NInputDimensions, NOutputDimensions>::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Transformation direction: Forward" << std::endl;
}
}
#endif
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*