26 #include <opencv/cv.h> 
   27 #include <opencv/cxcore.h> 
   40     int depth, channels_nb;
 
   43     else if (pixfmt == 
AV_PIX_FMT_BGRA)  { depth = IPL_DEPTH_8U;  channels_nb = 4; }
 
   44     else if (pixfmt == 
AV_PIX_FMT_BGR24) { depth = IPL_DEPTH_8U;  channels_nb = 3; }
 
   47     tmpimg = cvCreateImageHeader((CvSize){frame->
width, frame->
height}, 
depth, channels_nb);
 
   49     img->imageData = img->imageDataOrigin = frame->
data[0];
 
   50     img->dataOrder = IPL_DATA_ORDER_PIXEL;
 
   51     img->origin    = IPL_ORIGIN_TL;
 
   58     frame->
data[0]     = img->imageData;
 
   91     char type_str[128] = 
"gaussian";
 
   99         sscanf(args, 
"%127[^|]|%d|%d|%lf|%lf", type_str, &smooth->
param1, &smooth->
param2, &smooth->
param3, &smooth->
param4);
 
  101     if      (!strcmp(type_str, 
"blur"         )) smooth->
type = CV_BLUR;
 
  102     else if (!strcmp(type_str, 
"blur_no_scale")) smooth->
type = CV_BLUR_NO_SCALE;
 
  103     else if (!strcmp(type_str, 
"median"       )) smooth->
type = CV_MEDIAN;
 
  104     else if (!strcmp(type_str, 
"gaussian"     )) smooth->
type = CV_GAUSSIAN;
 
  105     else if (!strcmp(type_str, 
"bilateral"    )) smooth->
type = CV_BILATERAL;
 
  113                "Invalid value '%d' for param1, it has to be a positive odd number\n",
 
  117     if ((smooth->
type == CV_BLUR || smooth->
type == CV_BLUR_NO_SCALE || smooth->
type == CV_GAUSSIAN) &&
 
  120                "Invalid value '%d' for param2, it has to be zero or a positive odd number\n",
 
  144     if ((ret = 
av_file_map(filename, &buf, &size, 0, log_ctx)) < 0)
 
  149     for (i = 0; i < 
size; i++) {
 
  150         if (buf[i] == 
'\n') {
 
  151             if (*rows == INT_MAX) {
 
  156             *cols = 
FFMAX(*cols, w);
 
  158         } 
else if (w == INT_MAX) {
 
  164     if (*rows > (SIZE_MAX / 
sizeof(
int) / *cols)) {
 
  169     if (!(*values = 
av_mallocz(
sizeof(
int) * *rows * *cols)))
 
  175     for (i = 0; i < *rows; i++) {
 
  177             if (p > pend || *p == 
'\n') {
 
  181                 (*values)[*cols*i + j] = !!
av_isgraph(*(p++));
 
  191         for (i = 0; i < *rows; i++) {
 
  192             for (j = 0; j < *cols; j++)
 
  193                 line[j] = (*values)[i * *cols + j] ? 
'@' : 
' ';
 
  206     char shape_filename[128] = 
"", shape_str[32] = 
"rect";
 
  207     int cols = 0, rows = 0, anchor_x = 0, anchor_y = 0, shape = CV_SHAPE_RECT;
 
  208     int *values = NULL, 
ret;
 
  210     sscanf(buf, 
"%dx%d+%dx%d/%32[^=]=%127s", &cols, &rows, &anchor_x, &anchor_y, shape_str, shape_filename);
 
  212     if      (!strcmp(shape_str, 
"rect"   )) shape = CV_SHAPE_RECT;
 
  213     else if (!strcmp(shape_str, 
"cross"  )) shape = CV_SHAPE_CROSS;
 
  214     else if (!strcmp(shape_str, 
"ellipse")) shape = CV_SHAPE_ELLIPSE;
 
  215     else if (!strcmp(shape_str, 
"custom" )) {
 
  216         shape = CV_SHAPE_CUSTOM;
 
  221                "Shape unspecified or type '%s' unknown.\n", shape_str);
 
  225     if (rows <= 0 || cols <= 0) {
 
  227                "Invalid non-positive values for shape size %dx%d\n", cols, rows);
 
  231     if (anchor_x < 0 || anchor_y < 0 || anchor_x >= cols || anchor_y >= rows) {
 
  233                "Shape anchor %dx%d is not inside the rectangle with size %dx%d.\n",
 
  234                anchor_x, anchor_y, cols, rows);
 
  238     *kernel = cvCreateStructuringElementEx(cols, rows, anchor_x, anchor_y, shape, values);
 
  244            rows, cols, anchor_x, anchor_y, shape_str);
 
  257     char default_kernel_str[] = 
"3x3+0x0/rect";
 
  265         kernel_str = 
av_strdup(default_kernel_str);
 
  288     cvReleaseStructuringElement(&dilate->
kernel);
 
  330         if (!strcmp(s->
name, entry->
name)) {
 
  360     IplImage inimg, outimg;
 
  379 #define OFFSET(x) offsetof(OCVContext, x) 
  380 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM 
  411     .priv_class = &ocv_class,
 
  417     .
inputs    = avfilter_vf_ocv_inputs,
 
  419     .
outputs   = avfilter_vf_ocv_outputs,