Skip to content

Håndregistrering ​

Instanserklæring ​

Når du tilføjer en Håndregistrering(HandDetection)-blok i arbejdsområdet, indsættes følgende instanserklæring automatisk i Python-koden:

python
hand_detection = HandDetection(0)
# Når der er flere instanser
hand_detection_1 = HandDetection(1)

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
indexRullemenupunktInstansnummer (starter ved 0)Heltal 0 eller større0

Vælg kameraenhed ​

Indstiller, hvilket kamera der skal bruges til håndregistreringen.

device

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unitRullemenupunktKameraets enhedsnavnSystemets kameraetiket-

Python ​

python
hand_detection = HandDetection(0)

hand_detection.device('')

Indlæs modellen ​

Indlæser den trænede håndmodel. Dette trin er nødvendigt for at kunne bruge funktionerne i modulet Håndregistrering.

load_model

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
waitAfkrydsningsfeltOm kørslen skal vente, indtil indlæsningen er færdigTRUE / FALSETRUE

Python ​

python
hand_detection = HandDetection(0)

hand_detection.load_model(wait=True)

Indstil højeste antal hænder ​

Bestemmer, om registreringen skal tage udgangspunkt i én hånd eller i begge hænder.

max_hands

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unitRullemenupunktAntal hænderén hånd(one), to hænder(both)-

Python ​

python
hand_detection = HandDetection(0)

hand_detection.max_hands('one')
hand_detection.max_hands('both')

Registrér én gang ​

Finder de hænder, der er i billedet lige nu, og viser dem én enkelt gang.

detect_once

Parametre ​

(ingen)

Python ​

python
hand_detection = HandDetection(0)

hand_detection.detect_once()

Start / stop kontinuerlig registrering ​

Følger de hænder, der er i billedet, hele tiden og viser dem på skærmen.

detect_continuous

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unitRullemenupunktHandlingstart(start), stop(stop)-

Python ​

python
hand_detection = HandDetection(0)

# unit = "start"
hand_detection.detect_continuous()
# unit = "stop"
hand_detection.stop()

Vis resultatet ​

Bestemmer, om resultatet af håndregistreringen skal vises i kamerabilledet eller ikke.

display

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
onRullemenupunktVisning TIL / FRAvis(on=True), skjul(off=False)TRUE

Python ​

python
hand_detection = HandDetection(0)

hand_detection.display(True)
hand_detection.display(False)

Håndens deles koordinater ​

Returnerer positionen for håndfladen eller håndleddet på den angivne hånd.

hand_data

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
sideRullemenupunktHåndens sidevenstre(left), højre(right)-
unitRullemenupunktHånddelhåndflade(palm), håndled(wrist)-
posRullemenupunktSlags koordinat/størrelsex, y-

Python ​

python
hand_detection = HandDetection(0)

hand_detection.hand('left', 'palm', 'x')
hand_detection.hand('right', 'wrist', 'y')
hand_detection.hand('left', 'hand', 'min_x')
hand_detection.hand('right', 'palm', 'width')

Fingerleddenes koordinater ​

Returnerer koordinaterne for leddene på den angivne finger.

joint_data

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
sideRullemenupunktHåndens sidevenstre(left), højre(right)-
unitRullemenupunktFingertommelfinger(thumb), pegefinger(index), langfinger(middle), ringfinger(ring), lillefinger(pinky)-
jointRullemenupunktLeddets positionførste led(first), andet led(second), tredje led(third), spidsen(last)-
posRullemenupunktKoordinatx, y-

Python ​

python
hand_detection = HandDetection(0)

hand_detection.finger('left', 'index', 'first', 'x')
hand_detection.finger('right', 'thumb', 'last', 'y')

Håndrektanglens oplysninger ​

Returnerer position og størrelse for rektanglen omkring den angivne hånd.

hand_square

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
sideRullemenupunktHåndens sidevenstre(left), højre(right)-
unitRullemenupunktHånddelhånd(hand), håndflade(palm)-
posRullemenupunktRektangeloplysningermin. x-position(min_x), maks. x-position(max_x), min. y-position(min_y), maks. y-position(max_y), bredde(width), højde(height), areal(area)-

Python ​

python
hand_detection = HandDetection(0)

hand_detection.hand('left', 'hand', 'min_x')
hand_detection.hand('right', 'palm', 'width')

Afstand mellem hånd og hånd ​

Returnerer afstanden mellem to hånddele.

hand_to_hand_distance

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unit1Input (streng)Første hånddelHånd: 'side_unit' (f.eks. 'left_palm'). side=left/right, unit=palm/wrist/hand-
unit2Input (streng)Anden hånddelHånd: 'side_unit' (f.eks. 'right_palm'). side=left/right, unit=palm/wrist/hand-
typeRullemenupunktSlags afstandafstand (udelades eller None), vandret afstand(horizontal), lodret afstand(vertical)None

Python ​

python
hand_detection = HandDetection(0)

# hånd ↔ hånd / afstand
hand_detection.get_distance('left_palm', 'right_palm')

Afstand mellem hånd og finger ​

Returnerer afstanden mellem en hånddel og et fingerled.

hand_to_joint_distance

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unit1Input (streng)Første delHånd: 'side_unit' (f.eks. 'left_palm').side=left/right, unit=palm/wrist/hand-
unit2Input (streng)Anden delFinger: 'side_unit_joint' (f.eks. 'right_index_first'). unit=thumb/index/middle/ring/pinky, joint=first/second/third/last-
typeRullemenupunktSlags afstandafstand (udelades eller None), vandret afstand(horizontal), lodret afstand(vertical)None

Python ​

python
hand_detection = HandDetection(0)

# hånd ↔ fingerled / vandret afstand
hand_detection.get_distance('left_palm', 'right_index_first')

Afstand mellem finger og finger ​

Returnerer afstanden mellem to fingerled.

joint_to_joint_distance

Parametre ​

NavnSlagsBeskrivelseInterval / TypeStandard
unit1Input (streng)Første delFinger: 'side_unit_joint' (f.eks. 'left_thumb_last'). unit=thumb/index/middle/ring/pinky, joint=first/second/third/last-
unit2Input (streng)Anden delFinger: 'side_unit_joint' (f.eks. 'right_index_first'). unit=thumb/index/middle/ring/pinky, joint=first/second/third/last-
typeRullemenupunktSlags afstandafstand (udelades eller None), vandret afstand(horizontal), lodret afstand(vertical)None

Python ​

python
hand_detection = HandDetection(0)

# fingerled ↔ fingerled / lodret afstand
hand_detection.get_distance('left_thumb_last', 'right_index_first', 'vertical')

Modellens tilstand ​

Returnerer håndmodellens indlæsningstilstand.
Den returnerer 0, hvis modellen ikke er indlæst endnu, 1 mens den indlæses, og 2 når indlæsningen er færdig.

model_state

Parametre ​

(ingen)

Python ​

python
hand_detection = HandDetection(0)

hand_detection.model_state()

Er der registreret en hånd? ​

Om der er fundet en hånd

detected

Parametre ​

(ingen)

Python ​

python
hand_detection = HandDetection(0)

hand_detection.detected()