Ask Your Question

Calculate histogram along line

asked 2012-11-14 06:07:21 -0600

njaa gravatar image

updated 2012-11-14 06:08:00 -0600


I have a binary image and I would like to determine the amount of white pixels along different angles. Let`s say the starting Point (F) is at the middle of the bottom row. Based on this 0° means all white pixels to the right of F and 180° means all white pixels to the left of F in the bottom row. So at the end I would like to have a histogram with x-axis holding the angle (from 0 to 180) and y-axis the number of white pixels.

Is this possible with the OpenCV calcHistogram function? Or do you have any idea how to do this efficiently?

Hope you understand the problem since I`m not allowed(?) to attach images here.

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2012-11-14 07:08:27 -0600

Michael Burdinov gravatar image

calcHistogram won't help you to collect histograms at angles different from 0 and 180, so I guess you will have to write your own loop to collect those histograms. I think use of LineIterator will help you to implement those loops.

edit flag offensive delete link more

Question Tools


Asked: 2012-11-14 06:07:21 -0600

Seen: 707 times

Last updated: Nov 14 '12