• 大小: 20.04M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-28
  • 语言: 其他
  • 标签: 其他  

资源简介

LearningOpenCV_Code.rar

资源截图

代码片段和文件信息

// Example 10-1. Pyramid Lucas-Kanade optical flow code
//
/* *************** License:**************************
   Oct. 3 2008
   Right to use this code in any way you want without warrenty support or any guarentee of it working.

   BOOK: It would be nice if you cited it:
   Learning OpenCV: Computer Vision with the OpenCV Library
     by Gary Bradski and Adrian Kaehler
     Published by O‘Reilly Media October 3 2008
 
   AVAILABLE AT: 
     http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134
     Or: http://oreilly.com/catalog/9780596516130/
     ISBN-10: 0596516134 or: ISBN-13: 978-0596516130    

   OTHER OPENCV SITES:
   * The source code is on sourceforge at:
     http://sourceforge.net/projects/opencvlibrary/
   * The OpenCV wiki page (As of Oct 1 2008 this is down for changing over servers but should come back):
     http://opencvlibrary.sourceforge.net/
   * An active user group is at:
     http://tech.groups.yahoo.com/group/OpenCV/
   * The minutes of weekly OpenCV development meetings are at:
     http://pr.willowgarage.com/wiki/OpenCV
   ************************************************** */

#include 
#include 
#include 
#include 

const int MAX_CORNERS = 500;
int main(int argc char** argv) {
   // Initialize load two images from the file system and
   // allocate the images and other structures we will need for
   // results.
//
IplImage* imgA = cvLoadImage(“OpticalFlow0.jpg“CV_LOAD_IMAGE_GRAYSCALE);
IplImage* imgB = cvLoadImage(“OpticalFlow1.jpg“CV_LOAD_IMAGE_GRAYSCALE);
CvSize      img_sz    = cvGetSize( imgA );
int         win_size = 10;
IplImage* imgC = cvLoadImage(“OpticalFlow1.jpg“CV_LOAD_IMAGE_UNCHANGED);

// The first thing we need to do is get the features
// we want to track.
//
IplImage* eig_image = cvCreateImage( img_sz IPL_DEPTH_32F 1 );
IplImage* tmp_image = cvCreateImage( img_sz IPL_DEPTH_32F 1 );
int              corner_count = MAX_CORNERS;
CvPoint2D32f* cornersA        = new CvPoint2D32f[ MAX_CORNERS ];
cvGoodFeaturesToTrack(
imgA
eig_image
tmp_image
cornersA
&corner_count
0.01
5.0
0
3
0
0.04
);
cvFindCornerSubPix(
imgA
cornersA
corner_count
cvSize(win_sizewin_size)
cvSize(-1-1)
cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS200.03)
);
// Call the Lucas Kanade algorithm
//
char features_found[ MAX_CORNERS ];
float feature_errors[ MAX_CORNERS ];
CvSize pyr_sz = cvSize( imgA->width+8 imgB->height/3 );
IplImage* pyrA = cvCreateImage( pyr_sz IPL_DEPTH_32F 1 );
  IplImage* pyrB = cvCreateImage( pyr_sz IPL_DEPTH_32F 1 );
  CvPoint2D32f* cornersB        = new CvPoint2D32f[ MAX_CORNERS ];
  cvCalcOpticalFlowPyrLK(
     imgA
     imgB
     pyrA
     pyrB
     cornersA
     cornersB
     corner_count
     cvSize( win_sizewin_size )
     5
     features_found
     feature_errors
     cvTermCriteria( CV_TERMCRIT_ITER | CV_TERMCRIT_EPS 20 .3 )
     0
  );
  /

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6148  2008-10-07 15:10  LearningOpenCV_Code\.DS_Store

     文件     189623  2008-10-07 10:00  LearningOpenCV_Code\adrian.jpg

     文件     373704  2008-10-07 10:00  LearningOpenCV_Code\agaricus-lepiota.data

     文件       6148  2008-10-07 15:08  LearningOpenCV_Code\birdseye\.DS_Store

     文件     317775  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0214.jpg

     文件     317832  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0214L.jpg

     文件     325383  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0215.jpg

     文件     325446  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0215L.jpg

     文件     302958  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0217.jpg

     文件     302321  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0217L.jpg

     文件     296209  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0218.jpg

     文件     295342  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0218L.jpg

     文件     297508  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0219.jpg

     文件     297073  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0219L.jpg

     文件     348274  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0220.jpg

     文件     348262  2008-10-07 10:00  LearningOpenCV_Code\birdseye\IMG_0220L.jpg

     文件       5237  2008-10-07 10:00  LearningOpenCV_Code\BlueCup.jpg

     文件     463757  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0191.jpg

     文件     407260  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0192.jpg

     文件     447239  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0193.jpg

     文件     451479  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0194.jpg

     文件     490611  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0195.jpg

     文件     450338  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0196.jpg

     文件     433052  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0197.jpg

     文件     429153  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0198.jpg

     文件     431073  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0199.jpg

     文件     457885  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0200.jpg

     文件     465117  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0201.jpg

     文件     466802  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0202.jpg

     文件     502801  2008-10-07 10:00  LearningOpenCV_Code\calibration\IMG_0203.jpg

............此处省略149个文件信息

评论

共有 条评论