cv2.CV_8SC
Signed 8-bit, and almost nothing wants it
- int
cv2.CV_8SC is the signed sibling of CV_8UC: one INT in, one INT out, no pixels involved. It returns the OpenCV type code for a signed 8-bit matrix with the channel count you ask for. You will almost never build one - but you will read it in error messages and doc tables, which is the entire reason to know it.
The number
Same packing rule as every other member of the family, with the depth code for signed 8-bit (CV_8S == 1) replacing CV_8U:
type_code = depth + ((channels - 1) << 3)
CV_8SC(1) = 1
CV_8SC(3) = 17
CV_8SC(4) = 25
You can check it without ComfyUI, since the node is just this call wrapped:
python3 -c "import cv2; print(cv2.CV_8SC(1), cv2.CV_8SC(3))"
# 1 17
channels is the only input, and its default is 0 - which is not a channel count. Set it to 1, 3 or 4 before running; the wrapper passes your value straight through without validating it.
Why the pack even ships one
Because the registry is generated: every callable that the installed cv2 stubs expose becomes a node, and the <depth>C(n) family happens to exist for signed 8-bit too. That's the same machinery that gives you CV_16SC, CV_32FC, CV_64FC and the rest of the ~470 wrappers in this pack. If a generated wrapper's function isn't present in your cv2 build, the node simply doesn't appear - the pack resolves each one through getattr at import.
Where the value is genuinely useful
For reading OpenCV's own documentation. Depth-sensitive parameters name their accepted types, and CV_8SC1 shows up in places like cv2.norm's mask, which accepts CV_8UC1, CV_8SC1 or CV_BoolC1. Knowing that CV_8SC1 == 1 while CV_8UC1 == 0 is the difference between "why does this mask work in one call and not the other" and a shrug.
If you're composing a type code by hand, the interesting target is still cv2.CV_MAKETYPE, whose depth input takes a raw depth code like the one this node's sibling CV_8UC(1) produces.
Install
Manager → Install Custom Nodes → ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"
Restart afterwards. Python ≥ 3.12 and a recent, V3-API ComfyUI; the contrib wheel is the only dependency and there are no models to download for the low-level wrappers. comfyui_cv is GPL-3.0, a fork of geroldmeisinger/opencv-comfyui, largely LLM-written, and its author is up front that it isn't production-grade and that updates are unscheduled.
Common issues
- Nothing downstream accepts your link. Expected. The pack's curated depth widgets are dropdowns with named options; those take
CV_8S, not1. Use this node when you need the number, not as a way to drive a combo. - The value looks meaningless (e.g. a negative or huge number). You left
channelsat 0. Raw wrappers don't hold your hand. - You fed
CV_8SCoutput into an image-ish input and cv2 raised on execution. That happens with the array type, not this node - nothing in ComfyUI hands you signed 8-bit data, andLoad Imageproduces uint8 (unsigned). Treat the 8SC code as documentation, not a destination.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| channels | INT | 0-2147483648–2147483647 | - - - |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int | INT | — |