Class XMLHandler

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

public class XMLHandler
extends java.lang.Object
Class that takes ClarifAI API responses and builds XML output in the defined GMAF format.
Author:
Julius K�ndiger
  • Constructor Summary

    Constructors 
    Constructor Description
    XMLHandler()  
  • Method Summary

    Modifier and Type Method Description
    boolean write​(java.io.File file, java.util.List<com.clarifai.grpc.api.Region> results, java.awt.Dimension dimension)
    Parses the API output, writes and saves an XML file containing the file name, found objects, bounding box parameters and probabilities.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • write

      public boolean write​(java.io.File file, java.util.List<com.clarifai.grpc.api.Region> results, java.awt.Dimension dimension)
      Parses the API output, writes and saves an XML file containing the file name, found objects, bounding box parameters and probabilities. ClarifAI returns bounding boxes as normalized values ranging from 0 to 1. This method takes the image's dimensions and applies them to this output to determine pixel based bounding boxes for the XML output.
      Parameters:
      file - The XML file that will be written through this method
      results - Bounding boxes resulting from the API call
      dimension - Image dimensions needed for calculating bounding boxes