Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
T-API python support implemented #6078
New tests covers: ORB, BFMatcher, goodFeaturesToTrack, calcOpticalFlowPyrLK
NB: effective support for
Example of usage:
ps, descs_umat = orb.detectAndCompute(cv2.UMat(img), None) descs = descs_umat.get() matcher = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True) res = matcher.match(descs_umat, descs_umat)
For more you can see tests.
@vpisarev There is an example of generated wrappers:
UMat code path is used as a fallback if some parameters can't be used as Mat objects or invalid. It is not very effective, but it should not introduce significant performance impact to the original "Mat"-like code. Also there is no mixing of UMat/Mat object types (
It has no performance impact on usages without UMat (in case of single-signature functions). And in case of multiple-signature functions this pattern already used:
So if user does not now about T-API it will not see any difference on usage or performance.
If user wants to use T-API - he just passes one of params wrapped with cv2.UMat(param), and unwrap results when he needs them.
The alternative is to write accurate
Python style is to return results via returned tuple, not via arguments, so user have no possibility to specify result type. I don't see problems here.
Tests implementing for Python is complicated - you can not just call function in old way and in new way with different params wrapped with UMat, and then compare results for equality - because:
Is it bad in some way? User still can mix them on his python side.
referenced this pull request
Oct 5, 2016
@PolarNick239, sorry for a huge delay. And big thanks for the contribution! Let's finally merge it in! I'm not completely happy with some of the decisions; in particular, I'd rather convert numpy array to cv::Mat and cv2.UMat to cv::UMat, then wrap it into InputArray/OutputArray and then let the function decide what to do with mixed-type arguments. But the proposed solution looks good enough to be merged. We can refine it further. Once again, thank you for the contribution!
Oct 5, 2016
1 check passed
I am new to using github and openCV.
PS: The original error that I was getting was for :
flann = cv2.FlannBasedMatcher(index_params,search_params)
the des1 and des2 are SIFT descriptors.
Also , I tried setting openCL(False) but the error "data should be normally NULL" didn't go for me.