Assertion error when running `rotatedRectangleIntersection`

I stripped it down some more. I can reproduce it.

import cv2 as cv
import numpy as np

def box(box):
    return ((box[0], box[1]), (box[2], box[3]), box[4])

box_1 = np.array([ 246805.033  , 4002326.94   ,      26.40587,       6.20026,     -62.10156])
box_2 = np.array([ 246805.122  , 4002326.59   ,      27.4821 ,       8.5361 ,     -56.33761])

try:
    print(cv.rotatedRectangleIntersection(box(box_1), box(box_2)))
except Exception as e:
    print(e)

offset = (246805, 4002326, 0, 0, 0)

box_1 -= offset
box_2 -= offset

print(cv.rotatedRectangleIntersection(box(box_1), box(box_2))) # that works

I’d say (1) it’s not designed for very “out there” values (2) it’s calculating some type of error based on this assumption

worth an issue on the github! no matter if you can figure out what the implementation does or not.

the implementation shouldn’t be doing this kind of check at all. it shouldn’t rely on some arbitrary, hardcoded “epsilon”.

1 Like