From f758127362e3c1e4e926204a83ce3104af1278bb Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 11 Jul 2013 13:21:36 +0100 Subject: cvimage fully incorporated --- rotord/cvimage.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 rotord/cvimage.cpp (limited to 'rotord/cvimage.cpp') diff --git a/rotord/cvimage.cpp b/rotord/cvimage.cpp new file mode 100644 index 0000000..3a070a9 --- /dev/null +++ b/rotord/cvimage.cpp @@ -0,0 +1,66 @@ +#include "cvimage.h" + +using namespace std; + +namespace Rotor { + //believe these still work, don't know if these optimisations are better than opencvs.. + Image & Image::operator+=(const Image &other) { + if (other.w!=w||other.h!=h) { + cerr<<"Rotor: cannot add images with different sizes! (wanted "<rgb=rgb*amount; + return other; + } + Image * Image::operator+(const float &amount) { + uint8_t amt=(uint8_t)(amount*255.0f); + Image *other=new Image(w,h); + other->rgb=rgb+amt; + return other; + } + Image * Image::operator-(const float &amount) { + uint8_t amt=(uint8_t)(amount*255.0f); + Image *other=new Image(w,h); + other->rgb=rgb-amt; + return other; + } + Image * Image::operator/(const float &amount) { + Image *other=new Image(w,h); + other->rgb=rgb/amount; + return other; + } +} -- cgit v1.2.3