<p>In <a href="https://github.com/mlpack/mlpack/pull/696#discussion_r67153674">src/mlpack/methods/edge_boxes/feature_extraction_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +{
&gt; +  arma::vec f(std::max(im.n_rows, im.n_cols));
&gt; +  // transform along columns
&gt; +  for (size_t x = 0; x &lt; im.n_cols; ++x)
&gt; +  {
&gt; +    f.subvec(0, im.n_rows - 1) = im.col(x);
&gt; +    arma::vec d = this-&gt;DistanceTransform1D(f, im.n_rows, inf);
&gt; +    im.col(x) = d;
&gt; +  }
&gt; +
&gt; +  // transform along rows
&gt; +  for (size_t y = 0; y &lt; im.n_rows; y++)
&gt; +  {
&gt; +    f.subvec(0, im.n_cols - 1) = im.row(y).t();
&gt; +    arma::vec d = this-&gt;DistanceTransform1D(f, im.n_cols, inf);
&gt; +    im.row(y) = d.t();
</pre>
<p>It looks like you could pass im.row(y) instead of passing a copy of the transposed row.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/696/files/b38b688edfc4c2ee8bf461240f8384a70575d3a4#r67153674">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFFHw6z03RBFCBQ69jFrHAJaTMNOtks5qL_N0gaJpZM4I1lnr">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFLBGyDRInVioM4yuCxtpNA4VLT8tks5qL_N0gaJpZM4I1lnr.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/696/files/b38b688edfc4c2ee8bf461240f8384a70575d3a4#r67153674"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>