Nodes/opencv-comfyui/OpenCV getWindowProperty_0
ComfyUI Node

OpenCV getWindowProperty_0

Reading window properties you can't create

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV getWindowProperty_0
    • float
    winname
    prop_id

    getWindowProperty_0 asks OpenCV a question about a GUI window: is it visible, is it fullscreen, is it on top? The problem is that in ComfyUI, the window it's asking about doesn't exist. It has two inputs - winname (STRING) and prop_id (INT) - and one FLOAT output. Wrapped cv2.getWindowProperty, it's part of the HighGUI window family, and like the rest of that family it assumes a desktop session with native OpenCV windows that ComfyUI simply doesn't open.

    The prop_id you'd pass

    The property constants are plain integers:

    • 0 WND_PROP_FULLSCREEN - is the window fullscreen
    • 1 WND_PROP_AUTOSIZE - is it set to auto-size
    • 4 WND_PROP_VISIBLE - is the window currently visible
    • 5 WND_PROP_TOPMOST - is it pinned on top

    In a normal script you'd read these to decide, say, whether to restore a window after minimizing it. Every one of those reads requires a live HighGUI window with a display backend - X11, Windows GDI, macOS Cocoa. ComfyUI's previews render in a web frontend, and unless you've gone out of your way to open native windows in custom code, getWindowProperty has nothing to inspect. It will error at runtime, and the error is not one you can fix by changing inputs.

    The pattern to recognize

    At this point in the pack you can spot the family: getTrackbarPos_0, getWindowImageRect_0, and this node are all HighGUI orphans - real, well-defined OpenCV functions that only make sense in an interactive desktop context. They got wrapped because the pack auto-generates a node for every top-level cv2 function, and the author's own README concedes not every function is useful in ComfyUI. These three are the clearest demonstration. There's nothing wrong with your install when they fail; the environment is wrong for them, permanently.

    If you genuinely need a togglable property that changes behavior mid-workflow - the thing you'd use a window flag for in desktop OpenCV - ComfyUI's native widgets (a BOOLEAN toggle, or a node like rgthree's fast bypassers) are the graph-native equivalent, and they don't require a window that doesn't exist.

    Install & troubleshooting

    Standard:

    cd ComfyUI/custom_nodes
    git clone https://github.com/geroldmeisinger/opencv-comfyui
    

    or ComfyUI Manager (search "opencv-comfyui"), then restart. The pack needs opencv-contrib-python; numpy/torch are already in ComfyUI. No models, no keys. The only startup error this pack is known for is the conflicting-OpenCV one - Cannot import name 'guidedFilter' from 'cv2.ximgproc' - which is about duplicate OpenCV wheels, not this node. If the node fails at runtime with a HighGUI/window assertion, that's expected behavior, not a bug. Delete it and move on.

    Categoryimage/OpenCV

    Inputs (2)

    NameTypeDefaultDescription
    winnameSTRING
    prop_idINT

    Outputs (1)

    NameTypeDescription
    floatFLOAT