我正在尝试使用opencv中的SurfFeatureDetector来检测关键点,不幸的是它不能正常工作。任何人都知道为什么?
这是我的代码的和平:
import numpy as np
import cv2
from matplotlib import pyplot as plt
img1 = imread("C:/Work/Python/in/150903_090428_Image007.jpg", CV_LOAD_IMAGE_GRAYSCALE);
img2 = imread("C:/Work/Python/in/150903_094605_Image003.jpg", CV_LOAD_IMAGE_GRAYSCALE);
#detecting keypoints
SurfFeatureDetector detector(400);
vector<KeyPoint> keypoints1, keypoints2;
detector.detect(img1, keypoints1);
detector.detect(img2, keypoints2);
这是我的错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Magda\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Users\Magda\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Work/Python/in/Images_manipulation_v3.py", line 9
SurfFeatureDetector detector(400);
^
SyntaxError: invalid syntax
>>>
我正在使用OpenCV 2.4.9,Visual Studio 2013,| Anaconda 2.3.0(64位)和Python 2.7.10,Windows 10。