0.0.7 • Published 5 months ago

@mat2718/capacitor-face-detection v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@mat2718/face-detection

Live face detection for Capacitor

Install

npm install @mat2718/face-detection
npx cap sync

API

startActiveScan(...)

startActiveScan(options: StartActiveScanOptions) => Promise<void>
ParamType
optionsStartActiveScanOptions

readFaceFromImage(...)

readFaceFromImage(options: readFaceFromImageOptions) => Promise<FaceDetectionResults>
ParamType
optionsreadFaceFromImageOptions

Returns: Promise<FaceDetectionResults>


stopScan()

stopScan() => Promise<void>

addListener('faceScanned', ...)

addListener(eventName: 'faceScanned', listenerFunc: (event: ActiveFaceSanResult) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
ParamType
eventName'faceScanned'
listenerFunc(event: ActiveFaceSanResult) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('scanError', ...)

addListener(eventName: 'scanError', listenerFunc: (event: ScanErrorEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
ParamType
eventName'scanError'
listenerFunc(event: ScanErrorEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

enableTorch()

enableTorch() => Promise<void>

disableTorch()

disableTorch() => Promise<void>

toggleTorch()

toggleTorch() => Promise<void>

isTorchEnabled()

isTorchEnabled() => Promise<IsTorchEnabledResult>

Returns: Promise<IsTorchEnabledResult>


isTorchAvailable()

isTorchAvailable() => Promise<IsTorchAvailableResult>

Returns: Promise<IsTorchAvailableResult>


openSettings()

openSettings() => Promise<void>

isSupported()

isSupported() => Promise<IsSupportedResult>

Returns: Promise<IsSupportedResult>


checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Returns: Promise<PermissionStatus>


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Returns: Promise<PermissionStatus>


Interfaces

StartActiveScanOptions

PropType
lensFacingLensFacing

FaceDetectionResults

PropType
facesFace[]

Face

Represents a face detected by FaceDetector.

PropTypeDescription
boundsRectReturns the axis-aligned bounding rectangle of the detected face.
landmarksFaceLandmark[]Returns a list of face landmarks.
contoursFaceContour[]Returns a list of face contours.
trackingIdnumberReturns the tracking ID if the tracking is enabled.
headEulerAngleXnumberReturns the rotation of the face about the horizontal axis of the image. Positive euler X is the face is looking up.
headEulerAngleYnumberReturns the rotation of the face about the vertical axis of the image. Positive euler y is when the face turns toward the right side of the image that is being processed.
headEulerAngleZnumberReturns the rotation of the face about the axis pointing out of the image. Positive euler z is a counter-clockwise rotation within the image plane.
smilingProbabilitynumberReturns a value between 0.0 and 1.0 giving a probability that the face is smiling.
leftEyeOpenProbabilitynumberReturns a value between 0.0 and 1.0 giving a probability that the face's left eye is open.
rightEyeOpenProbabilitynumberReturns a value between 0.0 and 1.0 giving a probability that the face's right eye is open.

Rect

Rect holds four integer coordinates for a rectangle.

PropTypeDescriptionSince
leftnumberThe X coordinate of the left side of the rectangle.5.1.0
topnumberThe Y coordinate of the top of the rectangle.5.1.0
rightnumberThe X coordinate of the right side of the rectangle.5.1.0
bottomnumberThe Y coordinate of the bottom of the rectangle.5.1.0

FaceLandmark

Represent a face landmark. A landmark is a point on a detected face, such as an eye, nose, or mouth.

PropTypeDescriptionSince
typeLandmarkTypeGets the FaceLandmark.LandmarkType type.5.1.0
positionPointGets a 2D point for landmark position, where (0, 0) is the upper-left corner of the image.5.1.0

Point

Point holds two coordinates

PropType
xnumber
ynumber

FaceContour

Represent a face contour. A contour is a list of points on a detected face, such as the mouth.

PropTypeDescriptionSince
typeContourTypeGets the FaceContour.ContourType type.5.1.0
pointsPoint[]Gets a list of 2D points for this face contour, where (0, 0) is the upper-left corner of the image.5.1.0

readFaceFromImageOptions

PropType
pathstring

PluginListenerHandle

PropType
remove() => Promise<void>

ActiveFaceSanResult

PropType
faceFace

ScanErrorEvent

PropType
messagestring

IsTorchEnabledResult

PropType
enabledboolean

IsTorchAvailableResult

PropType
availableboolean

IsSupportedResult

PropType
supportedboolean

PermissionStatus

PropType
cameraCameraPermissionState

Type Aliases

CameraPermissionState

PermissionState | 'limited'

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

Enums

LensFacing

MembersValue
Front'FRONT'
Back'BACK'

LandmarkType

MembersValueDescriptionSince
MouthBottom0The center of the subject's bottom lip.5.1.0
LeftCheek1The midpoint between the subject's left mouth corner and the outer corner of the subject's left eye. For full profile faces, this becomes the centroid of the nose base, nose tip, left ear lobe and left ear tip.5.1.0
LeftEar3The midpoint of the subject's left ear tip and left ear lobe.5.1.0
LeftEye4The center of the subject's left eye cavity.5.1.0
MouthLeft5The subject's left mouth corner where the lips meet.5.1.0
NoseBase6The midpoint between the subject's nostrils where the nose meets the face.5.1.0
RightCheek7The midpoint between the subject's right mouth corner and the outer corner of the subject's right eye. For full profile faces, this becomes the centroid of the nose base, nose tip, right ear lobe and right ear tip.5.1.0
RightEar9The midpoint of the subject's right ear tip and right ear lobe.5.1.0
RightEye10The center of the subject's right eye cavity.5.1.0
MouthRight11The subject's right mouth corner where the lips meet.5.1.0

ContourType

MembersValueDescriptionSince
Face1The outline of the subject's face.5.1.0
LeftEyebrowTop2The top outline of the subject's left eyebrow.5.1.0
LeftEyebrowBottom3The bottom outline of the subject's left eyebrow.5.1.0
RightEyebrowTop4The top outline of the subject's right eyebrow.5.1.0
RightEyebrowBottom5The bottom outline of the subject's right eyebrow.5.1.0
LeftEye6The outline of the subject's left eye cavity.5.1.0
RightEye7The outline of the subject's right eye cavity.5.1.0
UpperLipTop8The top outline of the subject's upper lip.5.1.0
UpperLipBottom9The bottom outline of the subject's upper lip.5.1.0
LowerLipTop10The top outline of the subject's lower lip.5.1.0
LowerLipBottom11The bottom outline of the subject's lower lip.5.1.0
NoseBridge12The outline of the subject's nose bridge.5.1.0
NoseBottom13The outline of the subject's nose bridge.5.1.0
LeftCheek14The center of the left cheek.5.1.0
RightCheek15The center of the right cheek.5.1.0
0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago