Detect centre and angle of rectangles in an image using Opencv

后端 未结 3 1460
名媛妹妹
名媛妹妹 2020-12-05 08:36

I have an image as below :

I need to find out the number of rectangles,centre of each rectangle and the measure the angle between the axis parallel to the l

3条回答
  •  孤城傲影
    2020-12-05 08:47

    Here is how you can do it:

    1. Connected component labeling in order to detect each pattern (in your case the rectangles)
    2. Separate the patterns in different images
    3. (optional) if the pattern are not all rectangles, then use shape indexes to discriminate them
    4. Compute the main axis using Principal Component Analysis (PCA), it will give you the angle you are looking for.

提交回复
热议问题