当前位置: 首页>>代码示例>>Java>>正文


Java TangoCameraIntrinsics类代码示例

本文整理汇总了Java中com.google.atap.tangoservice.TangoCameraIntrinsics的典型用法代码示例。如果您正苦于以下问题:Java TangoCameraIntrinsics类的具体用法?Java TangoCameraIntrinsics怎么用?Java TangoCameraIntrinsics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TangoCameraIntrinsics类属于com.google.atap.tangoservice包,在下文中一共展示了TangoCameraIntrinsics类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPause

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    // Synchronize against disconnecting while the service is being used in the OpenGL thread or
    // in the UI thread.
    synchronized (this) {
        if (mIsConnected) {
            mRenderer.getCurrentScene().clearFrameCallbacks();
            mTango.disconnectCamera(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
            // We need to invalidate the connected texture ID so that we cause a re-connection
            // in the OpenGL thread after resume
            mConnectedTextureIdGlThread = INVALID_TEXTURE_ID;
            mTango.disconnect();
            mIsConnected = false;
        }
    }
}
 
开发者ID:tdb-alcorn,项目名称:defect-party,代码行数:18,代码来源:FloorplanActivity.java

示例2: onPause

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    mSurfaceView.onPause();
    // Synchronize against disconnecting while the service is being used in the OpenGL
    // thread or in the UI thread.
    // NOTE: DO NOT lock against this same object in the Tango callback thread.
    // Tango.disconnect will block here until all Tango callback calls are finished.
    // If you lock against this object in a Tango callback thread it will cause a deadlock.
    synchronized (this) {
        try {
            mTango.disconnectCamera(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
            // We need to invalidate the connected texture ID so that we cause a
            // re-connection in the OpenGL thread after resume
            mConnectedTextureIdGlThread = INVALID_TEXTURE_ID;
            mTango.disconnect();
            mIsConnected = false;
        } catch (TangoErrorException e) {
            Log.e(TAG, getString(R.string.exception_tango_error), e);
        }
    }
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:23,代码来源:HelloVideoActivity.java

示例3: setProjectionMatrix

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
/**
 * Sets the projection matrix for the scen camera to match the parameters of the color camera,
 * provided by the {@code TangoCameraIntrinsics}.
 */
public void setProjectionMatrix(TangoCameraIntrinsics intrinsics) {
    Matrix4 projectionMatrix = ScenePoseCalculator.calculateProjectionMatrix(
            intrinsics.width, intrinsics.height,
            intrinsics.fx, intrinsics.fy, intrinsics.cx, intrinsics.cy);
    getCurrentCamera().setProjectionMatrix(projectionMatrix);
}
 
开发者ID:tdb-alcorn,项目名称:defect-party,代码行数:11,代码来源:FloorplanRenderer.java

示例4: setProjectionMatrix

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
/**
 * Sets the projection matrix for the scene camera to match the parameters of the color camera,
 * provided by the {@code TangoCameraIntrinsics}.
 */
public void setProjectionMatrix(TangoCameraIntrinsics intrinsics) {
    Matrix4 projectionMatrix = ScenePoseCalculator.calculateProjectionMatrix(
            intrinsics.width, intrinsics.height,
            intrinsics.fx, intrinsics.fy, intrinsics.cx, intrinsics.cy);
    getCurrentCamera().setProjectionMatrix(projectionMatrix);
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:11,代码来源:SceneRenderer.java

示例5: startCameraPreview

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
private void startCameraPreview() {
    // Connect to color camera
	tangoCameraPreview.connectToTangoCamera(mTango,
			TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
	// Use default configuration for Tango Service.
	TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
	mTango.connect(config);
	
	// No need to add any coordinate frame pairs since we are not using 
	// pose data. So just initialize.
	ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
	mTango.connectListener(framePairs, new OnTangoUpdateListener() {
		@Override
		public void onPoseAvailable(TangoPoseData pose) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onFrameAvailable(int cameraId) {
		    
		    // Check if the frame available is for the camera we want and
		    // update its frame on the camera preview.
			if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
				tangoCameraPreview.onFrameAvailable();
			}
		}

		@Override
		public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onTangoEvent(TangoEvent event) {
			// We are not using OnPoseAvailable for this app
		}
	});
}
 
开发者ID:erlandsona,项目名称:Bat-Vision,代码行数:39,代码来源:MainActivity.java

示例6: configureCamera

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
private void configureCamera() {
    // This should never happen, but it never hurts to double-check
    if (mTango == null) {
        return;
    }

    // Configure the Rajawali Scene camera projection to match the Tango camera intrinsic
    TangoCameraIntrinsics intrinsics = mTango.getCameraIntrinsics(mCameraId);
    Matrix4 projectionMatrix = mScenePoseCalcuator.calculateProjectionMatrix(
            intrinsics.width, intrinsics.height, intrinsics.fx, intrinsics.fy, intrinsics.cx,
            intrinsics.cy);
    getCurrentCamera().setProjectionMatrix(projectionMatrix);
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:14,代码来源:TangoRajawaliRenderer.java

示例7: startCameraPreview

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
private void startCameraPreview() {
    // Connect to color camera
	tangoCameraPreview.connectToTangoCamera(mTango,
			TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
	// Use default configuration for Tango Service.
	TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
	mTango.connect(config);
	mIsConnected = true;
	
	// No need to add any coordinate frame pairs since we are not using 
	// pose data. So just initialize.
	ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
	mTango.connectListener(framePairs, new OnTangoUpdateListener() {
		@Override
		public void onPoseAvailable(TangoPoseData pose) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onFrameAvailable(int cameraId) {
		    
		    // Check if the frame available is for the camera we want and
		    // update its frame on the camera preview.
			if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
				tangoCameraPreview.onFrameAvailable();
			}
		}

		@Override
		public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onTangoEvent(TangoEvent event) {
			// We are not using OnPoseAvailable for this app
		}
	});
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:40,代码来源:MainActivity.java

示例8: connectTango

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
/**
 * Configure the Tango service and connect it to callbacks.
 */
private void connectTango() {
    // Use default configuration for Tango Service, plus low latency
    // IMU integration and area learning.
    TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
    // NOTE: Low latency integration is necessary to achieve a precise alignment of virtual
    // objects with the RBG image and produce a good AR effect.
    config.putBoolean(TangoConfig.KEY_BOOLEAN_LOWLATENCYIMUINTEGRATION, true);
    config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
    // NOTE: Area learning is necessary to achieve better precision is pose estimation
    config.putBoolean(TangoConfig.KEY_BOOLEAN_LEARNINGMODE, true);
    config.putBoolean(TangoConfig.KEY_BOOLEAN_COLORCAMERA, true);
    mTango.connect(config);

    // No need to add any coordinate frame pairs since we are not
    // using pose data. So just initialize.
    ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(TangoPoseData pose) {
            // We are not using OnPoseAvailable for this app.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // Check if the frame available is for the camera we want and update its frame
            // on the view.
            if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                // Mark a camera frame is available for rendering in the OpenGL thread
                mIsFrameAvailableTangoThread.set(true);
                mSurfaceView.requestRender();
            }
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // Save the cloud and point data for later use.
            mPointCloudManager.updateXyzIj(xyzIj);
        }

        @Override
        public void onTangoEvent(TangoEvent event) {
            // We are not using OnTangoEvent for this app.
        }
    });

    mIntrinsics = mTango.getCameraIntrinsics(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
}
 
开发者ID:tdb-alcorn,项目名称:defect-party,代码行数:51,代码来源:FloorplanActivity.java

示例9: setTangoListeners

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();

    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            // We are not using TangoPoseData for this application.
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // We are not using onXyzIjAvailable for this app.
        }

        @Override
        public void onPointCloudAvailable(final TangoPointCloudData pointCloudData) {
            logPointCloud(pointCloudData);
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            // Ignoring TangoEvents.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // This will get called every time a new RGB camera frame is available to be
            // rendered.
            Log.d(TAG, "onFrameAvailable");

            if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                // Now that we are receiving onFrameAvailable callbacks, we can switch
                // to RENDERMODE_WHEN_DIRTY to drive the render loop from this callback.
                // This will result on a frame rate of  approximately 30FPS, in synchrony with
                // the RGB camera driver.
                // If you need to render at a higher rate (i.e.: if you want to render complex
                // animations smoothly) you  can use RENDERMODE_CONTINUOUSLY throughout the
                // application lifecycle.
                if (mSurfaceView.getRenderMode() != GLSurfaceView.RENDERMODE_WHEN_DIRTY) {
                    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
                }

                // Note that the RGB data is not passed as a parameter here.
                // Instead, this callback indicates that you can call
                // the {@code updateTexture()} method to have the
                // RGB data copied directly to the OpenGL texture at the native layer.
                // Since that call needs to be done from the OpenGL thread, what we do here is
                // set-up a flag to tell the OpenGL thread to do that in the next run.
                // NOTE: Even if we are using a render by request method, this flag is still
                // necessary since the OpenGL thread run requested below is not guaranteed
                // to run in synchrony with this requesting call.
                mIsFrameAvailableTangoThread.set(true);
                // Trigger an OpenGL render to update the OpenGL scene with the new RGB data.
                mSurfaceView.requestRender();
            }
        }
    });
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:66,代码来源:HelloVideoActivity.java

示例10: setupRenderer

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
/**
 * Here is where you would set-up your rendering logic. We're replacing it with a minimalistic,
 * dummy example using a standard GLSurfaceView and a basic renderer, for illustration purposes
 * only.
 */
private void setupRenderer() {
    mSurfaceView.setEGLContextClientVersion(2);
    mRenderer = new HelloVideoRenderer(new HelloVideoRenderer.RenderCallback() {
        @Override
        public void preRender() {
            Log.d(TAG, "preRender");
            // This is the work that you would do on your main OpenGL render thread.

            // We need to be careful to not run any Tango-dependent code in the OpenGL
            // thread unless we know the Tango service to be properly set-up and connected.
            if (!mIsConnected) {
                return;
            }

            try {
                // Synchronize against concurrently disconnecting the service triggered from the
                // UI thread.
                synchronized (HelloVideoActivity.this) {
                    // Connect the Tango SDK to the OpenGL texture ID where we are going to
                    // render the camera.
                    // NOTE: This must be done after both the texture is generated and the Tango
                    // service is connected.
                    if (mConnectedTextureIdGlThread == INVALID_TEXTURE_ID) {
                        mConnectedTextureIdGlThread = mRenderer.getTextureId();
                        mTango.connectTextureId(TangoCameraIntrinsics.TANGO_CAMERA_COLOR,
                                mRenderer.getTextureId());
                        Log.d(TAG, "connected to texture id: " + mRenderer.getTextureId());
                    }

                    // If there is a new RGB camera frame available, update the texture and
                    // scene camera pose.
                    if (mIsFrameAvailableTangoThread.compareAndSet(true, false)) {
                        double rgbTimestamp =
                                mTango.updateTexture(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
                        // {@code rgbTimestamp} contains the exact timestamp at which the
                        // rendered RGB frame was acquired.

                        // In order to see more details on how to use this timestamp to modify
                        // the scene camera and achieve an augmented reality effect, please
                        // refer to java_augmented_reality_example and/or
                        // java_augmented_reality_opengl_example projects.

                        // Log and display timestamp for informational purposes
                        Log.d(TAG, "Frame updated. Timestamp: " + rgbTimestamp);

                        // Updating the UI needs to be in a separate thread. Do it through a
                        // final local variable to avoid concurrency issues.
                        final String timestampText = String.format(sTimestampFormat,
                                rgbTimestamp);
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mTimestampTextView.setText(timestampText);
                            }
                        });
                    }
                }
            } catch (TangoErrorException e) {
                Log.e(TAG, "Tango API call error within the OpenGL thread", e);
            } catch (Throwable t) {
                Log.e(TAG, "Exception on the OpenGL thread", t);
            }
        }
    });
    mSurfaceView.setRenderer(mRenderer);
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:72,代码来源:HelloVideoActivity.java

示例11: PointCloudManager

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
public PointCloudManager(TangoCameraIntrinsics intrinsics) {
    mXyzIjData = new TangoXyzIjData();
    mTangoCameraIntrinsics = intrinsics;
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:5,代码来源:PointCloudManager.java

示例12: startAugmentedreality

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
private void startAugmentedreality() {
    if (!mIsConnected) {
        mIsConnected = true;
        // Connect to color camera
        mGLView.connectToTangoCamera(mTango, TangoCameraIntrinsics.TANGO_CAMERA_COLOR);

        // Use default configuration for Tango Service, plus low latency IMU integration.
        TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
        // NOTE: low latency integration is necessary to achieve a precise alignment of
        // virtual objects with the RBG image and produce a good AR effect.
        config.putBoolean(TangoConfig.KEY_BOOLEAN_LOWLATENCYIMUINTEGRATION, true);
        config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
        mTango.connect(config);

        // No need to add any coordinate frame pairs since we are not using
        // pose data. So just initialize.
        ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
        mTango.connectListener(framePairs, new OnTangoUpdateListener() {
            @Override
            public void onPoseAvailable(TangoPoseData pose) {
                // We are not using OnPoseAvailable for this app
            }

            @Override
            public void onFrameAvailable(int cameraId) {
                // Check if the frame available is for the camera we want and
                // update its frame on the view.
                if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                    mGLView.onFrameAvailable();
                }
            }

            @Override
            public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
                // Get the device pose at the time the point cloud was acquired
                TangoCoordinateFramePair framePair = new TangoCoordinateFramePair(
                        TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
                        TangoPoseData.COORDINATE_FRAME_DEVICE);
                TangoPoseData cloudPose = mTango.getPoseAtTime(xyzIj.timestamp, framePair);

                // Save the cloud and point data for later use
                mPointCloudManager.updateXyzIjData(xyzIj, cloudPose);
            }

            @Override
            public void onTangoEvent(TangoEvent event) {
                // We are not using OnPoseAvailable for this app
            }
        });

        // Get extrinsics from device for use in transforms
        // This needs to be done after connecting Tango and listeners
        setupExtrinsics();

        // Set-up point cloud plane fitting library helper class
        mPointCloudManager = new PointCloudManager(mTango.getCameraIntrinsics(
                TangoCameraIntrinsics.TANGO_CAMERA_COLOR));

    }
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:61,代码来源:AugmentedRealityActivity.java

示例13: onSurfaceCreated

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    glClearColor(0.3f, 0.3f, 0.3f, 1.0f);

    IntBuffer bufferNames = IntBuffer.allocate(1);
    glGenBuffers(1, bufferNames);
    videoVertexBuffer_ = bufferNames.get(0);

    // Create a bi-unit square geometry.
    glBindBuffer(GL_ARRAY_BUFFER, videoVertexBuffer_);
    glBufferData(GL_ARRAY_BUFFER, 8, null, GL_STATIC_DRAW);
    ((ByteBuffer)glMapBufferRange(
            GL_ARRAY_BUFFER,
            0, 8,
            GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT))
            .order(ByteOrder.nativeOrder())
            .put(new byte[] { -1, 1,  -1, -1,  1, 1,  1, -1 });
    glUnmapBuffer(GL_ARRAY_BUFFER);

    // Create the video texture.
    IntBuffer textureNames = IntBuffer.allocate(1);
    glGenTextures(1, textureNames);
    videoTextureName_ = textureNames.get(0);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, videoTextureName_);

    // Connect the texture to Tango.
    activity_.attachTexture(TangoCameraIntrinsics.TANGO_CAMERA_COLOR, videoTextureName_);

    // Prepare the shader program.
    videoProgram_ = createShaderProgram(videoVertexSource, videoFragmentSource);
    glUseProgram(videoProgram_);
    videoVertexAttribute_ = glGetAttribLocation(videoProgram_, "a_v");
    glUniform1i(
            glGetUniformLocation(videoProgram_, "colorTex"),
            0);  // GL_TEXTURE0
    glUniform1i(
            glGetUniformLocation(videoProgram_, "cap"),
            0);

    // Get the camera frame dimensions.
    offscreenSize_ = activity_.getCameraFrameSize(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);

    // Create an offscreen render target to capture a frame.
    IntBuffer renderbufferName = IntBuffer.allocate(1);
    glGenRenderbuffers(1, renderbufferName);
    glBindRenderbuffer(GL_RENDERBUFFER, renderbufferName.get(0));
    glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, offscreenSize_.x, offscreenSize_.y);

    IntBuffer framebufferName = IntBuffer.allocate(1);
    glGenFramebuffers(1, framebufferName);
    glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferName.get(0));

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    offscreenBuffer_ = framebufferName.get(0);

    Log.i(activity_.TAG, "onSurfaceCreated");
}
 
开发者ID:daryllstrauss,项目名称:tango,代码行数:61,代码来源:FrameRenderer.java

示例14: getCameraFrameSize

import com.google.atap.tangoservice.TangoCameraIntrinsics; //导入依赖的package包/类
public Point getCameraFrameSize(int cameraId) {
    TangoCameraIntrinsics intrinsics = mTango.getCameraIntrinsics(cameraId);
    return new Point(intrinsics.width, intrinsics.height);
}
 
开发者ID:daryllstrauss,项目名称:tango,代码行数:5,代码来源:PointCloudActivity.java


注:本文中的com.google.atap.tangoservice.TangoCameraIntrinsics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。