Package edu.tufts.hrilab.vision.stm
Class MemoryObject
java.lang.Object
edu.tufts.hrilab.vision.stm.MemoryObject
- All Implemented Interfaces:
Serializable
MemoryObject - A Java class-wrapper for the data to be passed between the
vision system and the rest of the Java system.
Changes to this class MUST be appropriately reflected in native classes MemoryObjectInterface and MemoryObject, as well as TrackedObjects.addMemoryObjectToSend(...)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(MemoryObject child) Add a child MemoryObject to the scene graph.void
addDescriptor
(Term descriptor) Deprecated.void
addDescriptor
(Term descriptor, float confidence) void
addDescriptor
(String descriptor, float confidence) Convenience method for adding descriptors from native side.void
addFace
(int index, int[] face) Add face to 3D mesh.void
addMaskIndex
(int indexNumber, int index) Add index to mask.void
addOrientation
(int index, double x, double y, double z, double w) Add orientation.void
addPoint
(int index, double x, double y, double z) Add point to point cloud.void
addRelation
(float confidence, Term descriptor, MemoryObject relatedObject, boolean reciprocate) Add new relation.void
addRelation
(float confidence, String descriptor, MemoryObject relatedObject, boolean reciprocate) Convenience method to populate relations from native side.boolean
containsDescriptor
(Term descriptor) Check if this MemoryObject contains the descriptor.boolean
containsDescriptors
(List<Term> descriptors) javax.vecmath.Matrix4d
Get all immediate children of this MemoryObject.double
Deprecated.double
javax.vecmath.Point3d
javax.vecmath.Vector3d
double
getDist()
Deprecated.int[][]
long
javax.vecmath.Point3d
int[]
getMemoryObject
(Symbol identifier) Find the MemoryObject in the scene graph matching the identifier.double[][]
double
getPan()
Deprecated.double[][]
Get all relations this MemoryObject has.getRelations
(Term relation) Get all relations this MemoryObject has that match the specified relation.double
getTilt()
Deprecated.long
Get unique token ID.double
long
Return search type ID.boolean
isValid()
If MemoryObject is a valid STM MemoryObject (i.e., have the appropriate fields been set).void
static double
roundToXDigits
(double num, int x) void
setBaseTransform
(double[] transform) Set the transform to go from vision to base coordinate system.void
setBaseTransform
(javax.vecmath.Matrix4d transform) Set the transform to go from vision to base coordinate system.void
setBoundingBox
(int x, int y, int width, int height) void
setConfidence
(double conf) Deprecated.void
setCoordinateFrame
(String frame) void
setDetectionConfidence
(double conf) void
setDimensions
(double x, double y, double z) void
setDirection
(double x, double y, double z) void
setFrameNum
(long fNum) void
setLocation
(double x, double y, double z) void
setNumFaces
(int size) Set number of faces in 3D mesh.void
setNumMaskIndices
(int size) Set number of indices in mask.void
setNumOrientations
(int size) Set number of orientations.void
setNumPoints
(int size) Set number of points in 3D point cloud.void
setPrimitives
(List<MemoryPrimitive> primitives) void
setTokenId
(long tokenId) void
setTrackingConfidence
(double conf) void
setTypeId
(long typeId) void
setVariable
(Variable variable) void
setVariable
(String variableName) toString()
boolean
boolean
boolean
-
Constructor Details
-
MemoryObject
public MemoryObject()Default constructor. -
MemoryObject
Deep copy constructor.- Parameters:
rhs
-
-
-
Method Details
-
addChild
Add a child MemoryObject to the scene graph.- Parameters:
child
-
-
addRelation
public void addRelation(float confidence, Term descriptor, MemoryObject relatedObject, boolean reciprocate) Add new relation.- Parameters:
confidence
- [0 1] valuedescriptor
- Term description of relationrelatedObject
- other MemoryObject in relationreciprocate
- if relation should be added to relatedObject too
-
addRelation
public void addRelation(float confidence, String descriptor, MemoryObject relatedObject, boolean reciprocate) Convenience method to populate relations from native side.- Parameters:
confidence
-descriptor
-relatedObject
-reciprocate
-
-
getChildren
Get all immediate children of this MemoryObject.- Returns:
- all immediate children in a List
-
getRelations
Get all relations this MemoryObject has.- Returns:
- list of MemoryObjectRelations (potentially empty)
-
getRelations
Get all relations this MemoryObject has that match the specified relation.- Parameters:
relation
-- Returns:
- list of MemoryObjectRelations (potentially empty)
-
getMemoryObject
Find the MemoryObject in the scene graph matching the identifier. Returns null if no match is found.- Parameters:
identifier
-- Returns:
-
isValid
public boolean isValid()If MemoryObject is a valid STM MemoryObject (i.e., have the appropriate fields been set). Currently, this returns true if the ID has been set, and is no longer "-1".- Returns:
-
getStringsForVisualization
-
roundToXDigits
public static double roundToXDigits(double num, int x) -
toString
-
getDisplayString
-
printSceneGraph
public void printSceneGraph() -
setTypeId
public void setTypeId(long typeId) -
setTokenId
public void setTokenId(long tokenId) -
setFrameNum
public void setFrameNum(long fNum) -
setVariable
-
setVariable
-
setConfidence
Deprecated. -
setDetectionConfidence
public void setDetectionConfidence(double conf) -
setTrackingConfidence
public void setTrackingConfidence(double conf) -
setLocation
public void setLocation(double x, double y, double z) -
setDirection
public void setDirection(double x, double y, double z) -
setBoundingBox
public void setBoundingBox(int x, int y, int width, int height) -
setDimensions
public void setDimensions(double x, double y, double z) -
setBaseTransform
public void setBaseTransform(javax.vecmath.Matrix4d transform) Set the transform to go from vision to base coordinate system. Should only be set once, from native side.- Parameters:
transform
-
-
setBaseTransform
public void setBaseTransform(double[] transform) Set the transform to go from vision to base coordinate system. Should only be set once, from native side.- Parameters:
transform
-
-
setNumPoints
public void setNumPoints(int size) Set number of points in 3D point cloud.- Parameters:
size
-
-
addPoint
public void addPoint(int index, double x, double y, double z) Add point to point cloud. Assumes setNumPoints has been called to allocate space for points.- Parameters:
index
-x
-y
-z
-
-
setNumFaces
public void setNumFaces(int size) Set number of faces in 3D mesh.- Parameters:
size
-
-
addFace
public void addFace(int index, int[] face) Add face to 3D mesh. Assumes setNumFaces has been called to allocate space for faces. Faces can contain three or more vertices.- Parameters:
face
-
-
setNumOrientations
public void setNumOrientations(int size) Set number of orientations.- Parameters:
size
-
-
addOrientation
public void addOrientation(int index, double x, double y, double z, double w) Add orientation. Assumes setNumOrientations has been called to allocate space for orientations.- Parameters:
index
-x
-y
-z
-w
-
-
setNumMaskIndices
public void setNumMaskIndices(int size) Set number of indices in mask.- Parameters:
size
-
-
addMaskIndex
public void addMaskIndex(int indexNumber, int index) Add index to mask. Assumes setNumMaskIndices has been called to allocate space for mask.- Parameters:
indexNumber
- index into mask data structureindex
- image index value
-
setCoordinateFrame
-
setPrimitives
-
addDescriptor
Deprecated. -
addDescriptor
-
addDescriptor
Convenience method for adding descriptors from native side.- Parameters:
descriptor
- String that originated from Predicate
-
getTypeId
public long getTypeId()Return search type ID.- Returns:
-
getTokenId
public long getTokenId()Get unique token ID.- Returns:
-
getFrameNum
public long getFrameNum() -
getIdentifier
-
getVariable
-
getConfidence
Deprecated. -
getDetectionConfidence
public double getDetectionConfidence() -
getTrackingConfidence
public double getTrackingConfidence() -
getBoundingBox
-
getDimensions
public javax.vecmath.Point3d getDimensions() -
getDist
Deprecated. -
getLocation
public javax.vecmath.Point3d getLocation() -
getDirection
public javax.vecmath.Vector3d getDirection() -
getPan
Deprecated.Get pan angle (radians). This assumes camera coordinate frame (i.e., +pan is -x, +tilt is -y).- Returns:
- angle in radians
-
getTilt
Deprecated.Get tilt angle (radians). This assumes camera coordinate frame (i.e., +pan is -x, +tilt is -y).- Returns:
- angle in radians
-
getPointCloud
public double[][] getPointCloud() -
getFaceIndices
public int[][] getFaceIndices() -
getOrientations
public double[][] getOrientations() -
getMaskIndices
public int[] getMaskIndices() -
getBaseTransform
public javax.vecmath.Matrix4d getBaseTransform() -
getDescriptors
-
containsDescriptors
-
containsDescriptor
Check if this MemoryObject contains the descriptor. If compared Terms both have a Variable as an argument, the Variable does not need to be equal. For example, on(X,Y) matches on(Y,Z).- Parameters:
descriptor
-- Returns:
-
getCoordinateFrame
-
getPrimitives
-
transformToBase
public boolean transformToBase() -
transformToVision
public boolean transformToVision() -
transform
-