[mlpack-git] [mlpack/mlpack] backported ind2sub and sub2ind. (#683)

stereomatchingkiss notifications at github.com
Thu Jun 9 12:32:34 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;

if the value of InImage woud be altered, could you change the name to inoutImage?

---
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#r66475398
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160609/d72c3bc3/attachment-0001.html>


More information about the mlpack-git mailing list