Commit 66304f4faf5dbaacae16eb56fba9d7f228f18ffa

Authored by David Mayerich
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 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 636 image<T> srgb2lab(){
628 637 std::cout<<"ERROR stim::image::srgb2lab - function has been broken, re-implement."<<std::endl;
629 638 exit(1);
... ...