Is there a function in OpenCV that is similar to 'gen_measure_rectangle2' in halcon?

welcome.

could you show what this actually does?

in particular, how does the choice of length1 and length2 affect results? how do results vary when phi is changed a little? I’m not asking for words, I’m asking for pictures.