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
315657cc
Commit
315657cc
authored
17 years ago
by
Mathieu Deltorre
Browse files
Options
Downloads
Patches
Plain Diff
SIFT v2 creation point set pour les points d'interets avec octave dans les datas du point set
parent
bf7b5eaf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h
+17
-9
17 additions, 9 deletions
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx
+37
-25
37 additions, 25 deletions
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx
with
54 additions
and
34 deletions
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h
+
17
−
9
View file @
315657cc
...
...
@@ -81,6 +81,10 @@ namespace otb
/** Set/Get the expand factors */
itkSetMacro
(
ExpandFactors
,
unsigned
int
);
itkGetMacro
(
ExpandFactors
,
unsigned
int
);
/** Set/Get the shrink factors */
itkSetMacro
(
ShrinkFactors
,
unsigned
int
);
itkGetMacro
(
ShrinkFactors
,
unsigned
int
);
/** Set/Get the sigma 0 */
itkSetMacro
(
Sigma0
,
double
);
...
...
@@ -89,6 +93,9 @@ namespace otb
/** Internal typedefs */
typedef
itk
::
ExpandImageFilter
<
TInputImage
,
TInputImage
>
ExpandFilterType
;
typedef
typename
ExpandFilterType
::
Pointer
ExpandFilterPointerType
;
typedef
itk
::
ShrinkImageFilter
<
InputImageType
,
InputImageType
>
ShrinkFilterType
;
typedef
typename
ShrinkFilterType
::
Pointer
ShrinkFilterPointerType
;
typedef
itk
::
RecursiveGaussianImageFilter
<
InputImageType
,
InputImageType
>
GaussianFilterType
;
typedef
typename
GaussianFilterType
::
Pointer
GaussianFilterPointerType
;
...
...
@@ -98,9 +105,6 @@ namespace otb
typedef
itk
::
SubtractImageFilter
<
InputImageType
,
InputImageType
,
InputImageType
>
SubtractFilterType
;
typedef
typename
SubtractFilterType
::
Pointer
SubtractFilterPointerType
;
typedef
itk
::
ShrinkImageFilter
<
InputImageType
,
InputImageType
>
ShrinkFilterType
;
typedef
typename
ShrinkFilterType
::
Pointer
ShrinkFilterPointerType
;
typedef
itk
::
ConstNeighborhoodIterator
<
InputImageType
>
NeighborhoodIteratorType
;
typedef
typename
NeighborhoodIteratorType
::
NeighborhoodType
NeighborhoodType
;
...
...
@@ -120,16 +124,16 @@ namespace otb
virtual
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
;
/** Initialize input image */
void
i
nitializeInputImage
();
void
I
nitializeInputImage
();
/** Compute differenec of gaussian
*
* \param input, current input in process
*/
void
c
omputeDifferenceOfGaussian
(
InputImagePointerType
input
);
void
C
omputeDifferenceOfGaussian
(
InputImagePointerType
input
);
/** Localize key point */
void
localize
KeyPoint
();
void
Detect
KeyPoint
(
const
unsigned
int
octave
);
/** Check local extremum for 26 neighbors (current and adjacents scales)
*
...
...
@@ -139,7 +143,7 @@ namespace otb
*
* \return true if the pixel is extremum
*/
bool
i
sLocalExtremum
(
const
NeighborhoodIteratorType
&
currentScale
,
bool
I
sLocalExtremum
(
const
NeighborhoodIteratorType
&
currentScale
,
const
NeighborhoodIteratorType
&
previousScale
,
const
NeighborhoodIteratorType
&
nextScale
)
const
;
...
...
@@ -156,6 +160,12 @@ namespace otb
/** Expand factors */
unsigned
int
m_ExpandFactors
;
/** Shrink factors */
unsigned
int
m_ShrinkFactors
;
/** Threshold DoG */
double
m_ThresholdDoG
;
/** Sigma 0 */
typename
GaussianFilterType
::
ScalarRealType
m_Sigma0
;
...
...
@@ -183,8 +193,6 @@ namespace otb
/** Subtract filter */
SubtractFilterPointerType
m_SubtractFilter
;
};
}
// End namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
...
...
This diff is collapsed.
Click to expand it.
Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx
+
37
−
25
View file @
315657cc
...
...
@@ -31,9 +31,11 @@ namespace otb
m_OctavesNumber = 1;
m_ScalesNumber = 4;
m_ExpandFactors = 2;
m_ShrinkFactors = 2;
m_Sigma0 = 1.6;
m_Sigmak = vcl_pow((double)2, (double)((double)1/(double)m_ScalesNumber));
m_ValidatedKeyPoints = 0;
m_ThresholdDoG = 0.03;
m_ExpandFilter = ExpandFilterType::New();
}
...
...
@@ -44,25 +46,29 @@ namespace otb
::GenerateData()
{
// First, subsample the input image
initializeInputImage();
InitializeInputImage();
InputImagePointerType input = m_ExpandFilter->GetOutput();
// for each octave, compute the difference of gaussian
unsigned int lOctave = 0;
InputImagePointerType input = m_ExpandFilter->GetOutput();
for (lOctave = 0; lOctave != m_OctavesNumber; lOctave++)
{
c
omputeDifferenceOfGaussian(input);
localize
KeyPoint();
C
omputeDifferenceOfGaussian(input);
Detect
KeyPoint(
lOctave
);
//
m_ShrinkFilter = ShrinkFilterType::New();
m_ShrinkFilter = ShrinkFilterType::New();
// temporary get the second gaussian for subsample and
/// repeat the process
//m_ShrinkFilter->SetInput(m_GaussianList->GetNthElement(1));
//m_ShrinkFilter->Update();
//input = m_ShrinkFilter->GetOutput();
m_ShrinkFilter->SetInput(m_GaussianList->Back());
m_ShrinkFilter->SetShrinkFactors(m_ShrinkFactors);
m_ShrinkFilter->Update();
input = m_ShrinkFilter->GetOutput();
std::cout << "Number key points per octave : " <<
m_ValidatedKeyPoints << std::endl;
std::cout << "Number key points per octave : " \
<< m_ValidatedKeyPoints << std::endl;
std::cout << "Resample image factor : " \
<< m_ShrinkFactors << std::endl;
}
}
...
...
@@ -72,7 +78,7 @@ namespace otb
template <class TInputImage, class TOutputPointSet>
void
ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet>
::
i
nitializeInputImage()
::
I
nitializeInputImage()
{
m_ExpandFilter->SetInput( this->GetInput(0));
m_ExpandFilter->SetExpandFactors(m_ExpandFactors);
...
...
@@ -85,7 +91,7 @@ namespace otb
template <class TInputImage, class TOutputPointSet>
void
ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet>
::
c
omputeDifferenceOfGaussian(InputImagePointerType input)
::
C
omputeDifferenceOfGaussian(InputImagePointerType input)
{
unsigned int lScale = 0;
...
...
@@ -136,7 +142,7 @@ namespace otb
template <class TInputImage, class TOutputPointSet>
void
ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet>
::
localize
KeyPoint()
::
Detect
KeyPoint(
const unsigned int octave
)
{
typename ImageListType::Iterator lIterDoG = m_DoGList->Begin()+1;
...
...
@@ -165,7 +171,7 @@ namespace otb
!lIterUpperAdjacent.IsAtEnd() )
{
// check local min/max
if (
i
sLocalExtremum(lIterCurrent,
if (
I
sLocalExtremum(lIterCurrent,
lIterLowerAdjacent,
lIterUpperAdjacent))
{
...
...
@@ -174,6 +180,13 @@ namespace otb
lIterDoG.Get()->TransformIndexToPhysicalPoint(lIterCurrent.GetIndex(),
keyPoint);
pointSet->SetPoint(m_ValidatedKeyPoints, keyPoint);
OutputPixelType data;
data.SetSize(2);
data.SetElement(0,octave);
//! \todo compute scale
unsigned int scale = 0;
data.SetElement(1,scale);
pointSet->SetPointData(m_ValidatedKeyPoints, data);
++m_ValidatedKeyPoints;
}
...
...
@@ -192,7 +205,7 @@ namespace otb
template <class TInputImage, class TOutputPointSet>
bool
ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet>
::
i
sLocalExtremum( const NeighborhoodIteratorType& currentScale,
::
I
sLocalExtremum( const NeighborhoodIteratorType& currentScale,
const NeighborhoodIteratorType& previousScale,
const NeighborhoodIteratorType& nextScale) const
{
...
...
@@ -200,7 +213,6 @@ namespace otb
OffsetType offset2 = {{-1, 0}};
OffsetType offset3 = {{-1, 1}};
OffsetType offset4 = {{ 0,-1}};
OffsetType offset5 = {{ 0, 0}};
OffsetType offset6 = {{ 0, 1}};
OffsetType offset7 = {{ 1,-1}};
OffsetType offset8 = {{ 1, 0}};
...
...
@@ -227,15 +239,15 @@ namespace otb
{
isExtremum =
currentScale.GetCenterPixel() < currentScale.GetPixel(*lIterOffset) &&
currentScale.GetPixel(
offset5
) < previousScale.GetPixel(*lIterOffset) &&
currentScale.GetPixel(
offset5
) < nextScale.GetPixel(*lIterOffset);
currentScale.Get
Center
Pixel() < previousScale.GetPixel(*lIterOffset) &&
currentScale.Get
Center
Pixel() < nextScale.GetPixel(*lIterOffset);
}
else if (isMax)
{
isExtremum =
currentScale.GetCenterPixel() > currentScale.GetPixel(*lIterOffset) &&
currentScale.GetPixel(
offset5
) > previousScale.GetPixel(*lIterOffset) &&
currentScale.GetPixel(
offset5
) > nextScale.GetPixel(*lIterOffset);
currentScale.Get
Center
Pixel() > previousScale.GetPixel(*lIterOffset) &&
currentScale.Get
Center
Pixel() > nextScale.GetPixel(*lIterOffset);
}
else
{
...
...
@@ -246,14 +258,14 @@ namespace otb
if (isExtremum && isMin)
{
isExtremum =
currentScale.GetPixel(
offset5
) < previousScale.GetPixel(
offset5
) &&
currentScale.GetPixel(
offset5
) < nextScale.GetPixel(
offset5
);
currentScale.Get
Center
Pixel() < previousScale.Get
Center
Pixel() &&
currentScale.Get
Center
Pixel() < nextScale.Get
Center
Pixel();
}
else if (isExtremum && isMax)
{
isExtremum =
currentScale.GetPixel(
offset5
) > previousScale.GetPixel(
offset5
) &&
currentScale.GetPixel(
offset5
) > nextScale.GetPixel(
offset5
);
currentScale.Get
Center
Pixel() > previousScale.Get
Center
Pixel() &&
currentScale.Get
Center
Pixel() > nextScale.Get
Center
Pixel();
}
return isExtremum;
}
...
...
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