Questions tagged [projection-matrix]
234 questions
34
votes
4 answers
Three.JS rotate projection so that the y axis becomes the z-axis
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…

Alex Turpin
- 46,743
- 23
- 113
- 145
28
votes
3 answers
Understanding the libGDX Projection Matrix
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…

user3059686
- 423
- 2
- 5
- 10
20
votes
3 answers
countNonZero function gives an assertion error in openCV
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,…

Samitha Chathuranga
- 1,689
- 5
- 30
- 57
11
votes
1 answer
Compute projection / hat matrix via QR factorization, SVD (and Cholesky factorization?)
I'm trying to calculate in R a projection matrix P of an arbitrary N x J matrix S:
P = S (S'S) ^ -1 S'
I've been trying to perform this with the following function:
P <- function(S){
output <- S %*% solve(t(S) %*% S) %*% t(S)
…

bikeclub
- 369
- 2
- 10
8
votes
2 answers
OpenGL ES Screen Projection Matrix and Camera Projection Matrix
I have a projection matrix derived from the camera calibration in an augmented reality app and as long as the screen aspect ratio matches the camera image aspect ratio everything is fine. When the camera image doesn't match the screen edge-for-edge…

Cameron Lowell Palmer
- 21,528
- 7
- 125
- 126
6
votes
5 answers
How to get CATransform3D from Projection and ModelView matrices?
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…

Zapko
- 2,461
- 25
- 30
6
votes
1 answer
Generate point cloud from depth image
I am trying to convert a depth image (RGBD) into a 3d point cloud. The solution I am currently using is taken from this post where:
cx = image center height
cy = image center width
fx and fy = 250, chosen by iterating through a few options
The…

Lloyd Rayner
- 1,009
- 2
- 7
- 10
6
votes
2 answers
Why does a 3D point appear to be behind the camera?
I wrote a simple script to project 3D points into an image bases on the camera intrinsics and extrintics. But when I have a camera at the origin pointing down the z-axis and a 3D points further down the z-axis it appears to be behind the camera…

nickponline
- 25,354
- 32
- 99
- 167
6
votes
2 answers
Projection Matrix for Pseudo Cylindrical Projection
Imagine having a mixed group of 3D objects contained within a sphere, and your goal is to create a cylindrical equal-area projection of the entire scene. Using OpenGL, you might think to stitch together multiple render target textures (4 to be…

Blake Regalia
- 2,677
- 2
- 20
- 29
6
votes
1 answer
Compute 3D point from mouse-position and depth-map
I need to compute 3D coordinates from a screen-space position using a rendered depth-map. Unfortunately, using the regular raytracing is not an option for me because I am dealing with a single geometry containing something on the order of 5M…

Martin Schuhfuß
- 6,814
- 1
- 36
- 44
6
votes
1 answer
How to get camera transformation matrix from single image?
I have a single image and several known points and its projections to image plane. (each 3d point has projection to 2d). My goal is to find matrix 4x4, for easy calculation of projection of any 3d point to image plane.
I tried to use Monte-Carlo…

Inflight
- 497
- 4
- 12
6
votes
2 answers
OpenGL - ortho Projection matrix, glViewport
I'm having trouble wrapping my head around how these work. First, in a 2d game the projection matrix should be set up as ortho with left, right, top, bottom matching the window, right? But when the window resizes, should I just change glViewport,…

mk12
- 25,873
- 32
- 98
- 137
6
votes
2 answers
OpenGL: Mix orthographic and perspective projection
I want to mix a perspective and orthographic view, but I can't get it to work.
I want X and Y coordinates to be orthographic and Z perspective. For clarification I added a sketch of the desired transformation from OpenGL coordinates to screen…

hardmooth
- 1,202
- 2
- 19
- 36
6
votes
3 answers
back-projecting a 2D point to 3D Plucker line
I'm trying to build a tracker (hand tracking personal project), and for this reason I need to back-project a 2d point to a 3d line, using Plucker coordinates. (like ray tracing)
As an input, I have the 2d coordinates of a point and the projection…

dim_tz
- 1,451
- 5
- 20
- 37
5
votes
3 answers
Why does the camera face the negative end of the z-axis by default?
I am learning openGL from this scratchpixel, and here is a quote from the perspective project matrix chapter:
Cameras point along the world coordinate system negative z-axis so that when a point is converted from world space to camera space (and…

watashiSHUN
- 9,684
- 4
- 36
- 44