spacr.image_colors¶
Colour-order boundaries for OpenCV.
spaCR’s in-memory colour contract is RGB (or RGBA). OpenCV is the one major
dependency that decodes and encodes three-channel images as BGR, so conversions
belong directly beside imread/imwrite rather than in plotting or model
code. Grayscale arrays pass through unchanged.
Attributes¶
Functions¶
|
Convert an OpenCV BGR/BGRA array to spaCR's RGB/RGBA contract. |
|
Read with OpenCV and immediately return RGB/RGBA in memory. |
|
Convert an RGB/RGBA array only for an immediate OpenCV write call. |
|
Write an RGB/RGBA array through OpenCV without leaking BGR internally. |
Module Contents¶
- spacr.image_colors.cv2_to_rgb(image: numpy.ndarray | None) numpy.ndarray | None[source]¶
Convert an OpenCV BGR/BGRA array to spaCR’s RGB/RGBA contract.
- spacr.image_colors.read_image_rgb(path: PathValue, flags: int = -1) numpy.ndarray | None[source]¶
Read with OpenCV and immediately return RGB/RGBA in memory.
- spacr.image_colors.rgb_to_cv2(image: numpy.ndarray) numpy.ndarray[source]¶
Convert an RGB/RGBA array only for an immediate OpenCV write call.
- spacr.image_colors.write_image_rgb(path: PathValue, image: numpy.ndarray, params=None) bool[source]¶
Write an RGB/RGBA array through OpenCV without leaking BGR internally.