Skip to content

Lichaamsdetectie ​

Instantie declareren ​

Voeg je een Lichaamsdetectie(BodyDetection)-blok toe aan het werkgebied, dan wordt in de Python-code automatisch de volgende instantiedeclaratie ingevoegd:

python
body_detection = BodyDetection(0)
# als er meerdere instanties zijn
body_detection_1 = BodyDetection(1)

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
indexKeuzelijstoptieInstantienummer (begint bij 0)geheel getal ≥ 00

Camera instellen ​

Stelt de camera voor de lichaamsdetectie in.

device

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
unitKeuzelijstoptieNaam van het camera-apparaatCameralabel van het systeem-

Python ​

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.

load_model

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
waitAankruisvakWachten tot het laden klaar isTRUE / FALSETRUE

Python ​

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.

detect_once

Parameters ​

(geen)

Python ​

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.

detect_continuous

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
unitKeuzelijstoptieActiestarten(start), stoppen(stop)-

Python ​

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.

display

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
onKeuzelijstoptieWeergave ON / OFFtonen(on=True), verbergen(off=False)TRUE

Python ​

python
body_detection = BodyDetection(0)

body_detection.display(True)
body_detection.display(False)

Coördinaat van lichaamsdelen ​

Geeft de coördinaat per lichaamsdeel terug.

body_data

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
unitKeuzelijstoptieLichaamsdeelneus(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)-
posKeuzelijstoptieCoördinaatx, y-

Python ​

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.

body_distance

Parameters ​

NaamSoortBeschrijvingBereik / TypeStandaardwaarde
unit1KeuzelijstoptieEerste lichaamsdeel(zie de tabel met lichaamsdelen hierboven)-
unit2KeuzelijstoptieTweede lichaamsdeel(zie de tabel met lichaamsdelen hierboven)-
typeKeuzelijstoptieSoort afstandafstand (weggelaten of None), horizontale afstand(horizontal), verticale afstand(vertical)None

Python ​

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 afstand

Laadstatus 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.

model_state

Parameters ​

(geen)

Python ​

python
body_detection = BodyDetection(0)

body_detection.model_state()

Lichaam gedetecteerd? ​

Of er een lichaam is gevonden

detected

Parameters ​

(geen)

Python ​

python
body_detection = BodyDetection(0)

body_detection.detected()