Nodes/ComfyUI CV/CV Random Points
ComfyUI Node

CV Random Points

A labelled toy dataset with zero downloads and no VRAM

By bmad4ever·Created 4 months ago·Updated 14 days ago· 1
CV Random Points
    • points
    • count
    ◄count60►
    ◄distributiongaussian (normal)►
    ◄center_x100.00►
    ◄center_y100.00►
    ◄spread_x12.00►
    ◄spread_y12.00►
    ◄seed0►

    Every classifier tutorial starts with three blobs of points and a decision boundary. This node is the blob. It drops count 2-D points into an NPARRAY - Gaussian around a centre, or uniformly filling a box - and that's it. Boring by design, and genuinely useful the moment you want to test something downstream without downloading a dataset or burning a diffusion pass to make one.

    What you get

    Two outputs. points is Nx1x2 float32 (x, y) - that oddly-shaped Nx1x2 is the pack's point convention, and every point node in it (draw, filter, polar, cluster, reduce) speaks the same shape. count is just the number you asked for, as an INT, which is worth wiring around when you're building graphs that have to survive an empty set.

    distribution picks between gaussian (normal) and uniform (center +/- spread). spread_x / spread_y mean different things per mode, and the tooltip says so plainly: for Gaussian it's the standard deviation per axis, for uniform it's the half-extent of the box. Same widget, different statistics - a classic source of "why does my uniform cloud look like a cross".

    The seed is the feature

    seed makes it deterministic. Same seed, same points, every run, forever. That's the difference between a demo and a test fixture: use one seed for the training classes and a different seed to generate queries the model has never seen, and you've got a train/test split that reproduces on any machine. The pack's classifier-reuse example leans on exactly that - train on three shapes with one set of seeds, then classify fresh ones with rotations and noise the training run never produced.

    count accepts 0 and emits an empty point array. That sounds like a footnote until you're wiring a graph that should degrade instead of erroring, at which point it's the cheapest degenerate-case probe you have.

    What it's for

    Three things, in rough order of how often people actually do them:

    A decision-boundary playground. Several of these nodes with different seeds and centres become the synthetic classes; CV Stack Feature Classes glues them into one labelled training matrix; CV Train Classifier fits and evaluates it; then CV Coordinate Grid + predict + CV Reshape Array paints the decision regions back out as an image. That whole loop is workflows/80_ml_decision_boundary.json, and it runs with no inputs and no model files - which is the honest pitch for the ML corner of this pack. It's for understanding classifiers, not for classifying anything.

    k-means test data. Feed a couple of these into a clustering node and you know the right answer in advance, which is rare and pleasant. The pack's workflows/85_data_charts.json uses them alongside CV Reduce Points By Label as a plotting fixture.

    Markers to draw. CV Draw Points renders them; combined with CV Fit Points To Box and CV Draw Plot Frame you get a scatter plot with axes, which is a legitimately nice way to visualise any point set your pipeline produces.

    Install

    It lives in ComfyUI CV (bmad4ever/comfyui_cv), a GPL-3.0 fork of opencv-comfyui that exposes OpenCV as nodes - ~470 generated cv2.* wrappers plus ~317 hand-written ones. Manager: search the pack title. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_cv
    pip install "opencv-contrib-python-headless~=5.0.0.93"
    # restart
    

    Python ≥ 3.12 and a ComfyUI on the V3 node API - a build that predates it will simply not show these nodes.

    Worth knowing

    This node is one of the pack's NC ("non-OpenCV") entries: it's numpy doing the sampling, not cv2.randn or cv2.Scalar. That's why it behaves predictably across OpenCV builds, and it's also why it emits Nx1x2 float32 rather than a Mat - nothing here cares about the pixel grid, so don't try to treat the output as an image without going through a reshape or a draw node first.

    The other honest caveat is the pack's own: it's a personal project with heavy AI assistance, and the maintainer says not to trust it in production without reading the source. For a fixture generator that's fine. Just don't mistake the tidy output for a validated pipeline component - if you care about the sampling, the implementation is numpy's default_rng with the seed you passed, and you can read it in opencv_nodes/ml.py.

    Categoryimage/CV/ml

    Inputs (7)

    NameTypeDefaultDescription
    countINT600–100000How many points to draw. 0 is valid and yields an empty point array (for testing the degenerate path).
    distributionCOMBOgaussian (normal)gaussian: normal distribution, spread = standard deviation per axis. uniform: even fill of the box center +/- spread.
    center_xFLOAT100.00-1000000–1000000X coordinate of the cloud center (pixels).
    center_yFLOAT100.00-1000000–1000000Y coordinate of the cloud center (pixels).
    spread_xFLOAT12.000–1000000Horizontal spread: std for gaussian, half-extent for uniform (pixels).
    spread_yFLOAT12.000–1000000Vertical spread: std for gaussian, half-extent for uniform (pixels).
    seedINT00–2147483647Random seed - the same seed always yields the same points. Use different seeds for different classes.

    Outputs (2)

    NameTypeDescription
    pointsNPARRAYNx1x2 float32 (x, y) points - feeds 'CV Draw Points', 'CV Stack Feature Classes' and every other point node.
    countINT—