com.metaio.sdk.jni
Class IMetaioSDK

java.lang.Object
  extended by com.metaio.sdk.jni.IMetaioSDK
Direct Known Subclasses:
IMetaioSDKAndroid

public class IMetaioSDK
extends Object

The common interface for all platforms. LicenseThis code is the property of the metaio GmbH (www.metaio.com). It is absolutely not free to be used, copied or be modified without prior written permission from metaio GmbH. The code is provided "as is" with no expressed or implied warranty. The author accepts no liability if it causes any damage to your computer, or any harm at all.


Constructor Summary
IMetaioSDK(long cPtr, boolean cMemoryOwn)
           
 
Method Summary
 IBillboardGroup createBillboardGroup(float nearValue, float farValue)
          Calling this function the first time will create a billboard group.
 IGeometry createGeometry(String filepath)
          This function loads a 3D geometry from the given file.
 IGeometry createGeometryFromImage(String filepath)
          This function loads an image from a given file and places it on a generated 3D-plane.
 IGeometry createGeometryFromImage(String filepath, boolean displayAsBillboard)
          This function loads an image from a given file and places it on a generated 3D-plane.
 IGeometry createGeometryFromMovie(String filepath)
          This function loads a movie from a given file and places it on a generated 3d-plane.
 IGeometry createGeometryFromMovie(String filepath, boolean transparentMovie)
          This function loads a movie from a given file and places it on a generated 3d-plane.
 IGeometry createGeometryFromMovie(String filepath, boolean transparentMovie, boolean displayAsBillboard)
          This function loads a movie from a given file and places it on a generated 3d-plane.
 IRadar createRadar()
          The radar object is destroyed with the metaio SDK destructor.
 IRadar createRadar(float size)
          The radar object is destroyed with the metaio SDK destructor.
 void delete()
           
 Vector3d get3DPositionFromScreenCoordinates(int coordinateSystemID, Vector2d point)
          Note: There must be a model loaded for the specific coordinateSystemID, otherwise the function will only return (0,0,0)
 void getCameraParameters(Vector2di imageResolution, Vector2d focalLengths, Vector2d principalPoint)
           
 int getCoordinateSystemID(String name)
          In the XML configuration each coordinate system can have a name tag, the .
 String getCoordinateSystemName(int coordinateSystemID)
          Use this to find out the given name of a coordinate system according to it's ID.
 TrackingValues getCosOffset(int coordinateSystemID)
           
 boolean getCosRelation(int baseCos, int relativeCos, TrackingValues relation)
          This function computes the spatial relationship between the two given coordinate systems.
static long getCPtr(IMetaioSDK obj)
           
 boolean getFreezeTracking()
          This function will return the state set by setFreezeTracking();true if the tracking currently frozen.
 IGeometry getGeometryFromScreenCoordinates(int x, int y)
           
 IGeometry getGeometryFromScreenCoordinates(int x, int y, boolean useTriangleTest)
           
 IGeometryVector getLoadedGeometries()
          This function returns a vector containing pointers to all loaded 3D geometries.
 int getNumberOfDefinedCoordinateSystems()
          This function returns the number of coordinate systems that are currently defined.The number of defined coordinate systems.
 int getNumberOfValidCoordinateSystems()
          This function returns the number of coordinate systems that are currently tracked, i.e. have a valid pose.The number of tracked coordinate systems.
 void getProjectionMatrix(float[] matrix, boolean rightHanded)
          The values can be used to set the OpenGL projection matrix according to the camera parameters of the current camera.Currently you should use the left handed variant to work in conjunction with getTrackingValues(float* matrix) as in the android custom renderer example.
 ISensorsComponent getRegisteredSensorsComponent()
          pointer to the sensors component or NULL See: metaio::ISensorsComponent registerSensorsComponent
 float getRenderingFrameRate()
          The methods returns the rendering performance as number of frames per second.The mean rendering performance in frames per second over the last 25 frames.
 Vector2di getRenderSize()
          A vector containing viewport size (x=width, y=height) See: resizeRenderer
 Vector2d getScreenCoordinatesFrom3DPosition(int coordinateSystemID, Vector3d point)
           
 ESCREEN_ROTATION getScreenRotation()
          See: setScreenRotationESCREEN_ROTATIONScreen rotation
 ImageStruct getScreenshot()
          Note, you need to free the memory assigned to ImageStruct.
 String getSensorType()
          The type of the currently loaded tracking sensor.
 float getTrackingFrameRate()
          The methods returns the image processing performance as number of frames per second.The mean image processing performance in frames per second over the last 25 frames.
 TrackingValuesVector getTrackingValues()
          Returned tracking values may have a state Found, Tracking and Lost.
 TrackingValuesVector getTrackingValues(boolean rotate)
          Returned tracking values may have a state Found, Tracking and Lost.
 TrackingValues getTrackingValues(int coordinateSystemID)
          Returned tracking values may have a state Found, Tracking and Lost.
 TrackingValues getTrackingValues(int coordinateSystemID, boolean rotate)
          Returned tracking values may have a state Found, Tracking and Lost.
 void getTrackingValues(int coordinateSystemID, float[] matrix)
          The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target.
 void getTrackingValues(int coordinateSystemID, float[] matrix, boolean preMultiplyWithStandardViewMatrix)
          The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target.
 void getTrackingValues(int coordinateSystemID, float[] matrix, boolean preMultiplyWithStandardViewMatrix, boolean rightHanded)
          The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target.
 String getVersion()
          version string
 TrackingValues invertPose(TrackingValues inPose)
          This can be interpreted as swapping the roles of the coordinate systems of the camera and the tracking target.
 boolean loadEnvironmentMap(String folder)
          This feature can be used to attach a reflection map to an object.The six image files contained in the provided folder need to have the following names: "positive_x.png", "positive_y.png", "positive_z.png", "negative_x.png", "negative_y.png", "negative_z.png".
 IGeometry loadImageBillboard(String texturePath)
          Supported image formats are PNG, JPG and BMP.
 IGeometry loadImageBillboard(String textureName, ImageStruct image)
           
 void pause()
          Use this to pause the processing whenever application switches to another view or goes to the background See: resume
 void pauseAllMovieTextures()
           
 void pauseSensors()
          Call resumeSensors to start the required sensors again.
 void pauseTracking()
          Use this to pause tracking while continuing rendering See: resumeTracking
 void registerCallback(IMetaioSDKCallback callback)
           
 void registerSensorsComponent(ISensorsComponent sensors)
          Pass NULL to de-register sensors component.
 void render()
          This method is usually called from the application loop.
 void requestCameraImage()
          The image will have the dimensions of the current capture resolution.
 void requestCameraImage(String filepath, int width, int height)
          The result is notified in IMetaioSDKCallback.onCameraImageSaved.
 void requestScreenshot()
           
 void requestScreenshot(long frameBuffer)
           
 void requestScreenshot(long frameBuffer, long renderBuffer)
          The screenshot will be returned in IMetaioSDKCallback::onScreenshot as a new ImageStruct object in the next render cycle.
 void requestScreenshot(String filepath)
           
 void requestScreenshot(String filepath, long frameBuffer)
           
 void requestScreenshot(String filepath, long frameBuffer, long renderBuffer)
          Currently JPG and PNG file formats are supported.
 void resizeRenderer(int width, int height)
           
 void resume()
          Use this to resume the processing that was previously paused See: pause
 void resumeSensors()
          See: pauseSensors
 void resumeTracking()
          Use this to resume tracking that is paused before See: pauseTracking
 int saveScreenshot(String filename)
          Currently JPG and PNG file types are supported.
 String sensorCommand(String command)
          Some times a sensor need a more fine grained control, e.g. for Stereo- SLAM initialization it is helpful to specify an output file, without needing to re-generate XML file.
 String sensorCommand(String command, String parameter)
          Some times a sensor need a more fine grained control, e.g. for Stereo- SLAM initialization it is helpful to specify an output file, without needing to re-generate XML file.
 boolean setCameraParameters(String calibrationFile)
          The provided XML file should be structured as follows:
 void setCosOffset(int coordinateSystemID, TrackingValues pose)
           
 void setFreezeTracking(boolean freeze)
          Freezes or un-freezes the current tracking.
 void setImage(ImageStruct image)
          This method is used to set the image source for display and (optical) tracking.
 Vector2di setImage(String source)
          (formerly named: setImageSource)This method is used to set the image source for display and (optical) tracking.
 void setLLAObjectRenderingLimits(int nearLimit, int farLimit)
          The near limit will ensure that all geometries closer than this limit are pushed back to the near limit.
 void setRendererClippingPlaneLimits(float nearCP, float farCP)
          Note: This should be called after initializeRenderer() on Android.
 void setRendererFrameBuffers(long frameBuffer, long renderBuffer)
           
 void setScreenRotation(ESCREEN_ROTATION rotation)
          natural orientationThis should be called on Android if the Activity should support orientations other than Landscape See: getScreenRotationESCREEN_ROTATION
 void setSeeThrough(boolean seeThrough)
          This function can be used to turn off the rendering of the camera image.
 boolean setTrackingConfiguration(String trackingConfig)
          This function configures the tracking system and the coordinate systems based on an XML file or string input.
 boolean setTrackingConfiguration(String trackingConfig, boolean readFromFile)
          This function configures the tracking system and the coordinate systems based on an XML file or string input.
 Vector2di startCamera(int index)
          Start camera with the given capture resolution (optional).
 Vector2di startCamera(int index, long width)
          Start camera with the given capture resolution (optional).
 Vector2di startCamera(int index, long width, long height)
          Start camera with the given capture resolution (optional).
 Vector2di startCamera(int index, long width, long height, int downsample)
          Start camera with the given capture resolution (optional).
 void startInstantTracking(String trackingMode)
          It will instantly start creating a tracking configuration based on camera image and available device sensors if requested.
 void startInstantTracking(String trackingMode, String outFile)
          It will instantly start creating a tracking configuration based on camera image and available device sensors if requested.
 void stopCamera()
          Use this to stop capturing on the current camera.
 boolean unloadGeometry(IGeometry geometry)
          This function unloads a geometry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IMetaioSDK

public IMetaioSDK(long cPtr,
                  boolean cMemoryOwn)
Method Detail

getCPtr

public static long getCPtr(IMetaioSDK obj)

delete

public void delete()

getVersion

public String getVersion()
version string


setTrackingConfiguration

public boolean setTrackingConfiguration(String trackingConfig,
                                        boolean readFromFile)
This function configures the tracking system and the coordinate systems based on an XML file or string input. Additonally, some predefined configurations can be loaded by specifiying special strings below:"GPS" default configuration for GPS-Compass tracking, suitable for location based scenarios. "ORIENTATION" tracking configuration for device attitude tracking, suitable for 360 degrees scenarios. "LLA" tracking configuration for LLA markers, it also uses GPS-Compass tracking in addition to LLA markers reading "CODE" configuration for reading barcodes including QR codes "QRCODE" configuration for reading QR codes only

Parameters:
trackingConfig - Fully qualified path of the XML file that should be loaded. If a ZIP is specified it will first try to load "TrackingData_ML3D.xml" from the ZIP and if that isn't successful it'll try to load any other xml from the ZIP. It can also be one of the special strings to load predefined configurations, or string containing XML configuration.
readFromFile - if set to false, it will interpret trackingConfig as tracking- configuration XML true if successful, false otherwise.

setTrackingConfiguration

public boolean setTrackingConfiguration(String trackingConfig)
This function configures the tracking system and the coordinate systems based on an XML file or string input. Additonally, some predefined configurations can be loaded by specifiying special strings below:"GPS" default configuration for GPS-Compass tracking, suitable for location based scenarios. "ORIENTATION" tracking configuration for device attitude tracking, suitable for 360 degrees scenarios. "LLA" tracking configuration for LLA markers, it also uses GPS-Compass tracking in addition to LLA markers reading "CODE" configuration for reading barcodes including QR codes "QRCODE" configuration for reading QR codes only

Parameters:
trackingConfig - Fully qualified path of the XML file that should be loaded. If a ZIP is specified it will first try to load "TrackingData_ML3D.xml" from the ZIP and if that isn't successful it'll try to load any other xml from the ZIP. It can also be one of the special strings to load predefined configurations, or string containing XML configuration.
readFromFile - if set to false, it will interpret trackingConfig as tracking- configuration XML true if successful, false otherwise.

startInstantTracking

public void startInstantTracking(String trackingMode,
                                 String outFile)
It will instantly start creating a tracking configuration based on camera image and available device sensors if requested. Once the tracking configuration has been created, it will report it through IMetaioSDKCallback.onInstantTrackingEvent() callback. The following tracking modes are supported:"INSTANT_2D" create instant tracking configuration for 2D planar target. "INSTANT_2D_GRAVITY" same as INSTANT_2D with additional use of gravity sensor to rectify the pose. "INSTANT_2D_GRAVITY_EXTRAPOLATED" same as INSTANT_2D_GRAVITY with additional use of attitude sensor to extrapolate the pose when the target image cannot be tracked visually. "INSTANT_3D" create instant tracking configuration for 3D objects. It is also known as SLAM.

Parameters:
trackingMode - one of the supported tracking modes
outFile - Output file to save the result, if empty, it will save it to a temporary file. The saved file path is returned in IMetaioSDKCallback.onInstantTrackingEvent callback. See: IMetaioSDKCallback.onInstantTrackingEvent

startInstantTracking

public void startInstantTracking(String trackingMode)
It will instantly start creating a tracking configuration based on camera image and available device sensors if requested. Once the tracking configuration has been created, it will report it through IMetaioSDKCallback.onInstantTrackingEvent() callback. The following tracking modes are supported:"INSTANT_2D" create instant tracking configuration for 2D planar target. "INSTANT_2D_GRAVITY" same as INSTANT_2D with additional use of gravity sensor to rectify the pose. "INSTANT_2D_GRAVITY_EXTRAPOLATED" same as INSTANT_2D_GRAVITY with additional use of attitude sensor to extrapolate the pose when the target image cannot be tracked visually. "INSTANT_3D" create instant tracking configuration for 3D objects. It is also known as SLAM.

Parameters:
trackingMode - one of the supported tracking modes
outFile - Output file to save the result, if empty, it will save it to a temporary file. The saved file path is returned in IMetaioSDKCallback.onInstantTrackingEvent callback. See: IMetaioSDKCallback.onInstantTrackingEvent

setCameraParameters

public boolean setCameraParameters(String calibrationFile)
The provided XML file should be structured as follows: iPhoneCamera 480360 500500 240180 You can also provide a device identifier. Currently iOS is supported with "iPhone2" for iPhone 3GS, "iPhone3" for iPhone 4, "iPad" for iPad2 and "iPod" for 4th generation iPod.If you provide an empty parameter, the system will detect your device automatically (only works for iOS).

Parameters:
calibrationFile - Fully qualified path to the calibration file. True if successful, false otherwise.

getCameraParameters

public void getCameraParameters(Vector2di imageResolution,
                                Vector2d focalLengths,
                                Vector2d principalPoint)
Parameters:
imageResolution - The resolution (width and height) of the camera image in pixels.
focalLengths - The horizontal and vertical focal lengths of the camera in pixels.
principalPoint - The principal point of the camera in pixels.

render

public void render()
This method is usually called from the application loop. It takes care of capturing, tracking and rendering. See: startCamera stopCamera setImage getTrackingValuesgetValidTrackingValues


setImage

public Vector2di setImage(String source)
(formerly named: setImageSource)This method is used to set the image source for display and (optical) tracking. The image source can be any string representing a fully qualified path to an image file e.g. "c:/image/1.jpg". Setting a new image will include the tracking step. You do not need to call render() afterwards to perform the tracking.Supported image formats are JPG and PNG.

Parameters:
source - A fully qualified path to an image file. Resolution of the image if loaded successfully, else a null vector.

setImage

public void setImage(ImageStruct image)
This method is used to set the image source for display and (optical) tracking. Setting a new image will include the tracking step. You do not need to call render() afterwards to perform the tracking. Valid color formats are ECF_YUV420SP and ECF_A8R8G8B8.Note: This function is only available with a signature retrieved using a PRO license.

Parameters:
image - the image structure containing the image data

startCamera

public Vector2di startCamera(int index,
                             long width,
                             long height,
                             int downsample)
Start camera with the given capture resolution (optional). The captured image can be optionally downscaled for tracking (Only available on Android).

Parameters:
index - The index of the camera to start (zero-based).
width - The desired width of the camera frame (default=320).
height - The desired height of the camera frame (default=240).
downsample - downsampling factor for the tracking image(default=1), e.g. 2 or 3. Only valid for Android. Actual camera frame resolution (x = width, y = height) on success, else a null vector. See: stopCamera

startCamera

public Vector2di startCamera(int index,
                             long width,
                             long height)
Start camera with the given capture resolution (optional). The captured image can be optionally downscaled for tracking (Only available on Android).

Parameters:
index - The index of the camera to start (zero-based).
width - The desired width of the camera frame (default=320).
height - The desired height of the camera frame (default=240).
downsample - downsampling factor for the tracking image(default=1), e.g. 2 or 3. Only valid for Android. Actual camera frame resolution (x = width, y = height) on success, else a null vector. See: stopCamera

startCamera

public Vector2di startCamera(int index,
                             long width)
Start camera with the given capture resolution (optional). The captured image can be optionally downscaled for tracking (Only available on Android).

Parameters:
index - The index of the camera to start (zero-based).
width - The desired width of the camera frame (default=320).
height - The desired height of the camera frame (default=240).
downsample - downsampling factor for the tracking image(default=1), e.g. 2 or 3. Only valid for Android. Actual camera frame resolution (x = width, y = height) on success, else a null vector. See: stopCamera

startCamera

public Vector2di startCamera(int index)
Start camera with the given capture resolution (optional). The captured image can be optionally downscaled for tracking (Only available on Android).

Parameters:
index - The index of the camera to start (zero-based).
width - The desired width of the camera frame (default=320).
height - The desired height of the camera frame (default=240).
downsample - downsampling factor for the tracking image(default=1), e.g. 2 or 3. Only valid for Android. Actual camera frame resolution (x = width, y = height) on success, else a null vector. See: stopCamera

stopCamera

public void stopCamera()
Use this to stop capturing on the current camera. See: startCamera


pause

public void pause()
Use this to pause the processing whenever application switches to another view or goes to the background See: resume


resume

public void resume()
Use this to resume the processing that was previously paused See: pause


pauseTracking

public void pauseTracking()
Use this to pause tracking while continuing rendering See: resumeTracking


resumeTracking

public void resumeTracking()
Use this to resume tracking that is paused before See: pauseTracking


resizeRenderer

public void resizeRenderer(int width,
                           int height)
Parameters:
width - width of the view port in pixels
height - width of the view port in pixels See: getRenderSize

getRenderSize

public Vector2di getRenderSize()
A vector containing viewport size (x=width, y=height) See: resizeRenderer


setScreenRotation

public void setScreenRotation(ESCREEN_ROTATION rotation)
natural orientationThis should be called on Android if the Activity should support orientations other than Landscape See: getScreenRotationESCREEN_ROTATION

Parameters:
rotation - screen rotation

getScreenRotation

public ESCREEN_ROTATION getScreenRotation()
See: setScreenRotationESCREEN_ROTATIONScreen rotation


requestCameraImage

public void requestCameraImage()
The image will have the dimensions of the current capture resolution. It will be delivered through the IMetaioSDKCallback.onNewCameraFrameNote: you need to copy the ImageStuct::buffer, if you need it for later. See: registerCallback to register a callback.


requestCameraImage

public void requestCameraImage(String filepath,
                               int width,
                               int height)
The result is notified in IMetaioSDKCallback.onCameraImageSaved. In case of failure, an empty string will be returned, else the string will have full path of the file.

Parameters:
filepath - file path to write file, currently only JPEG is supported
width - Desired width of the camera image
height - Desired height of the camera image See: registerCallback to register a callback.

requestScreenshot

public void requestScreenshot(long frameBuffer,
                              long renderBuffer)
The screenshot will be returned in IMetaioSDKCallback::onScreenshot as a new ImageStruct object in the next render cycle.

Parameters:
frameBuffer - Frame Buffer (iOS only)
renderBuffer - Render Buffer (iOS only) See: IMetaioSDKCallback::onScreenshot setRendererFrameBuffers

requestScreenshot

public void requestScreenshot(long frameBuffer)

requestScreenshot

public void requestScreenshot()

requestScreenshot

public void requestScreenshot(String filepath,
                              long frameBuffer,
                              long renderBuffer)
Currently JPG and PNG file formats are supported. If an empty string is passed, it will save JPEG at a temporary path.The result will be notified in IMetaioSDKCallback::onScreenshot. In case of success, the fullpath to the file will be passed, else an empty string.

Parameters:
filepath - Filepath where screenshot should be saved, or empty string to use temporary directory
frameBuffer - Frame Buffer (iOS only)
renderBuffer - Render Buffer (iOS only) See: IMetaioSDKCallback::onScreenshot setRendererFrameBuffers

requestScreenshot

public void requestScreenshot(String filepath,
                              long frameBuffer)

requestScreenshot

public void requestScreenshot(String filepath)

setRendererFrameBuffers

public void setRendererFrameBuffers(long frameBuffer,
                                    long renderBuffer)
Parameters:
frameBuffer - the default framebuffer
renderBuffer - the default renderBuffer

getRenderingFrameRate

public float getRenderingFrameRate()
The methods returns the rendering performance as number of frames per second.The mean rendering performance in frames per second over the last 25 frames.


getTrackingFrameRate

public float getTrackingFrameRate()
The methods returns the image processing performance as number of frames per second.The mean image processing performance in frames per second over the last 25 frames.


getTrackingValues

public void getTrackingValues(int coordinateSystemID,
                              float[] matrix,
                              boolean preMultiplyWithStandardViewMatrix,
                              boolean rightHanded)
The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target. The matrix is always returned in column-major order as expected by OpenGL. The screen rotation is also used for computing the matrix.

Parameters:
coordinateSystemID - The (one-based) index of the coordinate system, the values should be retrieved for.
matrix - An array that will carry 16 float values forming a (4x4) ModelView matrix after execution.
preMultiplyWithStandardViewMatrix - A boolean parameter specifying if the matrix should be pre-multiplied with metaio's standard ViewMatrix to finally form a ModelView matrix for OpenGL.
rightHanded - True to get a matrix for a right-handed coordinate system, false for a left-handed coordinate system.

getTrackingValues

public void getTrackingValues(int coordinateSystemID,
                              float[] matrix,
                              boolean preMultiplyWithStandardViewMatrix)
The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target. The matrix is always returned in column-major order as expected by OpenGL. The screen rotation is also used for computing the matrix.

Parameters:
coordinateSystemID - The (one-based) index of the coordinate system, the values should be retrieved for.
matrix - An array that will carry 16 float values forming a (4x4) ModelView matrix after execution.
preMultiplyWithStandardViewMatrix - A boolean parameter specifying if the matrix should be pre-multiplied with metaio's standard ViewMatrix to finally form a ModelView matrix for OpenGL.
rightHanded - True to get a matrix for a right-handed coordinate system, false for a left-handed coordinate system.

getTrackingValues

public void getTrackingValues(int coordinateSystemID,
                              float[] matrix)
The provided matrix is compatible with the OpenGL ModelView matrix (if you specify rightHanded=true) such that rendered geometry will e.g. be placed on a marker or markerless tracking target. The matrix is always returned in column-major order as expected by OpenGL. The screen rotation is also used for computing the matrix.

Parameters:
coordinateSystemID - The (one-based) index of the coordinate system, the values should be retrieved for.
matrix - An array that will carry 16 float values forming a (4x4) ModelView matrix after execution.
preMultiplyWithStandardViewMatrix - A boolean parameter specifying if the matrix should be pre-multiplied with metaio's standard ViewMatrix to finally form a ModelView matrix for OpenGL.
rightHanded - True to get a matrix for a right-handed coordinate system, false for a left-handed coordinate system.

getTrackingValues

public TrackingValues getTrackingValues(int coordinateSystemID,
                                        boolean rotate)
Returned tracking values may have a state Found, Tracking and Lost. For Lost its actually not tracking anymore, but the value is still passed on to inform the user.Depending on the configuration of the tracking system, the provided values may include a 6DoF camera pose with 3D translation and 3D rotation, an LLA coordinate (latitude, longitude, altitude) and a value indicating the quality/certainty of the above.

Parameters:
rotate - if the tracking values should be rotated according to screen rotation See: metaio::TrackingValues metaio::IMetaioSDKCallback.onTrackingEvent
coordinateSystemID - The (one-based) index of the coordinate system, the values should be retrieved for. A TrackingValues object containing the tracking values for the desired coordinate system.

getTrackingValues

public TrackingValues getTrackingValues(int coordinateSystemID)
Returned tracking values may have a state Found, Tracking and Lost. For Lost its actually not tracking anymore, but the value is still passed on to inform the user.Depending on the configuration of the tracking system, the provided values may include a 6DoF camera pose with 3D translation and 3D rotation, an LLA coordinate (latitude, longitude, altitude) and a value indicating the quality/certainty of the above.

Parameters:
rotate - if the tracking values should be rotated according to screen rotation See: metaio::TrackingValues metaio::IMetaioSDKCallback.onTrackingEvent
coordinateSystemID - The (one-based) index of the coordinate system, the values should be retrieved for. A TrackingValues object containing the tracking values for the desired coordinate system.

getTrackingValues

public TrackingValuesVector getTrackingValues(boolean rotate)
Returned tracking values may have a state Found, Tracking and Lost. For Lost its actually not tracking anymore, but the value is still passed on to inform the user.

Parameters:
rotate - if the tracking values should be rotated according to screen rotation In order to get informed about tracking changes, use the onTrackingEvent callback. See: metaio::TrackingValues metaio::IMetaioSDKCallback.onTrackingEventA vector containing the TrackingValues.

getTrackingValues

public TrackingValuesVector getTrackingValues()
Returned tracking values may have a state Found, Tracking and Lost. For Lost its actually not tracking anymore, but the value is still passed on to inform the user.

Parameters:
rotate - if the tracking values should be rotated according to screen rotation In order to get informed about tracking changes, use the onTrackingEvent callback. See: metaio::TrackingValues metaio::IMetaioSDKCallback.onTrackingEventA vector containing the TrackingValues.

getCosRelation

public boolean getCosRelation(int baseCos,
                              int relativeCos,
                              TrackingValues relation)
This function computes the spatial relationship between the two given coordinate systems.

Parameters:
baseCos - The (one-based) index of the coordinate system to measure from.
relativeCos - The (one-based) index of the coordinate system to measure to.
relation - Relation (i.e. transformation) between the given baseCOS and the relativeCOS True if the relation could be computed, false otherwise (e.g. if one coordinate system has no pose).

setCosOffset

public void setCosOffset(int coordinateSystemID,
                         TrackingValues pose)
Parameters:
coordinateSystemID - The (one-based) index of the desired coordinate system.
pose - A pose consisting of a 3D translation and a 3D rotation which should act as offset.

getCosOffset

public TrackingValues getCosOffset(int coordinateSystemID)
Parameters:
coordinateSystemID - The (one-based) index of the desired coordinate system. See: metaio::TrackingValuesa pose consisting of a 3D translation and a 3D rotation which should act as offset.

invertPose

public TrackingValues invertPose(TrackingValues inPose)
This can be interpreted as swapping the roles of the coordinate systems of the camera and the tracking target.

Parameters:
inPose - TrackingValues containing pose to invert. TrackingValues with inverted pose.

getProjectionMatrix

public void getProjectionMatrix(float[] matrix,
                                boolean rightHanded)
The values can be used to set the OpenGL projection matrix according to the camera parameters of the current camera.Currently you should use the left handed variant to work in conjunction with getTrackingValues(float* matrix) as in the android custom renderer example. See: setStandardCameraCalibration

Parameters:
matrix - An array that will carry 16 float values forming a (4x4) projection matrix after execution. The matrix is stored as column major.
rightHanded - True to get a projection matrix for a right handed coordinate system false for a left handed coordinate system.

getNumberOfValidCoordinateSystems

public int getNumberOfValidCoordinateSystems()
This function returns the number of coordinate systems that are currently tracked, i.e. have a valid pose.The number of tracked coordinate systems.


getNumberOfDefinedCoordinateSystems

public int getNumberOfDefinedCoordinateSystems()
This function returns the number of coordinate systems that are currently defined.The number of defined coordinate systems.


setSeeThrough

public void setSeeThrough(boolean seeThrough)
This function can be used to turn off the rendering of the camera image. It is useful e.g. when overlaying the metaio SDK view on top of another view that renders the camera image.

Parameters:
seeThrough - If true, the camera image is not displayed, otherwise it is drawn as by default.

setFreezeTracking

public void setFreezeTracking(boolean freeze)
Freezes or un-freezes the current tracking. While frozen, the CPU load is reduced. The tracking values of the last frame before freezing will be returned by the metaio SDK.

Parameters:
freeze - True to freeze the tracking, false to un-freeze it.

getFreezeTracking

public boolean getFreezeTracking()
This function will return the state set by setFreezeTracking();true if the tracking currently frozen.


getScreenshot

public ImageStruct getScreenshot()
Note, you need to free the memory assigned to ImageStruct. On Android you don't have access to the buffer of the ImageStruct, so use saveScreenshot instead.DeprecatedUse requestScreenshotReturns an ImageStruct containing the screenshot.


saveScreenshot

public int saveScreenshot(String filename)
Currently JPG and PNG file types are supported. You also need to make sure to call this function in the OpenGL thread, e.g. right after IMetaioSDK::render()DeprecatedUse requestScreenshot

Parameters:
filename - The filename where to save the screenshot. Returns 0 if saving was successful.

getSensorType

public String getSensorType()
The type of the currently loaded tracking sensor.


setRendererClippingPlaneLimits

public void setRendererClippingPlaneLimits(float nearCP,
                                           float farCP)
Note: This should be called after initializeRenderer() on Android.

Parameters:
nearCP - The distance of the near clipping plane in millimeters.
farCP - The distance of the far clipping plane in millimeters.

createGeometry

public IGeometry createGeometry(String filepath)
This function loads a 3D geometry from the given file. The file format can be OBJ, MD2 or converted FBX. ZIP archive containing 3D geometry is also supported.The geometry can be deleted by calling unloadGeometry. See: createGeometryFromMovie to create a 3D plane to play a movie file createGeometryFromImage to create a 3D plane showing an image loadImageBillboard unloadGeometry to unload the geometry.

Parameters:
filepath - Path to the geometry file to load. Pointer to the geometry. Null pointer if not successful.

createGeometryFromImage

public IGeometry createGeometryFromImage(String filepath,
                                         boolean displayAsBillboard)
This function loads an image from a given file and places it on a generated 3D-plane. You can unload the geometry again with unloadGeometry(). Supported image formats are PNG, JPG and BMP. See: unloadGeometry to unload the geometry. createGeometry loadImageBillboard createGeometryFromMovie

Parameters:
filepath - Path to the image file.
displayAsBillboard - true if the plane should be rendered as a billboard (always facing camera) Pointer to the geometry. Null pointer if not successful.

createGeometryFromImage

public IGeometry createGeometryFromImage(String filepath)
This function loads an image from a given file and places it on a generated 3D-plane. You can unload the geometry again with unloadGeometry(). Supported image formats are PNG, JPG and BMP. See: unloadGeometry to unload the geometry. createGeometry loadImageBillboard createGeometryFromMovie

Parameters:
filepath - Path to the image file.
displayAsBillboard - true if the plane should be rendered as a billboard (always facing camera) Pointer to the geometry. Null pointer if not successful.

createGeometryFromMovie

public IGeometry createGeometryFromMovie(String filepath,
                                         boolean transparentMovie,
                                         boolean displayAsBillboard)
This function loads a movie from a given file and places it on a generated 3d-plane. You can unload the geometry again with unloadGeometry(). Supported movie file format is "3g2" (for details see movietexture documentation). See: createGeometryFromMovie to create a 3D plane to play a movie file createGeometryFromImage to create a 3D plane showing an image loadImageBillboard unloadGeometry to unload the geometry.

Parameters:
filepath - Path to the movie file.
transparentMovie - true if the movie contains an alpha-plane next to the movie itself. default is false.
displayAsBillboard - true if the plane should be rendered as a billboard (always facing camera). default is false. Pointer to the geometry. Null pointer if not successful.

createGeometryFromMovie

public IGeometry createGeometryFromMovie(String filepath,
                                         boolean transparentMovie)
This function loads a movie from a given file and places it on a generated 3d-plane. You can unload the geometry again with unloadGeometry(). Supported movie file format is "3g2" (for details see movietexture documentation). See: createGeometryFromMovie to create a 3D plane to play a movie file createGeometryFromImage to create a 3D plane showing an image loadImageBillboard unloadGeometry to unload the geometry.

Parameters:
filepath - Path to the movie file.
transparentMovie - true if the movie contains an alpha-plane next to the movie itself. default is false.
displayAsBillboard - true if the plane should be rendered as a billboard (always facing camera). default is false. Pointer to the geometry. Null pointer if not successful.

createGeometryFromMovie

public IGeometry createGeometryFromMovie(String filepath)
This function loads a movie from a given file and places it on a generated 3d-plane. You can unload the geometry again with unloadGeometry(). Supported movie file format is "3g2" (for details see movietexture documentation). See: createGeometryFromMovie to create a 3D plane to play a movie file createGeometryFromImage to create a 3D plane showing an image loadImageBillboard unloadGeometry to unload the geometry.

Parameters:
filepath - Path to the movie file.
transparentMovie - true if the movie contains an alpha-plane next to the movie itself. default is false.
displayAsBillboard - true if the plane should be rendered as a billboard (always facing camera). default is false. Pointer to the geometry. Null pointer if not successful.

unloadGeometry

public boolean unloadGeometry(IGeometry geometry)
This function unloads a geometry. If you do not want to unload the geometry but hide it, use setVisible() instead.

Parameters:
geometry - Pointer to the geometry that is returned by one of the createGeometry functions. true on success, false on failure See: createGeometrysetVisible

getLoadedGeometries

public IGeometryVector getLoadedGeometries()
This function returns a vector containing pointers to all loaded 3D geometries. See: createGeometryA vector containing pointers to all the created geometries.


getGeometryFromScreenCoordinates

public IGeometry getGeometryFromScreenCoordinates(int x,
                                                  int y,
                                                  boolean useTriangleTest)
Parameters:
x - The x-component of the screen coordinate.
y - The y-component of the screen coordinate.
useTriangleTest - If true, all triangles are tested which is more accurate but slower. If set to false, bounding boxes are used instead. A pointer to the geometry. If no 3D model is located at the given coordinate, it's a null pointer.

getGeometryFromScreenCoordinates

public IGeometry getGeometryFromScreenCoordinates(int x,
                                                  int y)
Parameters:
x - The x-component of the screen coordinate.
y - The y-component of the screen coordinate.
useTriangleTest - If true, all triangles are tested which is more accurate but slower. If set to false, bounding boxes are used instead. A pointer to the geometry. If no 3D model is located at the given coordinate, it's a null pointer.

getScreenCoordinatesFrom3DPosition

public Vector2d getScreenCoordinatesFrom3DPosition(int coordinateSystemID,
                                                   Vector3d point)
Parameters:
coordinateSystemID - The (one-based) index of the coordinate system in which the 3D point is defined.
point - The 3D point to convert. A 2D vector containing the screen coordinates.

get3DPositionFromScreenCoordinates

public Vector3d get3DPositionFromScreenCoordinates(int coordinateSystemID,
                                                   Vector2d point)
Note: There must be a model loaded for the specific coordinateSystemID, otherwise the function will only return (0,0,0)

Parameters:
coordinateSystemID - The (one-based) index of the coordinate system in which the 3D point is defined.
point - The 2D screen coordinate to use. A 3D vector containing the coordinates of the resulting 3D point.

setLLAObjectRenderingLimits

public void setLLAObjectRenderingLimits(int nearLimit,
                                        int farLimit)
The near limit will ensure that all geometries closer than this limit are pushed back to the near limit. The far limit will ensure that all geometries farther away than this limit are pulled forward to the far limit.This is especially helpful for billboards.

Parameters:
nearLimit - The near limit or 0 to disable.
farLimit - The far limit or 0 disable. See: setLLALimitsEnabled

createBillboardGroup

public IBillboardGroup createBillboardGroup(float nearValue,
                                            float farValue)
Calling this function the first time will create a billboard group. Calling it again, will return the previously created object.A billboard group takes a set of billboards and reorders them in space. All billboards within the set are placed in space relative to each other. First the billboard distance to the global origin (3d camera position) is adjusted (in the range [nearValue, farValue] see parameters) and then the billboards are arranged in clip space that they don't overlap anymore.

Parameters:
nearValue - The minimum billboard-to-camera distance a billboard can have.
farValue - The maximum billboard-to-camera distance a billboard can have Pointer to the billboard group.

loadImageBillboard

public IGeometry loadImageBillboard(String texturePath)
Supported image formats are PNG, JPG and BMP.

Parameters:
texturePath - The path to the image file to create a billboard from. A pointer to the created billboard geometry.

loadImageBillboard

public IGeometry loadImageBillboard(String textureName,
                                    ImageStruct image)
Parameters:
textureName - Assign a unique identifier to the texture.
image - The new image in memory. A pointer to the created billboard geometry.

createRadar

public IRadar createRadar(float size)
The radar object is destroyed with the metaio SDK destructor.

Parameters:
size - size of the radar (default=100.0) Pointer to the new radar object See: IRadar

createRadar

public IRadar createRadar()
The radar object is destroyed with the metaio SDK destructor.

Parameters:
size - size of the radar (default=100.0) Pointer to the new radar object See: IRadar

registerCallback

public void registerCallback(IMetaioSDKCallback callback)
Parameters:
callback - A pointer to the object that implements metaio::IMetaioSDKCallback See: metaio::IMetaioSDKCallback

loadEnvironmentMap

public boolean loadEnvironmentMap(String folder)
This feature can be used to attach a reflection map to an object.The six image files contained in the provided folder need to have the following names: "positive_x.png", "positive_y.png", "positive_z.png", "negative_x.png", "negative_y.png", "negative_z.png".

Parameters:
folder - The path of a folder that should contain six PNG image files containing the textures for the six faces of the cube. Returns true, if the environment map was successfully loaded.

pauseAllMovieTextures

public void pauseAllMovieTextures()

registerSensorsComponent

public void registerSensorsComponent(ISensorsComponent sensors)
Pass NULL to de-register sensors component. This should be done before deleting the sensors component.

Parameters:
sensors - An implementation of metaio::ISensorsComponent interface See: metaio::ISensorsComponent getRegisteredSensorsComponent()

getRegisteredSensorsComponent

public ISensorsComponent getRegisteredSensorsComponent()
pointer to the sensors component or NULL See: metaio::ISensorsComponent registerSensorsComponent


pauseSensors

public void pauseSensors()
Call resumeSensors to start the required sensors again. See: resumeSensors


resumeSensors

public void resumeSensors()
See: pauseSensors


sensorCommand

public String sensorCommand(String command,
                            String parameter)
Some times a sensor need a more fine grained control, e.g. for Stereo- SLAM initialization it is helpful to specify an output file, without needing to re-generate XML file.

Parameters:
command - the command to send to the sensor
parameter - the parameters for the sensor result of the command

sensorCommand

public String sensorCommand(String command)
Some times a sensor need a more fine grained control, e.g. for Stereo- SLAM initialization it is helpful to specify an output file, without needing to re-generate XML file.

Parameters:
command - the command to send to the sensor
parameter - the parameters for the sensor result of the command

getCoordinateSystemName

public String getCoordinateSystemName(int coordinateSystemID)
Use this to find out the given name of a coordinate system according to it's ID.

Parameters:
coordinateSystemID - ID of the according coordinate system. The name of a coordinate system. The return value is an empty string if no ID is found.

getCoordinateSystemID

public int getCoordinateSystemID(String name)
In the XML configuration each coordinate system can have a name tag, the .

Parameters:
name - the name specified in the xml the id, 0 if coordinate system name is not found