Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine object orientation in binary image? (Python, OpenCV)

I am supposed to determine the direction a windmill is facing from aerial images (with respect to True North - 0 to 359 degrees).

My question is, how can I determine the correct direction of the windmill and calculate its angle relative to the y-axis? Thanks!

like image 798
Kiki Avatar asked Sep 12 '17 09:09

Kiki


1 Answers

Do not know if this works in general, but given your sample images I'd find the middle point of the short edges of the bounding box and get two rectangles for the two halves of the big BBox.

I would then compute the sum of the mask pixels in the two separate half-BBoxes, assuming white is 1 and black is 0. Since the white area is bigger on the half of the rectangle where the "front" of the turbine is, pick the direction according to which of the two half-BBoxes has a higher sum

like image 96
GPhilo Avatar answered Sep 29 '22 19:09

GPhilo