Package lukas.wais.smart.mirror.model
Class ImageDetection
java.lang.Object
lukas.wais.smart.mirror.model.ImageDetection
public class ImageDetection
extends java.lang.Object
Class for detecting if a person is present
-
Field Summary
Fields Modifier and Type Field Description static boolean
detected
boolean that is true if a face was detected in the lasttimeout
milliseconds -
Constructor Summary
Constructors Constructor Description ImageDetection()
-
Method Summary
Modifier and Type Method Description static org.opencv.core.Mat
detectFace(org.opencv.core.Mat inputImage)
detects if a matrix contains faces and adds rectangles around that facesstatic javafx.scene.image.Image
getCapture()
get an image from the camerastatic javafx.scene.image.Image
getCaptureWithFaceDetection()
get an image from the camera with detected faces in itstatic void
init(org.opencv.objdetect.CascadeClassifier c, org.opencv.videoio.VideoCapture vc)
initializes the class before detectingstatic org.opencv.core.Mat
loadImage(java.lang.String path)
load image as matrixstatic javafx.scene.image.Image
mat2Img(org.opencv.core.Mat m)
converts a matrix into an image
-
Field Details
-
detected
public static boolean detectedboolean that is true if a face was detected in the lasttimeout
milliseconds
-
-
Constructor Details
-
ImageDetection
public ImageDetection()
-
-
Method Details
-
loadImage
public static org.opencv.core.Mat loadImage(java.lang.String path)load image as matrix- Parameters:
path
- to image- Returns:
- image as matrix
-
init
public static void init(org.opencv.objdetect.CascadeClassifier c, org.opencv.videoio.VideoCapture vc)initializes the class before detecting- Parameters:
c
- CascadeClassifier that was loaded beforevc
- VideoCapture to get images from camera
-
mat2Img
public static javafx.scene.image.Image mat2Img(org.opencv.core.Mat m)converts a matrix into an image- Parameters:
m
- matrix that contains the captured image- Returns:
- image that can be set to the imageview
-
detectFace
public static org.opencv.core.Mat detectFace(org.opencv.core.Mat inputImage)detects if a matrix contains faces and adds rectangles around that faces- Parameters:
inputImage
- matrix that contains the input image- Returns:
- matrix with output image that contains rectangles where faces were detected
-
getCapture
public static javafx.scene.image.Image getCapture()get an image from the camera- Returns:
- current image from
capture
-
getCaptureWithFaceDetection
public static javafx.scene.image.Image getCaptureWithFaceDetection()get an image from the camera with detected faces in it- Returns:
- image with detected faces from
capture
-