Skip to content

Commit

Permalink
Merge pull request #1535 from s-trinh/fix_gaussianBlur_min_img_size
Browse files Browse the repository at this point in the history
Check image dimension in vpImageFilter::gaussianBlur function
  • Loading branch information
fspindle authored Jan 9, 2025
2 parents 39d7d33 + a82c454 commit abf3419
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/core/src/image/vpImageFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ void vpImageFilter::gaussianBlur<double, double>(const vpImage<double> &I, vpIma
void vpImageFilter::gaussianBlur(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &GI, unsigned int size, double sigma, bool normalize,
const vpImage<bool> *p_mask)
{
if (size-1 > I.getWidth() || size-1 > I.getHeight()) {
std::ostringstream oss;
oss << "Image size (" << I.getWidth() << "x" << I.getHeight() << ") is too small for the Gaussian kernel ("
<< "size=" << size << "), min size is " << (size-1);
throw vpException(vpException::dimensionError, oss.str());
}

double *fg = new double[(size + 1) / 2];
vpImageFilter::getGaussianKernel(fg, size, sigma, normalize);
vpImage<vpRGBa> GIx;
Expand Down

0 comments on commit abf3419

Please sign in to comment.