Can an Integral Image assist in producing histograms?

asked 2018-07-10 04:07:14 -0600

sazr gravatar image

I am reading 'OpenCV Computer Vision Application Programming Cookbook, 2nd Edition' and it teaches integral images. I understand the concept that an integral image allows us to calculate the mean of ROI's very efficiently - we just calculate the integral image first then whenever we want to know the mean for a given ROI we just need to perform 4 calculations (the 4 corners of the ROI) to obtain the mean rather than sum all pixels in the ROI and divide by the number of pixels.

However, in the book there is a sentence that I don't quite understand (see the bold one below).

We have also seen that sometimes, we are only interested in computing our histogram in a certain area of the image. In fact, having to cumulate a sum of pixels inside an image’s subregion is a common task in many computer vision algorithms. Now, suppose you have to compute several such histograms over multiple regions of interest inside your image. All these computations could rapidly become very costly. In such a situation, there is a tool that can drastically improve the efficiency of counting pixels over image subregions: the integral image.

Does this mean integrals images can somehow produce histograms more efficiently? What is this relationship between integral images and histograms? Is it simply, you can use inspect histogram to obtain the mean of an ROI but you can also use an integral image (II) to obtain the mean of an ROI (and an II is more efficient). A histogram has other uses (not just finding the mean); we can find the min value, max value, standard deviation, local maximas/minimas. Does the integral image offer this sort of information aswell or just the mean?

edit retag flag offensive close merge delete

Comments

Where did you find about: "considering only the 4 corners of an ROI to calculate the mean?"

Ziri gravatar imageZiri ( 2018-07-10 04:16:37 -0600 )edit
1

@Zirihttps://docs.opencv.org/3.4/d7/d1b/gr...

(to be exact, we can calculate the sum from the 4 corners, and knowing the area, the mean later)

berak gravatar imageberak ( 2018-07-10 04:36:05 -0600 )edit

That makes sense now.

Ziri gravatar imageZiri ( 2018-07-10 04:47:54 -0600 )edit

@sazr, histograms of what ? (i don't see the connection) .

also it would need some explanation, why you're after the "mean".

berak gravatar imageberak ( 2018-07-10 07:23:49 -0600 )edit