homogenous-transformation

Why are aggregate and fold two different APIs in Spark?

拟墨画扇 提交于 2020-01-01 09:03:14
问题 When using the Scala standard lib, I can do somthing like this: scala> val scalaList = List(1,2,3) scalaList: List[Int] = List(1, 2, 3) scala> scalaList.foldLeft(0)((acc,n)=>acc+n) res0: Int = 6 Making one Int out of many Ints. And I can do something like this: scala> scalaList.foldLeft("")((acc,n)=>acc+n.toString) res1: String = 123 Making one String out of many Ints. So, foldLeft could be either homogeneous or heterogeneous, whichever we want, it's in one API. While in Spark, if I want one

Determining a homogeneous affine transformation matrix from six points in 3D using Python

☆樱花仙子☆ 提交于 2019-12-21 02:52:23
问题 I am given the locations of three points: p1 = [1.0, 1.0, 1.0] p2 = [1.0, 2.0, 1.0] p3 = [1.0, 1.0, 2.0] and their transformed counterparts: p1_prime = [2.414213562373094, 5.732050807568877, 0.7320508075688767] p2_prime = [2.7677669529663684, 6.665063509461097, 0.6650635094610956] p3_prime = [2.7677669529663675, 5.665063509461096, 1.6650635094610962] The affine transformation matrix is of the form trans_mat = np.array([[…, …, …, …], […, …, …, …], […, …, …, …], […, …, …, …]]) such that with

extracting scale matrix from modelview matrix

半城伤御伤魂 提交于 2019-12-20 04:36:58
问题 how do we extract scale matrix from model view matrix? Right now I am taking length of each coloumn, but it fails when the scale is negative. here is my code: float xs = matrix[0][0] * matrix[0][1] * matrix[0][2] * matrix[0][3] < 0 ? -1 : 1; float ys = matrix[1][0] * matrix[1][1] * matrix[1][2] * matrix[1][3] < 0 ? -1 : 1; float zs = matrix[2][0] * matrix[2][1] * matrix[2][2] * matrix[2][3] < 0 ? -1 : 1; glm::vec3 new_scale; new_scale.x = xs* glm::sqrt( matrix[0][0] * matrix[0][0] + matrix[0]

Get 3D coordinates from 2D image pixel if extrinsic and intrinsic parameters are known

丶灬走出姿态 提交于 2019-12-17 03:51:18
问题 I am doing camera calibration from tsai algo. I got intrensic and extrinsic matrix, but how can I reconstruct the 3D coordinates from that inormation? 1) I can use Gaussian Elimination for find X,Y,Z,W and then points will be X/W , Y/W , Z/W as homogeneous system. 2) I can use the OpenCV documentation approach: as I know u , v , R , t , I can compute X,Y,Z . However both methods end up in different results that are not correct. What am I'm doing wrong? 回答1: If you got extrinsic parameters

Get 3D coordinates from 2D image pixel if extrinsic and intrinsic parameters are known

Deadly 提交于 2019-12-17 03:50:33
问题 I am doing camera calibration from tsai algo. I got intrensic and extrinsic matrix, but how can I reconstruct the 3D coordinates from that inormation? 1) I can use Gaussian Elimination for find X,Y,Z,W and then points will be X/W , Y/W , Z/W as homogeneous system. 2) I can use the OpenCV documentation approach: as I know u , v , R , t , I can compute X,Y,Z . However both methods end up in different results that are not correct. What am I'm doing wrong? 回答1: If you got extrinsic parameters

Under which conditions can I leave out the perspective division?

↘锁芯ラ 提交于 2019-12-11 09:37:51
问题 I want to revert a homogeneous transformation after performing a perspective division. To be more specific, I’m implementing a GPU-based voxelization algorithm using conservative rasterization. For an overview, these are the steps I’ve implemented so far (VS=vertex shader, GS=geometry shader): Apply the model transform to the vertices (VS). Apply an orthographic projection transform to a copy of each vertex (GS). Apply a view transform to the copies (GS). Perform a perspective division on the

Why are aggregate and fold two different APIs in Spark?

允我心安 提交于 2019-12-04 04:43:47
When using the Scala standard lib, I can do somthing like this: scala> val scalaList = List(1,2,3) scalaList: List[Int] = List(1, 2, 3) scala> scalaList.foldLeft(0)((acc,n)=>acc+n) res0: Int = 6 Making one Int out of many Ints. And I can do something like this: scala> scalaList.foldLeft("")((acc,n)=>acc+n.toString) res1: String = 123 Making one String out of many Ints. So, foldLeft could be either homogeneous or heterogeneous, whichever we want, it's in one API. While in Spark, if I want one Int out of many Ints, I can do this: scala> val rdd = sc.parallelize(List(1,2,3)) rdd: org.apache.spark

Determining a homogeneous affine transformation matrix from six points in 3D using Python

旧城冷巷雨未停 提交于 2019-12-03 08:18:18
I am given the locations of three points: p1 = [1.0, 1.0, 1.0] p2 = [1.0, 2.0, 1.0] p3 = [1.0, 1.0, 2.0] and their transformed counterparts: p1_prime = [2.414213562373094, 5.732050807568877, 0.7320508075688767] p2_prime = [2.7677669529663684, 6.665063509461097, 0.6650635094610956] p3_prime = [2.7677669529663675, 5.665063509461096, 1.6650635094610962] The affine transformation matrix is of the form trans_mat = np.array([[…, …, …, …], […, …, …, …], […, …, …, …], […, …, …, …]]) such that with import numpy as np def transform_pt(point, trans_mat): a = np.array([point[0], point[1], point[2], 1]) ap

extracting scale matrix from modelview matrix

无人久伴 提交于 2019-12-02 07:03:56
how do we extract scale matrix from model view matrix? Right now I am taking length of each coloumn, but it fails when the scale is negative. here is my code: float xs = matrix[0][0] * matrix[0][1] * matrix[0][2] * matrix[0][3] < 0 ? -1 : 1; float ys = matrix[1][0] * matrix[1][1] * matrix[1][2] * matrix[1][3] < 0 ? -1 : 1; float zs = matrix[2][0] * matrix[2][1] * matrix[2][2] * matrix[2][3] < 0 ? -1 : 1; glm::vec3 new_scale; new_scale.x = xs* glm::sqrt( matrix[0][0] * matrix[0][0] + matrix[0][1] * matrix[0][1] + matrix[0][2] * matrix[0][2]); new_scale.y = ys* glm::sqrt( matrix[1][0] * matrix[1

Why do 2D transformations need 3x3 matrices?

瘦欲@ 提交于 2019-11-30 03:47:01
I want to do some 2D drawing and thus want to implement some matrix transformations. With my light mathematics background I am trying to understand how to do so in C# (any other oop language would do it obviously). All I read is explaining that we need to work with 3x3 matrices to be able to cope with the translations. Because you cannot make translation with multiplications. But this is with multiplications of the matrices that we create our transformations. So we work with something like: { x1, x2, tx } { y1, y2, ty } { 0, 0, 1 } I understand the mean of the third column, but why do we need