diff c/cvutils.cpp @ 9:eb38637f338d

created cvutils
author Nicolas Saunier <nico@confins.net>
date Sun, 08 Nov 2009 10:33:41 -0500
parents
children e77e2fd69b02
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c/cvutils.cpp	Sun Nov 08 10:33:41 2009 -0500
@@ -0,0 +1,20 @@
+#include "cvutils.hpp"
+
+#include "opencv/cv.h"
+
+#include <iostream>
+
+using namespace std;
+
+IplImage* allocateImage(const int& width, const int& height, const int& depth, const int& channels) { return ::allocateImage(cvSize(width, height), depth, channels);}
+
+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;
+}