Ask Your Question

Which other values does the anchor point in blur function take?

asked 2013-05-23 04:01:20 -0600

muglikar gravatar image

updated 2013-06-12 03:34:23 -0600

This link says:

anchor – anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.

I could change this value to (0,0) and it worked with the image slightly shifted to top left. But it did not work for any other value i.e. it gives Unhandled Exception (Unhandled exception at 0x75d8d36f in testCV.exe: Microsoft C++ exception: cv::Exception at memory location 0x0020ee6c..) for any other value of the coordinates of the anchor point. So, I'm a bit unclear about what does it exactly mean?

blur(src, dst, Size(i, i), Point( 2, 2 )); // The point takes on (0,0) & (-1,-1) values for now. Why???

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2019-09-11 10:59:23 -0600

Freeman gravatar image

The anchor point indicates how the kernel is aligned with the source image. cv::point(-1-1) indicates that the anchor is at the kernel center, i.e., it is equivalent to kernelWidth/2 and kernelHeight/2. In my case, with a 3x3 kernel it works (does not crash) with anchor points from (0,0) to (2,2). In particular, with this way of calling:

cv::blur(src,t1, cv::Size(3,3), cv::Point(2,2));

In this call the anchor is cv::Point(2,2) and so the filter weighted average takes values from the current pixels and from up to 2 left and and upper pixels.

edit flag offensive delete link more

answered 2013-05-23 04:47:44 -0600

Notas gravatar image

sigh What does "did not work" mean? Did the program crash? What kernel did you even use? I guess it was a 1x1 one, hence only (0,0) worked.

edit flag offensive delete link more

Question Tools


Asked: 2013-05-23 04:01:20 -0600

Seen: 1,535 times

Last updated: Sep 11 '19