vf_libopencv.c File Reference

libopencv wrapper functions More...

#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"
Include dependency graph for vf_libopencv.c:

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)
 

Variables

static OCVFilterEntry ocv_filter_entries []
 
static const AVOption options []
 
static const AVClass ocv_class
 
static const AVFilterPad avfilter_vf_ocv_inputs []
 
static const AVFilterPad avfilter_vf_ocv_outputs []
 
AVFilter avfilter_vf_ocv
 

Detailed Description

libopencv wrapper functions

Definition in file vf_libopencv.c.

Macro Definition Documentation

Definition at line 382 of file vf_libopencv.c.

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

Definition at line 381 of file vf_libopencv.c.

Function Documentation

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

Definition at line 293 of file vf_libopencv.c.

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

Definition at line 255 of file vf_libopencv.c.

static av_cold void dilate_uninit ( AVFilterContext ctx)
static

Definition at line 285 of file vf_libopencv.c.

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

Definition at line 300 of file vf_libopencv.c.

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

Definition at line 57 of file vf_libopencv.c.

Referenced by filter_frame().

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

Definition at line 39 of file vf_libopencv.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 356 of file vf_libopencv.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 321 of file vf_libopencv.c.

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().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 63 of file vf_libopencv.c.

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

Definition at line 139 of file vf_libopencv.c.

Referenced by parse_iplconvkernel().

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

Definition at line 132 of file vf_libopencv.c.

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

Definition at line 89 of file vf_libopencv.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 347 of file vf_libopencv.c.

Variable Documentation

AVFilter avfilter_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,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold int init(AVFilterContext *ctx)
Definition: vf_libopencv.c:321
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVFilterPad avfilter_vf_ocv_outputs[]
Definition: vf_libopencv.c:405
static const AVClass ocv_class
Definition: vf_libopencv.c:389
static const AVFilterPad avfilter_vf_ocv_inputs[]
Definition: vf_libopencv.c:396
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:347
static int query_formats(AVFilterContext *ctx)
Definition: vf_libopencv.c:63
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 at line 413 of file vf_libopencv.c.

const AVFilterPad avfilter_vf_ocv_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_libopencv.c:356
NULL
Definition: eval.c:55

Definition at line 396 of file vf_libopencv.c.

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

Definition at line 405 of file vf_libopencv.c.

const AVClass ocv_class
static
Initial value:
= {
.class_name = "ocv",
.item_name = av_default_item_name,
.option = options,
}
av_default_item_name
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static const AVOption options[]
Definition: vf_libopencv.c:383

Definition at line 389 of file vf_libopencv.c.

OCVFilterEntry ocv_filter_entries[]
static
Initial value:
= {
}
static void smooth_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:132
static av_cold void dilate_uninit(AVFilterContext *ctx)
Definition: vf_libopencv.c:285
static void dilate_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:293
NULL
Definition: eval.c:55
static av_cold int dilate_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:255
static void erode_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg)
Definition: vf_libopencv.c:300
static av_cold int smooth_init(AVFilterContext *ctx, const char *args)
Definition: vf_libopencv.c:89

Definition at line 315 of file vf_libopencv.c.

const AVOption 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 },
}
const char * name
Definition: avisynth_c.h:675
#define FLAGS
Definition: vf_libopencv.c:382
#define OFFSET(x)
Definition: vf_libopencv.c:381
NULL
Definition: eval.c:55
const char const char * params
Definition: avisynth_c.h:675

Definition at line 383 of file vf_libopencv.c.