# MixingCameraExtension

## GetSubCameraOfClass

Returns a sub-camera with given class. Returns nullptr if not found or invalid. Note that inherited classes will also be considered as desired. That is, if current sub-camera is B inherited from A, and your specified camera class is A, this function will return this sub-camera as **it is** a type of A.

![](https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FLGNulIy2AR1K99qows0t%2Fsub1.png?alt=media\&token=3eaf9341-20cf-4111-a28f-f7b511853057)

<table><thead><tr><th width="163.33333333333331">Input / Output</th><th width="140"></th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td></td><td></td></tr><tr><td></td><td>Target</td><td>A <code>MixingCameraExtension</code>target object.</td></tr><tr><td></td><td>Camera Class</td><td>The desired camera class you want to extract.</td></tr><tr><td>Output</td><td></td><td></td></tr><tr><td></td><td>Return Value</td><td>A camera object with your specified class. Can be nullptr.</td></tr></tbody></table>

## GetSubCameraOfIndex

Returns a sub-camera at specified index. This function will check if it's valid. If the input index is out of range, it will return nullptr.

![](https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2Fu8bnuGvyIMlvPpFihmjX%2Fsub2.png?alt=media\&token=b556c8d8-ead2-4f1b-9862-b52eeb4cd98d)

<table><thead><tr><th width="163.33333333333331">Input / Output</th><th width="140"></th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td></td><td></td></tr><tr><td></td><td>Target</td><td>A <code>MixingCameraExtension</code>target object.</td></tr><tr><td></td><td>Index</td><td>Camera index, in the order of how you set it up.</td></tr><tr><td>Output</td><td></td><td></td></tr><tr><td></td><td>Return Value</td><td>A camera object at the given index. Can be nullptr.</td></tr></tbody></table>

## NormalizeWeights

Normalize an array of input weights. Make sure the weight number is equal to the number of sub-cameras. Besides, this function will not take invalid cameras into account. If no valid camera is found, it will return the input weight array. If all input weights are zero, it will output an average weight array.

![](https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FOQUMdbeUJ5tZdzJBkWZh%2Fnormalizeweights.png?alt=media\&token=3902421b-3cc1-4369-802a-3c8bfa8e9193)

<table><thead><tr><th width="163.33333333333331">Input / Output</th><th width="140"></th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td></td><td></td></tr><tr><td></td><td>Target</td><td>A <code>MixingCameraExtension</code>target object.</td></tr><tr><td></td><td>In Weights</td><td>Un-normalized weights. Make sure the number is equal to the number of sub-cameras.</td></tr><tr><td>Output</td><td></td><td></td></tr><tr><td></td><td>Return Value</td><td>A normalized weight array. Sum is 1.</td></tr></tbody></table>

## SetWeights

Set weights by given input weights.

![](https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FKqtmENiQ1814X6wNHcgS%2Fsetweights.png?alt=media\&token=d9e75dc1-9c8c-4282-b141-df899c00d7f2)

<table><thead><tr><th width="163.33333333333331">Input / Output</th><th width="140"></th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td></td><td></td></tr><tr><td></td><td>Target</td><td>A <code>MixingCameraExtension</code>target object.</td></tr><tr><td></td><td>In Weights</td><td>Input weights. Make sure their sum is 1.</td></tr></tbody></table>
