From a7ed4b2e339671452ccc41291c136490f509335b Mon Sep 17 00:00:00 2001 From: David Date: Fri, 3 Feb 2017 10:39:52 -0600 Subject: [PATCH] ivote updates --- stim/image/image.h | 16 ++++++++++++---- stim/math/filters/gauss2.cuh | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/stim/image/image.h b/stim/image/image.h index 8d44f73..9e43730 100644 --- a/stim/image/image.h +++ b/stim/image/image.h @@ -54,8 +54,6 @@ class image{ allocate(); //allocate memory } - size_t bytes(){ return size() * sizeof(T); } - inline size_t idx(size_t x, size_t y, size_t c = 0) const { return y * R[0] * R[1] + x * R[0] + c; } @@ -82,6 +80,8 @@ class image{ public: + size_t bytes() { return size() * sizeof(T); } + /// Default constructor - creates an empty image object image(){ init(); } //initialize all variables to zero, don't allocate any memory @@ -116,7 +116,7 @@ public: free(img); } - ///Resize an image + ///Resize an image - this function looks like it hasn't been implemented void resize(size_t x, size_t y, size_t c = 1) { allocate(x, y, c); } @@ -384,6 +384,15 @@ public: } + /// invert the image, given a specified maximum value (ex. maxval = 255, I' = 255 - I) + /*image invert(T maxval) { + image result(width(), height(), channels()); //create a new image + size_t N = size(); //get the number of elements in the image + for (size_t n = 0; n < N; n++) + result.data()[n] = maxval - img[n]; //perform the inversion and save the result to the new image + return result; + }*/ + /// Stretch the contrast of the image such that the minimum and maximum intensity match the given values image stretch(T low, T high) { T maxval = maxv(); @@ -540,7 +549,6 @@ public: } image convolve2(image mask){ - std::cout<<"ERROR stim::image::convolve2 - function has been broken, and shouldn't really be in here."< > IN = in.split(); //split the input image into channels + std::vector< stim::image > clist = in.split(); //split the input image into channels std::vector< stim::image > R = r.split(); //split the output image into channels for (size_t c = 0; c < in.channels(); c++) //for each channel - cpu_sepconv2(R[c].data(), IN[c].data(), gx, gy, IN[c].width(), IN[c].height(), kx, ky); + cpu_sepconv2(R[c].data(), clist[c].data(), gx, gy, clist[c].width(), clist[c].height(), kx, ky); r.merge(R); //merge the blurred channels into the final image return r; -- libgit2 0.21.4