Nodes/opencv-comfyui/OpenCV rotatedRectangleIntersection_1
ComfyUI Node

OpenCV rotatedRectangleIntersection_1

The overlap test, UMat twin

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV rotatedRectangleIntersection_1
  • intersectingRegion
  • int
  • nparray
rect1
rect2

Same function, same node, one extra letter of mustache: rotatedRectangleIntersection_1 is the UMat overload of cv2.rotatedRectangleIntersection, and inside ComfyUI it is indistinguishable from its _0 sibling. The pack's generator emitted a numbered variant for every OpenCV type-stub overload, so you get this duplicate for free. Nothing about your workflow changes based on which one you grab.

What it does

The job, briefly: take two rotated rectangles, return whether they overlap and the polygon of the intersection. rect1 and rect2 are STRING inputs in RotatedRect literal form - ((cx, cy), (w, h), angle_degrees) - parsed with ast.literal_eval, so exact Python syntax matters. An integer output tells you the status (0 no intersection, 1 partial, 2 one fully inside the other) and the nparray output is the intersection polygon's vertices. Leave the optional intersectingRegion out-parameter unwired per the README.

If you want the reasoning - why rotated rectangles instead of plain boxes, where you'd use the status integer to gate a detection/detailing step - read the rotatedRectangleIntersection_0 article. It has the full context, and nothing here changes for the _1 variant.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python

Install is the pack standard: ComfyUI Manager → search "opencv-comfyui", or the commands above, then make sure OpenCV is present (pip install opencv-contrib-python, which is what the pack's requirements.txt declares). No model downloads.

Verdict

The only practical thing worth remembering about this pair: if a shared workflow references one class name and you have the other, they're drop-in equivalents. Don't go hunting for a behavioral difference that isn't there. This is a short article because the content lives in the _0 page - the _1 here is a placeholder that exists because the pack ships every function twice.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
rect1STRING
rect2STRING
intersectingRegionoptNPARRAY

Outputs (2)

NameTypeDescription
intINT
nparrayNPARRAY