# Intensity Processing¶

The intensity module contains classes that hide some of all the repeated code associated with processing intensity data. The main component is the IntensityProcessing class, which is used to process continuously retrieved data from the kinect. The background model used in this class is obtained through Zivkovic method: Adaptive Gaussian Mixture Model. The extraction of the foreground pixels proposals is obtained via the IntensityProcessing.compute_foreground_masks(). The bounding boxes proposals are extracted using IntensityProcessing.extract_proposal_bbox() from an aggregator build using Porikli’s method via IntensityProcessing.update_detection_aggregator().

## Usage Example¶

If code already exists to retrieve the data extracting the bounding boxes proposals can be reduced to as little as the following:

# get next video frame
rgb.current_frame = cam.get_image()
while True:
# get rgb dual background (long and short sensitivity)
# N.B. background is black (0) and foreground white (1)
rgb.compute_foreground_masks(rgb.current_frame)

# update rgb aggregator
rgb.update_detection_aggregator()

# extract bounding box proposals
rgb_proposal_bbox = rgb.extract_proposal_bbox()


## IntensityProcessing class¶

This module contains class for intensity processing. This class handles the rgb camera status and its methods ensure proper updates to the background models and the bounding boxes extraction.

class intensity_processing.IntensityProcessing(image_shape=(640, 480))[source]
compute_foreground_masks(frame)[source]

Compute foreground masks for term background and short term background following Porikli’s method

Parameters: frame (np.uint8) – frame (3 channels) from which extract foregrounds masks foreground masks for long term and short term backgrounds np.int8
extract_proposal_bbox()[source]

Extract RGB proposal as the bounding boxes of the areas of the accumulator that have reached a value of AGG_RGB_MAX_E

Returns: list of bounding boxes
update_detection_aggregator()[source]

Update aggregator with the provided foregrounds. If a pixel is in foreground_long but not in foreground_short increment its accumulator otherwise decrement it. If a particular area has already been detected as proposal don’t decrement if the above condition is not verified.

Returns: updated accumulator np.int8