Opt Module

The opt module provides global configuration options that affect the behavior of various functions in the cv3 library.

Global configuration options for cv3.

This module provides global configuration options that affect the behavior of various functions in the cv3 library. These options can be modified directly or through provided setter functions.

cv3.opt.RGB

Flag indicating whether to use RGB color format (True) or BGR (False).

Type:

bool

cv3.opt.FPS

Default frames per second for video operations.

Type:

int

cv3.opt.FOURCC

Default codec for video writing.

Type:

str or int

cv3.opt.THICKNESS

Default line thickness for drawing operations.

Type:

int

cv3.opt.COLOR

Default color for drawing operations.

cv3.opt.FONT

Default font for text drawing operations.

cv3.opt.LINE_TYPE

Default line type for drawing operations.

cv3.opt.THRESHOLD_TYPE

Default threshold type for threshold operations.

cv3.opt.SCALE

Default scale factor for drawing operations.

Type:

float

cv3.opt.PT_RADIUS

Default point radius for drawing operations.

Type:

int

cv3.opt.EXPERIMENTAL

Flag to enable experimental features.

Type:

bool

cv3.opt.set_rgb()[source]

Set the color format to RGB.

This function sets the global RGB flag to True, indicating that color values should be interpreted as RGB rather than BGR.

cv3.opt.set_bgr()[source]

Set the color format to BGR.

This function sets the global RGB flag to False, indicating that color values should be interpreted as BGR rather than RGB.

cv3.opt.video(fps=None, fourcc=None)[source]

Set default video parameters.

Parameters:
  • fps (int, optional) – Default frames per second for video operations.

  • fourcc (str or int, optional) – Default codec for video writing.

Raises:

AssertionError – If fps is not positive.

cv3.opt.draw(thickness=None, color=None, font=None, pt_radius=None, scale=None, line_type=None)[source]

Set default drawing parameters.

Parameters:
  • thickness (int, optional) – Default line thickness for drawing operations.

  • color (optional) – Default color for drawing operations.

  • font (optional) – Default font for text drawing operations.

  • pt_radius (int, optional) – Default point radius for drawing operations.

  • scale (float, optional) – Default scale factor for drawing operations.

  • line_type (optional) – Default line type for drawing operations.

Raises:
  • AssertionError – If thickness is not a positive integer.

  • AssertionError – If color is not of a supported type.

cv3.opt.set_exp(exp=True)[source]

set_rgb()

Set the color format to RGB.

set_bgr()

Set the color format to BGR.

video([fps, fourcc])

Set default video parameters.

draw([thickness, color, font, pt_radius, ...])

Set default drawing parameters.

RGB

bool(x) -> bool

FPS

int([x]) -> integer int(x, base=10) -> integer

FOURCC

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

THICKNESS

int([x]) -> integer int(x, base=10) -> integer

COLOR

int([x]) -> integer int(x, base=10) -> integer

FONT

int([x]) -> integer int(x, base=10) -> integer

SCALE

int([x]) -> integer int(x, base=10) -> integer

PT_RADIUS

int([x]) -> integer int(x, base=10) -> integer

EXPERIMENTAL

bool(x) -> bool