Class ClarifAIObjectDetection

java.lang.Object
de.swa.fuh.clarifai.ClarifAIObjectDetection

public class ClarifAIObjectDetection
extends java.lang.Object
Controller for submitting details for object detection to ClarifAI API.
Class can submit images to API in form of a URL, an image files or a byte array and returns bounding boxes defined by the service as a List of Type "Region".
For further information see ClarifAI documentation.
Class parameters are:
  • API_KEY: Needs to be generated by the user through clarifai.com and entered in clarifaiPlugin.config.
  • modelId: Defines the ClarifAI model used for object detection. The general ClarifAI model is being submitted as a default.
  • maximumConcepts: Defines the maximum amount of objects returned by the API. Default is 0 for no limitation.
  • minConfidece: Defines the minimal confidence for objects to be returned by the API. Default is 0 for no limitation.
Author:
Julius K�ndiger, ClarifAI
  • Constructor Summary

    Constructors 
    Constructor Description
    ClarifAIObjectDetection()  
  • Method Summary

    Modifier and Type Method Description
    java.util.List<com.clarifai.grpc.api.Region> getObjects​(byte[] bytes)
    Uses a byte array object and class parameters to submit a request to ClarifAI API.
    java.util.List<com.clarifai.grpc.api.Region> getObjects​(java.io.File file)
    Uses a File object and class parameters to submit a request to ClarifAI API.
    java.util.List<com.clarifai.grpc.api.Region> getObjects​(java.net.URL url)
    Uses an URL object and class parameters to submit a request to ClarifAI API.

    Methods inherited from class java.lang.Object

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

    • ClarifAIObjectDetection

      public ClarifAIObjectDetection() throws java.lang.IllegalArgumentException
      Throws:
      java.lang.IllegalArgumentException
  • Method Details

    • getObjects

      public java.util.List<com.clarifai.grpc.api.Region> getObjects​(java.net.URL url)
      Uses an URL object and class parameters to submit a request to ClarifAI API.
      Parameters:
      url - image file as URL object
      Returns:
      bounding boxes as List of Regions
    • getObjects

      public java.util.List<com.clarifai.grpc.api.Region> getObjects​(java.io.File file) throws java.io.IOException
      Uses a File object and class parameters to submit a request to ClarifAI API.
      Parameters:
      file - image file
      Returns:
      bounding boxes as List of Regions
      Throws:
      java.io.IOException - if file cannot be converted to ByteString
    • getObjects

      public java.util.List<com.clarifai.grpc.api.Region> getObjects​(byte[] bytes)
      Uses a byte array object and class parameters to submit a request to ClarifAI API.
      Parameters:
      bytes - byte array
      Returns:
      bounding boxes as List of Regions