diff c/test-pixels.cpp @ 9:eb38637f338d

created cvutils
author Nicolas Saunier <nico@confins.net>
date Sun, 08 Nov 2009 10:33:41 -0500
parents 59b7e3954178
children
line wrap: on
line diff
--- a/c/test-pixels.cpp	Sat Nov 07 23:33:51 2009 -0500
+++ b/c/test-pixels.cpp	Sun Nov 08 10:33:41 2009 -0500
@@ -1,3 +1,5 @@
+#include "cvutils.hpp"
+
 #include "opencv/cv.h"
 #include "opencv/highgui.h"
 
@@ -5,16 +7,6 @@
 
 using namespace std;
 
-IplImage* allocateImage(const CvSize& size, const int& depth, const int& channels) {
-  IplImage* image = cvCreateImage(size, depth, channels);
-
-  if (!image) {
-    cerr << "Error: Couldn't allocate image.  Out of memory?\n" << endl;
-    exit(-1);
-  }
-
-  return image;
-}
 
 int main(int argc, char *argv[]) {
   //cout << "Hello World" << endl;
@@ -22,7 +14,7 @@
   CvCapture *inputVideo = cvCaptureFromFile(argv[1]);
 
   IplImage* frame = cvQueryFrame(inputVideo);
-  IplImage* bwFrame = allocateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 1);
+  IplImage* bwFrame = allocateImage(frame->width, frame->height, IPL_DEPTH_8U, 1);
 
   int frameNum = 0;
   while (frame) {