MATLAB: Histogram within Minimum Bounding Box

bounding boxhistogramImage Processing Toolbox

How do I calculate the histogram within a minimum bounding box, along the orientation of the rectangle? Let say I have the coordinates of the four corners.

Best Answer

Ignore my last answer since it doesn't look like you want "the histogram within a minimum bounding box" like you said first. The second part of your question looks like you really want the radon transform. To get the radon transform, look it up in the help. The radon transform is the sum of your image (the profile) as it's summed along a particular angle, which is what it sounds like you want.
I'm attaching a demo where I use the radon transform to rotate an image to align it with the raster lines.