Augmented Reality System
An Augmented Reality (AR) system generates a composite view for the user that is the combination of the real scene viewed by the user (through a camera or another electronic device) and a virtual scene generated by the computer, that augments the scene with additional information. The virtual objects generated by the computer are designed to enhance the user perception of the mixed world they are seeing or interacting with. Today, AR is used in entertainment, military training, engineering design, robotics, education, manufacturing, maintenance and other industries.
An AR system must have the following properties:
- combine real content (usually observed through some electronic device such as cameras and HMD -Head Mounted Displays-) and virtual computer-generated content, adequately superimposed on the real content;
- are real-time interactive systems;
- must be registered in 3D space. The real space observed by the user defines the context used to interact with and represent real and virtual elements. A tracking system is used for positioning the virtual elements over the video stream: fiducial markers, GPS, magnetic and/or optical systems and so on.
Available methods for the augmented reality system of EJS
- boolean isMarkerDetected(int reference). Check if a marker is detected. Parameter: Reference, the integer reference of the marker. Returns true if marker is detected, false otherwise.
- double getMarkerPosition(int markerReference, double position). Returns the position in space of a marker. Parameters: markerReference, the integer reference of the marker. Position, the double array with the position.
- double getMarkerOrientation(int markerReference, double orientation). Returns the 3D orientation in space of a marker. Parameters: markerReference, the integer reference of the marker. Orientation, the 3×3 or 4×4 matrix with the orientation.
- int getMarkerXY(int markerReference). Returns the position of the center of a marker in the screen coordinate system. Parameter: markerReference, the integer reference of the marker.
- double getDistance(int firstMarker, int secondMarker). Returns the distance between the centers of two markers in the 3D space. Parameters: firstMarker, the integer reference of the first marker. SecondMarker, the integer reference of the second marker.
- double getDistanceFromCamera(int markerReference). Returns the distance from the camera to one marker. Parameter: markerReference, the integer reference of the marker.
- void setThreshold(int threshold). Sets the threshold value of the camera. Poor lighting conditions may prevent the virtual image from appearing, or cause it to flicker in and out of view. This problem can often be fixed by changing the lighting threshold value used by the image processing routines. Parameter: threshold, a threshold value from 0 to 255, default is 100.
- void setThreshold(). Sets the default threshold value.
- int getThreshold(). Returns the current threshold level.
- void setConfidence(double confidence). Sets the confidence value, i.e. the probablity with which to decide the validity of a marker. Parameter: confidence, a value between 0 and 1.
- double getConfidence(int markerReference). Returns the confidence value of a marker. Parameter: markerReference, the integer reference of the marker.
- void setLostDelay(int delay). Sets the delay to indicate the disappearance of the marker. Parameter: delay, delay in tenths of a second (greater than 0).
- long getLife(int markerReference). Returns the life value of a marker. Life value is incremented each time the marker is recognized. Parameters: markerReference, the integer reference of the marker.
- double getMatrix(int markerReference). Returns the 3D matrix of a marker (a 4×4 matrix), null if the marker is invalid or not detected. Parameter: markerReference, the integer reference of the marker.