Commit 66304f4faf5dbaacae16eb56fba9d7f228f18ffa
1 parent
abb832b8
added an addition operator to stim::image
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
stim/image/image.h
@@ -624,6 +624,15 @@ public: | @@ -624,6 +624,15 @@ public: | ||
624 | return result; | 624 | return result; |
625 | } | 625 | } |
626 | 626 | ||
627 | + //operator functions | ||
628 | + image<T> operator+(image<T> rhs) { | ||
629 | + size_t N = size(); //calculate the total number of values in the image | ||
630 | + image<T> r(X(), Y(), C()); //allocate space for the resulting image | ||
631 | + for (size_t n = 0; n < N; n++) | ||
632 | + r.img[n] = img[n] + rhs.img[n]; //perform the inversion | ||
633 | + return r; //return the inverted image | ||
634 | + } | ||
635 | + | ||
627 | image<T> srgb2lab(){ | 636 | image<T> srgb2lab(){ |
628 | std::cout<<"ERROR stim::image::srgb2lab - function has been broken, re-implement."<<std::endl; | 637 | std::cout<<"ERROR stim::image::srgb2lab - function has been broken, re-implement."<<std::endl; |
629 | exit(1); | 638 | exit(1); |