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
dfe4af9e
Commit
dfe4af9e
authored
Nov 26, 2010
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed warnings under win32
parent
337f1dd2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
32 deletions
+32
-32
calonder.cpp
modules/features2d/src/calonder.cpp
+1
-1
bagofwords_classification.cpp
samples/cpp/bagofwords_classification.cpp
+10
-12
brief_match_test.cpp
samples/cpp/brief_match_test.cpp
+1
-1
adetectordescriptor_evaluation.cpp
tests/cv/src/adetectordescriptor_evaluation.cpp
+11
-10
afeatures2d.cpp
tests/cv/src/afeatures2d.cpp
+8
-7
tabruteforcematcher.cpp
tests/cv/src/tabruteforcematcher.cpp
+1
-1
No files found.
modules/features2d/src/calonder.cpp
View file @
dfe4af9e
...
...
@@ -961,7 +961,7 @@ float RTreeClassifier::countZeroElements()
float
*
p
=
trees_
[
i
].
getPosteriorByIndex
(
k
);
uchar
*
p2
=
trees_
[
i
].
getPosteriorByIndex2
(
k
);
assert
(
p
);
assert
(
p2
);
for
(
int
j
=
0
;
j
<
num_elem
;
++
j
,
++
p
,
++
p2
)
{
for
(
int
j
=
0
;
j
<
(
int
)
num_elem
;
++
j
,
++
p
,
++
p2
)
{
if
(
*
p
==
0.
f
)
flt_zeros
++
;
if
(
*
p2
==
0
)
ui8_zeros
++
;
}
...
...
samples/cpp/bagofwords_classification.cpp
View file @
dfe4af9e
...
...
@@ -861,7 +861,7 @@ void VocData::calcPrecRecall_impl(const vector<char>& ground_truth, const vector
recall
[
0
]
=
0
;
for
(
size_t
idx
=
0
;
idx
<
ground_truth
.
size
();
++
idx
)
{
if
(
ground_truth
[
ranking
[
idx
]]
==
true
)
++
retrieved_hits
;
if
(
ground_truth
[
ranking
[
idx
]]
!=
0
)
++
retrieved_hits
;
precision
[
idx
+
1
]
=
static_cast
<
float
>
(
retrieved_hits
)
/
static_cast
<
float
>
(
idx
+
1
);
recall
[
idx
+
1
]
=
static_cast
<
float
>
(
retrieved_hits
)
/
static_cast
<
float
>
(
recall_norm
);
...
...
@@ -897,12 +897,12 @@ void VocData::calcPrecRecall_impl(const vector<char>& ground_truth, const vector
for
(
size_t
idx
=
0
;
idx
<
(
recall
.
size
()
-
1
);
++
idx
)
{
ap
+=
(
recall
[
idx
+
1
]
-
recall
[
idx
])
*
precision_monot
[
idx
+
1
]
+
//no need to take min of prec - is monotonically decreasing
0.5
*
(
recall
[
idx
+
1
]
-
recall
[
idx
])
*
std
::
abs
(
precision_monot
[
idx
+
1
]
-
precision_monot
[
idx
]);
0.5
f
*
(
recall
[
idx
+
1
]
-
recall
[
idx
])
*
std
::
abs
(
precision_monot
[
idx
+
1
]
-
precision_monot
[
idx
]);
}
}
else
{
// FOR BEFORE VOC2010 AP IS CALCULATED BY SAMPLING PRECISION AT RECALL 0.0,0.1,..,1.0
for
(
float
recall_pos
=
0.
0
;
recall_pos
<=
1.0
;
recall_pos
+=
0.1
)
for
(
float
recall_pos
=
0.
f
;
recall_pos
<=
1.
f
;
recall_pos
+=
0.1
f
)
{
//find iterator of the precision corresponding to the first recall >= recall_pos
vector
<
float
>::
iterator
recall_it
=
recall
.
begin
();
...
...
@@ -1037,7 +1037,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector<Obd
/* convert iterator to index */
int
class_idx
=
std
::
distance
(
output_headers
.
begin
(),
class_idx_it
);
//add to confusion matrix row in proportion
output_values
[
class_idx
]
+=
1.
0
/
static_cast
<
float
>
(
img_objects
.
size
());
output_values
[
class_idx
]
+=
1.
f
/
static_cast
<
float
>
(
img_objects
.
size
());
}
}
//check break conditions if breaking on certain level of recall
...
...
@@ -1154,16 +1154,16 @@ void VocData::calcDetectorConfMatRow(const string& obj_class, const ObdDatasetTy
//find the ground truth object which has the highest overlap score with the detected object
float
maxov
=
-
1.0
;
size_
t
max_gt_obj_idx
=
-
1
;
in
t
max_gt_obj_idx
=
-
1
;
//-- for each detected object iterate through objects present in ground truth --
for
(
size_t
gt_obj_idx
=
0
;
gt_obj_idx
<
img_objects
.
size
();
++
gt_obj_idx
)
{
//check difficulty flag
if
(
ignore_difficult
||
(
img_object_data
[
gt_obj_idx
].
difficult
=
false
))
if
(
ignore_difficult
||
(
img_object_data
[
gt_obj_idx
].
difficult
=
=
false
))
{
//if the class matches, then check if the detected object and ground truth object overlap by a sufficient margin
in
t
ov
=
testBoundingBoxesForOverlap
(
bounding_boxes_flat
[
ranking
[
image_idx
]],
img_objects
[
gt_obj_idx
].
boundingBox
);
if
(
ov
!=
-
1.
0
)
floa
t
ov
=
testBoundingBoxesForOverlap
(
bounding_boxes_flat
[
ranking
[
image_idx
]],
img_objects
[
gt_obj_idx
].
boundingBox
);
if
(
ov
!=
-
1.
f
)
{
//if all conditions are met store the overlap score and index (as objects are assigned to the highest scoring match)
if
(
ov
>
maxov
)
...
...
@@ -1773,7 +1773,7 @@ bool VocData::getClassifierGroundTruthImage(const string& obj_class, const strin
if
(
it
!=
m_classifier_gt_all_ids
.
end
())
{
//image found, so return corresponding ground truth
return
m_classifier_gt_all_present
[
std
::
distance
(
m_classifier_gt_all_ids
.
begin
(),
it
)];
return
m_classifier_gt_all_present
[
std
::
distance
(
m_classifier_gt_all_ids
.
begin
(),
it
)]
!=
0
;
}
else
{
string
err_msg
=
"could not find classifier ground truth for image '"
+
id
+
"' and class '"
+
obj_class
+
"'"
;
CV_Error
(
CV_StsError
,
err_msg
.
c_str
());
...
...
@@ -2015,9 +2015,7 @@ struct VocabTrainParams
struct
SVMTrainParamsExt
{
SVMTrainParamsExt
()
:
descPercent
(
0.5
f
),
targetRatio
(
0.4
f
),
balanceClasses
(
true
)
{}
SVMTrainParamsExt
(
float
_descPercent
,
float
_targetRatio
,
bool
_balanceClasses
,
int
_svmType
,
int
_kernelType
,
double
_degree
,
double
_gamma
,
double
_coef0
,
double
_C
,
double
_nu
,
double
_p
,
Mat
&
_class_weights
,
TermCriteria
_termCrit
)
:
SVMTrainParamsExt
(
float
_descPercent
,
float
_targetRatio
,
bool
_balanceClasses
)
:
descPercent
(
_descPercent
),
targetRatio
(
_targetRatio
),
balanceClasses
(
_balanceClasses
)
{}
void
read
(
const
FileNode
&
fn
)
{
...
...
samples/cpp/brief_match_test.cpp
View file @
dfe4af9e
...
...
@@ -45,7 +45,7 @@ float match(const vector<KeyPoint>& kpts_train, const vector<KeyPoint>& kpts_que
const
Mat
&
train
,
const
Mat
&
query
,
vector
<
DMatch
>&
matches
)
{
float
t
=
(
double
)
getTickCount
();
double
t
=
(
double
)
getTickCount
();
matcher
.
match
(
query
,
train
,
matches
);
//Using features2d
return
((
double
)
getTickCount
()
-
t
)
/
getTickFrequency
();
}
...
...
tests/cv/src/adetectordescriptor_evaluation.cpp
View file @
dfe4af9e
...
...
@@ -58,7 +58,8 @@ static inline Point2f applyHomography( const Mat_<double>& H, const Point2f& pt
if
(
z
)
{
double
w
=
1.
/
z
;
return
Point2f
(
(
H
(
0
,
0
)
*
pt
.
x
+
H
(
0
,
1
)
*
pt
.
y
+
H
(
0
,
2
))
*
w
,
(
H
(
1
,
0
)
*
pt
.
x
+
H
(
1
,
1
)
*
pt
.
y
+
H
(
1
,
2
))
*
w
);
return
Point2f
(
(
float
)((
H
(
0
,
0
)
*
pt
.
x
+
H
(
0
,
1
)
*
pt
.
y
+
H
(
0
,
2
))
*
w
),
(
float
)((
H
(
1
,
0
)
*
pt
.
x
+
H
(
1
,
1
)
*
pt
.
y
+
H
(
1
,
2
))
*
w
)
);
}
return
Point2f
(
numeric_limits
<
float
>::
max
(),
numeric_limits
<
float
>::
max
()
);
}
...
...
@@ -103,13 +104,13 @@ static void calcKeyPointProjections( const vector<KeyPoint>& src, const Mat_<dou
Mat_
<
double
>
dstM
;
invert
(
Aff
*
invM
*
Aff
.
t
(),
dstM
);
Mat_
<
double
>
eval
;
eigen
(
dstM
,
eval
);
assert
(
eval
(
0
,
0
)
&&
eval
(
1
,
0
)
);
float
dstSize
=
pow
(
1.
/
(
eval
(
0
,
0
)
*
eval
(
1
,
0
)),
0.25
);
float
dstSize
=
(
float
)
pow
(
1.
/
(
eval
(
0
,
0
)
*
eval
(
1
,
0
)),
0.25
);
// TODO: check angle projection
float
srcAngleRad
=
srcIt
->
angle
*
CV_PI
/
180
;
float
srcAngleRad
=
(
float
)(
srcIt
->
angle
*
CV_PI
/
180
)
;
Point2f
vec1
(
cos
(
srcAngleRad
),
sin
(
srcAngleRad
)),
vec2
;
vec2
.
x
=
Aff
(
0
,
0
)
*
vec1
.
x
+
Aff
(
0
,
1
)
*
vec1
.
y
;
vec2
.
y
=
Aff
(
1
,
0
)
*
vec1
.
x
+
Aff
(
0
,
1
)
*
vec1
.
y
;
vec2
.
x
=
(
float
)(
Aff
(
0
,
0
)
*
vec1
.
x
+
Aff
(
0
,
1
)
*
vec1
.
y
)
;
vec2
.
y
=
(
float
)(
Aff
(
1
,
0
)
*
vec1
.
x
+
Aff
(
0
,
1
)
*
vec1
.
y
)
;
float
dstAngleGrad
=
fastAtan2
(
vec2
.
y
,
vec2
.
x
);
*
dstIt
=
KeyPoint
(
dstPt
,
dstSize
,
dstAngleGrad
,
srcIt
->
response
,
srcIt
->
octave
,
srcIt
->
class_id
);
...
...
@@ -184,8 +185,8 @@ protected:
virtual
void
writeDatasetRunParams
(
FileStorage
&
fs
,
int
datasetIdx
)
const
=
0
;
void
setDefaultAllDatasetsRunParams
();
virtual
void
setDefaultDatasetRunParams
(
int
datasetIdx
)
=
0
;
virtual
void
readDefaultRunParams
(
FileNode
&
fn
)
{};
virtual
void
writeDefaultRunParams
(
FileStorage
&
fs
)
const
{};
virtual
void
readDefaultRunParams
(
FileNode
&
/*fn*/
)
{}
virtual
void
writeDefaultRunParams
(
FileStorage
&
/*fs*/
)
const
{}
virtual
void
readResults
();
virtual
void
readResults
(
FileNode
&
fn
,
int
datasetIdx
,
int
caseIdx
)
=
0
;
...
...
@@ -196,13 +197,13 @@ protected:
virtual
void
readAlgorithm
(
)
{};
virtual
void
processRunParamsFile
()
{};
virtual
void
runDatasetTest
(
const
vector
<
Mat
>
&
imgs
,
const
vector
<
Mat
>
&
Hs
,
int
di
,
int
&
progress
)
{};
virtual
void
runDatasetTest
(
const
vector
<
Mat
>
&
/*imgs*/
,
const
vector
<
Mat
>&
/*Hs*/
,
int
/*di*/
,
int
&
/*progress*/
)
{}
void
run
(
int
);
virtual
void
processResults
(
int
datasetIdx
);
virtual
int
processResults
(
int
datasetIdx
,
int
caseIdx
)
=
0
;
virtual
void
processResults
();
virtual
void
writePlotData
(
int
datasetIdx
)
const
{};
virtual
void
writePlotData
(
int
/*datasetIdx*/
)
const
{}
virtual
void
writeAveragePlotData
()
const
{};
string
algName
;
...
...
@@ -915,7 +916,7 @@ void DescriptorQualityTest::writeDefaultRunParams (FileStorage &fs) const
void
DescriptorQualityTest
::
readDatasetRunParams
(
FileNode
&
fn
,
int
datasetIdx
)
{
commRunParams
[
datasetIdx
].
isActiveParams
=
(
int
)
fn
[
IS_ACTIVE_PARAMS
];
commRunParams
[
datasetIdx
].
isActiveParams
=
(
int
)
fn
[
IS_ACTIVE_PARAMS
]
!=
0
;
if
(
commRunParams
[
datasetIdx
].
isActiveParams
)
{
commRunParams
[
datasetIdx
].
keypontsFilename
=
(
string
)
fn
[
KEYPOINTS_FILENAME
];
...
...
tests/cv/src/afeatures2d.cpp
View file @
dfe4af9e
...
...
@@ -296,6 +296,7 @@ public:
maxDistDif
(
_maxDistDif
),
prevTime
(
_prevTime
),
dextractor
(
_dextractor
),
distance
(
d
)
{}
protected
:
virtual
void
createDescriptorExtractor
()
{}
CV_DescriptorExtractorTest
&
operator
=
(
const
CV_DescriptorExtractorTest
&
)
{}
void
compareDescriptors
(
const
Mat
&
validDescriptors
,
const
Mat
&
calcDescriptors
)
{
...
...
@@ -508,14 +509,14 @@ class CV_DescriptorMatcherTest : public CvTest
public
:
CV_DescriptorMatcherTest
(
const
char
*
testName
,
const
Ptr
<
DescriptorMatcher
>&
_dmatcher
,
float
_badPart
)
:
CvTest
(
testName
,
"cv::DescritorMatcher::[,knn,radius]match()"
),
badPart
(
_badPart
),
dmatcher
(
_dmatcher
)
{
CV_Assert
(
queryDescCount
%
2
==
0
);
// because we split train data in same cases in two
CV_Assert
(
countFactor
==
4
);
}
{}
protected
:
static
const
int
dim
=
500
;
static
const
int
queryDescCount
=
300
;
static
const
int
countFactor
=
4
;
static
const
int
queryDescCount
=
300
;
// must be even number because we split train data in same cases in two
static
const
int
countFactor
=
4
;
// do not change it
const
float
badPart
;
CV_DescriptorMatcherTest
&
operator
=
(
const
CV_DescriptorMatcherTest
&
)
{}
virtual
void
run
(
int
);
void
generateData
(
Mat
&
query
,
Mat
&
train
);
...
...
@@ -788,7 +789,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
}
if
(
(
float
)
badCount
>
(
float
)
queryDescCount
*
badPart
)
{
ts
->
printf
(
CvTS
::
LOG
,
"%f - too large bad matches part while test radiusMatch() function (1)
\.
n"
,
ts
->
printf
(
CvTS
::
LOG
,
"%f - too large bad matches part while test radiusMatch() function (1)
.
\
n
"
,
(
float
)
badCount
/
(
float
)
queryDescCount
);
ts
->
set_failed_test_info
(
CvTS
::
FAIL_INVALID_OUTPUT
);
}
...
...
@@ -900,8 +901,8 @@ CV_DescriptorExtractorTest<L2<float> > siftDescriptorTest( "descriptor-sift", 0.
DescriptorExtractor
::
create
(
"SIFT"
),
8.06652
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
surfDescriptorTest
(
"descriptor-surf"
,
0.035
f
,
DescriptorExtractor
::
create
(
"SURF"
),
0.147372
f
);
CV_DescriptorExtractorTest
<
Hamming
>
briefDescriptorTest
(
"descriptor-brief"
,
std
::
numeric_limits
<
float
>::
epsilon
()
+
1
,
DescriptorExtractor
::
create
(
"BRIEF"
),
0.00527548
);
CV_DescriptorExtractorTest
<
Hamming
>
briefDescriptorTest
(
"descriptor-brief"
,
1
,
DescriptorExtractor
::
create
(
"BRIEF"
),
0.00527548
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
oppSiftDescriptorTest
(
"descriptor-opponent-sift"
,
0.008
f
,
DescriptorExtractor
::
create
(
"OpponentSIFT"
),
8.06652
f
);
...
...
tests/cv/src/tabruteforcematcher.cpp
View file @
dfe4af9e
...
...
@@ -68,7 +68,7 @@ void BruteForceMatcherTest::run( int )
ts
->
set_failed_test_info
(
CvTS
::
FAIL_INVALID_OUTPUT
);
for
(
int
i
=
0
;
i
<
descriptorsNumber
;
i
++
)
{
float
epsilon
=
1e-2
;
float
epsilon
=
0.01
f
;
bool
isEquiv
=
fabs
(
specMatches
[
i
].
distance
-
genericMatches
[
i
].
distance
)
<
epsilon
&&
specMatches
[
i
].
queryIdx
==
genericMatches
[
i
].
queryIdx
&&
specMatches
[
i
].
trainIdx
==
genericMatches
[
i
].
trainIdx
;
...
...
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