https://qiita.com/mt08/items/e8e8e728cf106ac83218#comment-dbe1ad502bf526744ab5
での確認で、このサンプルを試しました。
環境
- Raspberry Pi 3B
- Raspbian: 2019-04-08-raspbian-stretch (デスクトップ環境)
- OpenCV 3.4.6 (ラズパイ3にOpenCV3/4を簡単に導入より)
手順
- ラズパイ等の準備 ... (省略)
-
サンプルで使用する画像データ取得
pi@raspberrypi:~ $ # Sample Data pi@raspberrypi:~ $ wget -q https://github.com/opencv/opencv/raw/master/samples/data/box.png pi@raspberrypi:~ $ wget -q https://github.com/opencv/opencv/raw/master/samples/data/box_in_scene.png
-
--feature=brisk
にてpi@raspberrypi:~ $ python3 /usr/local/share/OpenCV/samples/python/find_obj.py --feature=brisk box.png box_in_scene.png Feature-based image matching sample. Note, that you will need the https://github.com/opencv/opencv_contrib repo for SIFT and SURF USAGE find_obj.py [--feature=<sift|surf|orb|akaze|brisk>[-flann]] [ <image1> <image2> ] --feature - Feature to use. Can be sift, surf, orb or brisk. Append '-flann' to feature name to use Flann-based matcher instead bruteforce. Press left mouse button on a feature point to see its matching point. using brisk img1 - 1662 features, img2 - 2786 features matching... 50 / 52 inliers/matched Done pi@raspberrypi:~ $
その他
-
--feature=sirf
や--feature=surf
ここで配布しているラズパイ向けパッケージでは、ビルドに含まれていないのでエラーとなります。
(-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'
ぐーぐる先生翻訳:
(-213:機能/機能は実装されていません) このアルゴリズムは特許取得済みで、この構成では除外されています。
OPENCV_ENABLE_NONFREE
CMakeオプションを設定し、関数 'create'でライブラリを再構築します実行例pi@raspberrypi:~ $ python3 /usr/local/share/OpenCV/samples/python/find_obj.py --feature=sift box.png box_in_scene.png Feature-based image matching sample. Note, that you will need the https://github.com/opencv/opencv_contrib repo for SIFT and SURF USAGE find_obj.py [--feature=<sift|surf|orb|akaze|brisk>[-flann]] [ <image1> <image2> ] --feature - Feature to use. Can be sift, surf, orb or brisk. Append '-flann' to feature name to use Flann-based matcher instead bruteforce. Press left mouse button on a feature point to see its matching point. Traceback (most recent call last): File "/usr/local/share/OpenCV/samples/python/find_obj.py", line 195, in <module> main() File "/usr/local/share/OpenCV/samples/python/find_obj.py", line 154, in main detector, matcher = init_feature(feature_name) File "/usr/local/share/OpenCV/samples/python/find_obj.py", line 32, in init_feature detector = cv.xfeatures2d.SIFT_create() cv2.error: OpenCV(3.4.6) /home/pi/opencv_contrib-3.4.6/modules/xfeatures2d/src/sift.cpp:1205: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create' pi@raspberrypi:~ $
OPENCV_ENABLE_NONFREE
は今度ためしてみようかと思いますが、公に配布はどうなんでしょう?