Passing a class as IntPtr

196 views Asked by At

I am using the Emgu CV when I come across this code:

Image<Bgr, byte> image = new Image<Bgr, byte>("test.jpg");
Image<Bgr, byte> image2 = new Image<Bgr, byte>("test2.jpg");
CvInvoke.cvSmooth(image, image2, SMOOTH_TYPE.CV_GAUSSIAN, 5, 5, 9, 9);

According to the definition of cvSmooth(), the first 2 parameters are IntPtr.

My question is that why is it valid to pass in a type of Image<Bgr, byte> into this?

1

There are 1 answers

3
RadioSpace On

looks like Image<TColor,TDepth> has a Ptr property

Ptr

Image

I would change your code to read

Image<Bgr, byte> image = new Image<Bgr, byte>("test.jpg");
Image<Bgr, byte> image2 = new Image<Bgr, byte>("test2.jpg");
CvInvoke.cvSmooth(image.Ptr, image2.Ptr, SMOOTH_TYPE.CV_GAUSSIAN, 5, 5, 9, 9);

what version are you working with? I just went with the "Stable" version to find the docs