Auki::Ark::Ark
Auki Unity Ark module provides access to QR corner detection, bit array scanning, pose estimation and pose optimization functions.
Public Functions
Name | |
---|---|
async Task< IReadOnlyList<(IReadOnlyList< Vector2 > Corners, IReadOnlyList< bool > BitArray, int Size, uint Framestamp)> > | ParseTextureForQRs(Texture texture) Given a Texture object the function will try to find QR codes and for each will extract a n-tuple containing detected QR corners, bit array, size (bit array width and height), framestamp. The corners will be ordered top left, top right, bottom right, bottom left. |
bool Pose float Confidence | EstimatePose(IReadOnlyList< Vector2 > corners, float sideLengthInM, Matrix4x4 textureToProjectedCoordinatesMatrix, Matrix4x4 projectionMatrix, Matrix4x4 worldToCameraMatrix) |
bool Pose float Confidence | EstimatePose(IReadOnlyList< Vector2 > corners, float sideLengthInM, CoordinateEnvironment coordinateEnvironment) |
Pose | OptimizePose(IReadOnlyList< Vector2 > corners, Pose poseToOptimize, float sideLengthInM, CoordinateEnvironment coordinateEnvironment, float optimizationTimeLimitInMs =2) Tries to apply optimization to find a better fit according to an integrated cost function. |
Pose | OptimizePose(Pose poseToOptimize, Func< Pose, float > costFunction, float optimizationTimeLimitInMs) Tries to apply optimization to find a better fit according to a given cost function. |
void | SetScannerDebugTexture(RenderTexture debugRenderTexture) (Internal) Sets a texture that the scanner will draw debug info on. |
void | SetScannerDebugMode(bool showEdges, bool showCandidates, bool showFinders, bool showMarkers, bool showBits) (Internal) Configures what scanner debug information should be drawn on the debug texture. |
Public Attributes
Name | |
---|---|
bool | Succeeded Estimate the pose in world space for a given set of QR code corners, a given physical side length, a given textureToProjectedCoordinatesMatrix, a given projectionMatrix and worldToCameraMatrix. |
bool Pose | Pose |
Public Functions Documentation
function ParseTextureForQRs
static async Task< IReadOnlyList<(IReadOnlyList< Vector2 > Corners, IReadOnlyList< bool > BitArray, int Size, uint Framestamp)> > ParseTextureForQRs(
Texture texture
)
Given a Texture object the function will try to find QR codes and for each will extract a n-tuple containing detected QR corners, bit array, size (bit array width and height), framestamp. The corners will be ordered top left, top right, bottom right, bottom left.
Parameters:
- texture Texture that will be scanned for QR codes.
Return: An awaitable Task that returns a list of n-tuples.
function EstimatePose
static bool Pose float Confidence EstimatePose(
IReadOnlyList< Vector2 > corners,
float sideLengthInM,
Matrix4x4 textureToProjectedCoordinatesMatrix,
Matrix4x4 projectionMatrix,
Matrix4x4 worldToCameraMatrix
)
function EstimatePose
static bool Pose float Confidence EstimatePose(
IReadOnlyList< Vector2 > corners,
float sideLengthInM,
CoordinateEnvironment coordinateEnvironment
)
function OptimizePose
static Pose OptimizePose(
IReadOnlyList< Vector2 > corners,
Pose poseToOptimize,
float sideLengthInM,
CoordinateEnvironment coordinateEnvironment,
float optimizationTimeLimitInMs =2
)
Tries to apply optimization to find a better fit according to an integrated cost function.
Parameters:
- corners Corners of the QR code in texture coordinate system.
- poseToOptimize Pose that will be optimized.
- sideLengthInM Physical size of QR code (in meters).
- coordinateEnvironment Instance of CoordinateEnvironment corresponding to the captured frame.
- optimizationTimeLimitInMs How long (in milliseconds) is the optimization algorithm allowed to run (2 ms by default).
Return: Optimized pose if a lower cost one was found, the original poseToOptimize
if not.
function OptimizePose
static Pose OptimizePose(
Pose poseToOptimize,
Func< Pose, float > costFunction,
float optimizationTimeLimitInMs
)
Tries to apply optimization to find a better fit according to a given cost function.
Parameters:
- poseToOptimize Pose that will be optimized.
- costFunction Function that returns the cost of a given pose.
- optimizationTimeLimitInMs How long (in milliseconds) is the optimization algorithm allowed to run.
Return: Optimized pose if a lower cost one was found, the original poseToOptimize
if not.
function SetScannerDebugTexture
static void SetScannerDebugTexture(
RenderTexture debugRenderTexture
)
(Internal) Sets a texture that the scanner will draw debug info on.
Parameters:
- debugRenderTexture Target texture.
function SetScannerDebugMode
static void SetScannerDebugMode(
bool showEdges,
bool showCandidates,
bool showFinders,
bool showMarkers,
bool showBits
)
(Internal) Configures what scanner debug information should be drawn on the debug texture.
Parameters:
- showEdges Draw edges.
- showCandidates Draw finder candidates.
- showFinders Draw finders.
- showMarkers Draw markers.
- showBits Draw bits.
Public Attributes Documentation
variable Succeeded
static bool Succeeded;
Estimate the pose in world space for a given set of QR code corners, a given physical side length, a given textureToProjectedCoordinatesMatrix, a given projectionMatrix and worldToCameraMatrix.
Parameters:
- corners Corners of the QR code in texture coordinate system.
- sideLengthInM Physical size of QR code (in meters).
- textureToProjectedCoordinatesMatrix Transformation matrix between texture space and projected coordinates space.
- projectionMatrix Camera projection matrix.
- worldToCameraMatrix World to camera transformation matrix.
- corners Corners of the QR code in texture coordinate system.
- sideLengthInM Physical size of QR code (in meters).
- coordinateEnvironment Instance of CoordinateEnvironment corresponding to the captured frame.
Return:
- A triple containing a bool if the estimation
Succeeded
, a pose in world space and a confidence value (0.0 (worst) - 1.0 (best)). It will returnPose.identity
on failure. - A triple containing a bool if the estimation
Succeeded
, a pose in world space and a confidence value (0.0 (worst) - 1.0 (best)). It will returnPose.identity
on failure.
Estimate the pose in world space for a given set of QR code corners, a given physical sidelength, and a given CoordinateEnvironment.
variable Pose
static bool Pose Pose;