Lichaamsdetectie
Instantie declareren
Voeg je een Lichaamsdetectie(BodyDetection)-blok toe aan het werkgebied, dan wordt in de Python-code automatisch de volgende instantiedeclaratie ingevoegd:
body_detection = BodyDetection(0)
# als er meerdere instanties zijn
body_detection_1 = BodyDetection(1)Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| index | Keuzelijstoptie | Instantienummer (begint bij 0) | geheel getal ≥ 0 | 0 |
Camera instellen
Stelt de camera voor de lichaamsdetectie in.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| unit | Keuzelijstoptie | Naam van het camera-apparaat | Cameralabel van het systeem | - |
Python
body_detection = BodyDetection(0)
body_detection.device('')Lichaamsmodel laden
Laadt het getrainde lichaamsmodel. Deze stap is beslist nodig om de functies van de module „Lichaamsdetectie" te gebruiken.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| wait | Aankruisvak | Wachten tot het laden klaar is | TRUE / FALSE | TRUE |
Python
body_detection = BodyDetection(0)
body_detection.load_model(wait=True)Eenmaal lichaam detecteren
Zoekt het lichaam in het huidige beeld en markeert het precies één keer.

Parameters
(geen)
Python
body_detection = BodyDetection(0)
body_detection.detect_once()Continue lichaamsdetectie starten / stoppen
Volgt het lichaam in het huidige beeld voortdurend en markeert het op het scherm.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| unit | Keuzelijstoptie | Actie | starten(start), stoppen(stop) | - |
Python
body_detection = BodyDetection(0)
# unit = "start"
body_detection.detect_continuous()
# unit = "stop"
body_detection.stop()Resultaat tonen
Bepaalt of het resultaat van de lichaamsdetectie in het camerabeeld wordt getoond of niet.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| on | Keuzelijstoptie | Weergave ON / OFF | tonen(on=True), verbergen(off=False) | TRUE |
Python
body_detection = BodyDetection(0)
body_detection.display(True)
body_detection.display(False)Coördinaat van lichaamsdelen
Geeft de coördinaat per lichaamsdeel terug.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| unit | Keuzelijstoptie | Lichaamsdeel | neus(nose), mond(mouth), linkeroog(left eye), rechteroog(right eye), linkeroor(left ear), rechteroor(right ear), linkerschouder(left shoulder), rechterschouder(right shoulder), linkerelleboog(left elbow), rechterelleboog(right elbow), linkerpols(left wrist), rechterpols(right wrist), linkerhand(left hand), rechterhand(right hand), linkerheup(left hip), rechterheup(right hip), linkerknie(left knee), rechterknie(right knee), linkerenkel(left ankle), rechterenkel(right ankle), linkervoet(left foot), rechtervoet(right foot) | - |
| pos | Keuzelijstoptie | Coördinaat | x, y | - |
Python
body_detection = BodyDetection(0)
body_detection.nose('x')
body_detection.mouth('y')
body_detection.left_eye('x')
body_detection.right_shoulder('y')
body_detection.left_hand('x')Afstand tussen twee delen
Geeft de afstand tussen twee lichaamsdelen terug.

Parameters
| Naam | Soort | Beschrijving | Bereik / Type | Standaardwaarde |
|---|---|---|---|---|
| unit1 | Keuzelijstoptie | Eerste lichaamsdeel | (zie de tabel met lichaamsdelen hierboven) | - |
| unit2 | Keuzelijstoptie | Tweede lichaamsdeel | (zie de tabel met lichaamsdelen hierboven) | - |
| type | Keuzelijstoptie | Soort afstand | afstand (weggelaten of None), horizontale afstand(horizontal), verticale afstand(vertical) | None |
Python
body_detection = BodyDetection(0)
body_detection.get_distance('left_shoulder', 'right_shoulder') # afstand
body_detection.get_distance('left_wrist', 'right_wrist', 'horizontal') # horizontale afstand
body_detection.get_distance('left_hip', 'left_knee', 'vertical') # verticale afstandLaadstatus van het lichaamsmodel
Geeft de laadstatus van het lichaamsmodel terug.
Is het nog niet geladen, dan komt 0 terug, tijdens het laden 1 en na het laden 2.

Parameters
(geen)
Python
body_detection = BodyDetection(0)
body_detection.model_state()Lichaam gedetecteerd?
Of er een lichaam is gevonden

Parameters
(geen)
Python
body_detection = BodyDetection(0)
body_detection.detected()