Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
dfe4af9e
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dfe4af9e
编写于
11月 26, 2010
作者:
M
Maria Dimashova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed warnings under win32
上级
337f1dd2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
32 deletion
+32
-32
modules/features2d/src/calonder.cpp
modules/features2d/src/calonder.cpp
+1
-1
samples/cpp/bagofwords_classification.cpp
samples/cpp/bagofwords_classification.cpp
+10
-12
samples/cpp/brief_match_test.cpp
samples/cpp/brief_match_test.cpp
+1
-1
tests/cv/src/adetectordescriptor_evaluation.cpp
tests/cv/src/adetectordescriptor_evaluation.cpp
+11
-10
tests/cv/src/afeatures2d.cpp
tests/cv/src/afeatures2d.cpp
+8
-7
tests/cv/src/tabruteforcematcher.cpp
tests/cv/src/tabruteforcematcher.cpp
+1
-1
未找到文件。
modules/features2d/src/calonder.cpp
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录