Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
f6fc39ce
Commit
f6fc39ce
authored
Sep 25, 2013
by
Juan Manuel Perez
Committed by
Vadim Pisarevsky
Sep 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Putting definitions of SCD and SCDMatcher separated from sc_dis.cpp file
parent
4672a70c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
0 deletions
+128
-0
sc_dis.cpp
modules/shape/src/sc_dis.cpp
+0
-0
scd_def.hpp
modules/shape/src/scd_def.hpp
+128
-0
No files found.
modules/shape/src/sc_dis.cpp
View file @
f6fc39ce
This diff is collapsed.
Click to expand it.
modules/shape/src/scd_def.hpp
0 → 100644
View file @
f6fc39ce
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include <stdlib.h>
#include <math.h>
#include <vector>
/*
* ShapeContextDescriptor class
*/
class
SCD
{
public
:
//! the full constructor taking all the necessary parameters
explicit
SCD
(
int
_nAngularBins
=
12
,
int
_nRadialBins
=
5
,
double
_innerRadius
=
0.1
,
double
_outerRadius
=
1
,
bool
_rotationInvariant
=
false
)
{
setAngularBins
(
_nAngularBins
);
setRadialBins
(
_nRadialBins
);
setInnerRadius
(
_innerRadius
);
setOuterRadius
(
_outerRadius
);
setRotationInvariant
(
_rotationInvariant
);
}
void
extractSCD
(
cv
::
Mat
&
contour
,
cv
::
Mat
&
descriptors
,
const
std
::
vector
<
int
>&
queryInliers
=
std
::
vector
<
int
>
(),
const
float
_meanDistance
=-
1
);
int
descriptorSize
()
{
return
nAngularBins
*
nRadialBins
;}
void
setAngularBins
(
int
angularBins
)
{
nAngularBins
=
angularBins
;
}
void
setRadialBins
(
int
radialBins
)
{
nRadialBins
=
radialBins
;
}
void
setInnerRadius
(
double
_innerRadius
)
{
innerRadius
=
_innerRadius
;
}
void
setOuterRadius
(
double
_outerRadius
)
{
outerRadius
=
_outerRadius
;
}
void
setRotationInvariant
(
bool
_rotationInvariant
)
{
rotationInvariant
=
_rotationInvariant
;
}
int
getAngularBins
()
const
{
return
nAngularBins
;
}
int
getRadialBins
()
const
{
return
nRadialBins
;
}
double
getInnerRadius
()
const
{
return
innerRadius
;
}
double
getOuterRadius
()
const
{
return
outerRadius
;
}
bool
getRotationInvariant
()
const
{
return
rotationInvariant
;
}
float
getMeanDistance
()
const
{
return
meanDistance
;
}
private
:
int
nAngularBins
;
int
nRadialBins
;
double
innerRadius
;
double
outerRadius
;
bool
rotationInvariant
;
float
meanDistance
;
protected
:
void
logarithmicSpaces
(
std
::
vector
<
double
>&
vecSpaces
)
const
;
void
angularSpaces
(
std
::
vector
<
double
>&
vecSpaces
)
const
;
void
buildNormalizedDistanceMatrix
(
cv
::
Mat
&
contour
,
cv
::
Mat
&
disMatrix
,
const
std
::
vector
<
int
>
&
queryInliers
,
const
float
_meanDistance
=-
1
);
void
buildAngleMatrix
(
cv
::
Mat
&
contour
,
cv
::
Mat
&
angleMatrix
)
const
;
};
/*
* Matcher
*/
class
SCDMatcher
{
public
:
// the full constructor
SCDMatcher
()
{
}
// the matcher function using Hungarian method
void
matchDescriptors
(
cv
::
Mat
&
descriptors1
,
cv
::
Mat
&
descriptors2
,
std
::
vector
<
cv
::
DMatch
>&
matches
,
cv
::
Ptr
<
cv
::
HistogramCostExtractor
>&
comparer
,
std
::
vector
<
int
>&
inliers1
,
std
::
vector
<
int
>
&
inliers2
);
// matching cost
float
getMatchingCost
()
const
{
return
minMatchCost
;}
private
:
float
minMatchCost
;
float
betaAdditional
;
protected
:
void
buildCostMatrix
(
const
cv
::
Mat
&
descriptors1
,
const
cv
::
Mat
&
descriptors2
,
cv
::
Mat
&
costMatrix
,
cv
::
Ptr
<
cv
::
HistogramCostExtractor
>&
comparer
)
const
;
void
hungarian
(
cv
::
Mat
&
costMatrix
,
std
::
vector
<
cv
::
DMatch
>&
outMatches
,
std
::
vector
<
int
>
&
inliers1
,
std
::
vector
<
int
>
&
inliers2
,
int
sizeScd1
=
0
,
int
sizeScd2
=
0
);
};
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