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
Julien Cabieces
otb
Commits
4e14b787
Commit
4e14b787
authored
8 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
ENH: return as soon as we know the answer
parent
a9785977
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx
+16
-17
16 additions, 17 deletions
...ting/include/otbNeighborhoodMajorityVotingImageFilter.txx
with
16 additions
and
17 deletions
Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx
+
16
−
17
View file @
4e14b787
...
...
@@ -52,43 +52,42 @@ NeighborhoodMajorityVotingImageFilter<TInputImage,
const KernelIteratorType kernelEnd)
{
const PixelType centerPixel = nit.GetCenterPixel();
PixelType result = centerPixel;
if (centerPixel != m_LabelForNoDataPixels)
if (centerPixel == m_LabelForNoDataPixels)
{
return m_LabelForNoDataPixels;
}
else
{
//Get a histogram of label frequencies where the 2 highest are at the beginning and sorted
const HistoSummary histoSummary = this->ComputeNeighborhoodHistogramSummary(nit, kernelBegin, kernelEnd);
if(m_OnlyIsolatedPixels && histoSummary.freqCenterLabel > m_IsolatedThreshold)
const HistoSummary histoSummary =
this->ComputeNeighborhoodHistogramSummary(nit, kernelBegin, kernelEnd);
if(m_OnlyIsolatedPixels &&
histoSummary.freqCenterLabel > m_IsolatedThreshold)
{
//If we want to filter only isolated pixels, keep the label if
//there are enough pixels with the center label to consider that
//it is not isolated
re
sult =
centerPixel;
re
turn
centerPixel;
}
else
{
//Extraction of the more representative Label in the neighborhood (majorityLabel)
result = histoSummary.majorityLabel;
//If the majorityLabel is NOT unique in the neighborhood
if(histoSummary.secondFreq == histoSummary.majorityFreq && histoSummary.secondLabel != histoSummary.majorityLabel)
if(histoSummary.secondFreq == histoSummary.majorityFreq &&
histoSummary.secondLabel != histoSummary.majorityLabel)
{
if (m_KeepOriginalLabelBool == true)
{
re
sult =
centerPixel;
re
turn
centerPixel;
}
else
{
re
sult =
m_LabelForUndecidedPixels;
re
turn
m_LabelForUndecidedPixels;
}
}
//Extraction of the more representative Label in the neighborhood (majorityLabel)
return histoSummary.majorityLabel;
}
}//END if (centerPixel != m_LabelForNoDataPixels)
//If (centerPixel == m_LabelForNoDataPixels)
else
{
result = m_LabelForNoDataPixels;
}
return result;
}
template<class TInputImage, class TOutputImage, class TKernel>
...
...
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