Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
34d2ff17
Commit
34d2ff17
authored
Mar 07, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenCV: more cosmetics.
parent
6ad0cd7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
modules/video_filter/opencv_example.cpp
modules/video_filter/opencv_example.cpp
+20
-18
No files found.
modules/video_filter/opencv_example.cpp
View file @
34d2ff17
...
...
@@ -111,8 +111,8 @@ static int OpenFilter( vlc_object_t *p_this )
//OpenCV init specific to this example
char
*
filename
=
var_InheritString
(
p_filter
,
"opencv-haarcascade-file"
);
p_
filter
->
p_
sys
->
p_cascade
=
(
CvHaarClassifierCascade
*
)
cvLoad
(
filename
,
0
,
0
,
0
);
p_
filter
->
p_
sys
->
p_storage
=
cvCreateMemStorage
(
0
);
p_sys
->
p_cascade
=
(
CvHaarClassifierCascade
*
)
cvLoad
(
filename
,
0
,
0
,
0
);
p_sys
->
p_storage
=
cvCreateMemStorage
(
0
);
free
(
filename
);
return
VLC_SUCCESS
;
...
...
@@ -126,13 +126,13 @@ static void CloseFilter( vlc_object_t *p_this )
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
if
(
p_
filter
->
p_
sys
->
p_cascade
)
cvReleaseHaarClassifierCascade
(
&
p_
filter
->
p_
sys
->
p_cascade
);
if
(
p_sys
->
p_cascade
)
cvReleaseHaarClassifierCascade
(
&
p_sys
->
p_cascade
);
if
(
p_
filter
->
p_
sys
->
p_storage
)
cvReleaseMemStorage
(
&
p_
filter
->
p_
sys
->
p_storage
);
if
(
p_sys
->
p_storage
)
cvReleaseMemStorage
(
&
p_sys
->
p_storage
);
free
(
p_
filter
->
p_
sys
->
event_info
.
p_region
);
free
(
p_sys
->
event_info
.
p_region
);
free
(
p_sys
);
var_Destroy
(
p_filter
->
p_libvlc
,
VIDEO_FILTER_EVENT_VARIABLE
);
...
...
@@ -150,6 +150,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
int
i_planes
=
0
;
CvPoint
pt1
,
pt2
;
int
i
,
scale
=
1
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
if
((
!
p_pic
)
)
{
...
...
@@ -183,23 +184,24 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
//perform face detection
cvClearMemStorage
(
p_
filter
->
p_
sys
->
p_storage
);
if
(
p_
filter
->
p_
sys
->
p_cascade
)
cvClearMemStorage
(
p_sys
->
p_storage
);
if
(
p_sys
->
p_cascade
)
{
//we should make some of these params config variables
CvSeq
*
faces
=
cvHaarDetectObjects
(
p_img
[
0
],
p_filter
->
p_sys
->
p_cascade
,
p_filter
->
p_sys
->
p_storage
,
1.15
,
5
,
CV_HAAR_DO_CANNY_PRUNING
,
CvSeq
*
faces
=
cvHaarDetectObjects
(
p_img
[
0
],
p_sys
->
p_cascade
,
p_sys
->
p_storage
,
1.15
,
5
,
CV_HAAR_DO_CANNY_PRUNING
,
cvSize
(
20
,
20
)
);
//create the video_filter_region_info_t struct
if
(
faces
&&
(
faces
->
total
>
0
))
{
//msg_Dbg( p_filter, "Found %d face(s)", faces->total );
free
(
p_
filter
->
p_
sys
->
event_info
.
p_region
);
p_
filter
->
p_
sys
->
event_info
.
p_region
=
(
video_filter_region_info_t
*
)
free
(
p_sys
->
event_info
.
p_region
);
p_sys
->
event_info
.
p_region
=
(
video_filter_region_info_t
*
)
calloc
(
faces
->
total
,
sizeof
(
video_filter_region_info_t
));
if
(
!
p_
filter
->
p_
sys
->
event_info
.
p_region
)
if
(
!
p_sys
->
event_info
.
p_region
)
return
NULL
;
p_
filter
->
p_
sys
->
event_info
.
i_region_size
=
faces
->
total
;
p_sys
->
event_info
.
i_region_size
=
faces
->
total
;
}
//populate the video_filter_region_info_t struct
...
...
@@ -212,9 +214,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
pt2
.
y
=
(
r
->
y
+
r
->
height
)
*
scale
;
cvRectangle
(
p_img
[
0
],
pt1
,
pt2
,
CV_RGB
(
0
,
0
,
0
),
3
,
8
,
0
);
*
(
CvRect
*
)(
&
(
p_
filter
->
p_
sys
->
event_info
.
p_region
[
i
]))
=
*
r
;
p_
filter
->
p_sys
->
event_info
.
p_region
[
i
].
i_id
=
p_filter
->
p_sys
->
i_id
++
;
p_
filter
->
p_
sys
->
event_info
.
p_region
[
i
].
p_description
=
"Face Detected"
;
*
(
CvRect
*
)(
&
(
p_sys
->
event_info
.
p_region
[
i
]))
=
*
r
;
p_
sys
->
event_info
.
p_region
[
i
].
i_id
=
p_sys
->
i_id
++
;
p_sys
->
event_info
.
p_region
[
i
].
p_description
=
"Face Detected"
;
}
if
(
faces
&&
(
faces
->
total
>
0
))
//raise the video filter event
...
...
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