Get histogram of edge lengths/orientations in an image using OpenCV
I don't know if OpenCV has some implementation - but i can provide you with a pointer of algorithm for this. 

MPEG 7 provides a fairly well defined (and well thought out) edge histogram descriptor [EHD] which essentially serves your purpose. 

You can refer to this: Efficient Use of MPEG-7 Edge Histogram Descriptor which i think is an excellent paper on this. 

If you want to see some implementation of MPEG-7 you can find it on JOANNEUM RESEARCH MPEG 7 page. 

For more information on MPEG-7: List of possible image features for content based image retrieval