OpenCV getTickFrequency_0
The other half of OpenCV's stopwatch
- float
getTickFrequency_0 is the companion piece to getTickCount_0, and it makes the pair actually useful. It has no inputs and one output: a FLOAT telling you how many ticks per second OpenCV's internal counter runs at. In the classic OpenCV timing idiom, the frequency is the divisor that turns raw tick deltas into seconds:
elapsed_seconds = (cv2.getTickCount() - start) / cv2.getTickFrequency()
Ticks alone are meaningless without knowing how fast the clock ticks, so this node is what gives meaning to a getTickCount_0 reading. The output is a stable, environment-specific constant - typically something like 1e7 (ten million ticks per second) on Linux and Windows, matching the underlying high-resolution platform timer. It basically never changes for a given machine, which is why this is one of the most boring nodes in the pack: you query it, you get a number, and it's the same number every time.
How it works
It's a direct wrapper of cv2.getTickFrequency(), which reports the frequency of the monotonic tick counter returned by getTickCount(). The two are joined at the hip in OpenCV's docs - you rarely see one without the other. The key detail: since the frequency is per-machine, you should always read it from the running environment rather than hardcoding 1e7. Different platforms and OpenCV builds report different values, and a hardcoded number quietly breaks your timing math on the wrong box.
What you can actually do with it in ComfyUI
Same fundamental limitation as getTickCount_0 - this pack wraps functions as individual graph nodes, and ComfyUI doesn't give you a clean "run node A, then immediately node B, then diff the results" construct. In practice:
- Combined with two
getTickCount_0readings, divide the delta by this frequency and you have a rough elapsed-seconds estimate for whatever ran between the ticks. - It's also a decent sanity check that your OpenCV installation is alive and reporting real numbers - if the frequency output looks like
0.0or nonsense, something's off with yourcv2build.
Install
Identical to every node in this pack. ComfyUI Manager, search "opencv-comfyui", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
Dependencies are opencv-contrib-python, numpy, torch - the last two are already part of ComfyUI, and Manager handles OpenCV. No models, no keys. If startup throws Cannot import name 'guidedFilter' from 'cv2.ximgproc', you have conflicting OpenCV packages installed; uninstall the duplicates and keep one.
Is this node going to be the star of your workflow? No. But it's the correct answer to the question "how do I convert ticks to seconds," and when you're doing the pack's version of timing experiments, having both halves of the idiom available beats reinventing them in Python.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |