Nodes/opencv-comfyui/OpenCV cornerMinEigenVal_1
ComfyUI Node

OpenCV cornerMinEigenVal_1

CornerMinEigenVal_1 — the twin, and why the min eigenvalue beats Harris

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

cornerMinEigenVal_1 is cornerMinEigenVal_0's auto-generated twin - same inputs, same single-channel float32 output, same call to cv2.cornerMinEigenVal. The pack emits a node per overload in OpenCV's type definitions and they're interchangeable; use whichever and stop second-guessing. What deserves a second look is why this detector exists alongside Harris, because it's the difference between a corner map that's useful and one that's lying to you.

The short version of the math

Both Harris and Shi-Tomasi start from the same place: the 2×2 gradient structure tensor per pixel, with eigenvalues λ1 ≥ λ2 describing how much image structure exists in each direction.

  • Harris scores λ1λ2 − k(λ1+λ2)², which can reward the wrong things - an edge diagonal to the image axes can score like a corner.
  • Shi-Tomasi scores min(λ1, λ2), i.e. cornerMinEigenVal. A pixel only scores well if structure is strong in both directions. That's the more honest definition of "corner," and it's why goodFeaturesToTrack - the most-used corner picker in OpenCV - is built on exactly this measure.

So if your workflow is about tracking or matching (frame alignment before an img2img pass, feature correspondence between views), the min-eigenvalue score is usually the better raw material. If you only need a quick, tunable corner mask, Harris with its k knob is friendlier.

Inputs and output

  • src - grayscale nparray; color triggers the CV_8UC1 assertion.
  • blockSize - odd, 3–7.
  • ksize - odd Sobel aperture, 3 or 5.
  • borderType - default.
  • dst - optional out-parameter; leave unconnected.

Output: one nparray, a per-pixel quality map. Not viewable raw - threshold it (OpenCV's standard 0.01 × max cutoff) or feed it into a top-N feature selection. It also plays nicely as a control/analysis signal in a graph: threshold → mask → use as a region selector.

Install

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

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

Restart. Requirements: opencv-contrib-python, numpy, torch. No model downloads.

The honest gotchas

Same family traps as every node here: grayscale or the assertion bites; batch size 1 only (ImageFromBatch if you have more); and the output is data, not a picture - feed it to Nparrays2Image unprocessed and you'll hit the NoneType shape error the README documents. And again: _1 is not a better version of _0. It's the same function wearing a second overload's name tag. Use the pair as one, and spend your real tuning effort on blockSize and the threshold.

Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
srcNPARRAY
blockSizeINT
ksizeINT
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY