floodfill documentation 2.4.5 (Feature #2942)
Description
The documentation for floodfill at http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#floodfill shows there is an option to modify just a mask, but does not indicate how to set the value to fill the mask with. The documentation makes it seem like the Scalar newVal is used in some cases, and not in others, but never explicitly indicates what is used in the "others" case.
The function actually decodes the value from the upper 8 bits of the flags, so for instance if you wanted to set values in the mask to 255 then you'd set flags = (255 << 8).
Especially for programmers who aren't aware that << can be used with things other than insertion this is very confusing.
I believe the following section:
FLOODFILL_MASK_ONLY If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only.
Should be changed to something like:
FLOODFILL_MASK_ONLY If set, the function does not change the image ( newVal is ignored), but fills the mask with the value in the upper 8 bits of the flags. The flag can be used for the second variant only.
Or better yet it should just use newVal, which would be the expected behavior.
Associated revisions
doc: update/clarify behaviour of mask in floodFill
Clarify how the mask parameter is set on output and how this is
affected by the flags parameter.
resolves Feature #2942
Merge pull request #2942 from ernest-galbrun:tvl1_chambolle
History
Updated by Maria Dimashova almost 12 years ago
Can you please prepare and open a pull request on OpenCV github
It's probably the fastest way to apply your suggestions.
Updated by Vladislav Vinogradov almost 11 years ago
The fix was merged into 2.4 branch.
Kevin Mitchell, thank you for contribution!
- Status changed from Open to Done
- Target version changed from 3.0 to 2.4.10
- Pull request set to https://github.com/Itseez/opencv/pull/2738