# detection_config_generator

Python API: `depthai_nodes.node.utils.detection_config_generator`

## Functions

| Name | Description |
| --- | --- |
| [`generate_script_content`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/detection_config_generator.md#detection_config_generator-Functions-generate_script_content) | Generates the script content for the dai.Script node. |

### function `generate_script_content`

```python
def generate_script_content(
    resize_width: int,
    resize_height: int,
    resize_mode: str = 'STRETCH',
    padding: float = 0.0,
) -> str
```

Generates the script content for the dai.Script node.

It crops and resizes the input image based on the detected object, with optional padding. If a zero-area detection is encountered,
an error message is issued.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `resize_width` | `int` | Target width for the resized image | required |
| `resize_height` | `int` | Target height for the resized image | required |
| `resize_mode` | `str` | Resize mode for the image. Supported values: "CENTER_CROP", "LETTERBOX", "NONE", "STRETCH". Default: "STRETCH". "STRETCH" - stretches the image so that the corners of the region are now in the corners of the output image. "CENTER_CROP" - resizes + crops the image to keep aspect ratio and fill the final size. "LETTERBOX" - resizes + pads the image to the final size to keep aspect ratio. "NONE" - does not scale and pads top, bottom, left and right to fill the final image. | `'STRETCH'` |
| `padding` | `float` | Additional padding around the detection in normalized coordinates (0-1) | `0.0` |

Returns

| Type | Description |
| --- | --- |
| `str` | Generated script content as a string |
