< Back

Get-Emotion

Sun Jan 19, 2020 5:34 pm

NAME Get-Emotion



SYNOPSIS

Cmdlet is capable to detect the Emotion on the Faces identified in an Image on local machine.





SYNTAX

Get-Emotion [-Path] <String> [-Draw] [<CommonParameters>]





DESCRIPTION

This cmdlet is Using Microsoft cognitive service's "Emotion" API as a service to get the information needed by

issuing an HTTP request to the API

NOTE : You need to subscribe the "Emotion API" before using the powershell script from the following link and

setup an environment variable like, $env:$env:MS_Emotion_API_key = "YOUR API KEY"



API Subscription Page - https://www.microsoft.com/cognitive-ser ... us/sign-up





PARAMETERS

-Path <String>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Draw [<SwitchParameter>]

Choose this switch to draw rectangle around facees denoting emotion on the image.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Author: Prateek Singh - @SinghPrateik



-------------------------- EXAMPLE 1 --------------------------



PS Root\\>Get-Emotion -ImagePath C:\\2.jpg



Face : @{height=369; left=503; top=256; width=369}

Anger : 0.00

Contempt : 0.01

Disgust : 0.00

Fear : 0.00

Happiness : 0.81

Sadness : 0.00

Surprise : 0.00



Face : @{height=295; left=94; top=189; width=295}

Anger : 0.00

Contempt : 0.00

Disgust : 0.00

Fear : 0.00

Happiness : 1.00

Sadness : 0.00

Surprise : 0.00



In above example, Function identifies all Face Rectangle in the Image and returns the Emotion scores (0 to 1) on

each and every face.









-------------------------- EXAMPLE 2 --------------------------



PS Root\\>Get-Emotion -ImagePath C:\\2.jpg -Draw



You can use '-Draw' switch and to draw a Rectangle around each face in the image denoting the emotion name, like

Happiness, Anger, contempt.











RELATED LINKS