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
a30bbda3
Commit
a30bbda3
authored
Nov 14, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove hardcoded values
parent
8acfbde6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
isf-sc.cu
modules/gpu/src/cuda/isf-sc.cu
+3
-2
icf.hpp
modules/gpu/src/icf.hpp
+1
-1
softcascade.cpp
modules/gpu/src/softcascade.cpp
+6
-5
No files found.
modules/gpu/src/cuda/isf-sc.cu
View file @
a30bbda3
...
@@ -181,6 +181,7 @@ __device void CascadeInvoker<Policy>::detect(Detection* objects, const uint ndet
...
@@ -181,6 +181,7 @@ __device void CascadeInvoker<Policy>::detect(Detection* objects, const uint ndet
int st = level.octave * level.step;
int st = level.octave * level.step;
const int stEnd = st + level.step;
const int stEnd = st + level.step;
const int hogluvStep = gridDim.y * Policy::STA_Y;
float confidence = 0.f;
float confidence = 0.f;
for(; st < stEnd; st += Policy::WARP)
for(; st < stEnd; st += Policy::WARP)
{
{
...
@@ -189,13 +190,13 @@ __device void CascadeInvoker<Policy>::detect(Detection* objects, const uint ndet
...
@@ -189,13 +190,13 @@ __device void CascadeInvoker<Policy>::detect(Detection* objects, const uint ndet
Node node = nodes[nId];
Node node = nodes[nId];
float threshold = rescale<isUp>(level, node);
float threshold = rescale<isUp>(level, node);
int sum = get<isUp>(x, y + (node.threshold >> 28) *
120
, node.rect);
int sum = get<isUp>(x, y + (node.threshold >> 28) *
hogluvStep
, node.rect);
int next = 1 + (int)(sum >= threshold);
int next = 1 + (int)(sum >= threshold);
node = nodes[nId + next];
node = nodes[nId + next];
threshold = rescale<isUp>(level, node);
threshold = rescale<isUp>(level, node);
sum = get<isUp>(x, y + (node.threshold >> 28) *
120
, node.rect);
sum = get<isUp>(x, y + (node.threshold >> 28) *
hogluvStep
, node.rect);
const int lShift = (next - 1) * 2 + (int)(sum >= threshold);
const int lShift = (next - 1) * 2 + (int)(sum >= threshold);
float impact = leaves[(st + threadIdx.x) * 4 + lShift];
float impact = leaves[(st + threadIdx.x) * 4 + lShift];
...
...
modules/gpu/src/icf.hpp
View file @
a30bbda3
...
@@ -130,7 +130,7 @@ struct CascadeInvoker
...
@@ -130,7 +130,7 @@ struct CascadeInvoker
{
{
CascadeInvoker
()
:
levels
(
0
),
stages
(
0
),
nodes
(
0
),
leaves
(
0
),
scales
(
0
)
{}
CascadeInvoker
()
:
levels
(
0
),
stages
(
0
),
nodes
(
0
),
leaves
(
0
),
scales
(
0
)
{}
CascadeInvoker
(
const
PtrStepSzb
&
_levels
,
const
PtrStepSz
b
&
_octaves
,
const
PtrStepSz
f
&
_stages
,
CascadeInvoker
(
const
PtrStepSzb
&
_levels
,
const
PtrStepSzf
&
_stages
,
const
PtrStepSzb
&
_nodes
,
const
PtrStepSzf
&
_leaves
)
const
PtrStepSzb
&
_nodes
,
const
PtrStepSzf
&
_leaves
)
:
levels
((
const
Level
*
)
_levels
.
ptr
()),
:
levels
((
const
Level
*
)
_levels
.
ptr
()),
stages
((
const
float
*
)
_stages
.
ptr
()),
stages
((
const
float
*
)
_stages
.
ptr
()),
...
...
modules/gpu/src/softcascade.cpp
View file @
a30bbda3
...
@@ -316,7 +316,7 @@ struct cv::gpu::SCascade::Fields
...
@@ -316,7 +316,7 @@ struct cv::gpu::SCascade::Fields
cudaMemset
(
count
.
data
,
0
,
sizeof
(
Detection
));
cudaMemset
(
count
.
data
,
0
,
sizeof
(
Detection
));
cudaSafeCall
(
cudaGetLastError
());
cudaSafeCall
(
cudaGetLastError
());
device
::
icf
::
CascadeInvoker
<
device
::
icf
::
GK107PolicyX4
>
invoker
device
::
icf
::
CascadeInvoker
<
device
::
icf
::
GK107PolicyX4
>
invoker
=
device
::
icf
::
CascadeInvoker
<
device
::
icf
::
GK107PolicyX4
>
(
levels
,
octaves
,
stages
,
nodes
,
leaves
);
=
device
::
icf
::
CascadeInvoker
<
device
::
icf
::
GK107PolicyX4
>
(
levels
,
stages
,
nodes
,
leaves
);
invoker
(
roi
,
hogluv
,
objects
,
count
,
downscales
,
stream
);
invoker
(
roi
,
hogluv
,
objects
,
count
,
downscales
,
stream
);
}
}
...
@@ -414,7 +414,7 @@ private:
...
@@ -414,7 +414,7 @@ private:
void
integrate
(
const
int
fh
,
const
int
fw
,
Stream
&
s
)
void
integrate
(
const
int
fh
,
const
int
fw
,
Stream
&
s
)
{
{
GpuMat
channels
(
plane
,
cv
::
Rect
(
0
,
0
,
fw
,
fh
*
Fields
::
HOG_LUV_BINS
));
GpuMat
channels
(
plane
,
cv
::
Rect
(
0
,
0
,
fw
,
fh
*
Fields
::
HOG_LUV_BINS
));
cv
::
gpu
::
resize
(
channels
,
shrunk
,
cv
::
Size
(),
0.25
,
0.25
,
CV_INTER_AREA
,
s
);
cv
::
gpu
::
resize
(
channels
,
shrunk
,
cv
::
Size
(),
1.
f
/
shrinkage
,
1.
f
/
shrinkage
,
CV_INTER_AREA
,
s
);
if
(
info
.
majorVersion
()
<
3
)
if
(
info
.
majorVersion
()
<
3
)
cv
::
gpu
::
integralBuffered
(
shrunk
,
hogluv
,
integralBuffer
,
s
);
cv
::
gpu
::
integralBuffered
(
shrunk
,
hogluv
,
integralBuffer
,
s
);
...
@@ -518,7 +518,7 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
...
@@ -518,7 +518,7 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
GpuMat
tmp
=
GpuMat
(
objects
,
cv
::
Rect
(
0
,
0
,
sizeof
(
Detection
),
1
));
GpuMat
tmp
=
GpuMat
(
objects
,
cv
::
Rect
(
0
,
0
,
sizeof
(
Detection
),
1
));
objects
=
GpuMat
(
objects
,
cv
::
Rect
(
sizeof
(
Detection
),
0
,
objects
.
cols
-
sizeof
(
Detection
),
1
));
objects
=
GpuMat
(
objects
,
cv
::
Rect
(
sizeof
(
Detection
),
0
,
objects
.
cols
-
sizeof
(
Detection
),
1
));
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
flds
.
detect
(
rois
,
tmp
,
objects
,
stream
);
flds
.
detect
(
rois
,
tmp
,
objects
,
stream
);
...
@@ -527,13 +527,14 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
...
@@ -527,13 +527,14 @@ void cv::gpu::SCascade::detect(InputArray image, InputArray _rois, OutputArray _
void
cv
::
gpu
::
SCascade
::
genRoi
(
InputArray
_roi
,
OutputArray
_mask
,
Stream
&
stream
)
const
void
cv
::
gpu
::
SCascade
::
genRoi
(
InputArray
_roi
,
OutputArray
_mask
,
Stream
&
stream
)
const
{
{
CV_Assert
(
fields
);
CV_Assert
(
fields
);
int
shr
=
(
*
fields
).
shrinkage
;
const
GpuMat
roi
=
_roi
.
getGpuMat
();
const
GpuMat
roi
=
_roi
.
getGpuMat
();
_mask
.
create
(
roi
.
cols
/
4
,
roi
.
rows
/
4
,
roi
.
type
()
);
_mask
.
create
(
roi
.
cols
/
shr
,
roi
.
rows
/
shr
,
roi
.
type
()
);
GpuMat
mask
=
_mask
.
getGpuMat
();
GpuMat
mask
=
_mask
.
getGpuMat
();
cv
::
gpu
::
GpuMat
tmp
;
cv
::
gpu
::
GpuMat
tmp
;
cv
::
gpu
::
resize
(
roi
,
tmp
,
cv
::
Size
(),
0.25
,
0.25
,
CV_INTER_AREA
,
stream
);
cv
::
gpu
::
resize
(
roi
,
tmp
,
cv
::
Size
(),
1.
f
/
shr
,
1.
f
/
shr
,
CV_INTER_AREA
,
stream
);
cv
::
gpu
::
transpose
(
tmp
,
mask
,
stream
);
cv
::
gpu
::
transpose
(
tmp
,
mask
,
stream
);
}
}
...
...
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