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
e47f58f4
Commit
e47f58f4
authored
Jan 09, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace Mats to Input/OutputArrays for Octave's public interface
parent
e7bab669
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
ml.hpp
modules/ml/include/opencv2/ml/ml.hpp
+7
-5
octave.cpp
modules/ml/src/octave.cpp
+17
-7
No files found.
modules/ml/include/opencv2/ml/ml.hpp
View file @
e47f58f4
...
...
@@ -2171,15 +2171,17 @@ public:
};
Octave
(
cv
::
Rect
boundingBox
,
int
npositives
,
int
nnegatives
,
int
logScale
,
int
shrinkage
);
virtual
bool
train
(
const
Dataset
*
dataset
,
const
FeaturePool
*
pool
,
int
weaks
,
int
treeDepth
);
virtual
void
setRejectThresholds
(
OutputArray
thresholds
);
virtual
void
write
(
CvFileStorage
*
fs
,
string
name
)
const
;
virtual
void
write
(
cv
::
FileStorage
&
fs
,
const
FeaturePool
*
pool
,
InputArray
thresholds
)
const
;
virtual
~
Octave
();
virtual
bool
train
(
const
Dataset
*
dataset
,
const
FeaturePool
*
pool
,
int
weaks
,
int
treeDepth
);
virtual
float
predict
(
const
Mat
&
_sample
,
Mat
&
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
;
virtual
void
setRejectThresholds
(
cv
::
Mat
&
thresholds
);
virtual
void
write
(
CvFileStorage
*
fs
,
string
name
)
const
;
virtual
float
predict
(
InputArray
_sample
,
InputArray
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
;
virtual
void
write
(
cv
::
FileStorage
&
fs
,
const
FeaturePool
*
pool
,
const
Mat
&
thresholds
)
const
;
int
logScale
;
...
...
modules/ml/src/octave.cpp
View file @
e47f58f4
...
...
@@ -167,7 +167,7 @@ bool cv::Octave::train( const cv::Mat& _trainData, const cv::Mat& _responses, co
update
);
}
void
cv
::
Octave
::
setRejectThresholds
(
cv
::
Mat
&
thresholds
)
void
cv
::
Octave
::
setRejectThresholds
(
cv
::
OutputArray
_
thresholds
)
{
dprintf
(
"set thresholds according to DBP strategy
\n
"
);
...
...
@@ -190,7 +190,8 @@ void cv::Octave::setRejectThresholds(cv::Mat& thresholds)
}
int
weaks
=
weak
->
total
;
thresholds
.
create
(
1
,
weaks
,
CV_64FC1
);
_thresholds
.
create
(
1
,
weaks
,
CV_64FC1
);
cv
::
Mat
&
thresholds
=
_thresholds
.
getMatRef
();
double
*
thptr
=
thresholds
.
ptr
<
double
>
(
0
);
cv
::
Mat
traces
(
weaks
,
nsamples
,
CV_64FC1
,
cv
::
Scalar
::
all
(
FLT_MAX
));
...
...
@@ -346,12 +347,13 @@ void cv::Octave::traverse(const CvBoostTree* tree, cv::FileStorage& fs, int& nfe
fs
<<
"}"
;
}
void
cv
::
Octave
::
write
(
cv
::
FileStorage
&
fso
,
const
FeaturePool
*
pool
,
const
Mat
&
thresholds
)
const
void
cv
::
Octave
::
write
(
cv
::
FileStorage
&
fso
,
const
FeaturePool
*
pool
,
InputArray
_
thresholds
)
const
{
CV_Assert
(
!
thresholds
.
empty
());
CV_Assert
(
!
_
thresholds
.
empty
());
cv
::
Mat
used
(
1
,
weak
->
total
*
(
pow
(
2
,
params
.
max_depth
)
-
1
),
CV_32SC1
);
int
*
usedPtr
=
used
.
ptr
<
int
>
(
0
);
int
nfeatures
=
0
;
cv
::
Mat
thresholds
=
_thresholds
.
getMat
();
fso
<<
"{"
<<
"scale"
<<
logScale
<<
"weaks"
<<
weak
->
total
...
...
@@ -438,10 +440,18 @@ bool cv::Octave::train(const Dataset* dataset, const FeaturePool* pool, int weak
}
float
cv
::
Octave
::
predict
(
c
onst
Mat
&
_sample
,
Mat
&
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
float
cv
::
Octave
::
predict
(
c
v
::
InputArray
_sample
,
cv
::
InputArray
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
{
CvMat
sample
=
_sample
,
votes
=
_votes
;
return
CvBoost
::
predict
(
&
sample
,
0
,
(
_votes
.
empty
())
?
0
:
&
votes
,
CV_WHOLE_SEQ
,
raw_mode
,
return_sum
);
cv
::
Mat
sample
=
_sample
.
getMat
();
CvMat
csample
=
sample
;
if
(
_votes
.
empty
())
return
CvBoost
::
predict
(
&
csample
,
0
,
0
,
CV_WHOLE_SEQ
,
raw_mode
,
return_sum
);
else
{
cv
::
Mat
votes
=
_votes
.
getMat
();
CvMat
cvotes
=
votes
;
return
CvBoost
::
predict
(
&
csample
,
0
,
&
cvotes
,
CV_WHOLE_SEQ
,
raw_mode
,
return_sum
);
}
}
float
cv
::
Octave
::
predict
(
const
Mat
&
_sample
,
const
cv
::
Range
range
)
const
...
...
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