---
title: "align-depth-color"
description: "## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#overview](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#overview)Overview The depth sensor and the RGB sensor are positioned differently on the camera, resulting in a slight displacement between the images captured by each sensor. To align the depth and RGB images, we need to enable the \"Registration\"…"
url: "https://dev.lips-hci.com/lipsedge-sdk-python/python-align-depth-color/"
updated: "2025-06-30"
category: "LIPSedge™ SDK 1.x / LIPSedge™ SDK Languages & Libraries / Python"
tags:
  - LIPSedge SDK
---

# align-depth-color

## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#overview](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#overview)Overview

The depth sensor and the RGB sensor are positioned differently on the camera, resulting in a slight displacement between the images captured by each sensor. To align the depth and RGB images, we need to enable the "Registration" setting.

## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#expect-output](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#expect-output)Expect Output

- Registration diabled

![adc1 | LIPS® Developer Documentation](https://dev.lips-hci.com/wp-content/uploads/2025/02/adc1.avif)

- Registration Enabled

![adc2 | LIPS® Developer Documentation](https://dev.lips-hci.com/wp-content/uploads/2025/02/adc2.avif)

## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#prerequisite](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#prerequisite)Prerequisite

- [OpenCV Viewer](https://github.com/lips-marketing/lips_gitbook_dev/blob/master/sdk-code-samples-and-languages-wrappers/openni2/opencv_viewer/README.md)

## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#tutorial](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#tutorial)Tutorial

Modify from [opencv_viewer](https://github.com/lips-marketing/lips_gitbook_dev/blob/master/sdk-code-samples-and-languages-wrappers/openni2/opencv_viewer/README.md). After getting color and depth frame, we use opencv `addWeighted` function to overlap these two images.Copy

```
overlappingMat = cv2.addWeighted(rgbMat, 0.8, depthMat, 0.2, 0.0)
```

To turn on/off registration, Use `setImageRegistrationMode` in SDK and give proper parameter.Copy

```
// Enable
device.set_image_registration_mode(openni2.IMAGE_REGISTRATION_DEPTH_TO_COLOR)

//Disable
device.set_image_registration_mode(openni2.openni2.IMAGE_REGISTRATION_OFF)
```

Use variable `enableRegistration` to determinate whether to enable registration. When press 'a' on keyboard, turn on/off registration.Copy

```
 if input == ord('a'):
    enableRegistration = not enableRegistration
    device.set_image_registration_mode(openni2.IMAGE_REGISTRATION_DEPTH_TO_COLOR if enableRegistration else openni2.IMAGE_REGISTRATION_OFF)
    print(f"Image Registration: {'Enable' if enableRegistration else 'Disable'}")
```

## [https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#full-code](https://dev.lips-hci.com/lipsedge-tm-sdk-languages-and-libraries/overview-1/align-depth-color#full-code)Full code

[align-depth-color.py](https://github.com/lips-hci/dev-doc-code-samples/blob/master/python/align-depth-color/align-depth-color.py)
