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 int query_formats (AVFilterContext *ctx)
 
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 []
 
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 403 of file vf_libopencv.c.

◆ FLAGS

Definition at line 404 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().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 67 of file vf_libopencv.c.

◆ smooth_init()

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

Definition at line 94 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 137 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 144 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 217 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 272 of file vf_libopencv.c.

◆ dilate_uninit()

static av_cold void dilate_uninit ( AVFilterContext ctx)
static

Definition at line 307 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 315 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 322 of file vf_libopencv.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 343 of file vf_libopencv.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 369 of file vf_libopencv.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 378 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 337 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 405 of file vf_libopencv.c.

◆ avfilter_vf_ocv_inputs

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

Definition at line 413 of file vf_libopencv.c.

◆ avfilter_vf_ocv_outputs

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

Definition at line 422 of file vf_libopencv.c.

◆ ff_vf_ocv

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 430 of file vf_libopencv.c.

SmoothContext
Definition: vf_libopencv.c:88
FLAGS
#define FLAGS
Definition: vf_libopencv.c:404
name
const char * name
Definition: avisynth_c.h:867
DilateContext
Definition: vf_libopencv.c:267
OCVContext
Definition: vf_libopencv.c:78
OFFSET
#define OFFSET(x)
Definition: vf_libopencv.c:403
dilate_uninit
static av_cold void dilate_uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:307
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_libopencv.c:343
smooth_end_frame_filter
static void smooth_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:137
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_libopencv.c:378
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
avfilter_vf_ocv_outputs
static const AVFilterPad avfilter_vf_ocv_outputs[]
Definition: vf_libopencv.c:422
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
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:188
dilate_init
static av_cold int dilate_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:272
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:369
erode_end_frame_filter
static void erode_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:322
dilate_end_frame_filter
static void dilate_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:315
params
const char const char * params
Definition: avisynth_c.h:867
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_libopencv.c:67
avfilter_vf_ocv_inputs
static const AVFilterPad avfilter_vf_ocv_inputs[]
Definition: vf_libopencv.c:413
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
smooth_init
static av_cold int smooth_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:94
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227