You may use different spatial filters for different directions. If you give weights on the vertical for 3 x 3 or 5 x 5 kernel it masks everything but only shows the vertical lines i.e computation of moments will weighted for only one direction. Same way for horizontal, diagonal etc., assign different color at each filter operations. You will get nice edges. One of such spatial filter is sobel edge filter.
http://www.roborealm.com/help/Sobel.php[
^]Now you may compute your algorithm how to handle those edges, because an object can have a horizontal, vertical or any angle lines. You have to have an algorithm to find the major axis of it.
Accord .Net is a free library in c#
http://accord-net.origo.ethz.ch/[
^] which has predefined function which may be useful.
Lot of sophisticated high tech object oriented image segmentation algorithms out there. What I given is a simple idea.