Converting between Python/None <=> Julia/nothing seems like something that PyCall should maybe do since they are pretty much equivalent. Maybe open an issue here: https://github.com/stevengj/PyCall.jl?
On Fri, Jun 17, 2016 at 3:58 PM, Gabriel Gellner <[email protected]> wrote: > Have you tried passing `:none` in the argument list. I find that PyCall > does the correct conversion on the symbol. > > > On Friday, June 17, 2016 at 11:42:32 AM UTC-7, I Ce wrote: >> >> I am using PyCalland @pyimport cv2 to implement an OpenCV >> feature-matching program in Julia. >> >> >> I have an example of the code I want to use in *Python* (see *Brute-Force >> Matching with SIFT Descriptors and Ratio Test* in this link: >> http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html >> for >> the full Python code.) >> >> >> Everything up to the point of drawMatchesKnn() works fine, but I have >> issues with the outImg argument when converting to Julia. >> >> >> Documentation for drawMatchesKnn() is pasted below: >> (and can also be found here: >> >> http://docs.opencv.org/3.0-beta/modules/features2d/doc/drawing_function_of_keypoints_and_matches.html#drawmatches >> >> >> Python: cv2.drawMatchesKnn(img1, keypoints1, img2, keypoints2, >> matches1to2[, outImg[, matchColor[, singlePointColor[, matchesMask[, >> flags]]]]]) → outImg >> >> Parameter description: >> >> - img1 – First source image. >> - keypoints1 – Keypoints from the first source image. >> - img2 – Second source image. >> - keypoints2 – Keypoints from the second source image. >> - matches1to2 – Matches from the first image to the second one, which >> means that keypoints1[i] has a corresponding point in >> keypoints2[matches[i]] . >> - outImg – Output image. Its content depends on the flags value >> defining what is drawn in the output image. See possible flags bit values >> below. >> - matchColor – Color of matches (lines and connected keypoints). If >> matchColor==Scalar::all(-1) , the color is generated randomly. >> - singlePointColor – Color of single keypoints (circles), which means >> that keypoints do not have the matches. If >> singlePointColor==Scalar::all(-1) , the color is generated randomly. >> - matchesMask – Mask determining which matches are drawn. If the mask >> is empty, all matches are drawn. >> - flags – Flags setting drawing features. Possible flags bit values >> are defined by DrawMatchesFlags. >> >> As you can see from the sample program, the drawMatchesKnn() line in >> Python would look like this: >> img3 = cv2.drawMatchesKnn(train,kp1,query,kp2,good,None,flags=2) (the >> key argument is argument 6, specified as "None") >> >> >> I'm having problems because I don't really know what an equivalent, >> working example in Julia would be. >> >> >> >> I tried this: >> img3 = cv2.drawMatchesKnn(train,kp1,query,kp2,good) >> >> And got this error: (so arg6 is required) >> >> LoadError: PyError (:PyObject_Call) <type 'exceptions.TypeError'> >> TypeError("Required argument 'outImg' (pos 6) not found",) >> >> >> >> This: (passing the scalar value 0, which worked for the method >> drawKeyPoints() in another program) >> img3 = cv2.drawMatchesKnn(train,kp1,query,kp2,good,0,flags=2) >> >> and got this error: >> >> LoadError: PyError (:PyObject_Call) <type 'exceptions.SystemError'> >> SystemError('NULL result without error in PyObject_Call',) >> >> >> >> and this: >> img3 = cv2.drawMatchesKnn(train,kp1,query,kp2,good,nothing,flags=2) >> >> and got this error: >> >> LoadError: PyError (:PyObject_Call) <type 'exceptions.SystemError'> >> SystemError('NULL result without error in PyObject_Call',) >> >> >> Seems tricky to me because None in Python and nothing in Julia do not >> appear to behave the same way. >> >> >> Anything else I could try? What could the problem be, and how can I fix >> it? >> >> >> Thanks for reading! >> Any help is much appreciated. >> >
