> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dwe.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# exploreHD OpenCV-Schnellstartanleitung

> Eine grundlegende Einführung in die Verwendung der exploreHD-Kamera mit Python und OpenCV.

<div style={{ marginTop: '-40px' }} />

## Voraussetzungen

Bevor Sie die Anwendung ausführen, stellen Sie sicher, dass Folgendes auf Ihrem System installiert ist:

* Python (Version 3.x)
* OpenCV-Bibliothek (`cv2`)

## Beispielcode

Sie können das folgende `main.py`-Skript verwenden, um sich mit der Kamera zu verbinden und den Video-Feed anzuzeigen. Ein entscheidender Schritt bei der Konfiguration der Kamera ist, dass das Pixelformat `MJPG` *vor* der Auflösung eingestellt werden muss.

```python theme={null}
import cv2

# -- Camera Parameters --
# Camera Index
CAM_IDX = 0
# resolution
WIDTH = 1920
HEIGHT = 1080
# used to set the pixel format to MJPEG/MJPG mode.
MJPG = cv2.VideoWriter_fourcc(*'MJPG')

# -- DEVICE SETUP --
exploreHD = cv2.VideoCapture(CAM_IDX)

# set to MJPEG mode, by default idx 0 is YUYV
# MJPG needs to be set, before resolution. Pixel format is always selected first
exploreHD.set(cv2.CAP_PROP_FOURCC, MJPG)

exploreHD.set(cv2.CAP_PROP_FRAME_WIDTH, WIDTH)
exploreHD.set(cv2.CAP_PROP_FRAME_HEIGHT, HEIGHT)

# (Optional) Disable auto exposure
exploreHD.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1)
exploreHD.set(cv2.CAP_PROP_EXPOSURE, 90)

# Error Check
if ((exploreHD == None) or (not exploreHD.isOpened())):
    print('\nError - could not open video device.\n')
    exit(0)

while(True):
    success, frame = exploreHD.read()
    if (success):
        cv2.imshow('exploreHD', frame)
    
    # required for frames to buffer and show properly.
    k = cv2.waitKey(1)

    # press 'q' to quit
    if k == ord('q'):
        break
    
exploreHD.release()
cv2.destroyAllWindows()
```

## Weitere Informationen

Für zusätzliche Details, Beispiele in anderen Sprachen wie C++ oder zur Fehlerbehebung konsultieren Sie bitte unser GitHub-Repository.

<Card title="OpenCV-Schnellstart-Repository" icon="Github" href="https://github.com/DeepWaterExploration/opencv-guides">
  Grundlegende Videoaufnahme, softwareseitiges Frame-Sampling, C++-Code usw.
</Card>
