Class PixelMap

java.lang.Object
edu.tufts.hrilab.map.PixelMap

public class PixelMap extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    PixelMap(int floorNumber)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSemanticLabel(String semanticType, Integer pixelColor)
    Add semantic label with corresponding pixel color.
    List<javax.vecmath.Point2d>
    getConnectedComponents(int px, int py, boolean isPortal)
    gets a list of all pixels that neighbor the specified pixel
    com.google.common.graph.EndpointPair<javax.vecmath.Point2d>
    gets the boundaries of the door as min and max x and y
    Get MapObject from unique ID.
    getMapObjectFromPixel(int px, int py)
    Gets a MapObject based on single pixel location.
    int
    getPixelValue(javax.vecmath.Point3d p)
    Gets the map value at a location in meters.
    double
    gets the angle of the normal vector protuding from a portal
    float
    Get PGM map resolution (pixels/meter).
    boolean
    isExistingMapObjectPixel(int px, int py)
    Check if pixel is part of an existing MapObject.
    boolean
    queries if a object type is a portal type
    void
    parseMapYAML(String filename)
    parses the map metadata YAML to load metadata
    javax.vecmath.Point3d
    toMeter(javax.vecmath.Point2d p)
    converts a point in pixels to a point in meter coordinates based on the metadata provided by the map's yaml file
    javax.vecmath.Point2d
    toPixel(javax.vecmath.Point3d p)
    converts a point in meters to a point in pixel coordinates based on the metadata provided by the map's yaml file

    Methods inherited from class java.lang.Object

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

    • PixelMap

      public PixelMap(int floorNumber)
  • Method Details

    • getResolution

      public float getResolution()
      Get PGM map resolution (pixels/meter).
      Returns:
    • getMapObjectFromId

      public MapObject getMapObjectFromId(int id)
      Get MapObject from unique ID. This should be the same ID used in references.
      Parameters:
      id -
      Returns:
    • isExistingMapObjectPixel

      public boolean isExistingMapObjectPixel(int px, int py)
      Check if pixel is part of an existing MapObject.
      Parameters:
      px -
      py -
      Returns:
    • getMapObjectFromPixel

      public MapObject getMapObjectFromPixel(int px, int py)
      Gets a MapObject based on single pixel location.
      Parameters:
      px -
      py -
      Returns:
    • getPortalNormalAngle

      public double getPortalNormalAngle(MapObject portal)
      gets the angle of the normal vector protuding from a portal
      Parameters:
      portal - portal to get angle of
      Returns:
      angle in radians
    • getDoorPoints

      public com.google.common.graph.EndpointPair<javax.vecmath.Point2d> getDoorPoints(MapObject door)
      gets the boundaries of the door as min and max x and y
      Parameters:
      door - MapObject door to get the points of
      Returns:
      Two points, the first which represents the smallest x and y the door occupies, the next point representing the largest x and y
    • getConnectedComponents

      public List<javax.vecmath.Point2d> getConnectedComponents(int px, int py, boolean isPortal)
      gets a list of all pixels that neighbor the specified pixel
      Parameters:
      px - x coordinate of pixel
      py - y coordinate of pixel
      Returns:
      List of points that neighbors the pixel at px, py
    • isPortal

      public boolean isPortal(String type)
      queries if a object type is a portal type
      Parameters:
      type - Object type
      Returns:
      true if color is of a portal type, false otherwise
    • getPixelValue

      public int getPixelValue(javax.vecmath.Point3d p)
      Gets the map value at a location in meters.
      Parameters:
      p - - Point in meters to get value of
      Returns:
      pixel value
    • toMeter

      public javax.vecmath.Point3d toMeter(javax.vecmath.Point2d p)
      converts a point in pixels to a point in meter coordinates based on the metadata provided by the map's yaml file
      Parameters:
      p - Point in pixel-space to be converted
      Returns:
      Point in meter-space
    • toPixel

      public javax.vecmath.Point2d toPixel(javax.vecmath.Point3d p)
      converts a point in meters to a point in pixel coordinates based on the metadata provided by the map's yaml file
      Parameters:
      p - Point in meter-space to be converted
      Returns:
      Point in pixel-space
    • addSemanticLabel

      public void addSemanticLabel(String semanticType, Integer pixelColor)
      Add semantic label with corresponding pixel color.
    • parseMapYAML

      public void parseMapYAML(String filename)
      parses the map metadata YAML to load metadata