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
Container Registry
Model registry
Operate
Environments
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
Antoine Belvire
otb
Commits
d8513c83
Commit
d8513c83
authored
15 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ENH : add reference in function signature
parent
6ad6d5a8
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
Code/FeatureExtraction/otbLineSegmentDetector.h
+10
-8
10 additions, 8 deletions
Code/FeatureExtraction/otbLineSegmentDetector.h
Code/FeatureExtraction/otbLineSegmentDetector.txx
+43
-31
43 additions, 31 deletions
Code/FeatureExtraction/otbLineSegmentDetector.txx
with
53 additions
and
39 deletions
Code/FeatureExtraction/otbLineSegmentDetector.h
+
10
−
8
View file @
d8513c83
...
...
@@ -104,6 +104,7 @@ class ITK_EXPORT LineSegmentDetector :
typedef
typename
InputImageType
::
PixelType
InputPixelType
;
typedef
typename
InputImageType
::
IndexType
InputIndexType
;
typedef
typename
InputImageType
::
SizeType
SizeType
;
typedef
typename
InputImageType
::
RegionType
RegionType
;
/** Definition of the list of lines. */
typedef
LineSpatialObjectList
LineSpatialObjectListType
;
...
...
@@ -140,15 +141,16 @@ class ITK_EXPORT LineSegmentDetector :
typedef
itk
::
UnaryFunctorImageFilter
<
GradientOutputImageType
,
OutputImageType
,
Functor
::
MagnitudeFunctor
<
typename
GradientOutputImageType
::
PixelType
,
TPrecision
>
>
MagnitudeFilterType
;
typedef
typename
MagnitudeFilterType
::
Pointer
MagnitudeFilterPointerType
;
typedef
typename
MagnitudeFilterType
::
OutputImageType
::
PixelType
MagnitudePixelType
;
typedef
typename
MagnitudeFilterType
::
OutputImageType
MagnitudeImageType
;
typedef
typename
MagnitudeFilterType
::
Pointer
MagnitudeFilterPointerType
;
typedef
typename
MagnitudeFilterType
::
OutputImageType
::
PixelType
MagnitudePixelType
;
typedef
typename
MagnitudeFilterType
::
OutputImageType
MagnitudeImageType
;
typedef
typename
MagnitudeImageType
::
Pointer
MagnitudeImagePointerType
;
typedef
itk
::
UnaryFunctorImageFilter
<
GradientOutputImageType
,
OutputImageType
,
Functor
::
OrientationFunctor
<
typename
GradientOutputImageType
::
PixelType
,
TPrecision
>
>
OrientationFilterType
;
typedef
typename
OrientationFilterType
::
Pointer
OrientationFilterPointerType
;
typedef
typename
OrientationFilterType
::
OutputImageType
OutputImageDirType
;
typedef
typename
OutputImageDirType
::
RegionType
OutputImageDirRegionType
;
typedef
typename
OrientationFilterType
::
Pointer
OrientationFilterPointerType
;
typedef
typename
OrientationFilterType
::
OutputImageType
OutputImageDirType
;
typedef
typename
OutputImageDirType
::
RegionType
OutputImageDirRegionType
;
/** Create an image to store the label USED(1) or notUsed (0)*/
typedef
otb
::
Image
<
unsigned
char
,
2
>
LabelImageType
;
...
...
@@ -177,13 +179,13 @@ protected:
* this method is used to determine the seeds where to begin the search segments
* Points with large gradient modulus are more able to belong to a segment
*/
virtual
CoordinateHistogramType
SortImageByModulusValue
(
OutputImage
Type
*
modulusImage
);
virtual
CoordinateHistogramType
SortImageByModulusValue
(
MagnitudeImagePointer
Type
modulusImage
);
/** */
virtual
void
LineSegmentDetection
(
CoordinateHistogramType
&
CoordinateHistogram
);
/** */
virtual
bool
IsUsed
(
InputIndexType
index
);
virtual
bool
IsUsed
(
InputIndexType
&
index
);
/** Set Pixel flag to USED*/
virtual
void
SetPixelToUsed
(
InputIndexType
index
);
...
...
This diff is collapsed.
Click to expand it.
Code/FeatureExtraction/otbLineSegmentDetector.txx
+
43
−
31
View file @
d8513c83
...
...
@@ -23,6 +23,7 @@
#include "itkNumericTraits.h"
#include "itkMinimumMaximumImageCalculator.h"
#include "itkConstNeighborhoodIterator.h"
#include "itkImageConstIterator.h"
#include "itkNeighborhoodIterator.h"
#include "otbPolygon.h"
#include "itkCastImageFilter.h"
...
...
@@ -139,7 +140,7 @@ template <class TInputImage, class TPrecision >
typename LineSegmentDetector<TInputImage,TPrecision >
::CoordinateHistogramType
LineSegmentDetector<TInputImage,TPrecision >
::SortImageByModulusValue(
OutputImage
Type
*
modulusImage)
::SortImageByModulusValue(
MagnitudeImagePointer
Type modulusImage)
{
if(m_ImageSize[0]==0 && m_ImageSize[1]==0)
m_ImageSize = this->GetInput()->GetLargestPossibleRegion().GetSize();
...
...
@@ -178,17 +179,19 @@ LineSegmentDetector<TInputImage,TPrecision >
CoordinateHistogramType tempHisto(NbBin); /** Initializing the histogram */
itk::ImageRegionIterator<OutputImageType> it(modulusImage,
modulusImage->GetRequestedRegion());
itk::ImageRegionIterator<OutputImageType> it(modulusImage, modulusImage->GetLargestPossibleRegion()); //modulusImage->GetRequestedRegion());
InputIndexType indexRef = this->GetInput()->GetLargestPossibleRegion().GetIndex();
it.GoToBegin();
while(!it.IsAtEnd())
{
OutputIndexType index = it.GetIndex();
if(static_cast<int>(index[0]) > 0 && static_cast<int>(index[0]) < static_cast<int>(m_ImageSize[0])-1
&& static_cast<int>(index[1]) >0 && static_cast<int>(index[1]) < static_cast<int>(m_ImageSize[1])-1 )
// don't work with image boundaries
if(static_cast<int>(index[0]) > indexRef[0] && static_cast<int>(index[0]) < static_cast<int>(m_ImageSize[0]+indexRef[0])-1 &&
static_cast<int>(index[1]) > indexRef[1] && static_cast<int>(index[1]) < static_cast<int>(m_ImageSize[1]+indexRef[1])-1 )
{
unsigned int bin = static_cast<unsigned int> (it.Value()/lengthBin);
unsigned int bin = static_cast<unsigned int>
(static_cast<double>
(it.Value()
)
/lengthBin);
if( it.Value()- m_Threshold >1e-10 )
tempHisto[NbBin-bin-1].push_back(it.GetIndex());
}
...
...
@@ -211,24 +214,23 @@ LineSegmentDetector<TInputImage, TPrecision>
/** Begin the search of the segments*/
CoordinateHistogramIteratorType ItCoordinateList = CoordinateHistogram.begin();
while(ItCoordinateList != CoordinateHistogram.end())
{
typename IndexVectorType::iterator ItIndexVector = (*ItCoordinateList).begin();
while(ItIndexVector != (*ItCoordinateList).end())
{
InputIndexType index = *(ItIndexVector);
/** If the point is not yet computed */
if(!this->IsUsed(index))
{
this->GrowRegion(index);
}
{
this->GrowRegion(index);
}
++ItIndexVector;
}
++ItCoordinateList;
}
}
/**************************************************************************************************************/
...
...
@@ -431,19 +433,26 @@ LineSegmentDetector<TInputImage, TPrecision>
template <class TInputImage, class TPrecision >
bool
LineSegmentDetector<TInputImage, TPrecision>
::IsUsed(InputIndexType index)
::IsUsed(InputIndexType
&
index)
{
bool isUsed = false;
typedef itk::NeighborhoodIterator<LabelImageType> NeighborhoodLabelIteratorType;
typename NeighborhoodLabelIteratorType::SizeType radiusLabel;
radiusLabel.Fill(0);
NeighborhoodLabelIteratorType itLabel(radiusLabel,m_UsedPointImage,
m_UsedPointImage->GetRequestedRegion());
itLabel.SetLocation(index);
if(*(itLabel.GetCenterValue()) == 1)
isUsed = true;
typedef itk::ImageConstIterator<LabelImageType> ImageIteratorType;
RegionType region = m_UsedPointImage->GetLargestPossibleRegion();
InputIndexType indexRef = region.GetIndex();
ImageIteratorType itLabel(m_UsedPointImage,region);
itLabel.GoToBegin();
if( m_UsedPointImage->GetLargestPossibleRegion().IsInside(index) )
{
itLabel.SetIndex(index);
if( itLabel.Get() == 1 )
isUsed = true;
}
else
{
itkExceptionMacro(<<"Can't access to index "<<index<<", outside the image largest region ("<<region.GetIndex()<<", "<<region.GetSize()<<")");
}
return isUsed;
}
...
...
@@ -501,6 +510,7 @@ LineSegmentDetector<TInputImage, TPrecision>
double sumX = 0.;
double sumY = 0.;
/**
* Loop for searching regions
*/
...
...
@@ -518,14 +528,16 @@ LineSegmentDetector<TInputImage, TPrecision>
InputIndexType NeighIndex = itNeigh.GetIndex(s);
double angleComp = itNeighDir.GetPixel(s);
if( !this->IsUsed(NeighIndex) && this->IsAligned(angleComp, regionAngle, m_Prec) )
{
if(this->GetInput()->GetRequestedRegion().IsInside(NeighIndex)) /** Check if the index is inside the image*/
{
this->SetPixelToUsed(NeighIndex);
reg.push_back(NeighIndex);
}
}
if(this->GetInput()->GetLargestPossibleRegion().IsInside(NeighIndex)) /** Check if the index is inside the image*/
{
if( !this->IsUsed(NeighIndex) && this->IsAligned(angleComp, regionAngle, m_Prec) )
{
this->SetPixelToUsed(NeighIndex);
reg.push_back(NeighIndex);
}
}
//}
s++;
}
}/** End Searching loop*/
...
...
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