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
2e0161c6
Commit
2e0161c6
authored
Nov 28, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create objects mat if empty
parent
d9858614
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
softcascade.cpp
modules/gpu/src/softcascade.cpp
+19
-13
test_softcascade.cpp
modules/gpu/test/test_softcascade.cpp
+1
-1
No files found.
modules/gpu/src/softcascade.cpp
View file @
2e0161c6
...
...
@@ -519,6 +519,8 @@ public:
GpuMat
collected
;
cv
::
gpu
::
GpuMat
genRoiTmp
;
std
::
vector
<
device
::
icf
::
Octave
>
voctaves
;
DeviceInfo
info
;
...
...
@@ -546,29 +548,33 @@ bool cv::gpu::SCascade::load(const FileNode& fn)
return
fields
!=
0
;
}
void
cv
::
gpu
::
SCascade
::
detect
(
InputArray
image
,
InputArray
_rois
,
OutputArray
_objects
,
Stream
&
s
)
const
void
cv
::
gpu
::
SCascade
::
detect
(
InputArray
_
image
,
InputArray
_rois
,
OutputArray
_objects
,
Stream
&
s
)
const
{
CV_Assert
(
fields
);
const
GpuMat
colored
=
image
.
getGpuMat
();
// only color images are supperted
CV_Assert
(
colored
.
type
()
==
CV_8UC3
||
colored
.
type
()
==
CV_32SC1
);
// only color images and precomputed integrals are supported
int
type
=
_image
.
type
();
CV_Assert
(
type
==
CV_8UC3
||
type
==
CV_32SC1
||
(
!
_rois
.
empty
()));
const
GpuMat
image
=
_image
.
getGpuMat
();
if
(
_objects
.
empty
())
_objects
.
create
(
1
,
4096
*
sizeof
(
Detection
),
CV_8UC1
);
GpuMat
rois
=
_rois
.
getGpuMat
(),
objects
=
_objects
.
getGpuMat
();
Fields
&
flds
=
*
fields
;
if
(
colored
.
type
()
==
CV_8UC3
)
Fields
&
flds
=
*
fields
;
if
(
type
==
CV_8UC3
)
{
if
(
!
flds
.
update
(
colored
.
rows
,
colored
.
cols
,
flds
.
shrinkage
)
||
flds
.
check
(
minScale
,
maxScale
,
scales
))
flds
.
createLevels
(
colored
.
rows
,
colored
.
cols
);
flds
.
preprocess
(
colored
,
s
);
if
(
!
flds
.
update
(
image
.
rows
,
image
.
cols
,
flds
.
shrinkage
)
||
flds
.
check
(
minScale
,
maxScale
,
scales
))
flds
.
createLevels
(
image
.
rows
,
image
.
cols
);
flds
.
preprocess
(
image
,
s
);
}
else
{
if
(
s
)
s
.
enqueueCopy
(
colored
,
flds
.
hogluv
);
s
.
enqueueCopy
(
image
,
flds
.
hogluv
);
else
colored
.
copyTo
(
flds
.
hogluv
);
image
.
copyTo
(
flds
.
hogluv
);
}
flds
.
detect
(
rois
,
objects
,
s
);
...
...
@@ -587,10 +593,10 @@ void cv::gpu::SCascade::genRoi(InputArray _roi, OutputArray _mask, Stream& strea
int
shr
=
(
*
fields
).
shrinkage
;
const
GpuMat
roi
=
_roi
.
getGpuMat
();
_mask
.
create
(
roi
.
cols
/
shr
,
roi
.
rows
/
shr
,
roi
.
type
()
);
_mask
.
create
(
roi
.
cols
/
shr
,
roi
.
rows
/
shr
,
roi
.
type
());
GpuMat
mask
=
_mask
.
getGpuMat
();
cv
::
gpu
::
GpuMat
tmp
;
GpuMat
&
tmp
=
(
*
fields
).
genRoiTmp
;
cv
::
gpu
::
resize
(
roi
,
tmp
,
cv
::
Size
(),
1.
f
/
shr
,
1.
f
/
shr
,
CV_INTER_AREA
,
stream
);
cv
::
gpu
::
transpose
(
tmp
,
mask
,
stream
);
}
...
...
modules/gpu/test/test_softcascade.cpp
View file @
2e0161c6
...
...
@@ -234,7 +234,7 @@ GPU_TEST_P(SCascadeTestAll, detect,
+
"../cv/cascadeandhog/bahnhof/image_00000000_0.png"
);
ASSERT_FALSE
(
coloredCpu
.
empty
());
GpuMat
colored
(
coloredCpu
),
objectBoxes
(
1
,
100000
,
CV_8UC1
)
,
rois
(
colored
.
size
(),
CV_8UC1
);
GpuMat
colored
(
coloredCpu
),
objectBoxes
,
rois
(
colored
.
size
(),
CV_8UC1
);
rois
.
setTo
(
0
);
GpuMat
sub
(
rois
,
cv
::
Rect
(
rois
.
cols
/
4
,
rois
.
rows
/
4
,
rois
.
cols
/
2
,
rois
.
rows
/
2
));
sub
.
setTo
(
cv
::
Scalar
::
all
(
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