Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
GRM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cresson Remi
GRM
Commits
273d9b6a
Commit
273d9b6a
authored
Mar 24, 2017
by
remi cresson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: raffale patch for no-data
parent
70a3f75e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
14 deletions
+29
-14
include/grmBaatzSegmenter.txx
include/grmBaatzSegmenter.txx
+22
-11
include/grmGraphOperations.txx
include/grmGraphOperations.txx
+7
-3
No files found.
include/grmBaatzSegmenter.txx
View file @
273d9b6a
...
...
@@ -20,6 +20,7 @@
#include <otbImageFileReader.h>
#include <itkImageRegionIterator.h>
#include "grmBaatzSegmenter.h"
#include "otbNoDataHelper.h"
namespace grm
{
...
...
@@ -33,22 +34,32 @@ namespace grm
this->m_ImageWidth = this->m_InputImage->GetLargestPossibleRegion().GetSize()[0];
this->m_ImageHeight =this->m_InputImage->GetLargestPossibleRegion().GetSize()[1];
this->m_NumberOfComponentsPerPixel = this->m_InputImage->GetNumberOfComponentsPerPixel();
std::vector<bool> noDataFlags;
std::vector<double> noDataValues;
bool noDataPresent = otb::ReadNoDataFlags(this->m_InputImage->GetMetaDataDictionary(),noDataFlags,noDataValues);
std::size_t idx = 0;
ImageIterator it(this->m_InputImage, this->m_InputImage->GetLargestPossibleRegion());
for(it.GoToBegin(); !it.IsAtEnd(); ++it)
{
this->m_Graph.m_Nodes[idx]->m_Means.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_SquareMeans.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_SpectralSum.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_Std.assign(this->m_NumberOfComponentsPerPixel, 0.0f);
for(std::size_t b = 0; b < this->m_NumberOfComponentsPerPixel; ++b)
{
this->m_Graph.m_Nodes[idx]->m_Means.push_back(it.Get()[b]);
this->m_Graph.m_Nodes[idx]->m_SquareMeans.push_back((it.Get()[b])*(it.Get()[b]));
this->m_Graph.m_Nodes[idx]->m_SpectralSum.push_back(it.Get()[b]);
}
if (noDataPresent && otb::IsNoData<double>(it.Get(),noDataFlags,noDataValues)) {
this->m_Graph.m_Nodes[idx]->m_Expired = true;
} else {
this->m_Graph.m_Nodes[idx]->m_Means.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_SquareMeans.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_SpectralSum.reserve(this->m_NumberOfComponentsPerPixel);
this->m_Graph.m_Nodes[idx]->m_Std.assign(this->m_NumberOfComponentsPerPixel, 0.0f);
for(std::size_t b = 0; b < this->m_NumberOfComponentsPerPixel; ++b)
{
this->m_Graph.m_Nodes[idx]->m_Means.push_back(it.Get()[b]);
this->m_Graph.m_Nodes[idx]->m_SquareMeans.push_back((it.Get()[b])*(it.Get()[b]));
this->m_Graph.m_Nodes[idx]->m_SpectralSum.push_back(it.Get()[b]);
}
}
++idx;
}
}
...
...
include/grmGraphOperations.txx
View file @
273d9b6a
...
...
@@ -62,6 +62,8 @@ namespace grm
seg.m_Graph.m_Nodes.push_back(n);
}
seg.InitFromImage();
if(mask == FOUR)
{
...
...
@@ -71,7 +73,7 @@ namespace grm
FOURNeighborhood(neighborhood, r->m_Id, width, height);
for(short j = 0; j < 4; ++j)
{
if(neighborhood[j] > -1)
if(neighborhood[j] > -1
&& !seg.m_Graph.m_Nodes[neighborhood[j]]->m_Expired
)
r->m_Edges.push_back(EdgeType( seg.m_Graph.m_Nodes[neighborhood[j]], 0, 1));
}
}
...
...
@@ -84,7 +86,7 @@ namespace grm
EIGHTNeighborhood(neighborhood, r->m_Id, width, height);
for(short j = 0; j < 8; ++j)
{
if(neighborhood[j] > -1)
if(neighborhood[j] > -1
&& !seg.m_Graph.m_Nodes[neighborhood[j]]->m_Expired
)
{
if(j % 2 > 0)
r->m_Edges.push_back(EdgeType( seg.m_Graph.m_Nodes[neighborhood[j]], 0, 0));
...
...
@@ -94,7 +96,9 @@ namespace grm
}
}
}
seg.InitFromImage();
RemoveExpiredNodes(seg.m_Graph);
}
template<class TSegmenter>
...
...
Write
Preview
Markdown
is supported
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