public class CameraDetector extends Detector
Modifier and Type | Class and Description |
---|---|
static interface |
CameraDetector.CameraSurfaceViewListener
This interface provides methods that the CameraDetector uses to provide updates regarding its graphical elements.
|
static class |
CameraDetector.CameraType
This enumeration is used to specify which camera to use during recording.
|
Detector.FaceListener, Detector.ImageListener
Constructor and Description |
---|
CameraDetector(android.content.Context context,
CameraDetector.CameraType cameraType,
android.view.SurfaceView cameraPreviewView)
Creates a CameraDetector.
|
Modifier and Type | Method and Description |
---|---|
void |
reset()
Resets the baselines used to measure facial expressions and emotions.
|
void |
setCameraDetectorDimensionsListener(CameraDetector.CameraSurfaceViewListener listener) |
void |
setMaxProcessRate(float maxFramesPerSecond)
The maximum processing rate to operate in [FPS].
|
void |
setSendUnprocessedFrames(boolean sendUnprocessedFrameFlag)
When the SDK is in control of the camera, if the SDK frame rate is lower than the camera frame rate, there will
be frames that are not processed for expressions by the SDK.
|
void |
start()
Initiates processing of frames received from the device's camera.
|
void |
stop()
Stops processing frames received from the device's camera, and releases the camera to allow its use by other
apps.
|
getDetectAnger, getDetectAttention, getDetectBrowFurrow, getDetectBrowRaise, getDetectChinRaiser, getDetectContempt, getDetectDisgust, getDetectEngagement, getDetectEyeClosure, getDetectFear, getDetectGender, getDetectInnerBrowRaiser, getDetectJoy, getDetectLipDepressor, getDetectLipPress, getDetectLipPucker, getDetectLipSuck, getDetectMouthOpen, getDetectNoseWrinkler, getDetectSadness, getDetectSmile, getDetectSmirk, getDetectSurprise, getDetectUpperLipRaiser, getDetectValence, getPercentFaceDetected, isRunning, setAllEmotions, setAllExpressions, setDetectAnger, setDetectAttention, setDetectBrowFurrow, setDetectBrowRaise, setDetectChinRaiser, setDetectContempt, setDetectDisgust, setDetectEngagement, setDetectEyeClosure, setDetectFear, setDetectGender, setDetectInnerBrowRaiser, setDetectJoy, setDetectLipDepressor, setDetectLipPress, setDetectLipPucker, setDetectLipSuck, setDetectMouthOpen, setDetectNoseWrinkler, setDetectSadness, setDetectSmile, setDetectSmirk, setDetectSurprise, setDetectUpperLipRaiser, setDetectValence, setFaceListener, setImageListener, setLicensePath, setLicenseStream
public CameraDetector(android.content.Context context, CameraDetector.CameraType cameraType, android.view.SurfaceView cameraPreviewView)
SurfaceView
is much more efficient than using the returned images in the
Detector.ImageListener.onImageResults(List, Frame, float)
callback.context
- application's context.cameraType
- an enumerated value indicating which camera (front or back) to usecameraPreviewView
- a SurfaceView
to use as a camera preview, null
to let the SDK use an internal
one. When not null, face points will be oriented to the rotation of the camera preview view. When not null,
the SurfaceView
will also be resized to match the aspect ratio of the camera preview and will
occupy as much of its container ViewGroup
as possible. A RelativeLayout
is the most advisable
container to hold the SurfaceView
.NullPointerException
- if context
is null
.public void setMaxProcessRate(float maxFramesPerSecond)
Default: 5 frames per second.
maxFramesPerSecond
- the maximum frames per second the SDK can process frames, larger than or equal to zero.IllegalArgumentException
- if maxFramesPerSecond
is negative.public void setSendUnprocessedFrames(boolean sendUnprocessedFrameFlag)
sendUnprocessedFrameFlag
- Set this to true to receive unprocessed video frames.public void start()
stop()
is called.start
in class Detector
LicenseException
- if no or invalid license was provided see: Detector.setLicensePath(String)
.AffdexException
- if the detector did not initialize successfully.IllegalStateException
- if the Camera
can not be opened.public void stop()
stop
in class Detector
IllegalStateException
- if called before Detector.start()
.Detector.getPercentFaceDetected()
public void reset()
Detector
Detector.start()
.public void setCameraDetectorDimensionsListener(CameraDetector.CameraSurfaceViewListener listener)
Copyright © 2015. All rights reserved.