Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
06b03a7b
Commit
06b03a7b
authored
Nov 03, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #372 from alalek:ocl_off
parents
bf699c38
ac8dd366
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
9 deletions
+41
-9
convolution_layer.cpp
modules/dnn/src/layers/convolution_layer.cpp
+2
-0
im2col.cpp
modules/dnn/src/layers/im2col.cpp
+2
-0
im2col.hpp
modules/dnn/src/layers/im2col.hpp
+2
-0
tldDetector.cpp
modules/tracking/src/tldDetector.cpp
+6
-0
tldDetector.hpp
modules/tracking/src/tldDetector.hpp
+3
-1
tldModel.cpp
modules/tracking/src/tldModel.cpp
+2
-0
tldModel.hpp
modules/tracking/src/tldModel.hpp
+2
-0
tldTracker.cpp
modules/tracking/src/tldTracker.cpp
+14
-8
surf.cpp
modules/xfeatures2d/src/surf.cpp
+2
-0
surf.hpp
modules/xfeatures2d/src/surf.hpp
+2
-0
surf.ocl.cpp
modules/xfeatures2d/src/surf.ocl.cpp
+4
-0
No files found.
modules/dnn/src/layers/convolution_layer.cpp
View file @
06b03a7b
...
...
@@ -153,6 +153,7 @@ namespace dnn
return
;
}
#ifdef HAVE_OPENCL
if
(
useOpenCL
&&
ocl
::
useOpenCL
()
&&
inpBlob
.
type
()
==
CV_32F
&&
!
is1x1
())
{
std
::
vector
<
Range
>
ranges
(
4
,
Range
::
all
());
...
...
@@ -165,6 +166,7 @@ namespace dnn
dst
.
copyTo
(
colMat
);
return
;
}
#endif // HAVE_OPENCL
if
(
inpBlob
.
type
()
==
CV_32F
)
im2col_cpu
((
float
*
)
srcPtr
,
inpGroupCn
,
inpH
,
inpW
,
kerH
,
kerW
,
padH
,
padW
,
strideH
,
strideW
,
(
float
*
)
colMat
.
ptr
());
...
...
modules/dnn/src/layers/im2col.cpp
View file @
06b03a7b
...
...
@@ -49,6 +49,7 @@ namespace cv
namespace
dnn
{
#ifdef HAVE_OPENCL
void
im2col_ocl
(
UMat
&
img
,
int
channels
,
int
height
,
int
width
,
int
kernel_h
,
int
kernel_w
,
...
...
@@ -78,6 +79,7 @@ void im2col_ocl(UMat &img,
CV_Assert
(
im2col_ker
.
run
(
1
,
&
globalSize
,
&
localSize
,
true
));
}
#endif // HAVE_OPENCL
}
}
modules/dnn/src/layers/im2col.hpp
View file @
06b03a7b
...
...
@@ -111,12 +111,14 @@ void col2im_cpu(const Dtype* data_col,
}
}
#ifdef HAVE_OPENCL
void
im2col_ocl
(
UMat
&
img
,
int
channels
,
int
height
,
int
width
,
int
kernel_h
,
int
kernel_w
,
int
pad_h
,
int
pad_w
,
int
stride_h
,
int
stride_w
,
UMat
&
col
);
#endif
}
}
...
...
modules/tracking/src/tldDetector.cpp
View file @
06b03a7b
...
...
@@ -83,6 +83,7 @@ namespace cv
return
splus
/
(
sminus
+
splus
);
}
#ifdef HAVE_OPENCL
double
TLDDetector
::
ocl_Sr
(
const
Mat_
<
uchar
>&
patch
)
{
double
splus
=
0.0
,
sminus
=
0.0
;
...
...
@@ -185,6 +186,7 @@ namespace cv
resultSc
[
id
]
=
spc
/
(
smc
+
spc
);
}
}
#endif
// Calculate Conservative similarity of the patch (NN-Model)
double
TLDDetector
::
Sc
(
const
Mat_
<
uchar
>&
patch
)
...
...
@@ -212,6 +214,7 @@ namespace cv
return
splus
/
(
sminus
+
splus
);
}
#ifdef HAVE_OPENCL
double
TLDDetector
::
ocl_Sc
(
const
Mat_
<
uchar
>&
patch
)
{
double
splus
=
0.0
,
sminus
=
0.0
;
...
...
@@ -256,6 +259,7 @@ namespace cv
return
0.0
;
return
splus
/
(
sminus
+
splus
);
}
#endif // HAVE_OPENCL
// Generate Search Windows for detector from aspect ratio of initial BBs
void
TLDDetector
::
generateScanGrid
(
int
rows
,
int
cols
,
Size
initBox
,
std
::
vector
<
Rect2d
>&
res
,
bool
withScaling
)
...
...
@@ -393,6 +397,7 @@ namespace cv
}
}
#ifdef HAVE_OPENCL
bool
TLDDetector
::
ocl_detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
LabeledPatch
>&
patches
,
Size
initSize
)
{
patches
.
clear
();
...
...
@@ -507,6 +512,7 @@ namespace cv
res
=
maxScRect
;
return
true
;
}
#endif // HAVE_OPENCL
// Computes the variance of subimage given by box, with the help of two integral
// images intImgP and intImgP2 (sum of squares), which should be also provided.
...
...
modules/tracking/src/tldDetector.hpp
View file @
06b03a7b
...
...
@@ -76,10 +76,12 @@ namespace cv
double
ensembleClassifierNum
(
const
uchar
*
data
);
void
prepareClassifiers
(
int
rowstep
);
double
Sr
(
const
Mat_
<
uchar
>&
patch
);
double
ocl_Sr
(
const
Mat_
<
uchar
>&
patch
);
double
Sc
(
const
Mat_
<
uchar
>&
patch
);
#ifdef HAVE_OPENCL
double
ocl_Sr
(
const
Mat_
<
uchar
>&
patch
);
double
ocl_Sc
(
const
Mat_
<
uchar
>&
patch
);
void
ocl_batchSrSc
(
const
Mat_
<
uchar
>&
patches
,
double
*
resultSr
,
double
*
resultSc
,
int
numOfPatches
);
#endif
std
::
vector
<
TLDEnsembleClassifier
>
classifiers
;
Mat
*
posExp
,
*
negExp
;
...
...
modules/tracking/src/tldModel.cpp
View file @
06b03a7b
...
...
@@ -219,6 +219,7 @@ namespace cv
}
}
#ifdef HAVE_OPENCL
void
TrackerTLDModel
::
ocl_integrateAdditional
(
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForModel
,
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForEnsemble
,
bool
isPositive
)
{
int
positiveIntoModel
=
0
,
negativeIntoModel
=
0
,
positiveIntoEnsemble
=
0
,
negativeIntoEnsemble
=
0
;
...
...
@@ -271,6 +272,7 @@ namespace cv
}
}
}
#endif // HAVE_OPENCL
//Push the patch to the model
void
TrackerTLDModel
::
pushIntoModel
(
const
Mat_
<
uchar
>&
example
,
bool
positive
)
...
...
modules/tracking/src/tldModel.hpp
View file @
06b03a7b
...
...
@@ -58,7 +58,9 @@ namespace cv
void
setBoudingBox
(
Rect2d
boundingBox
){
boundingBox_
=
boundingBox
;
}
void
integrateRelabeled
(
Mat
&
img
,
Mat
&
imgBlurred
,
const
std
::
vector
<
TLDDetector
::
LabeledPatch
>&
patches
);
void
integrateAdditional
(
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForModel
,
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForEnsemble
,
bool
isPositive
);
#ifdef HAVE_OPENCL
void
ocl_integrateAdditional
(
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForModel
,
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForEnsemble
,
bool
isPositive
);
#endif
Size
getMinSize
(){
return
minSize_
;
}
void
printme
(
FILE
*
port
=
stdout
);
Ptr
<
TLDDetector
>
detector
;
...
...
modules/tracking/src/tldTracker.cpp
View file @
06b03a7b
...
...
@@ -129,9 +129,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
if
(
i
==
1
)
{
#ifdef HAVE_OPENCL
if
(
ocl
::
haveOpenCL
())
DETECT_FLG
=
tldModel
->
detector
->
ocl_detect
(
imageForDetector
,
image_blurred
,
tmpCandid
,
detectorResults
,
tldModel
->
getMinSize
());
else
#endif
DETECT_FLG
=
tldModel
->
detector
->
detect
(
imageForDetector
,
image_blurred
,
tmpCandid
,
detectorResults
,
tldModel
->
getMinSize
());
}
if
(
(
(
i
==
0
)
&&
!
data
->
failedLastTime
&&
trackerProxy
->
update
(
image
,
tmpCandid
)
)
||
(
DETECT_FLG
))
...
...
@@ -199,17 +201,21 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
}
tldModel
->
integrateRelabeled
(
imageForDetector
,
image_blurred
,
detectorResults
);
pExpert
.
additionalExamples
(
examplesForModel
,
examplesForEnsemble
);
if
(
ocl
::
haveOpenCL
())
tldModel
->
ocl_integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
true
);
else
tldModel
->
integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
true
);
#ifdef HAVE_OPENCL
if
(
ocl
::
haveOpenCL
())
tldModel
->
ocl_integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
true
);
else
#endif
tldModel
->
integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
true
);
examplesForModel
.
clear
();
examplesForEnsemble
.
clear
();
nExpert
.
additionalExamples
(
examplesForModel
,
examplesForEnsemble
);
if
(
ocl
::
haveOpenCL
())
tldModel
->
ocl_integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
false
);
else
tldModel
->
integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
false
);
#ifdef HAVE_OPENCL
if
(
ocl
::
haveOpenCL
())
tldModel
->
ocl_integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
false
);
else
#endif
tldModel
->
integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
false
);
}
else
{
...
...
modules/xfeatures2d/src/surf.cpp
View file @
06b03a7b
...
...
@@ -892,6 +892,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
CV_Assert
(
!
_img
.
empty
()
&&
CV_MAT_DEPTH
(
imgtype
)
==
CV_8U
&&
(
imgcn
==
1
||
imgcn
==
3
||
imgcn
==
4
));
CV_Assert
(
_descriptors
.
needed
()
||
!
useProvidedKeypoints
);
#ifdef HAVE_OPENCL
if
(
ocl
::
useOpenCL
()
)
{
SURF_OCL
ocl_surf
;
...
...
@@ -918,6 +919,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
return
;
}
}
#endif // HAVE_OPENCL
Mat
img
=
_img
.
getMat
(),
mask
=
_mask
.
getMat
(),
mask1
,
sum
,
msum
;
...
...
modules/xfeatures2d/src/surf.hpp
View file @
06b03a7b
...
...
@@ -64,6 +64,7 @@ public:
bool
upright
;
};
#ifdef HAVE_OPENCL
class
SURF_OCL
{
public
:
...
...
@@ -145,6 +146,7 @@ protected:
int
status
;
};
#endif // HAVE_OPENCL
/*
template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um)
...
...
modules/xfeatures2d/src/surf.ocl.cpp
View file @
06b03a7b
...
...
@@ -43,6 +43,9 @@
//
//M*/
#include "precomp.hpp"
#ifdef HAVE_OPENCL
#include "surf.hpp"
#include <cstdio>
...
...
@@ -461,3 +464,4 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
}
}
#endif // HAVE_OPENCL
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