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
e94e5866
Commit
e94e5866
authored
Jun 20, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed mingw build warnings
parent
988c405f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
173 additions
and
137 deletions
+173
-137
features.cpp
apps/traincascade/features.cpp
+1
-1
hybridtracker.hpp
modules/contrib/include/opencv2/contrib/hybridtracker.hpp
+98
-98
any.h
modules/flann/include/opencv2/flann/any.h
+11
-0
flann.cpp
modules/flann/src/flann.cpp
+3
-2
precomp.hpp
modules/flann/src/precomp.hpp
+0
-4
grfmt_jpeg.cpp
modules/highgui/src/grfmt_jpeg.cpp
+3
-2
test_mltests2.cpp
modules/ml/test/test_mltests2.cpp
+19
-20
cv2.cpp
modules/python/src2/cv2.cpp
+36
-3
perf_stich.cpp
modules/stitching/perf/perf_stich.cpp
+0
-5
cascadeclassifier_nvidia_api.cpp
samples/gpu/cascadeclassifier_nvidia_api.cpp
+1
-1
opticalflow_nvidia_api.cpp
samples/gpu/opticalflow_nvidia_api.cpp
+1
-1
No files found.
apps/traincascade/features.cpp
View file @
e94e5866
...
...
@@ -24,7 +24,7 @@ CvParams::CvParams() : name( "params" ) {}
void
CvParams
::
printDefaults
()
const
{
cout
<<
"--"
<<
name
<<
"--"
<<
endl
;
}
void
CvParams
::
printAttrs
()
const
{}
bool
CvParams
::
scanAttr
(
const
String
prmName
,
const
String
val
)
{
return
false
;
}
bool
CvParams
::
scanAttr
(
const
String
,
const
String
)
{
return
false
;
}
//---------------------------- FeatureParams --------------------------------------
...
...
modules/contrib/include/opencv2/contrib/hybridtracker.hpp
View file @
e94e5866
...
...
@@ -59,151 +59,151 @@ namespace cv
// To add Kalman filter
struct
CV_EXPORTS
CvMotionModel
{
enum
{
LOW_PASS_FILTER
=
0
,
KALMAN_FILTER
=
1
,
EM
=
2
};
enum
{
LOW_PASS_FILTER
=
0
,
KALMAN_FILTER
=
1
,
EM
=
2
};
CvMotionModel
()
{
}
CvMotionModel
()
{
}
float
low_pass_gain
;
// low pass gain
float
low_pass_gain
;
// low pass gain
};
// Mean Shift Tracker parameters for specifying use of HSV channel and CamShift parameters.
struct
CV_EXPORTS
CvMeanShiftTrackerParams
{
enum
{
H
=
0
,
HS
=
1
,
HSV
=
2
};
CvMeanShiftTrackerParams
(
int
tracking_type
=
CvMeanShiftTrackerParams
::
HS
,
CvTermCriteria
term_crit
=
CvTermCriteria
());
int
tracking_type
;
vector
<
float
>
h_range
;
vector
<
float
>
s_range
;
vector
<
float
>
v_range
;
CvTermCriteria
term_crit
;
enum
{
H
=
0
,
HS
=
1
,
HSV
=
2
};
CvMeanShiftTrackerParams
(
int
tracking_type
=
CvMeanShiftTrackerParams
::
HS
,
CvTermCriteria
term_crit
=
CvTermCriteria
());
int
tracking_type
;
vector
<
float
>
h_range
;
vector
<
float
>
s_range
;
vector
<
float
>
v_range
;
CvTermCriteria
term_crit
;
};
// Feature tracking parameters
struct
CV_EXPORTS
CvFeatureTrackerParams
{
enum
{
SIFT
=
0
,
SURF
=
1
,
OPTICAL_FLOW
=
2
};
CvFeatureTrackerParams
(
int
featureType
=
0
,
int
windowSize
=
0
)
{
featureType
=
0
;
windowSize
=
0
;
}
int
feature_type
;
// Feature type to use
int
window_size
;
// Window size in pixels around which to search for new window
enum
{
SIFT
=
0
,
SURF
=
1
,
OPTICAL_FLOW
=
2
};
CvFeatureTrackerParams
(
int
featureType
=
0
,
int
windowSize
=
0
)
{
feature_type
=
featureType
;
window_size
=
windowSize
;
}
int
feature_type
;
// Feature type to use
int
window_size
;
// Window size in pixels around which to search for new window
};
// Hybrid Tracking parameters for specifying weights of individual trackers and motion model.
struct
CV_EXPORTS
CvHybridTrackerParams
{
CvHybridTrackerParams
(
float
ft_tracker_weight
=
0.5
,
float
ms_tracker_weight
=
0.5
,
CvFeatureTrackerParams
ft_params
=
CvFeatureTrackerParams
(),
CvMeanShiftTrackerParams
ms_params
=
CvMeanShiftTrackerParams
(),
CvMotionModel
model
=
CvMotionModel
());
float
ft_tracker_weight
;
float
ms_tracker_weight
;
CvFeatureTrackerParams
ft_params
;
CvMeanShiftTrackerParams
ms_params
;
int
motion_model
;
float
low_pass_gain
;
CvHybridTrackerParams
(
float
ft_tracker_weight
=
0.5
,
float
ms_tracker_weight
=
0.5
,
CvFeatureTrackerParams
ft_params
=
CvFeatureTrackerParams
(),
CvMeanShiftTrackerParams
ms_params
=
CvMeanShiftTrackerParams
(),
CvMotionModel
model
=
CvMotionModel
());
float
ft_tracker_weight
;
float
ms_tracker_weight
;
CvFeatureTrackerParams
ft_params
;
CvMeanShiftTrackerParams
ms_params
;
int
motion_model
;
float
low_pass_gain
;
};
// Performs Camshift using parameters from MeanShiftTrackerParams
class
CV_EXPORTS
CvMeanShiftTracker
{
private
:
Mat
hsv
,
hue
;
Mat
backproj
;
Mat
mask
,
maskroi
;
MatND
hist
;
Rect
prev_trackwindow
;
RotatedRect
prev_trackbox
;
Point2f
prev_center
;
Mat
hsv
,
hue
;
Mat
backproj
;
Mat
mask
,
maskroi
;
MatND
hist
;
Rect
prev_trackwindow
;
RotatedRect
prev_trackbox
;
Point2f
prev_center
;
public
:
CvMeanShiftTrackerParams
params
;
CvMeanShiftTracker
();
explicit
CvMeanShiftTracker
(
CvMeanShiftTrackerParams
_params
);
~
CvMeanShiftTracker
();
void
newTrackingWindow
(
Mat
image
,
Rect
selection
);
RotatedRect
updateTrackingWindow
(
Mat
image
);
Mat
getHistogramProjection
(
int
type
);
void
setTrackingWindow
(
Rect
_window
);
Rect
getTrackingWindow
();
RotatedRect
getTrackingEllipse
();
Point2f
getTrackingCenter
();
CvMeanShiftTrackerParams
params
;
CvMeanShiftTracker
();
explicit
CvMeanShiftTracker
(
CvMeanShiftTrackerParams
_params
);
~
CvMeanShiftTracker
();
void
newTrackingWindow
(
Mat
image
,
Rect
selection
);
RotatedRect
updateTrackingWindow
(
Mat
image
);
Mat
getHistogramProjection
(
int
type
);
void
setTrackingWindow
(
Rect
_window
);
Rect
getTrackingWindow
();
RotatedRect
getTrackingEllipse
();
Point2f
getTrackingCenter
();
};
// Performs SIFT/SURF feature tracking using parameters from FeatureTrackerParams
class
CV_EXPORTS
CvFeatureTracker
{
private
:
Ptr
<
Feature2D
>
dd
;
Ptr
<
DescriptorMatcher
>
matcher
;
vector
<
DMatch
>
matches
;
Ptr
<
Feature2D
>
dd
;
Ptr
<
DescriptorMatcher
>
matcher
;
vector
<
DMatch
>
matches
;
Mat
prev_image
;
Mat
prev_image_bw
;
Rect
prev_trackwindow
;
Point2d
prev_center
;
Mat
prev_image
;
Mat
prev_image_bw
;
Rect
prev_trackwindow
;
Point2d
prev_center
;
int
ittr
;
vector
<
Point2f
>
features
[
2
];
int
ittr
;
vector
<
Point2f
>
features
[
2
];
public
:
Mat
disp_matches
;
CvFeatureTrackerParams
params
;
CvFeatureTracker
();
explicit
CvFeatureTracker
(
CvFeatureTrackerParams
params
);
~
CvFeatureTracker
();
void
newTrackingWindow
(
Mat
image
,
Rect
selection
);
Rect
updateTrackingWindow
(
Mat
image
);
Rect
updateTrackingWindowWithSIFT
(
Mat
image
);
Rect
updateTrackingWindowWithFlow
(
Mat
image
);
void
setTrackingWindow
(
Rect
_window
);
Rect
getTrackingWindow
();
Point2f
getTrackingCenter
();
Mat
disp_matches
;
CvFeatureTrackerParams
params
;
CvFeatureTracker
();
explicit
CvFeatureTracker
(
CvFeatureTrackerParams
params
);
~
CvFeatureTracker
();
void
newTrackingWindow
(
Mat
image
,
Rect
selection
);
Rect
updateTrackingWindow
(
Mat
image
);
Rect
updateTrackingWindowWithSIFT
(
Mat
image
);
Rect
updateTrackingWindowWithFlow
(
Mat
image
);
void
setTrackingWindow
(
Rect
_window
);
Rect
getTrackingWindow
();
Point2f
getTrackingCenter
();
};
// Performs Hybrid Tracking and combines individual trackers using EM or filters
class
CV_EXPORTS
CvHybridTracker
{
private
:
CvMeanShiftTracker
*
mstracker
;
CvFeatureTracker
*
fttracker
;
CvMeanShiftTracker
*
mstracker
;
CvFeatureTracker
*
fttracker
;
CvMat
*
samples
;
CvMat
*
labels
;
CvMat
*
samples
;
CvMat
*
labels
;
Rect
prev_window
;
Point2f
prev_center
;
Mat
prev_proj
;
RotatedRect
trackbox
;
Rect
prev_window
;
Point2f
prev_center
;
Mat
prev_proj
;
RotatedRect
trackbox
;
int
ittr
;
Point2f
curr_center
;
int
ittr
;
Point2f
curr_center
;
inline
float
getL2Norm
(
Point2f
p1
,
Point2f
p2
);
Mat
getDistanceProjection
(
Mat
image
,
Point2f
center
);
Mat
getGaussianProjection
(
Mat
image
,
int
ksize
,
double
sigma
,
Point2f
center
);
void
updateTrackerWithEM
(
Mat
image
);
void
updateTrackerWithLowPassFilter
(
Mat
image
);
inline
float
getL2Norm
(
Point2f
p1
,
Point2f
p2
);
Mat
getDistanceProjection
(
Mat
image
,
Point2f
center
);
Mat
getGaussianProjection
(
Mat
image
,
int
ksize
,
double
sigma
,
Point2f
center
);
void
updateTrackerWithEM
(
Mat
image
);
void
updateTrackerWithLowPassFilter
(
Mat
image
);
public
:
CvHybridTrackerParams
params
;
CvHybridTracker
();
explicit
CvHybridTracker
(
CvHybridTrackerParams
params
);
~
CvHybridTracker
();
void
newTracker
(
Mat
image
,
Rect
selection
);
void
updateTracker
(
Mat
image
);
Rect
getTrackingWindow
();
CvHybridTrackerParams
params
;
CvHybridTracker
();
explicit
CvHybridTracker
(
CvHybridTrackerParams
params
);
~
CvHybridTracker
();
void
newTracker
(
Mat
image
,
Rect
selection
);
void
updateTracker
(
Mat
image
);
Rect
getTrackingWindow
();
};
typedef
CvMotionModel
MotionModel
;
...
...
modules/flann/include/opencv2/flann/any.h
View file @
e94e5866
...
...
@@ -12,6 +12,7 @@
* Adapted for FLANN by Marius Muja
*/
#include "defines.h"
#include <stdexcept>
#include <ostream>
#include <typeinfo>
...
...
@@ -95,6 +96,16 @@ struct big_any_policy : typed_base_any_policy<T>
virtual
void
print
(
std
::
ostream
&
out
,
void
*
const
*
src
)
{
out
<<
*
reinterpret_cast
<
T
const
*>
(
*
src
);
}
};
template
<>
inline
void
big_any_policy
<
flann_centers_init_t
>::
print
(
std
::
ostream
&
out
,
void
*
const
*
src
)
{
out
<<
int
(
*
reinterpret_cast
<
flann_centers_init_t
const
*>
(
*
src
));
}
template
<>
inline
void
big_any_policy
<
flann_algorithm_t
>::
print
(
std
::
ostream
&
out
,
void
*
const
*
src
)
{
out
<<
int
(
*
reinterpret_cast
<
flann_algorithm_t
const
*>
(
*
src
));
}
template
<
typename
T
>
struct
choose_policy
{
...
...
modules/flann/src/flann.cpp
View file @
e94e5866
...
...
@@ -36,7 +36,7 @@ namespace cvflann
*/
flann_distance_t
flann_distance_type_
=
FLANN_DIST_L2
;
flann_distance_t
flann_distance_type
()
{
return
flann_distance_type_
;
}
/**
* Set distance type to used
* \deprecated
...
...
@@ -52,6 +52,6 @@ namespace cvflann
}
flann_distance_type_
=
distance_type
;
}
void
dummyfunc
()
{}
}
\ No newline at end of file
modules/flann/src/precomp.hpp
View file @
e94e5866
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#ifndef _OPENCV_FLANN_PRECOMP_HPP_
#define _OPENCV_FLANN_PRECOMP_HPP_
...
...
modules/highgui/src/grfmt_jpeg.cpp
View file @
e94e5866
...
...
@@ -542,8 +542,6 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
};
bool
result
=
false
;
fileWrapper
fw
;
int
_channels
=
img
.
channels
();
int
channels
=
_channels
>
1
?
3
:
1
;
int
width
=
img
.
cols
,
height
=
img
.
rows
;
vector
<
uchar
>
out_buf
(
1
<<
12
);
...
...
@@ -580,6 +578,9 @@ bool JpegEncoder::write( const Mat& img, const vector<int>& params )
{
cinfo
.
image_width
=
width
;
cinfo
.
image_height
=
height
;
int
_channels
=
img
.
channels
();
int
channels
=
_channels
>
1
?
3
:
1
;
cinfo
.
input_components
=
channels
;
cinfo
.
in_color_space
=
channels
>
1
?
JCS_RGB
:
JCS_GRAYSCALE
;
...
...
modules/ml/test/test_mltests2.cpp
View file @
e94e5866
...
...
@@ -52,7 +52,7 @@ void nbayes_check_data( CvMLData* _data )
CV_Error
(
CV_StsBadArg
,
"missing values are not supported"
);
const
CvMat
*
var_types
=
_data
->
get_var_types
();
bool
is_classifier
=
var_types
->
data
.
ptr
[
var_types
->
cols
-
1
]
==
CV_VAR_CATEGORICAL
;
if
(
(
fabs
(
cvNorm
(
var_types
,
0
,
CV_L1
)
-
if
(
(
fabs
(
cvNorm
(
var_types
,
0
,
CV_L1
)
-
(
var_types
->
rows
+
var_types
->
cols
-
2
)
*
CV_VAR_ORDERED
-
CV_VAR_CATEGORICAL
)
>
FLT_EPSILON
)
||
!
is_classifier
)
CV_Error
(
CV_StsBadArg
,
"incorrect types of predictors or responses"
);
...
...
@@ -89,7 +89,7 @@ float nbayes_calc_error( CvNormalBayesClassifier* nbayes, CvMLData* _data, int t
{
CvMat
sample
;
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
values
,
&
sample
,
si
);
cvGetRow
(
values
,
&
sample
,
si
);
float
r
=
(
float
)
nbayes
->
predict
(
&
sample
,
0
);
if
(
pred_resp
)
pred_resp
[
i
]
=
r
;
...
...
@@ -151,7 +151,7 @@ float knearest_calc_error( CvKNearest* knearest, CvMLData* _data, int k, int typ
{
CvMat
sample
;
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
&
predictors
,
&
sample
,
si
);
cvGetRow
(
&
predictors
,
&
sample
,
si
);
float
r
=
knearest
->
find_nearest
(
&
sample
,
k
);
if
(
pred_resp
)
pred_resp
[
i
]
=
r
;
...
...
@@ -166,14 +166,14 @@ float knearest_calc_error( CvKNearest* knearest, CvMLData* _data, int k, int typ
{
CvMat
sample
;
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
&
predictors
,
&
sample
,
si
);
cvGetRow
(
&
predictors
,
&
sample
,
si
);
float
r
=
knearest
->
find_nearest
(
&
sample
,
k
);
if
(
pred_resp
)
pred_resp
[
i
]
=
r
;
float
d
=
r
-
response
->
data
.
fl
[
si
*
r_step
];
err
+=
d
*
d
;
}
err
=
sample_count
?
err
/
(
float
)
sample_count
:
-
FLT_MAX
;
err
=
sample_count
?
err
/
(
float
)
sample_count
:
-
FLT_MAX
;
}
return
err
;
}
...
...
@@ -239,7 +239,7 @@ bool svm_train_auto( CvSVM* svm, CvMLData* _data, CvSVMParams _params,
const
CvMat
*
_responses
=
_data
->
get_responses
();
const
CvMat
*
_var_idx
=
_data
->
get_var_idx
();
const
CvMat
*
_sample_idx
=
_data
->
get_train_sample_idx
();
return
svm
->
train_auto
(
_train_data
,
_responses
,
_var_idx
,
return
svm
->
train_auto
(
_train_data
,
_responses
,
_var_idx
,
_sample_idx
,
_params
,
k_fold
,
C_grid
,
gamma_grid
,
p_grid
,
nu_grid
,
coef_grid
,
degree_grid
);
}
float
svm_calc_error
(
CvSVM
*
svm
,
CvMLData
*
_data
,
int
type
,
vector
<
float
>
*
resp
)
...
...
@@ -268,7 +268,7 @@ float svm_calc_error( CvSVM* svm, CvMLData* _data, int type, vector<float> *resp
{
CvMat
sample
;
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
values
,
&
sample
,
si
);
cvGetRow
(
values
,
&
sample
,
si
);
float
r
=
svm
->
predict
(
&
sample
);
if
(
pred_resp
)
pred_resp
[
i
]
=
r
;
...
...
@@ -290,7 +290,7 @@ float svm_calc_error( CvSVM* svm, CvMLData* _data, int type, vector<float> *resp
float
d
=
r
-
response
->
data
.
fl
[
si
*
r_step
];
err
+=
d
*
d
;
}
err
=
sample_count
?
err
/
(
float
)
sample_count
:
-
FLT_MAX
;
err
=
sample_count
?
err
/
(
float
)
sample_count
:
-
FLT_MAX
;
}
return
err
;
}
...
...
@@ -395,7 +395,7 @@ float ann_calc_error( CvANN_MLP* ann, CvMLData* _data, map<int, int>& cls_map, i
{
CvMat
sample
;
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
&
predictors
,
&
sample
,
si
);
cvGetRow
(
&
predictors
,
&
sample
,
si
);
ann
->
predict
(
&
sample
,
&
_output
);
CvPoint
best_cls
=
{
0
,
0
};
cvMinMaxLoc
(
&
_output
,
0
,
0
,
0
,
&
best_cls
,
0
);
...
...
@@ -417,7 +417,7 @@ int str_to_boost_type( string& str )
if
(
!
str
.
compare
(
"DISCRETE"
)
)
return
CvBoost
::
DISCRETE
;
if
(
!
str
.
compare
(
"REAL"
)
)
return
CvBoost
::
REAL
;
return
CvBoost
::
REAL
;
if
(
!
str
.
compare
(
"LOGIT"
)
)
return
CvBoost
::
LOGIT
;
if
(
!
str
.
compare
(
"GENTLE"
)
)
...
...
@@ -480,7 +480,7 @@ CV_MLBaseTest::~CV_MLBaseTest()
validationFS
.
release
();
if
(
nbayes
)
delete
nbayes
;
if
(
knearest
)
if
(
knearest
)
delete
knearest
;
if
(
svm
)
delete
svm
;
...
...
@@ -519,15 +519,14 @@ int CV_MLBaseTest::read_params( CvFileStorage* _fs )
return
cvtest
::
TS
::
OK
;;
}
void
CV_MLBaseTest
::
run
(
int
start_from
)
void
CV_MLBaseTest
::
run
(
int
)
{
string
filename
=
ts
->
get_data_path
();
filename
+=
get_validation_filename
();
validationFS
.
open
(
filename
,
FileStorage
::
READ
);
read_params
(
*
validationFS
);
int
code
=
cvtest
::
TS
::
OK
;
start_from
=
0
;
for
(
int
i
=
0
;
i
<
test_case_count
;
i
++
)
{
int
temp_code
=
run_test_case
(
i
);
...
...
@@ -594,7 +593,7 @@ string& CV_MLBaseTest::get_validation_filename()
int
CV_MLBaseTest
::
train
(
int
testCaseIdx
)
{
bool
is_trained
=
false
;
FileNode
modelParamsNode
=
FileNode
modelParamsNode
=
validationFS
.
getFirstTopLevelNode
()[
"validation"
][
modelName
][
dataSetNames
[
testCaseIdx
]][
"model_params"
];
if
(
!
modelName
.
compare
(
CV_NBAYES
)
)
...
...
@@ -651,7 +650,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
modelParamsNode
[
"max_categories"
]
>>
MAX_CATEGORIES
;
modelParamsNode
[
"cv_folds"
]
>>
CV_FOLDS
;
modelParamsNode
[
"is_pruned"
]
>>
IS_PRUNED
;
is_trained
=
dtree
->
train
(
&
data
,
is_trained
=
dtree
->
train
(
&
data
,
CvDTreeParams
(
MAX_DEPTH
,
MIN_SAMPLE_COUNT
,
REG_ACCURACY
,
USE_SURROGATE
,
MAX_CATEGORIES
,
CV_FOLDS
,
false
,
IS_PRUNED
,
0
))
!=
0
;
}
...
...
@@ -683,7 +682,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
modelParamsNode
[
"is_pruned"
]
>>
IS_PRUNED
;
modelParamsNode
[
"nactive_vars"
]
>>
NACTIVE_VARS
;
modelParamsNode
[
"max_trees_num"
]
>>
MAX_TREES_NUM
;
is_trained
=
rtrees
->
train
(
&
data
,
CvRTParams
(
MAX_DEPTH
,
MIN_SAMPLE_COUNT
,
REG_ACCURACY
,
is_trained
=
rtrees
->
train
(
&
data
,
CvRTParams
(
MAX_DEPTH
,
MIN_SAMPLE_COUNT
,
REG_ACCURACY
,
USE_SURROGATE
,
MAX_CATEGORIES
,
0
,
true
,
// (calc_var_importance == true) <=> RF processes variable importance
NACTIVE_VARS
,
MAX_TREES_NUM
,
OOB_EPS
,
CV_TERMCRIT_ITER
))
!=
0
;
}
...
...
@@ -713,7 +712,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
return
cvtest
::
TS
::
OK
;
}
float
CV_MLBaseTest
::
get_error
(
int
testCaseIdx
,
int
type
,
vector
<
float
>
*
resp
)
float
CV_MLBaseTest
::
get_error
(
int
/*testCaseIdx*/
,
int
type
,
vector
<
float
>
*
resp
)
{
float
err
=
0
;
if
(
!
modelName
.
compare
(
CV_NBAYES
)
)
...
...
@@ -721,8 +720,8 @@ float CV_MLBaseTest::get_error( int testCaseIdx, int type, vector<float> *resp )
else
if
(
!
modelName
.
compare
(
CV_KNEAREST
)
)
{
assert
(
0
);
testCaseIdx
=
0
;
/*
int k = 2;
/*
testCaseIdx = 0;
int k = 2;
validationFS.getFirstTopLevelNode()["validation"][modelName][dataSetNames[testCaseIdx]]["model_params"]["k"] >> k;
err = knearest->calc_error( &data, k, type, resp );*/
}
...
...
modules/python/src2/cv2.cpp
View file @
e94e5866
...
...
@@ -181,7 +181,7 @@ public:
datastart
=
data
=
(
uchar
*
)
PyArray_DATA
(
o
);
}
void
deallocate
(
int
*
refcount
,
uchar
*
datastart
,
uchar
*
data
)
void
deallocate
(
int
*
refcount
,
uchar
*
,
uchar
*
)
{
PyEnsureGIL
gil
;
if
(
!
refcount
)
...
...
@@ -349,6 +349,7 @@ static PyObject* pyopencv_from(bool value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
bool
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
int
_val
=
PyObject_IsTrue
(
obj
);
...
...
@@ -365,6 +366,7 @@ static PyObject* pyopencv_from(size_t value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
size_t
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
value
=
(
int
)
PyLong_AsUnsignedLong
(
obj
);
...
...
@@ -376,8 +378,19 @@ static PyObject* pyopencv_from(int value)
return
PyInt_FromLong
(
value
);
}
static
PyObject
*
pyopencv_from
(
cvflann_flann_algorithm_t
value
)
{
return
PyInt_FromLong
(
int
(
value
));
}
static
PyObject
*
pyopencv_from
(
cvflann_flann_distance_t
value
)
{
return
PyInt_FromLong
(
int
(
value
));
}
static
bool
pyopencv_to
(
PyObject
*
obj
,
int
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
value
=
(
int
)
PyInt_AsLong
(
obj
);
...
...
@@ -391,6 +404,7 @@ static PyObject* pyopencv_from(uchar value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
uchar
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
int
ivalue
=
(
int
)
PyInt_AsLong
(
obj
);
...
...
@@ -405,6 +419,7 @@ static PyObject* pyopencv_from(double value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
double
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyInt_CheckExact
(
obj
))
...
...
@@ -421,6 +436,7 @@ static PyObject* pyopencv_from(float value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
float
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyInt_CheckExact
(
obj
))
...
...
@@ -442,6 +458,7 @@ static PyObject* pyopencv_from(const string& value)
static
bool
pyopencv_to
(
PyObject
*
obj
,
string
&
value
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
char
*
str
=
PyString_AsString
(
obj
);
...
...
@@ -453,6 +470,7 @@ static bool pyopencv_to(PyObject* obj, string& value, const char* name = "<unkno
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Size
&
sz
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"ii"
,
&
sz
.
width
,
&
sz
.
height
)
>
0
;
...
...
@@ -465,6 +483,7 @@ static inline PyObject* pyopencv_from(const Size& sz)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Rect
&
r
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"iiii"
,
&
r
.
x
,
&
r
.
y
,
&
r
.
width
,
&
r
.
height
)
>
0
;
...
...
@@ -477,6 +496,7 @@ static inline PyObject* pyopencv_from(const Rect& r)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Range
&
r
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyObject_Size
(
obj
)
==
0
)
...
...
@@ -494,6 +514,7 @@ static inline PyObject* pyopencv_from(const Range& r)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
CvSlice
&
r
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyObject_Size
(
obj
)
==
0
)
...
...
@@ -511,6 +532,7 @@ static inline PyObject* pyopencv_from(const CvSlice& r)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Point
&
p
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyComplex_CheckExact
(
obj
))
...
...
@@ -525,6 +547,7 @@ static inline bool pyopencv_to(PyObject* obj, Point& p, const char* name = "<unk
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Point2f
&
p
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
||
obj
==
Py_None
)
return
true
;
if
(
PyComplex_CheckExact
(
obj
))
...
...
@@ -549,6 +572,7 @@ static inline PyObject* pyopencv_from(const Point2f& p)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
Vec3d
&
v
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"ddd"
,
&
v
[
0
],
&
v
[
1
],
&
v
[
2
])
>
0
;
...
...
@@ -792,6 +816,7 @@ template<> struct pyopencvVecConverter<string>
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
CvTermCriteria
&
dst
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"iid"
,
&
dst
.
type
,
&
dst
.
max_iter
,
&
dst
.
epsilon
)
>
0
;
...
...
@@ -804,6 +829,7 @@ static inline PyObject* pyopencv_from(const CvTermCriteria& src)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
TermCriteria
&
dst
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"iid"
,
&
dst
.
type
,
&
dst
.
maxCount
,
&
dst
.
epsilon
)
>
0
;
...
...
@@ -816,6 +842,7 @@ static inline PyObject* pyopencv_from(const TermCriteria& src)
static
inline
bool
pyopencv_to
(
PyObject
*
obj
,
RotatedRect
&
dst
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
if
(
!
obj
)
return
true
;
return
PyArg_ParseTuple
(
obj
,
"(ff)(ff)f"
,
&
dst
.
center
.
x
,
&
dst
.
center
.
y
,
&
dst
.
size
.
width
,
&
dst
.
size
.
height
,
&
dst
.
angle
)
>
0
;
...
...
@@ -847,6 +874,7 @@ static inline PyObject* pyopencv_from(const CvDTreeNode* node)
static
bool
pyopencv_to
(
PyObject
*
o
,
cv
::
flann
::
IndexParams
&
p
,
const
char
*
name
=
"<unknown>"
)
{
(
void
)
name
;
bool
ok
=
false
;
PyObject
*
keys
=
PyObject_CallMethod
(
o
,(
char
*
)
"keys"
,
0
);
PyObject
*
values
=
PyObject_CallMethod
(
o
,(
char
*
)
"values"
,
0
);
...
...
@@ -927,7 +955,7 @@ static void OnMouse(int event, int x, int y, int flags, void* param)
PyGILState_Release
(
gstate
);
}
static
PyObject
*
pycvSetMouseCallback
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
static
PyObject
*
pycvSetMouseCallback
(
PyObject
*
,
PyObject
*
args
,
PyObject
*
kw
)
{
const
char
*
keywords
[]
=
{
"window_name"
,
"on_mouse"
,
"param"
,
NULL
};
char
*
name
;
...
...
@@ -961,7 +989,7 @@ static void OnChange(int pos, void *param)
PyGILState_Release
(
gstate
);
}
static
PyObject
*
pycvCreateTrackbar
(
PyObject
*
self
,
PyObject
*
args
)
static
PyObject
*
pycvCreateTrackbar
(
PyObject
*
,
PyObject
*
args
)
{
PyObject
*
on_change
;
char
*
trackbar_name
;
...
...
@@ -983,6 +1011,11 @@ static PyObject *pycvCreateTrackbar(PyObject *self, PyObject *args)
#define MKTYPE2(NAME) pyopencv_##NAME##_specials(); if (!to_ok(&pyopencv_##NAME##_Type)) return
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#include "pyopencv_generated_types.h"
#include "pyopencv_generated_funcs.h"
...
...
modules/stitching/perf/perf_stich.cpp
View file @
e94e5866
#include "perf_precomp.hpp"
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wsign-promo"
#endif
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/internal.hpp"
#include "opencv2/flann/flann.hpp"
...
...
samples/gpu/cascadeclassifier_nvidia_api.cpp
View file @
e94e5866
...
...
@@ -18,7 +18,7 @@ using namespace cv;
#if !defined(HAVE_CUDA)
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
,
const
char
**
)
{
cout
<<
"Please compile the library with CUDA support"
<<
endl
;
return
-
1
;
...
...
samples/gpu/opticalflow_nvidia_api.cpp
View file @
e94e5866
...
...
@@ -20,7 +20,7 @@
#endif
#if !defined(HAVE_CUDA)
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
,
const
char
**
)
{
std
::
cout
<<
"Please compile the library with CUDA support"
<<
std
::
endl
;
return
-
1
;
...
...
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