summaryrefslogtreecommitdiff
path: root/rotord/src/cvimage.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/cvimage.h')
-rw-r--r--rotord/src/cvimage.h11
1 files changed, 8 insertions, 3 deletions
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);