乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      SIFT特征提取

       quasiceo 2016-01-16
      標(biāo)簽: matlabimage
      2012-03-18 10:43 34643人閱讀 評(píng)論(36) 收藏 舉報(bào)
      分類:

      SIFT特征具有縮放、旋轉(zhuǎn)特征不變性,下載了大牛的matlab版SIFT特征提取代碼,解釋如下:

      1.調(diào)用方法:

      將文件加入matlab目錄后,在主程序中有兩種操作:

      op1:尋找圖像中的Sift特征:

      1. [image, descrips, locs] = sift('scene.pgm');   
      2. showkeys(image, locs);  

      op2:對(duì)兩幅圖中的SIFT特征進(jìn)行匹配:

      1. match('scene.pgm','book.pgm');  


      由于scene和book兩圖中有相同的一本書(shū),但orientation和size都不同,可以發(fā)現(xiàn)所得結(jié)果中Sift特征檢測(cè)結(jié)果非常好。


      2.代碼下載地址:

      http://www.cs./~lowe/keypoints/
      3.想用自己的圖片進(jìn)行調(diào)用:
      1. i1=imread('D:\Images\New\Cars\image_0001.jpg');  
      2. i2=imread('D:\Images\New\Cars\image_0076.jpg');  
      3. i11=rgb2gray(i1);  
      4. i22=rgb2gray(i2);  
      5. imwrite(i11,'v1.jpg','quality',80);  
      6. imwrite(i22,'v2.jpg','quality',80);  
      7. match('v1.jpg','v2.jpg');  
      experiment results:
      
      
      scene

      book

      compare_result

      compare result

      EXP2:

      未找到匹配特征的兩幅圖



      C代碼:

      1. // FeatureDetector.cpp : Defines the entry point for the console application.  
      2. //  
      3.   
      4. #include "stdafx.h"  
      5. #include "highgui.h"  
      6. #include "cv.h"  
      7. #include "vector"  
      8. #include "opencv\cxcore.hpp"  
      9. #include "iostream"  
      10. #include "opencv.hpp"  
      11. #include "nonfree.hpp"  
      12. #include "showhelper.h"  
      13.   
      14. using namespace cv;  
      15. using namespace std;  
      16.   
      17. int _tmain(int argc, _TCHAR* argv[])  
      18. {  
      19.     //Load Image   
      20.     Mat c_src1 =  imread( "..\\Images\\3.jpg");  
      21.     Mat c_src2 = imread("..\\Images\\4.jpg");  
      22.     Mat src1 = imread( "..\\Images\\3.jpg", CV_LOAD_IMAGE_GRAYSCALE);  
      23.     Mat src2 = imread( "..\\Images\\4.jpg", CV_LOAD_IMAGE_GRAYSCALE);  
      24.     if( !src1.data || !src2.data )  
      25.     { std::cout<< " --(!) Error reading images " << std::endl; return -1; }  
      26.   
      27.     //sift feature detect  
      28.     SiftFeatureDetector detector;  
      29.     std::vector<KeyPoint> kp1, kp2;  
      30.   
      31.     detector.detect( src1, kp1 );  
      32.     detector.detect( src2, kp2 );  
      33.     SiftDescriptorExtractor extractor;  
      34.     Mat des1,des2;//descriptor  
      35.     extractor.compute(src1,kp1,des1);  
      36.     extractor.compute(src2,kp2,des2);     
      37.     Mat res1,res2;   
      38.     int drawmode = DrawMatchesFlags::DRAW_RICH_KEYPOINTS;  
      39.     drawKeypoints(c_src1,kp1,res1,Scalar::all(-1),drawmode);//在內(nèi)存中畫(huà)出特征點(diǎn)  
      40.     drawKeypoints(c_src2,kp2,res2,Scalar::all(-1),drawmode);  
      41.     cout<<"size of description of Img1: "<<kp1.size()<<endl;  
      42.     cout<<"size of description of Img2: "<<kp2.size()<<endl;  
      43.   
      44.     BFMatcher matcher(NORM_L2);  
      45.     vector<DMatch> matches;  
      46.     matcher.match(des1,des2,matches);  
      47.     Mat img_match;  
      48.     drawMatches(src1,kp1,src2,kp2,matches,img_match);//,Scalar::all(-1),Scalar::all(-1),vector<char>(),drawmode);  
      49.     cout<<"number of matched points: "<<matches.size()<<endl;  
      50.     imshow("matches",img_match);  
      51.     cvWaitKey();  
      52.     cvDestroyAllWindows();  
      53.   
      54.     return 0;  
      55. }  


      Python代碼:

      http://blog.csdn.net/abcjennifer/article/details/7639681



      關(guān)于sift的其他講解:

      http://blog.csdn.net/abcjennifer/article/details/7639681

      http://blog.csdn.net/abcjennifer/article/details/7372880

      http://blog.csdn.net/abcjennifer/article/details/7365882



        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多