Package trclib.vision
Class TrcOpenCvFaceDetector
java.lang.Object
trclib.vision.TrcOpenCvDetector
trclib.vision.TrcOpenCvFaceDetector
- All Implemented Interfaces:
TrcVideoSource<org.opencv.core.Mat>
,TrcVisionProcessor<org.opencv.core.Mat,
TrcOpenCvDetector.DetectedObject<?>>
This class implements an OpenCV face detector using the provided classifier.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class encapsulates info of the detected object.Nested classes/interfaces inherited from class trclib.vision.TrcOpenCvDetector
TrcOpenCvDetector.FilterTarget
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opencv.core.MatOfRect
private final org.opencv.objdetect.CascadeClassifier
Fields inherited from class trclib.vision.TrcOpenCvDetector
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionTrcOpenCvFaceDetector
(String instanceName, String classifierPath, int numImageBuffers) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionprocessFrame
(org.opencv.core.Mat image) This method is called to process an image frame to detect objects in the acquired frame.Methods inherited from class trclib.vision.TrcOpenCvDetector
getDetectedTargetsInfo, getPipeline, getProcessingInterval, getSelectedOutput, setPipeline, setProcessingInterval, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface trclib.vision.TrcVideoSource
getFrame, putFrame
-
Field Details
-
faceDetector
private final org.opencv.objdetect.CascadeClassifier faceDetector -
detectedFaceBuffer
private final org.opencv.core.MatOfRect detectedFaceBuffer
-
-
Constructor Details
-
TrcOpenCvFaceDetector
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.classifierPath
- specifies the file path for the classifier.numImageBuffers
- specifies the number of image buffers to allocate.
-
-
Method Details
-
processFrame
This method is called to process an image frame to detect objects in the acquired frame.- Specified by:
processFrame
in interfaceTrcVisionProcessor<org.opencv.core.Mat,
TrcOpenCvDetector.DetectedObject<?>> - Overrides:
processFrame
in classTrcOpenCvDetector
- Parameters:
image
- specifies the image to be processed.- Returns:
- detected objects, null if none detected.
-