Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positional Argument outImg Should Be Keyword Argument in cv2.drawMatches #14461

Open
zhanwenchen opened this issue Apr 30, 2019 · 1 comment
Open

Comments

@zhanwenchen
Copy link

zhanwenchen commented Apr 30, 2019

System information (version)
  • OpenCV => 4.0.1
  • Operating System / Platform => MacOS 10.14 Mojave
  • Compiler => XCode 10.1
Detailed description

The docstring says

drawMatches(...)
drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg[, matchColor[, singlePointColor[, matchesMask[, flags]]]]) ->

@param outImg Output image. Its content depends on the flags value defining what is drawn in the output image. See possible flags bit values below.

But it doesn't mention that passing None would actually eliminate the need to instantiate a placeholder image to draw on, which would otherwise be quite the task in itself - how would one even calculate the output size of a feature-matched pair of images with lines?

Either way, the actual behavior of the outImg positional argument is exactly what a Python kwarg is meant to do. Please implement this breaking change (breaking changes are necessary in software development).

See this StackOverflow thread for the confusion this has caused.

Steps to reproduce
import cv2
cv2.drawMatchesKnn(img1, kp1, img2, kp2, matches, None)
@alalek
Copy link
Member

alalek commented Apr 30, 2019

OpenCV is C++ library. Python bindings are generated from C++ code and these "docstring"s are come from C++ code. Including documentation.

"None" means that there is no pre-allocated output (like slice from larger numpy array).
I believe this function is fully usable.

Feel free to prepare patch with adding of documentation @note for Python users here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants