Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
0bcc6657
Commit
0bcc6657
authored
May 03, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_edgedetect: add planes option
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
d122c8b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
filters.texi
doc/filters.texi
+3
-1
vf_edgedetect.c
libavfilter/vf_edgedetect.c
+25
-0
No files found.
doc/filters.texi
View file @
0bcc6657
...
...
@@ -8280,8 +8280,10 @@ Mix the colors to create a paint/cartoon effect.
@item canny
Apply Canny edge detector on all selected planes.
@end table
Default value is @var{wires}.
@item planes
Select planes for filtering. By default all available planes are filtered.
@end table
@subsection Examples
...
...
libavfilter/vf_edgedetect.c
View file @
0bcc6657
...
...
@@ -26,12 +26,21 @@
*/
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#define PLANE_R 0x4
#define PLANE_G 0x1
#define PLANE_B 0x2
#define PLANE_Y 0x1
#define PLANE_U 0x2
#define PLANE_V 0x4
#define PLANE_A 0x8
enum
FilterMode
{
MODE_WIRES
,
MODE_COLORMIX
,
...
...
@@ -48,6 +57,7 @@ struct plane_info {
typedef
struct
EdgeDetectContext
{
const
AVClass
*
class
;
struct
plane_info
planes
[
3
];
int
filter_planes
;
int
nb_planes
;
double
low
,
high
;
uint8_t
low_u8
,
high_u8
;
...
...
@@ -63,6 +73,13 @@ static const AVOption edgedetect_options[] = {
{
"wires"
,
"white/gray wires on black"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_WIRES
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"colormix"
,
"mix colors"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_COLORMIX
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"canny"
,
"detect edges on planes"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_CANNY
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"planes"
,
"set planes to filter"
,
OFFSET
(
filter_planes
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
7
},
1
,
0x7
,
FLAGS
,
"flags"
},
{
"y"
,
"filter luma plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_Y
},
0
,
0
,
FLAGS
,
"flags"
},
{
"u"
,
"filter u plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_U
},
0
,
0
,
FLAGS
,
"flags"
},
{
"v"
,
"filter v plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_V
},
0
,
0
,
FLAGS
,
"flags"
},
{
"r"
,
"filter red plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_R
},
0
,
0
,
FLAGS
,
"flags"
},
{
"g"
,
"filter green plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_G
},
0
,
0
,
FLAGS
,
"flags"
},
{
"b"
,
"filter blue plane"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLANE_B
},
0
,
0
,
FLAGS
,
"flags"
},
{
NULL
}
};
...
...
@@ -322,6 +339,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
uint16_t
*
gradients
=
plane
->
gradients
;
int8_t
*
directions
=
plane
->
directions
;
if
(
!
((
1
<<
p
)
&
edgedetect
->
filter_planes
))
{
if
(
!
direct
)
av_image_copy_plane
(
out
->
data
[
p
],
out
->
linesize
[
p
],
in
->
data
[
p
],
in
->
linesize
[
p
],
inlink
->
w
,
inlink
->
h
);
continue
;
}
/* gaussian filter to reduce noise */
gaussian_blur
(
ctx
,
inlink
->
w
,
inlink
->
h
,
tmpbuf
,
inlink
->
w
,
...
...
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