0

I want to convolute my image with a kernel that has the shape of a circle (not filled) using Emgu. I found the ConvolutionKernelF which suits my needs (Gaussian Noise in emgucv).

Does anybody know how I could draw a circle in this kernel? Without anti-aliasing that is. Another simple method do do a convolution with a circular kernel is also appreciated.

I tried this:

Image<Gray, float> kernel = new Image<Gray, float>(radius * 2 + 1, radius * 2 + 1);
kernel.Draw(new CircleF(new Point(radius, radius), radius), new Gray(1.0), 1);
ConvolutionKernelF ckernel = new ConvolutionKernelF(kernel.Data); // error
kernel.CopyTo(ckernel);

Unfortunatly, the third statement gives me:

Argument 1: cannot convert from 'float[*,*,*]' to 'float[*,*]'

In addition, it does'nt seem very efficient.

Cheers,

Tom

Community
  • 1
  • 1
Goosebumps
  • 919
  • 2
  • 14
  • 27

1 Answers1

0

Ok, i did it like this:

Image<Gray, float> kernel = new Image<Gray, float>(radius * 2 + 1, radius * 2 + 1);
kernel.Draw(new CircleF(new Point(radius, radius), radius), new Gray(1.0), 1);
CvInvoke.cvFilter2D(A, B, kernel, new Point(-1, -1));
Goosebumps
  • 919
  • 2
  • 14
  • 27