projection-matrix

projecting Tango 3D point to screen Google Project Tango

扶醉桌前 提交于 2019-12-02 09:58:13
Ptoject Tango provides a point cloud, how can you get the position in pixels of a 3D point in the point cloud in meters? I tried using the projection matrix but I get very small values (0.5,1.3 etc) instead of say 1234,324 (in pixels). I include the code I have tried //Get the current rotation matrix Matrix4 projMatrix = mRenderer.getCurrentCamera().getProjectionMatrix(); //Get all the points in the pointcloud and store them as 3D points FloatBuffer pointsBuffer = mPointCloudManager.updateAndGetLatestPointCloudRenderBuffer().floatBuffer; Vector3[] points3D = new Vector3[pointsBuffer.capacity()

The Projection Matrix Does More than Scaling, Right?

不想你离开。 提交于 2019-12-02 09:41:44
问题 As I have it understood, a projection matrix scales a polygon depending on how far away or close it is from the camera. Though I might be completely wrong. My question is, how does the projection matrix "know" to show the sides of the following cube, as the camera moves, when the matrix is only supposed "scale" polygons? Notice in the image, the cube is off to the right side of the screen, by moving the camera to the left. If the camera is moved in the opposite direction (to the right) in

Orthographic projection with origin at screen bottom left

旧巷老猫 提交于 2019-12-01 14:39:29
I'm using the python OpenGL bindings, and trying to only use modern opengl calls. I have a VBO with verticies, and I am trying to render with an orthographic projection matrix passed to the vertex shader. At present I am calculating my projection matrix with the following values: from numpy import array w = float(width) h = float(height) n = 0.5 f = 3.0 matrix = array([ [2/w, 0, 0, 0], [ 0, 2/h, 0, 0], [ 0, 0, 1/(f-n), -n/(f-n)], [ 0, 0, 0, 1], ], 'f') #later projectionUniform = glGetUniformLocation(shader, 'projectionMatrix') glUniformMatrix4fv(projectionUniform, 1, GL_FALSE, matrix) That

Understanding the Projection Matrix

﹥>﹥吖頭↗ 提交于 2019-12-01 10:16:20
问题 I am trying to understand what the value range of projected vectors is. It seems at odds with what MSDN says. The code below outputs a colored triangle. The triangle is fully visible. I would expect that after the verticies have been projected, the following would be true: X and Y are in the range of -1 to 1. Z is in the range of 0 to 1. I got this information from here: http://msdn.microsoft.com/en-us/library/bb195665.aspx However, when I manually transform the verticies of the triangle

Understanding the libGDX Projection Matrix

孤人 提交于 2019-11-30 11:06:18
Over the past few weeks I've been attempting to learn the libGDX library. I'm finding it hard, especially for my first endeavor toward game development, to comprehend the system of Camera/viewport relationships. One line of code that I've been told to use, and the API mentions, is: batch.setProjectionMatrix(camera.combined); Despite a good 4 hours of research, I'm still lacking a complete understanding of the functionality of this code. It is to my basic understanding that it "tells" the batch where the camera is looking. My lack of comprehension is depressing and angering, and I'd appreciate

countNonZero function gives an assertion error in openCV

房东的猫 提交于 2019-11-30 07:14:41
问题 I tried to get horizontal projection using countNonZero() function as below. Mat src = imread(INPUT_FILE, CV_LOAD_IMAGE_COLOR); Mat binaryImage = src.clone(); cvtColor(src, src, CV_BGR2GRAY); Mat horizontal = Mat::zeros(1,binaryImage.cols, CV_8UC1); for (int i = 0; i<binaryImage.cols; i++) { Mat roi = binaryImage(Rect(0, 0, 1, binaryImage.rows)); horizontal.at<int>(0,i) = countNonZero(roi); cout << "Col no:" << i << " >>" << horizontal.at<int>(0, i); } But an error is occured in the line of

countNonZero function gives an assertion error in openCV

十年热恋 提交于 2019-11-29 04:32:25
I tried to get horizontal projection using countNonZero() function as below. Mat src = imread(INPUT_FILE, CV_LOAD_IMAGE_COLOR); Mat binaryImage = src.clone(); cvtColor(src, src, CV_BGR2GRAY); Mat horizontal = Mat::zeros(1,binaryImage.cols, CV_8UC1); for (int i = 0; i<binaryImage.cols; i++) { Mat roi = binaryImage(Rect(0, 0, 1, binaryImage.rows)); horizontal.at<int>(0,i) = countNonZero(roi); cout << "Col no:" << i << " >>" << horizontal.at<int>(0, i); } But an error is occured in the line of calling countonZero() function. Error is as follows. OpenCV Error: Assertion failed (src.channels() == 1

Three.JS rotate projection so that the y axis becomes the z-axis

╄→尐↘猪︶ㄣ 提交于 2019-11-28 20:20:32
Traditionally, in 3D projections, the Y-axis is the axis that represents "up and down". I learned to think of it, with other engines, as that axis being the Z-axis. What I was wondering was whether there is a way in Three.JS to make the Z-axis the "up/down" axis. If so, are there any consequences to it? Here is a diagram of what I want: You could just change the camera rather than the entire coordinate system. For example: var WIDTH = 1024; var HEIGHT = 768; var VIEW_ANGLE = 45; var ASPECT = WIDTH / HEIGHT; var NEAR = 0.1; var FAR = 10000; camera = new THREE.PerspectiveCamera(VIEW_ANGLE,

How to get CATransform3D from Projection and ModelView matrices?

徘徊边缘 提交于 2019-11-27 23:13:00
all, I've got an iphone project that draws a 3D model using OpenGL-ES for a given model view matrix and given projection matrix. I needed to replace 3D model with CALayer, so I put values of model view matrix into CATransform3D structure and assigned it to layer.transform . It worked well, layer was visible and moved on the screen as expected, but after some time I realized that my layers behavior is not precise enough and I should take projection matrix into account. And then a problem appeared: when I simply concatenate two matrices my layer looks odd (it is very small, about 2 pixels, while

Three.JS rotate projection so that the y axis becomes the z-axis

送分小仙女□ 提交于 2019-11-27 12:49:46
问题 Traditionally, in 3D projections, the Y-axis is the axis that represents "up and down". I learned to think of it, with other engines, as that axis being the Z-axis. What I was wondering was whether there is a way in Three.JS to make the Z-axis the "up/down" axis. If so, are there any consequences to it? Here is a diagram of what I want: 回答1: You could just change the camera rather than the entire coordinate system. For example: var WIDTH = 1024; var HEIGHT = 768; var VIEW_ANGLE = 45; var