Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
4a2911e9
Commit
4a2911e9
authored
Jan 26, 2021
by
Julien Osman
Browse files
TEST: Add test for GDALRPCTransformer with product instead of geom
parent
4b48ea30
Pipeline
#6620
failed with stages
in 86 minutes and 15 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Modules/IO/IOGDAL/test/CMakeLists.txt
View file @
4a2911e9
...
...
@@ -269,7 +269,7 @@ otb_add_test(NAME TuGDALRPCTransformerTest
${
INPUTDATA
}
/TuGDALRPCTransformerTest_DEM.tif
)
otb_add_test
(
NAME ioTvGDALRPCTransformerTest_ikonos
otb_add_test
(
NAME ioTvGDALRPCTransformerTest_ikonos
_geom
COMMAND otbIOGDALTestDriver
otbGDALRPCTransformerTest2
${
INPUTDATA
}
/ikonos/ikonos-1.geom
# Geom
...
...
@@ -278,6 +278,15 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_ikonos
0.1
# ImgTol
)
otb_add_test
(
NAME ioTvGDALRPCTransformerTest_ikonos_product
COMMAND otbIOGDALTestDriver
otbGDALRPCTransformerTest2
LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_blu_0000000.tif}
# Product
${
INPUTDATA
}
/ikonos/ikonos-1.gcp2
# GCP
0.04
# GeoTol
0.1
# ImgTol
)
otb_add_test
(
NAME ioTvGDALRPCTransformerTest_quickbird
COMMAND otbIOGDALTestDriver
otbGDALRPCTransformerTest2
...
...
Modules/IO/IOGDAL/test/otbGDALRPCTransformerTest2.cxx
View file @
4a2911e9
...
...
@@ -28,6 +28,8 @@
#include
"otbImageMetadataInterfaceFactory.h"
#include
"otbMacro.h"
#include
"otbDEMHandler.h"
#include
"otbImage.h"
#include
"otbImageFileReader.h"
//typedef otb::Image<double> ImageType;
typedef
std
::
vector
<
itk
::
Point
<
double
,
3
>>
pointsContainerType
;
...
...
@@ -41,7 +43,7 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
otb
::
GDALRPCTransformer
::
PointType
geo3dPoint
;
// Inputs
std
::
string
inputGeom
File
(
argv
[
1
]);
std
::
string
rpc
File
(
argv
[
1
]);
std
::
string
gcpFileName
(
argv
[
2
]);
double
geoTol
(
atof
(
argv
[
3
]));
double
imgTol
(
atof
(
argv
[
4
]));
...
...
@@ -49,15 +51,28 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
// Tools
auto
distance
=
DistanceType
::
New
();
auto
geoDistance
=
GeographicalDistanceType
::
New
();
// Fetching the RPC model from the product
otb
::
ImageMetadata
imd
;
otb
::
GeomMetadataSupplier
geomSupplier
(
inputGeomFile
);
for
(
int
loop
=
0
;
loop
<
geomSupplier
.
GetNbBands
()
;
++
loop
)
imd
.
Bands
.
emplace_back
();
auto
imi
=
otb
::
ImageMetadataInterfaceFactory
::
CreateIMI
(
imd
,
geomSupplier
);
imd
=
imi
->
GetImageMetadata
();
geomSupplier
.
FetchRPC
(
imd
);
if
(
0
==
rpcFile
.
compare
(
rpcFile
.
length
()
-
4
,
4
,
"geom"
))
{
// Fetching the RPC model from a GEOM file
otb
::
GeomMetadataSupplier
geomSupplier
(
rpcFile
);
for
(
int
loop
=
0
;
loop
<
geomSupplier
.
GetNbBands
()
;
++
loop
)
imd
.
Bands
.
emplace_back
();
auto
imi
=
otb
::
ImageMetadataInterfaceFactory
::
CreateIMI
(
imd
,
geomSupplier
);
imd
=
imi
->
GetImageMetadata
();
geomSupplier
.
FetchRPC
(
imd
);
}
else
{
// Fetching the RPC model from a product
typedef
otb
::
Image
<
double
,
2
>
ImageType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ImageFileReaderType
;
auto
reader
=
ImageFileReaderType
::
New
();
reader
->
SetFileName
(
rpcFile
);
reader
->
UpdateOutputInformation
();
imd
=
reader
->
GetOutput
()
->
GetImageMetadata
();
}
auto
rpcModel
=
boost
::
any_cast
<
otb
::
Projection
::
RPCParam
>
(
imd
[
otb
::
MDGeom
::
RPC
]);
// Setting the RPCTransformer
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment