本文整理汇总了C++中OCVContext类的典型用法代码示例。如果您正苦于以下问题:C++ OCVContext类的具体用法?C++ OCVContext怎么用?C++ OCVContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OCVContext类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
static av_cold int init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
char name[128], priv_args[1024];
int i;
char c;
sscanf(args, "%127[^=:]%c%1023s", name, &c, priv_args);
for (i = 0; i < FF_ARRAY_ELEMS(ocv_filter_entries); i++) {
OCVFilterEntry *entry = &ocv_filter_entries[i];
if (!strcmp(name, entry->name)) {
ocv->name = entry->name;
ocv->init = entry->init;
ocv->uninit = entry->uninit;
ocv->end_frame_filter = entry->end_frame_filter;
if (!(ocv->priv = av_mallocz(entry->priv_size)))
return AVERROR(ENOMEM);
return ocv->init(ctx, priv_args);
}
}
av_log(ctx, AV_LOG_ERROR, "No libopencv filter named '%s'\n", name);
return AVERROR(EINVAL);
}
示例2: init
static av_cold int init(AVFilterContext *ctx)
{
OCVContext *s = ctx->priv;
int i;
if (!s->name) {
av_log(ctx, AV_LOG_ERROR, "No libopencv filter name specified\n");
return AVERROR(EINVAL);
}
for (i = 0; i < FF_ARRAY_ELEMS(ocv_filter_entries); i++) {
const OCVFilterEntry *entry = &ocv_filter_entries[i];
if (!strcmp(s->name, entry->name)) {
s->init = entry->init;
s->uninit = entry->uninit;
s->end_frame_filter = entry->end_frame_filter;
if (!(s->priv = av_mallocz(entry->priv_size)))
return AVERROR(ENOMEM);
return s->init(ctx, s->params);
}
}
av_log(ctx, AV_LOG_ERROR, "No libopencv filter named '%s'\n", s->name);
return AVERROR(EINVAL);
}
示例3: uninit
static av_cold void uninit(AVFilterContext *ctx)
{
OCVContext *s = ctx->priv;
if (s->uninit)
s->uninit(ctx);
av_freep(&s->priv);
}
示例4: uninit
static av_cold void uninit(AVFilterContext *ctx)
{
OCVContext *ocv = ctx->priv;
if (ocv->uninit)
ocv->uninit(ctx);
av_free(ocv->priv);
memset(ocv, 0, sizeof(*ocv));
}
示例5: end_frame
static void end_frame(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
OCVContext *ocv = ctx->priv;
AVFilterLink *outlink= inlink->dst->outputs[0];
AVFilterBufferRef *inpicref = inlink ->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf;
IplImage inimg, outimg;
fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
ocv->end_frame_filter(ctx, &inimg, &outimg);
fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
avfilter_unref_buffer(inpicref);
avfilter_draw_slice(outlink, 0, outlink->h, 1);
avfilter_end_frame(outlink);
avfilter_unref_buffer(outpicref);
}
示例6: end_frame
static int end_frame(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
OCVContext *ocv = ctx->priv;
AVFilterLink *outlink= inlink->dst->outputs[0];
AVFilterBufferRef *inpicref = inlink ->cur_buf;
AVFilterBufferRef *outpicref = outlink->out_buf;
IplImage inimg, outimg;
int ret;
fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
ocv->end_frame_filter(ctx, &inimg, &outimg);
fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
if ((ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
(ret = ff_end_frame(outlink)) < 0)
return ret;
return 0;
}
示例7: filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext *ctx = inlink->dst;
OCVContext *ocv = ctx->priv;
AVFilterLink *outlink= inlink->dst->outputs[0];
AVFrame *out;
IplImage inimg, outimg;
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
fill_iplimage_from_frame(&inimg , in , inlink->format);
fill_iplimage_from_frame(&outimg, out, inlink->format);
ocv->end_frame_filter(ctx, &inimg, &outimg);
fill_frame_from_iplimage(out, &outimg, inlink->format);
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}