I am trying to automatically measure the width of a rectangular object in an image. This is an MR image of a true rectangular object, but the image can show some imperfections; the example image has some bowing. Ideally, I would measure the width near the center of the object, parallel to the object edges rather than along the image axes. The object should be rougly in the same position and orientaton every time, but may move slightly (a few cm) based on the actual positioning when the object is imaged.
I was able to successfuly measure width using BoundingBox from regionprops, but that does not work well when the image is rotated slightly, and it is measuring form the longest width instead of near the center.
I think I need to fill in the binary image, then rotate and count the pixels, but not sure how to do so or if that is the best approach.