Mercurial > hg > nsaunier > traffic-intelligence
comparison c/cvutils.cpp @ 407:5eeb3b9fb568
commented problem code (opencv 2.4.6)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 12 Aug 2013 22:50:42 -0400 |
| parents | 0089fb29cd26 |
| children | 1e3c7fe21a38 |
comparison
equal
deleted
inserted
replaced
| 406:37c7b46f6e21 | 407:5eeb3b9fb568 |
|---|---|
| 47 | 47 |
| 48 for (unsigned int i=0; i<kpts.size(); i++) | 48 for (unsigned int i=0; i<kpts.size(); i++) |
| 49 pts.push_back(kpts[i].pt); | 49 pts.push_back(kpts[i].pt); |
| 50 } | 50 } |
| 51 | 51 |
| 52 IplImage* allocateImage(const int& width, const int& height, const int& depth, const int& channels) { return ::allocateImage(cvSize(width, height), depth, channels);} | 52 // IplImage* allocateImage(const int& width, const int& height, const int& depth, const int& channels) { return ::allocateImage(cvSize(width, height), depth, channels);} |
| 53 | 53 |
| 54 IplImage* allocateImage(const CvSize& size, const int& depth, const int& channels) { | 54 // IplImage* allocateImage(const CvSize& size, const int& depth, const int& channels) { |
| 55 IplImage* image = cvCreateImage(size, depth, channels); | 55 // IplImage* image = cvCreateImage(size, depth, channels); |
| 56 | 56 |
| 57 if (!image) { | 57 // if (!image) { |
| 58 cerr << "Error: Couldn't allocate image. Out of memory?\n" << endl; | 58 // cerr << "Error: Couldn't allocate image. Out of memory?\n" << endl; |
| 59 exit(-1); | 59 // exit(-1); |
| 60 } | 60 // } |
| 61 | 61 |
| 62 return image; | 62 // return image; |
| 63 } | 63 // } |
| 64 | 64 |
| 65 int goToFrameNum(CvCapture* inputVideo, const int& currentFrameNum, const int& targetFrameNum) { | 65 // int goToFrameNum(CvCapture* inputVideo, const int& currentFrameNum, const int& targetFrameNum) { |
| 66 int frameNum = currentFrameNum; | 66 // int frameNum = currentFrameNum; |
| 67 if (currentFrameNum > targetFrameNum) { | 67 // if (currentFrameNum > targetFrameNum) { |
| 68 cerr << "Current frame number " << currentFrameNum << " is after the target frame number " << targetFrameNum << "." << endl; | 68 // cerr << "Current frame number " << currentFrameNum << " is after the target frame number " << targetFrameNum << "." << endl; |
| 69 } else if (currentFrameNum < targetFrameNum) { | 69 // } else if (currentFrameNum < targetFrameNum) { |
| 70 IplImage* frame = cvQueryFrame(inputVideo); | 70 // IplImage* frame = cvQueryFrame(inputVideo); |
| 71 frameNum++; | 71 // frameNum++; |
| 72 while (frame && frameNum<targetFrameNum) { | 72 // while (frame && frameNum<targetFrameNum) { |
| 73 frame = cvQueryFrame(inputVideo); | 73 // frame = cvQueryFrame(inputVideo); |
| 74 frameNum++; | 74 // frameNum++; |
| 75 } | 75 // } |
| 76 } | 76 // } |
| 77 | 77 |
| 78 return frameNum; | 78 // return frameNum; |
| 79 } | 79 // } |
| 80 | 80 |
| 81 const Scalar Colors::color[] = {Colors::red(), | 81 const Scalar Colors::color[] = {Colors::red(), |
| 82 Colors::green(), | 82 Colors::green(), |
| 83 Colors::blue(), | 83 Colors::blue(), |
| 84 Colors::cyan(), | 84 Colors::cyan(), |
