Nodes/opencv-comfyui/OpenCV cornerEigenValsAndVecs_1
ComfyUI Node

OpenCV cornerEigenValsAndVecs_1

CornerEigenValsAndVecs_1 — the identical twin nobody explains

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV cornerEigenValsAndVecs_1
  • src
  • dst
  • nparray
blockSize
ksize
borderType

First things first, because it's the question everyone asks the moment they see two of these: cornerEigenValsAndVecs_1 is functionally identical to cornerEigenValsAndVecs_0. Same inputs, same 6-channel output, same call underneath (cv2.cornerEigenValsAndVecs). The pack auto-generates a node per overload in OpenCV's type definitions - one for MatLike, one for UMat - and both end up calling the same C++ function with the same arguments. There is no "version 1 is better" here. Wire either one; I'd grab _0 out of habit and never think about it again.

So why are you here, then? Probably because the output is confusing you, which is fair. Let me be the guide your workflow needs.

What you actually get back

The single output nparray has six channels: the two eigenvalues [λ1, λ2] of the local gradient structure tensor, then the eigenvector components [x1, y1, x2, y2]. This is the raw material underneath every famous corner detector:

  • Harris combines them into det − k·trace².
  • Shi-Tomasi (the goodFeaturesToTrack quality measure) uses min(λ1, λ2).
  • This node gives you both, plus directions.

Where that matters in practice: the eigenvectors tell you edge orientation, not just "corner or not." If you're doing image registration or stitching inside ComfyUI - aligning frames before an img2img pass, matching features between two shots of the same scene - orientation-aware corner data is genuinely useful. If you just wanted dots on the screen, you overshot; cornerHarris_0 or cornerMinEigenVal_0 is the friendlier tool.

The few inputs you'll set

  • src - grayscale nparray only. Color in → CV_8UC1 assertion error. Convert with cvtColor code 6 (BGR2GRAY) before this node.
  • blockSize - neighborhood for the covariance matrix; odd, 3–7.
  • ksize - Sobel derivative aperture, odd, 3 or 5.
  • borderType - leave the default.
  • dst - the pack's optional out-parameter; skip it, per the README.

A wiring pattern that actually works

Get grayscale via cvtColor_0, feed cornerEigenValsAndVecs_1, then split channels so you can threshold the eigenvalue map and turn it into a usable mask. That's the loop: gradient analysis → threshold → mask → use as a control input or an analysis overlay. It plays fine with the pack's Image2Nparray/Nparrays2Image bridge nodes, but remember that this output is not a viewable image until you've done something to it.

Install

From ComfyUI Manager, search opencv-comfyui and install, or:

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

Restart. The pack needs opencv-contrib-python (plus numpy/torch); you likely already have OpenCV installed by another node pack. No model files.

The trap to remember

The whole opencv-comfyui pack is auto-generated and unpolished - the README literally says "expect dragons." This node family's dragon is the 6-channel float output masquerading as an image. Feed it to Nparrays2Image and you get a NoneType error. Treat it as data, not a picture, and you'll be fine.

Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
srcNPARRAY
blockSizeINT
ksizeINT
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY