Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
84291fb0
Commit
84291fb0
authored
12 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Simplifying and robustifying test on RCC8 graph computation
parent
84db0207
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Testing/Code/SpatialReasoning/CMakeLists.txt
+1
-18
1 addition, 18 deletions
Testing/Code/SpatialReasoning/CMakeLists.txt
Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx
+68
-55
68 additions, 55 deletions
...Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx
with
69 additions
and
73 deletions
Testing/Code/SpatialReasoning/CMakeLists.txt
+
1
−
18
View file @
84291fb0
...
...
@@ -205,24 +205,7 @@ ADD_TEST(srTvPolygonListToRCC8GraphFilter ${SPATIALREASONING_TESTS2}
${
BASELINE_FILES
}
/srTvPolygonListToRCC8GraphFilterOuptut.dot
${
TEMP
}
/srTvPolygonListToRCC8GraphFilterOuptut.dot
otbPolygonListToRCC8GraphFilter
4
${
TEMP
}
/srTvPolygonListToRCC8GraphFilterOuptut.dot
${
INPUTDATA
}
/rcc8_mire1.png
${
INPUTDATA
}
/rcc8_mire2.png
${
INPUTDATA
}
/rcc8_mire3.png
${
INPUTDATA
}
/rcc8_mire4.png
)
ADD_TEST
(
srTvPolygonListToRCC8GraphFilter2
${
SPATIALREASONING_TESTS2
}
--compare-ascii
${
NOTOL
}
${
BASELINE_FILES
}
/srTvPolygonListToRCC8GraphFilter2Ouptut.dot
${
TEMP
}
/srTvPolygonListToRCC8GraphFilter2Ouptut.dot
otbPolygonListToRCC8GraphFilter
3
${
TEMP
}
/srTvPolygonListToRCC8GraphFilter2Ouptut.dot
${
INPUTDATA
}
/Seg3InputForRCC8Graph.tif
${
INPUTDATA
}
/Seg4InputForRCC8Graph.tif
${
INPUTDATA
}
/Seg5InputForRCC8Graph.tif
)
${
TEMP
}
/srTvPolygonListToRCC8GraphFilterOuptut.dot
)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbSPATIALREASONINGTests3 ~~~~~~~~~~~~~~~~~~~~~~
...
...
This diff is collapsed.
Click to expand it.
Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx
+
68
−
55
View file @
84291fb0
...
...
@@ -21,76 +21,89 @@
#include
"otbObjectList.h"
#include
"otbRCC8VertexBase.h"
#include
"otbPolygonListToRCC8GraphFilter.h"
#include
"otbImageFileReader.h"
#include
"otbImage.h"
#include
"itkMinimumMaximumImageCalculator.h"
#include
"otbImageToEdgePathFilter.h"
#include
"otbRCC8GraphFileWriter.h"
#include
"otbSimplifyPathListFilter.h"
#include
"itkMinimumMaximumImageCalculator.h"
int
otbPolygonListToRCC8GraphFilter
(
int
argc
,
char
*
argv
[])
// typedefs
typedef
otb
::
Polygon
<>
PolygonType
;
typedef
otb
::
ObjectList
<
PolygonType
>
PolygonListType
;
typedef
otb
::
RCC8VertexBase
<
PolygonType
>
VertexType
;
typedef
otb
::
RCC8Graph
<
VertexType
>
RCC8GraphType
;
typedef
otb
::
PolygonListToRCC8GraphFilter
<
PolygonListType
,
RCC8GraphType
>
RCC8GraphFilterType
;
typedef
otb
::
RCC8GraphFileWriter
<
RCC8GraphType
>
GraphWriterType
;
PolygonType
::
VertexType
Vertex
(
double
i
,
double
j
)
{
const
unsigned
int
Dimension
=
2
;
PolygonType
::
VertexType
vertex
;
vertex
[
0
]
=
i
;
vertex
[
1
]
=
j
;
int
nbImages
=
atoi
(
argv
[
1
])
;
char
*
outfile
=
argv
[
2
];
return
vertex
;
}
// typedefs
typedef
otb
::
Polygon
<>
PolygonType
;
typedef
otb
::
ObjectList
<
PolygonType
>
PolygonListType
;
typedef
otb
::
RCC8VertexBase
<
PolygonType
>
VertexType
;
typedef
otb
::
RCC8Graph
<
VertexType
>
RCC8GraphType
;
typedef
otb
::
PolygonListToRCC8GraphFilter
<
PolygonListType
,
RCC8GraphType
>
RCC8GraphFilterType
;
typedef
otb
::
RCC8GraphFileWriter
<
RCC8GraphType
>
GraphWriterType
;
typedef
unsigned
short
PixelType
;
typedef
otb
::
Image
<
PixelType
,
Dimension
>
ImageType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ReaderType
;
typedef
otb
::
ImageToEdgePathFilter
<
ImageType
,
PolygonType
>
EdgeExtractionFilterType
;
typedef
itk
::
MinimumMaximumImageCalculator
<
ImageType
>
MinMaxCalculatorType
;
typedef
otb
::
SimplifyPathListFilter
<
PolygonType
>
SimplifyPathFilterType
;
int
otbPolygonListToRCC8GraphFilter
(
int
argc
,
char
*
argv
[])
{
const
unsigned
int
Dimension
=
2
;
char
*
outfile
=
argv
[
1
];
PolygonListType
::
Pointer
regions
=
PolygonListType
::
New
();
RCC8GraphFilterType
::
SegmentationRangesType
ranges
;
// Reading input images
for
(
int
cpt
=
1
;
cpt
<=
nbImages
;
++
cpt
)
{
ranges
.
push_back
(
regions
->
Size
());
ReaderType
::
Pointer
reader
=
ReaderType
::
New
();
reader
->
SetFileName
(
argv
[
2
+
cpt
]);
reader
->
Update
();
MinMaxCalculatorType
::
Pointer
minMax
=
MinMaxCalculatorType
::
New
();
minMax
->
SetImage
(
reader
->
GetOutput
());
minMax
->
Compute
();
for
(
PixelType
p
=
minMax
->
GetMinimum
();
p
<=
minMax
->
GetMaximum
();
++
p
)
{
if
(
p
!=
0
)
{
EdgeExtractionFilterType
::
Pointer
extraction
=
EdgeExtractionFilterType
::
New
();
extraction
->
SetInput
(
reader
->
GetOutput
());
extraction
->
SetForegroundValue
(
p
);
extraction
->
Update
();
if
(
extraction
->
GetOutput
()
->
GetVertexList
()
->
Size
()
>
2
)
{
regions
->
PushBack
(
extraction
->
GetOutput
());
}
}
}
}
// Simplifying regions
SimplifyPathFilterType
::
Pointer
simplifier
=
SimplifyPathFilterType
::
New
();
simplifier
->
SetInput
(
regions
);
simplifier
->
GetFunctor
().
SetTolerance
(
0.1
);
simplifier
->
Update
();
ranges
.
push_back
(
0
);
PolygonType
::
Pointer
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
0
,
0
));
polygon
->
AddVertex
(
Vertex
(
2
,
0
));
polygon
->
AddVertex
(
Vertex
(
2
,
6
));
polygon
->
AddVertex
(
Vertex
(
0
,
6
));
regions
->
PushBack
(
polygon
);
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
1
,
1
));
polygon
->
AddVertex
(
Vertex
(
4
,
1
));
polygon
->
AddVertex
(
Vertex
(
4
,
5
));
polygon
->
AddVertex
(
Vertex
(
1
,
5
));
regions
->
PushBack
(
polygon
);
ranges
.
push_back
(
2
);
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
3
,
1
));
polygon
->
AddVertex
(
Vertex
(
4
,
1
));
polygon
->
AddVertex
(
Vertex
(
4
,
2
));
polygon
->
AddVertex
(
Vertex
(
3
,
2
));
regions
->
PushBack
(
polygon
);
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
5
,
1
));
polygon
->
AddVertex
(
Vertex
(
8
,
1
));
polygon
->
AddVertex
(
Vertex
(
8
,
5
));
polygon
->
AddVertex
(
Vertex
(
5
,
5
));
regions
->
PushBack
(
polygon
);
ranges
.
push_back
(
4
);
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
6
,
2
));
polygon
->
AddVertex
(
Vertex
(
7
,
2
));
polygon
->
AddVertex
(
Vertex
(
7
,
3
));
polygon
->
AddVertex
(
Vertex
(
6
,
3
));
regions
->
PushBack
(
polygon
);
polygon
=
PolygonType
::
New
();
polygon
->
AddVertex
(
Vertex
(
8
,
1
));
polygon
->
AddVertex
(
Vertex
(
9
,
1
));
polygon
->
AddVertex
(
Vertex
(
9
,
5
));
polygon
->
AddVertex
(
Vertex
(
8
,
5
));
regions
->
PushBack
(
polygon
);
// Filter instantiation
RCC8GraphFilterType
::
Pointer
filter
=
RCC8GraphFilterType
::
New
();
filter
->
SetInput
(
simplifier
->
GetOutput
()
);
filter
->
SetInput
(
regions
);
filter
->
SetSegmentationRanges
(
ranges
);
GraphWriterType
::
Pointer
writer
=
GraphWriterType
::
New
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment