我试图通过使用
注册回调函数来检索TANGO_CAMERA_COLOR图像像素数据static void onFrameAvailable( void* context, const TangoCameraId id, const TangoImageBuffer* buffer )
{
LOGVI( "\nGOOGLE TANGO FRAME AVAILABLE" );
}
...
if(TangoService_connectOnFrameAvailable( TANGO_CAMERA_COLOR, NULL, onFrameAvailable ) == TANGO_SUCCESS)
{
LOGVI( "\nGOOGLE TANGO ONFRAMEAVAILABLE CONNECTED" );
}
我实际上将成功日志作为输出,但回调函数从不被称为。
输出:
01-13 12:04:02.655: I/tango_client_api(187): Tango Service: connect, internal status 0
01-13 12:04:02.655: I/VR(8529): GOOGLE TANGO CONNECTED
01-13 12:04:02.655: I/VR(8529): GOOGLE TANGO EVENT HANDLER CONNECTED
01-13 12:04:02.656: I/tango_client_api(187): Tango Service: getCameraIntrinsics, internal status 0
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE WIDTH 1280
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE HEIGHT 720
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE FOCAL X 1039.630000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE FOCAL Y 1039.900000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE PRINCIPAL X 634.922000
01-13 12:04:02.656: I/VR(8529): GOOGLE TANGO CAMERA IMAGE PRINCIPAL Y 362.981000
01-13 12:04:02.656: I/tango_client_api(187): Tango Service: connectSurface, internal status 0
01-13 12:04:02.657: I/VR(8529): GOOGLE TANGO ONFRAMEAVAILABLE CONNECTED
01-13 12:04:02.694: I/chromium(8529): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
01-13 12:04:02.823: I/Camera3-OutputStream(168): enqueue first Preview frame or first video frame
01-13 12:04:02.825: I/native-camera(187): Dropping VGA with too much latency 92240.015085 > 0.000000 + 2 * 0.033328
01-13 12:04:02.899: I/native-camera(187): VGA Stats: 3 frames, 0 locked_buffer_drops, 0 sensor_hub_drops, 1 ambiguous, 0 feature_tracking_drops
01-13 12:04:02.899: I/native-camera(187): COLOR Stats: 0 frames, 0 locked_buffer_drops, 0 sensor_hub_drops, 0 ambiguous
... what follows are only event notifications like FisheyeUnderExposed, TooFewFeaturesTracked
我正在使用C-API版笛卡尔。 清单中的权限已定义。 回调工作需要什么(init,连接,......)?
答案 0 :(得分:1)
值得检查的一件事是许可。要使用彩色摄像头,您需要将摄像头权限添加到清单文件中。
答案 1 :(得分:1)
尝试构建增强现实C样本 - 我将其破解(很差)以完成此操作并且它工作正常 - AquireTangoImage被调用(我切断了内容因为调用发生然后我无法更新纹理: - )) - ConnectTexture是原始示例的一部分,我刚刚添加了辅助connectOnFrameAvailable - 请注意,至少根据我的经验,一旦开始获得回调,就会停止获取纹理更新: - (
GLuint cached_single_texture_id;
void AcquireTangoImage(void *context, TangoCameraId id, const TangoImageBuffer *buffer)
{
TangoData* td = (TangoData*)context;
}
void TangoData::ConnectTexture(GLuint texture_id) {
cached_single_texture_id = texture_id;
if (TangoService_connectTextureId(TANGO_CAMERA_COLOR, texture_id, nullptr,
nullptr) == TANGO_SUCCESS) {
LOGI("TangoService_connectTextureId(): Success!");
} else {
LOGE("TangoService_connectTextureId(): Failed!");
}
if (TangoService_connectOnFrameAvailable(TANGO_CAMERA_COLOR, this, AcquireTangoImage) == TANGO_SUCCESS) {
LOGI("TangoService_connectOnFrameAvailable(): Success!");
}
else {
LOGE("TangoService_connectOnFrameAvailable(): Failed!");
}
}