FFmpeg
Data Structures | Macros | Functions | Variables
vf_libopencv.c File Reference
#include "config.h"
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/file.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  OCVContext
 
struct  SmoothContext
 
struct  DilateContext
 
struct  OCVFilterEntry
 

Macros

#define OFFSET(x)   offsetof(OCVContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static void fill_iplimage_from_frame (IplImage *img, const AVFrame *frame, enum AVPixelFormat pixfmt)
 
static void fill_frame_from_iplimage (AVFrame *frame, const IplImage *img, enum AVPixelFormat pixfmt)
 
static av_cold int smooth_init (AVFilterContext *ctx, const char *args)
 
static void smooth_end_frame_filter (AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
 
static int read_shape_from_file (int *cols, int *rows, int **values, const char *filename, void *log_ctx)
 
static int parse_iplconvkernel (IplConvKernel **kernel, char *buf, void *log_ctx)
 
static av_cold int dilate_init (AVFilterContext *ctx, const char *args)
 
static av_cold void dilate_uninit (AVFilterContext *ctx)
 
static void dilate_end_frame_filter (AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
 
static void erode_end_frame_filter (AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (ocv)
 

Variables

static const OCVFilterEntry ocv_filter_entries []
 
static const AVOption ocv_options []
 
static const AVFilterPad avfilter_vf_ocv_inputs []
 
static const AVFilterPad avfilter_vf_ocv_outputs []
 
const AVFilter ff_vf_ocv
 

Detailed Description

libopencv wrapper functions

Definition in file vf_libopencv.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(OCVContext, x)

Definition at line 392 of file vf_libopencv.c.

◆ FLAGS

Definition at line 393 of file vf_libopencv.c.

Function Documentation

◆ fill_iplimage_from_frame()

static void fill_iplimage_from_frame ( IplImage *  img,
const AVFrame frame,
enum AVPixelFormat  pixfmt 
)
static

Definition at line 43 of file vf_libopencv.c.

Referenced by filter_frame().

◆ fill_frame_from_iplimage()

static void fill_frame_from_iplimage ( AVFrame frame,
const IplImage *  img,
enum AVPixelFormat  pixfmt 
)
static

Definition at line 61 of file vf_libopencv.c.

Referenced by filter_frame().

◆ smooth_init()

static av_cold int smooth_init ( AVFilterContext ctx,
const char *  args 
)
static

Definition at line 83 of file vf_libopencv.c.

◆ smooth_end_frame_filter()

static void smooth_end_frame_filter ( AVFilterContext ctx,
IplImage *  inimg,
IplImage *  outimg 
)
static

Definition at line 126 of file vf_libopencv.c.

◆ read_shape_from_file()

static int read_shape_from_file ( int cols,
int rows,
int **  values,
const char *  filename,
void *  log_ctx 
)
static

Definition at line 133 of file vf_libopencv.c.

Referenced by parse_iplconvkernel().

◆ parse_iplconvkernel()

static int parse_iplconvkernel ( IplConvKernel **  kernel,
char *  buf,
void *  log_ctx 
)
static

Definition at line 206 of file vf_libopencv.c.

Referenced by dilate_init().

◆ dilate_init()

static av_cold int dilate_init ( AVFilterContext ctx,
const char *  args 
)
static

Definition at line 261 of file vf_libopencv.c.

◆ dilate_uninit()

static av_cold void dilate_uninit ( AVFilterContext ctx)
static

Definition at line 296 of file vf_libopencv.c.

◆ dilate_end_frame_filter()

static void dilate_end_frame_filter ( AVFilterContext ctx,
IplImage *  inimg,
IplImage *  outimg 
)
static

Definition at line 304 of file vf_libopencv.c.

◆ erode_end_frame_filter()

static void erode_end_frame_filter ( AVFilterContext ctx,
IplImage *  inimg,
IplImage *  outimg 
)
static

Definition at line 311 of file vf_libopencv.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 332 of file vf_libopencv.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 358 of file vf_libopencv.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 367 of file vf_libopencv.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( ocv  )

Variable Documentation

◆ ocv_filter_entries

const OCVFilterEntry ocv_filter_entries[]
static
Initial value:

Definition at line 326 of file vf_libopencv.c.

Referenced by init().

◆ ocv_options

const AVOption ocv_options[]
static
Initial value:
= {
{ "filter_name", NULL, OFFSET(name), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "filter_params", NULL, OFFSET(params), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ NULL }
}

Definition at line 394 of file vf_libopencv.c.

◆ avfilter_vf_ocv_inputs

const AVFilterPad avfilter_vf_ocv_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}

Definition at line 402 of file vf_libopencv.c.

◆ avfilter_vf_ocv_outputs

const AVFilterPad avfilter_vf_ocv_outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 410 of file vf_libopencv.c.

◆ ff_vf_ocv

const AVFilter ff_vf_ocv
Initial value:
= {
.name = "ocv",
.description = NULL_IF_CONFIG_SMALL("Apply transform using libopencv."),
.priv_size = sizeof(OCVContext),
.priv_class = &ocv_class,
.init = init,
}

Definition at line 417 of file vf_libopencv.c.

SmoothContext
Definition: vf_libopencv.c:77
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
FLAGS
#define FLAGS
Definition: vf_libopencv.c:393
DilateContext
Definition: vf_libopencv.c:256
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
OCVContext
Definition: vf_libopencv.c:67
OFFSET
#define OFFSET(x)
Definition: vf_libopencv.c:392
dilate_uninit
static av_cold void dilate_uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:296
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_libopencv.c:332
smooth_end_frame_filter
static void smooth_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:126
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_libopencv.c:367
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
NULL
#define NULL
Definition: coverity.c:32
avfilter_vf_ocv_outputs
static const AVFilterPad avfilter_vf_ocv_outputs[]
Definition: vf_libopencv.c:410
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:115
FILTER_PIXFMTS
#define FILTER_PIXFMTS(...)
Definition: internal.h:180
dilate_init
static av_cold int dilate_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:261
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:358
erode_end_frame_filter
static void erode_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:311
dilate_end_frame_filter
static void dilate_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:304
avfilter_vf_ocv_inputs
static const AVFilterPad avfilter_vf_ocv_inputs[]
Definition: vf_libopencv.c:402
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
smooth_init
static av_cold int smooth_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:83
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229