Class ClarifAIPluginGMAF

java.lang.Object
de.swa.fuh.clarifai.ClarifAIPluginGMAF
All Implemented Interfaces:
GMAF_Plugin

public class ClarifAIPluginGMAF
extends java.lang.Object
implements GMAF_Plugin

This class functions as an API between ClarifAI and GMAF. It is based on the given example RandomObjectDetection.java and enriches a given MMFG with nodes containing objects found through ClarifAI object detection.

As per the signature of method process() the API can accept URL objects, File objects and byte arrays for object detection via GMAF.

Author:
Julius K�ndiger
  • Constructor Summary

    Constructors 
    Constructor Description
    ClarifAIPluginGMAF()  
  • Method Summary

    Modifier and Type Method Description
    boolean canProcess​(java.lang.String extension)
    this method returns, if the plugin is able to process files with a given extension
    java.util.Vector<Node> getDetectedNodes()
    this method is called by the GMAF to receive the results of this plugin and to fuse it into the MMFG
    static java.awt.Dimension getImageDimension​(java.io.File imgFile)
    Gets image dimensions for given file
    boolean isGeneralPlugin()
    if this plugin contains overall metadata, e.g.
    void process​(java.net.URL url, java.io.File f, byte[] bytes, MMFG fv)
    this method is called by the GMAF framework, when a new asset has to be processed
    boolean providesRecoursiveData()
    this method should indicate, if it returns recursive data, which are then re-processed within the GMAF framework

    Methods inherited from class java.lang.Object

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

  • Method Details

    • canProcess

      public boolean canProcess​(java.lang.String extension)
      Description copied from interface: GMAF_Plugin
      this method returns, if the plugin is able to process files with a given extension
      Specified by:
      canProcess in interface GMAF_Plugin
      Returns:
      true or false
    • getDetectedNodes

      public java.util.Vector<Node> getDetectedNodes()
      Description copied from interface: GMAF_Plugin
      this method is called by the GMAF to receive the results of this plugin and to fuse it into the MMFG
      Specified by:
      getDetectedNodes in interface GMAF_Plugin
      Returns:
      a vector of MMFG nodes
    • isGeneralPlugin

      public boolean isGeneralPlugin()
      Description copied from interface: GMAF_Plugin
      if this plugin contains overall metadata, e.g. EXIF data, this method should return true to indicate, that these general data have to be attached to the MMFG's root node
      Specified by:
      isGeneralPlugin in interface GMAF_Plugin
      Returns:
      true, if it is a general plugin
    • process

      public void process​(java.net.URL url, java.io.File f, byte[] bytes, MMFG fv)
      Description copied from interface: GMAF_Plugin
      this method is called by the GMAF framework, when a new asset has to be processed
      Specified by:
      process in interface GMAF_Plugin
      Parameters:
      url - represents the temporary URL of the Multimedia asset to be process
      f - represents the temporary file of the asset to be processed
      bytes - contains the file's bytes
      fv - represents the current MMFG, where the results of this plugin should be fused into
    • providesRecoursiveData

      public boolean providesRecoursiveData()
      Description copied from interface: GMAF_Plugin
      this method should indicate, if it returns recursive data, which are then re-processed within the GMAF framework
      Specified by:
      providesRecoursiveData in interface GMAF_Plugin
      Returns:
      true, if recursive data is available
    • getImageDimension

      public static java.awt.Dimension getImageDimension​(java.io.File imgFile) throws java.io.IOException
      Gets image dimensions for given file
      Parameters:
      imgFile - image file
      Returns:
      dimensions of image
      Throws:
      java.io.IOException - if the file is not a known image