Skip to content

PiGear API Parameters⚓

camera_num⚓

This parameter selects the camera module index which will be used as source, if you're having multiple camera modules connected. Its value can only be greater than zero, otherwise, it will throw ValueError for any negative value.

This parameter shouldn't be altered, until unless you using Raspberry Pi 3/3+ Compute Module IO Board."

Data-Type: Integer

Default Value: Its default value is 0.

Usage:

PiGear(camera_num=0)

 

resolution⚓

This parameter sets the resolution (i.e. (width,height)) of the source.

For more information read here ➶

Data-Type: Tuple

Default Value: Its default value is (640,480).

Usage:

PiGear(resolution=(1280,720)) # sets 1280x720 resolution

 

framerate⚓

This parameter sets the framerate of the source.

For more information read here ➶

Data-Type: integer/float

Default Value: Its default value is 30.

Usage:

PiGear(framerate=60) # sets 60fps framerate

 

colorspace⚓

This parameter selects the colorspace of the source stream.

Data-Type: String

Default Value: Its default value is None.

Usage:

All supported colorspace values are given here ➶

PiGear(colorspace="COLOR_BGR2HSV")

Its complete usage example is given here ➶

 

options⚓

This parameter provides the ability to alter various Tweak Parameters like brightness, saturation, senor_mode, resolution, etc. available within Picamera library.

Data-Type: Dictionary

Default Value: Its default value is {}

Usage:

All supported parameters are listed in PiCamera Docs

The desired parameters can be passed to PiGear API by formatting them as this parameter's attributes, as follows:

# formatting parameters as dictionary attributes
options = {
    "hflip": True,
    "exposure_mode": "auto",
    "iso": 800,
    "exposure_compensation": 15,
    "awb_mode": "horizon",
    "sensor_mode": 0,
}
# assigning it
PiGear(logging=True, **options)

User-specific attributes:

Additionally, options parameter also support some User-specific attributes, which are as follows:

  • HWFAILURE_TIMEOUT (float): PiGear contains Threaded Internal Timer - that silently keeps active track of any frozen-threads/hardware-failures and exit safely, if any does occur at a timeout value. This parameter can be used to control that timeout value i.e. the maximum waiting time (in seconds) after which PiGear exits with a SystemError to save resources. Its value can only be between 1.0 (min) and 10.0 (max) and its default value is 2.0. Its usage is as follows:

    options = {"HWFAILURE_TIMEOUT": 2.5}  # sets timeout to 2.5 seconds
    

 

logging⚓

This parameter enables logging (if True), essential for debugging.

Data-Type: Boolean

Default Value: Its default value is False.

Usage:

PiGear(logging=True)

 

time_delay⚓

This parameter set the time delay (in seconds) before the PiGear API start reading the frames. This delay is only required if the source required some warm-up delay before starting up.

Data-Type: Integer

Default Value: Its default value is 0.

Usage:

PiGear(time_delay=1)  # set 1 seconds time delay

 


Last update: August 11, 2021