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 last timeout 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 faces
    static javafx.scene.image.Image getCapture()
    get an image from the camera
    static javafx.scene.image.Image getCaptureWithFaceDetection()
    get an image from the camera with detected faces in it
    static void init​(org.opencv.objdetect.CascadeClassifier c, org.opencv.videoio.VideoCapture vc)
    initializes the class before detecting
    static org.opencv.core.Mat loadImage​(java.lang.String path)
    load image as matrix
    static javafx.scene.image.Image mat2Img​(org.opencv.core.Mat m)
    converts a matrix into an image

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • detected

      public static boolean detected
      boolean that is true if a face was detected in the last timeout milliseconds
  • Constructor Details

  • 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 before
      vc - 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