OpenCV RotatedRect with specified angle

前端 未结 3 1716
自闭症患者
自闭症患者 2021-02-04 17:06

I have the situation that I have a small binary image that has one shape, around which I want to find the best fitting rotated rectangle (not b

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 17:39

    If understand the problem correctly, you're saying the method of using findContours and minAreaRectsuffers from jitter/wobbling due to the noisy input data. PCA is not more robust against this noise, so I don't see why you think finding the orientation of the pattern this way won't be as bad as your current code.

    If you need temporal smoothness a commonly used and simple solution is to use a filter, even a very simple filter like an alpha-beta filter probably gives you the smoothness you want. Say at frame n you estimate the parameters of the rotated rectangle A, and in frame n+1 you have the rectangle with the estimated parameters B. Instead of drawing the rectangle with B you find C which is between A and B, and then draw a rectangle with C in frame n+1.

提交回复
热议问题