[mlpack-git] [mlpack/mlpack] backported ind2sub and sub2ind. (#683)
Nilay Jain
notifications at github.com
Thu Jun 9 13:13:24 EDT 2016
> +sepFilter2D(CubeType& InImage, arma::vec& kernel, int radius)
> +{
> + CubeType OutImage = this->CopyMakeBorder(InImage, radius, radius, radius, radius);
> +
> + arma::vec row_res(1), col_res(1);
> + // reverse InImage and OutImage to avoid making an extra matrix.
> + for(size_t k = 0; k < OutImage.n_slices; ++k)
> + {
> + for(size_t j = radius; j < OutImage.n_cols - radius; ++j)
> + {
> + for(size_t i = radius; i < OutImage.n_rows - radius; ++i)
> + {
> + row_res = OutImage.slice(k).row(i).subvec(j - radius, j + radius) * kernel;
> + col_res = OutImage.slice(k).col(i).subvec(i - radius, i + radius).t() * kernel;
> + // divide by 2: avg of row_res and col_res, divide by 3: avg over 3 locations.
> + InImage(i - radius, j - radius, k) = (row_res(0) + col_res(0)) / 2 / 3;
Yes we can change it to a better name.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/683/files/9d85b64c6c6bdff608331195351d09abf56cfc96#r66482155
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160609/40074f84/attachment.html>
More information about the mlpack-git
mailing list