tango_support.h
Go to the documentation of this file.
00001 // Copyright 2017 Google Inc. All Rights Reserved.
00002 //
00003 // Licensed under the Apache License, Version 2.0 (the "License");
00004 // you may not use this file except in compliance with the License.
00005 // You may obtain a copy of the License at
00006 //
00007 //      http://www.apache.org/licenses/LICENSE-2.0
00008 //
00009 // Unless required by applicable law or agreed to in writing, software
00010 // distributed under the License is distributed on an "AS IS" BASIS,
00011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 // See the License for the specific language governing permissions and
00013 // limitations under the License.
00014 
00015 #ifndef TANGO_SUPPORT_TANGO_SUPPORT_H_
00016 #define TANGO_SUPPORT_TANGO_SUPPORT_H_
00017 
00018 #include <tango_client_api/tango_client_api.h>
00019 
00020 #include <stdint.h>
00021 
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00034 
00042 typedef enum {
00044   TANGO_SUPPORT_ROTATION_IGNORED = -1,
00045 
00047   TANGO_SUPPORT_ROTATION_0 = 0,
00048 
00050   TANGO_SUPPORT_ROTATION_90 = 1,
00051 
00053   TANGO_SUPPORT_ROTATION_180 = 2,
00054 
00056   TANGO_SUPPORT_ROTATION_270 = 3
00057 } TangoSupport_Rotation;
00058 
00070 TangoErrorType TangoSupport_getTangoVersion(void* jni_env, void* activity,
00071                                             int* version);
00072 
00075 typedef TangoErrorType (*TangoSupport_GetPoseAtTimeFn)(
00076     double timestamp, TangoCoordinateFramePair frame, TangoPoseData* pose);
00077 
00080 typedef TangoErrorType (*TangoSupport_GetCameraIntrinsicsFn)(
00081     TangoCameraId camera_id, TangoCameraIntrinsics* intrinsics);
00082 
00094 void TangoSupport_initialize(
00095     TangoSupport_GetPoseAtTimeFn getPoseAtTime,
00096     TangoSupport_GetCameraIntrinsicsFn getCameraIntrinsics);
00097 
00110 TangoErrorType TangoSupport_getVideoOverlayUVBasedOnDisplayRotation(
00111     const float uv_coordinates[8], TangoSupport_Rotation display_rotation,
00112     float output_uv_coordinates[8]);
00113 
00125 TangoErrorType TangoSupport_getCameraIntrinsicsBasedOnDisplayRotation(
00126     TangoCameraId camera_id, TangoSupport_Rotation display_rotation,
00127     TangoCameraIntrinsics* intrinsics);
00128 
00131 TangoSupport_Rotation TangoSupport_getAndroidDepthCameraRotation();
00132 
00135 TangoSupport_Rotation TangoSupport_getAndroidColorCameraRotation();
00136 
00141 bool TangoSupport_isValidRotation(TangoSupport_Rotation rotation,
00142                                   bool allowIgnored);
00143 
00145 
00149 
00159 struct TangoSupport_ImageBufferManager;
00160 
00170 TangoErrorType TangoSupport_createImageBufferManager(
00171     TangoImageFormatType format, int width, int height,
00172     TangoSupport_ImageBufferManager** manager);
00173 
00179 TangoErrorType TangoSupport_freeImageBufferManager(
00180     TangoSupport_ImageBufferManager* manager);
00181 
00200 TangoErrorType TangoSupport_setImageBufferCopyRegion(
00201     TangoSupport_ImageBufferManager* manager, int y_only, uint32_t begin_line,
00202     uint32_t end_line);
00203 
00211 TangoErrorType TangoSupport_updateImageBuffer(
00212     TangoSupport_ImageBufferManager* manager,
00213     const TangoImageBuffer* image_buffer);
00214 
00227 TangoErrorType TangoSupport_getLatestImageBufferAndNewDataFlag(
00228     TangoSupport_ImageBufferManager* manager, TangoImageBuffer** image_buffer,
00229     bool* new_data);
00230 
00240 TangoErrorType TangoSupport_getLatestImageBuffer(
00241     TangoSupport_ImageBufferManager* manager, TangoImageBuffer** image_buffer);
00242 
00244 
00249 
00252 typedef enum {
00257   TANGO_SUPPORT_ENGINE_TANGO,
00258 
00261   TANGO_SUPPORT_ENGINE_OPENGL,
00262 
00265   TANGO_SUPPORT_ENGINE_UNITY,
00266 
00269   TANGO_SUPPORT_ENGINE_UNREAL,
00270 
00272 } TangoSupport_EngineType;
00273 
00275 typedef struct TangoSupport_MatrixTransformData {
00277   double timestamp;
00278 
00280   float matrix[16];
00281 
00283   TangoPoseStatusType status_code;
00284 } TangoSupport_MatrixTransformData;
00285 
00287 typedef struct TangoSupport_DoubleMatrixTransformData {
00289   double timestamp;
00290 
00292   double matrix[16];
00293 
00295   TangoPoseStatusType status_code;
00296 } TangoSupport_DoubleMatrixTransformData;
00297 
00315 TangoErrorType TangoSupport_calculateRelativePose(
00316     double base_timestamp, TangoCoordinateFrameType base_frame,
00317     double target_timestamp, TangoCoordinateFrameType target_frame,
00318     TangoPoseData* base_frame_T_target_frame);
00319 
00356 TangoErrorType TangoSupport_getPoseAtTime(
00357     double timestamp, TangoCoordinateFrameType base_frame,
00358     TangoCoordinateFrameType target_frame, TangoSupport_EngineType base_engine,
00359     TangoSupport_EngineType target_engine,
00360     TangoSupport_Rotation display_rotation, TangoPoseData* pose);
00361 
00381 TangoErrorType TangoSupport_getMatrixTransformAtTime(
00382     double timestamp, TangoCoordinateFrameType base_frame,
00383     TangoCoordinateFrameType target_frame, TangoSupport_EngineType base_engine,
00384     TangoSupport_EngineType target_engine,
00385     TangoSupport_Rotation display_rotation,
00386     TangoSupport_MatrixTransformData* matrix_transform);
00387 
00407 TangoErrorType TangoSupport_getDoubleMatrixTransformAtTime(
00408     double timestamp, TangoCoordinateFrameType base_frame,
00409     TangoCoordinateFrameType target_frame, TangoSupport_EngineType base_engine,
00410     TangoSupport_EngineType target_engine,
00411     TangoSupport_Rotation display_rotation,
00412     TangoSupport_DoubleMatrixTransformData* matrix_transform);
00413 
00422 struct TangoSupport_PointCloudManager;
00423 
00432 TangoErrorType TangoSupport_createPointCloudManager(
00433     size_t max_points, TangoSupport_PointCloudManager** manager);
00434 
00439 TangoErrorType TangoSupport_freePointCloudManager(
00440     TangoSupport_PointCloudManager* manager);
00441 
00450 TangoErrorType TangoSupport_updatePointCloud(
00451     TangoSupport_PointCloudManager* manager,
00452     const TangoPointCloud* point_cloud);
00453 
00463 TangoErrorType TangoSupport_getLatestPointCloud(
00464     TangoSupport_PointCloudManager* manager,
00465     TangoPointCloud** latest_point_cloud);
00466 
00486 //    rotation.
00492 //    nullptr on failure. This pose has been transformed in the same way as
00493 //    getPoseAtTime.
00497 TangoErrorType TangoSupport_getLatestPointCloudWithPose(
00498     TangoSupport_PointCloudManager* manager,
00499     TangoCoordinateFrameType base_frame, TangoSupport_EngineType base_engine,
00500     TangoSupport_EngineType target_engine,
00501     TangoSupport_Rotation display_rotation,
00502     TangoPointCloud** latest_point_cloud, TangoPoseData* pose);
00503 
00516 TangoErrorType TangoSupport_getLatestPointCloudAndNewDataFlag(
00517     TangoSupport_PointCloudManager* manager,
00518     TangoPointCloud** latest_point_cloud, bool* new_data);
00520 
00524 
00560 TangoErrorType TangoSupport_fitPlaneModelNearPoint(
00561     const TangoPointCloud* point_cloud, const double point_cloud_translation[3],
00562     const double point_cloud_orientation[4],
00563     const float color_camera_uv_coordinates[2],
00564     TangoSupport_Rotation display_rotation,
00565     const double color_camera_translation[3],
00566     const double color_camera_orientation[4], double intersection_point[3],
00567     double plane_model[4]);
00568 
00573 struct TangoSupport_Plane {
00574   double intersection_point[3];
00575   double plane_equation[4];
00576   int inlier_count;
00577   double inlier_ratio;
00578 };
00579 
00613 TangoErrorType TangoSupport_fitMultiplePlaneModelsNearPoint(
00614     const TangoPointCloud* point_cloud, const double point_cloud_translation[3],
00615     const double point_cloud_orientation[4],
00616     const float color_camera_uv_coordinates[2],
00617     TangoSupport_Rotation display_rotation,
00618     const double color_camera_translation[3],
00619     const double color_camera_orientation[4], TangoSupport_Plane** planes,
00620     int* number_of_planes);
00621 
00626 void TangoSupport_freePlaneList(TangoSupport_Plane** planes);
00627 
00629 #ifdef __cplusplus
00630 }
00631 #endif
00632 
00633 #endif  // TANGO_SUPPORT_TANGO_SUPPORT_H_


tango_support
Author(s):
autogenerated on Thu Jun 6 2019 19:49:51