粗大メモ置き場

個人用,たまーに来訪者を意識する雑記メモ

Python3 "too many values to unpack (expected 2)" in feature detector in OpenCV3

There are many differences between Python2.x and Python3.x.
Also, OpenCV has many changes from opencv2.x to opencv3.x.

Detect ORB feature and matching (Python3,Opencv3)

Following code may be valid in opencv2

kp1,des1 = detector.detect(img1)
kp2,des2 = detector.detect(img2)

But it results in the error:
"too many values to unpack (expected 2)".
In opencv3, you should write as following:

kp1,des1 = detector.detectAndCompute(img1)
kp2,des2 = detector.detectAndCompute(img2)

Refferd(Japanese)
OpenCV3とPython3で特徴点を抽出する(AgastFeature, FAST, GFTT, MSER, AKAZE, BRISK, KAZE, ORB, SimpleBlob, SIFT) - Qiita

The other famous difference between opencv2 and 3 is the place of the package SIFT and SURF.

See
OpenCV 3でPythonからSIFT - danglingfarpointer's memoization


Hope this article will solve your problem.