Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename MatType, typename CubeType>
- void StructuredForests<MatType, CubeType>::
- ConvTriangle2(CubeType& InImage, const size_t radius, CubeType& Output)
- {
- Timer::Start("ConvTriangle_mlpack");
- if (radius != 0)
- {
- if (radius <= 1)
- {
- const double p = 12.0 / radius / (radius + 2) - 2;
- arma::vec kernel = {1, p, 1};
- kernel /= (p + 2);
- MatType k_mat = kernel * kernel.t();
- mlpack::ann::NaiveConvolution<FullConvolution>::Convolution(InImage, k_mat, Output);
- //this->SepFilter2D(InImage, kernel, radius);
- }
- else
- {
- const size_t len = 2 * radius + 1;
- arma::vec kernel(len);
- for( size_t i = 0; i < radius; ++i)
- kernel(i) = i + 1;
- kernel(radius) = radius + 1;
- size_t r = radius;
- for( size_t i = radius + 1; i < len; ++i)
- kernel(i) = r--;
- kernel /= std::pow(radius + 1, 2);
- MatType k_mat = kernel * kernel.t();
- mlpack::ann::NaiveConvolution<FullConvolution>::Convolution(InImage, k_mat, Output);
- //this->SepFilter2D(InImage, kernel, radius);
- }
- Timer::Stop("ConvTriangle_mlpack");
- }
- }
Add Comment
Please, Sign In to add comment