Ask Your Question
0

what is the role of mask passed to calcHist argument ?

asked 2017-01-02 04:11:30 -0500

simozz gravatar image

updated 2017-01-02 04:11:49 -0500

I have a doubt regarding the calcHist function:

From here I read:

"Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as images[i] . The non-zero mask elements mark the array elements counted in the histogram."

Is not clear to me how can be used the mask.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-02 06:02:15 -0500

It means that all the pixels having a value, will be added with their pixel value to the histogram you create. All the others will get ignored. Exactly like stated. For example if you have a squared image of 45x45 pixels, and a mask of 45x45 pixels with a white circle of 20 pixels diameter starting from the center point, then only the pixels inside the circle will be used for calculating your histogram.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-02 04:11:30 -0500

Seen: 668 times

Last updated: Jan 02 '17