From ad0e8b3e7f1d8889244f15134a00d1ac4803d9c3 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 20 Aug 2013 02:47:59 +0100 Subject: difference matte --- rotord/src/cvimage.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'rotord/src/cvimage.h') diff --git a/rotord/src/cvimage.h b/rotord/src/cvimage.h index 4921f78..dc421de 100644 --- a/rotord/src/cvimage.h +++ b/rotord/src/cvimage.h @@ -95,9 +95,10 @@ namespace Rotor { } bool clear(){ rgb.setTo(0); + return true; }; bool setup(int _w,int _h){ //set up with internal data - if (w!=_w|h!=h){ + if ((w!=_w)|(h!=_h)){ rgb.create(_h,_w,CV_8UC3); RGBdata=rgb.data; //can move to use the bare pointer eventually ownsRGBdata=false; //will not be necessary @@ -149,8 +150,11 @@ namespace Rotor { */ } bool setup_fromMat(cv::Mat& othermat){ - //here the mat belongs to another Image object - rgb=cv::Mat(othermat); + //here the mat belongs to another object + if (othermat.channels()==1) { + cv::cvtColor(othermat, rgb, CV_GRAY2RGB); + } + else rgb=othermat; RGBdata=rgb.data; //can move to use the bare pointer eventually ownsRGBdata=false; //will not be necessary w=rgb.rows; @@ -179,6 +183,7 @@ namespace Rotor { Image & alpha_blend(const Image &other); Image & alpha_blend_cv(const Image &other); Image & alpha_merge(const Image &other); + Image & alpha_from_cv(cv::Mat &other); Image & add_wrap(const Image &other); Image & divide_wrap(const Image &other); Image & operator*=(const float &amount); -- cgit v1.2.3