MATLAB Answers

How to find integral over 2D image

6 views (last 30 days)
Koen Franse
Koen Franse on 28 Sep 2020
Answered: Bjorn Gustavsson on 28 Sep 2020
Hi all,
I'm working on some image processing and try to reproduce something from an article, in which they integrate over an 2D image. I'm familiar with with finding the derivative of an image with the help of for example Sobel masking, but is there any procedure you would recommend for integration?
The problem I'm trying to work out is the following:
in which H is a vector with an x and y component. Or to put it differently, I've got to 2D images for H: Hx and Hy. I need to integrate both of them over x and y, to obtain the following:
Anyone any suggestions how to achieve this? I was already looking into the integralImage function, but was questioning if this was what I needed.
Thanks in advance! Cheers Koen
  3 Comments
Koen Franse
Koen Franse on 28 Sep 2020
In the meantime I found the functions 'IntegralFilter' and 'IntegralKernel', would that be a way to adress this? And if so, do you have any suggestions on what kernel to use?

Sign in to comment.

Answers (2)

Steve Eddins
Steve Eddins on 28 Sep 2020
Try integralImage. This function computes a cumulative in both directions, which would approximate the two-dimensional integral from the discrete image samples. The function integralFilter uses the output of integralImage to efficiently perform several different kinds of filtering operations, and I don't think that's what you need.

Bjorn Gustavsson
Bjorn Gustavsson on 28 Sep 2020
If you want to have dW at the same resolution as your original image, just add the four terms together. If you want some local smooting of dW then I think you should simply convolve dW with a suitable filter-kernel, if you want a reduced size on dW, then I figure you could downsample such a filtered image. Since I don't know what your Hx and Hy are nor what they were used for in the paper you refer to more detailed suggestions become blind guesses.
One point to mention is that the second and third term looks very peculiar to me as a physicist.
HTH

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by