Dark Star1
Dark Star1

Reputation: 7413

why is the 3rd argument to cv::Dilate failing?

I am testing out erode and dilate functions in openCV2.2 but compilation fails because of the 3rd argument when I pass the following line:

dilate(gscaleImage, gscaleImage, 0, 18 );

can anyone shed a light on this for me please as this is how they've been coded in the examples. Thanks

Upvotes: 0

Views: 742

Answers (2)

bersi
bersi

Reputation: 66

OpenCV has both C and C++ interfaces. You're calling the C++ function cv::dilate but, judging by the arguments, it was actually meant to be cvDilate from the old-style C interface.

Upvotes: 1

Blender
Blender

Reputation: 298562

From the OpenCV Documentation (sorry for the formatting):

void dilate(const Mat& src, Mat& dst, const Mat& element, Point anchor=Point(-1, -1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar& borderValue=morphologyDefaultBorderValue())

The third argument is const Mat& element, which is definitely not an int like 0. What exactly are you trying to accomplish?

For iterations, I'd do:

dilate(gscaleImage, gscaleImage, 0, iterations = 18);

Upvotes: 1

Related Questions