文档源代码opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope
生活随笔
收集整理的這篇文章主要介紹了
文档源代码opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本篇文章朋友在青島游玩的時候突然想到的...最近就有想寫幾篇關于文檔源代碼的文章,所以回家到之后就奮筆疾書的寫出來發布了
????
????這是文檔中的源代碼,:但是譯編的時候會有一下錯誤:
????error: ‘SurfFeatureDetector’ was not declared in this scope
#include <stdio.h> #include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp"using namespace cv;void readme();/** @function main */ int main( int argc, char** argv ) {if( argc != 3 ){ readme(); return -1; }Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );if( !img_1.data || !img_2.data ){ std::cout<< " --(!) Error reading images " << std::endl; return -1; }//-- Step 1: Detect the keypoints using SURF Detectorint minHessian = 400;SurfFeatureDetector detector( minHessian );std::vector<KeyPoint> keypoints_1, keypoints_2;detector.detect( img_1, keypoints_1 );detector.detect( img_2, keypoints_2 );//-- Draw keypointsMat img_keypoints_1; Mat img_keypoints_2;drawKeypoints( img_1, keypoints_1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags::DEFAULT );drawKeypoints( img_2, keypoints_2, img_keypoints_2, Scalar::all(-1), DrawMatchesFlags::DEFAULT );//-- Show detected (drawn) keypointsimshow("Keypoints 1", img_keypoints_1 );imshow("Keypoints 2", img_keypoints_2 );waitKey(0);return 0;}/** @function readme */void readme(){ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; } 每日一道理共和國迎來了她五十誕辰。五十年像一條長河,有急流也有緩流;五十年像一幅長卷,有冷色也有暖色;五十年像一首樂曲,有低音也有高音;五十年像一部史詩,有痛苦也有歡樂。長河永遠奔流,畫卷剛剛展開,樂曲漸趨高潮,史詩還在續寫。我們的共和國正邁著堅定的步伐,跨入新時代。
????加上這兩個頭文件就能夠了.
????
????
#include <opencv2/nonfree/features2d.hpp>????
#include <opencv2/nonfree/nonfree.hpp>????
文章結束給大家分享下程序員的一些笑話語錄: 古鴿是一種搜索隱禽,在中國快絕跡了…初步的研究表明,古鴿的離去,很可能導致另一種長著熊爪,酷似古鴿,卻又習性不同的猛禽類——犤毒鳥
轉載于:https://www.cnblogs.com/xinyuyuanm/archive/2013/04/22/3036477.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的文档源代码opencv 中的错误error: ‘SurfFeatureDetector’ was not declared in this scope的全部內容,希望文章能夠幫你解決所遇到的問題。