I have been learning about camera calibration and get confused in my way to understand how to recover extrinsic and intrinsic camera parameter from camera projection matrix.
In general, we can derive camera projection matrix values by solving the equations from correspondences of 3D world coordinates to 2D screen coordinates and that is, we get an matrix let's say "C"
C = [c11 c12 c13 c14; c21 c22 c23 c24; c31 c32 c33 c34]
And ussually, without loss of generality we can assign c34 = 1 and we can find the rest of the elements through correspondences 3D-2D.
After that, we can compare camera projection matrix C to conjunction of ext and int matrix (let's say M) that can be arranged to be
M = [fxr1+uxr3 fxtx+uxtz; fyr1+uyr3 fytx+uytz; r3 tz] where r1, r2, r3 are the row vector of Rotation matrix and tx,ty,tz are translation.
What I could not make out is when we compare each of C elements to M elements to get the ext and int parameter, our tz (translation about z) will be 1 because we have assigned c34 prior to be 1. How can the tz always 1? can anyone explain?
Look up "RQ decomposition". OpenCV has a routine to do it
Related
In section 25.8.1 Basic Polygon Rasterization of the Vulkan spec it says:
Barycentric coordinates are a set of three numbers, a, b, and c, each in the range [0,1], with a + b + c
= 1. These coordinates uniquely specify any point p within the triangle or on the triangle’s
boundary as
p = a * p_a + b * p_b + c * p_c
where p_a , p_b , and p_c are the vertices of the triangle. a, b, and c are determined by:
a = A(p, p_b, p_c) / A(p_a, p_b, p_c)
b = A(p, p_a, p_c) / A(p_a, p_b, p_c)
c = A(p, p_a, p_b) / A(p_a, p_b, p_c)
where A(l,m,n) denotes the area in framebuffer coordinates of the triangle with vertices l, m, and n.
Framebuffer coordinates technically have three components. This is specified in 24.5 Controlling the Viewport as:
The vertex’s framebuffer coordinates (x_f , y_f , z_f ) are given by [snip]
What precisely is the formula of the A function?
Is it either:
(a) the same as the formula given to calculate whether the triangle is back-facing or front-facing in 25.8.1, namely:
a = -0.5 * sum_i(x_f[i] * y_f[i+1] - x_f[i+1] * y_f[i])
That is, is it taken as read that the forumla of A does not use the z_f components of its arguments, and is purely a function of the (x_f, y_f) components? (ie It is calculating the area of the two dimensional projection of the triangle onto the x-y plane in framebuffer-space)
or (b), does A use all three framebuffer components? ie Does A return the area of the triangle in the full three-dimensional framebuffer-space (like shown here for example)
or (c) something else?
It actually doesn't matter, mathematically speaking. Whichever function you pick, you'll find that the particulars of the math divide out when computing the barycentric coordinate.
A barycentric coordinate is computed by taking the ratio of two areas. If you linearly project two co-planar triangles from 3D space to 2D space with the same projection, the ratio of their areas is unchanged (assuming that they have an area post-projection).
I am new in tensorflow so this might be an easy question, but it is really stuck me
I am tring to implement this paper by keras, background is tensorflow
In first stage of training, he used softmax_pair
if we got this output from last fc
vertical is batch size and this is NoneType
x11 x12 x13 x14...
x21 x22 x23 x24...
x31 x32 x33 x34...
...
and we do exponential, so we have
e11 e12 e13 e14...
e21 e22 e23 e24...
e31 e32 e33 e34...
...
and then, I am stuck here
e11/(e11+e12) e12/(e11+e12) e13/(e13+e14) e14/(e13+e14)...
e21/(e21+e22) e22/(e21+e22) e23/(e23+e24) e24/(e23+e24)...
e31/(e31+e32) e32/(e31+e32) e33/(e33+e34) e34/(e33+e34)...
...
I don't know how to do pairwise addition
tf.transpose and tf.segment_sum might be great
but after research I found transpose is expensive
further more, after tf.segment_sum I only have half size of tensor,
I don't know how to double it
oh and I am thinking how to produce segment_ids
so how can I do this calculate?
Thanks!!
----------update
The part I talked in paper is Fig.3
The fc output is P2c-1 and P2c, which is mean possibility of class c appear or not appear in the image
c=1,2,3...num of class
Is transpose not expensive? sometimes I see this,e.g. the comment ,perhaps I misunderstood this?
The tensorflow docs for tf.transpose state that unlike numpy tensorflow returns a new tensor -> memory.
Assuming X is your tensor of size R x C:
_, C = X.get_shape()
X_split = tf.split(1, C/2, X)
Y_split = [tf.nn.softmax(slice) for slice in X_split]
Y = tf.concat(1, Y_split)
C will be the number of colums, X_split will be a list of subtensors, each having a two columns, Y_split will calculate regular softmax for each of the tensors, Y will join the results of softmaxes.
I have two planes in 3D space as shown below.
Point "e" on plane2 represents the intersection of the line which passes from point "P" of plane1 and has the direction vector of "S". Let P be the edge of plane 1.
Which are the "e" point coordinates (xe,ye, 0) with respect to the coordinates system of the plane it belongs (plane2), using Numpy?
I have the following data available:
Coordinates of the centers of each plane with respect of the global coordinate system "C".
x = np.array([x1, x2])
y = np.array([y1, y2])
z = np.array([z1, z2])
Sun direction vector S = np.array([Sz, Sx, Sy])
Point "P" location with respect to the coordinate system of plane1: P(xp,yp,0)
Each plane has the same width and length dimensions: Hw, Hl
Unit vectors normal to the plane surfaces
n = np.array([[n1z, n1x, n1y], [n2z, n2x, n2y]])
Also the azimuthial and elevation angles for both planes with respect to the global coordinate system "c" are known:
alphaH = np.array([alphaH1, alphaH2])
aH = np.array([aH1, aH2])
You have the position vector for c2 and the position vector for e in the global coordinate system then all you need to do is calculate c2-e and this will give you the position vector of e relative to c2.
I had these questions in an exam today. State True or False and explain.
If k1(.,.) and k2(.,.) are two valid kernel functions, then if h = k1 - k2, is h(.,.) a valid kernel function?
A standard soft margin SVM is used to classify data set. We have a fixed C parameter. Two different algorithms A1 and A2 are used to obtain the support vector set {S:
α
i > 0}. Call them S1 and S2. Is S1 = S2 in all cases? Assume both algorithm use the same kernel function.
EDITED:
I guessed as:
As kernel function need to be positive semi definite (PSD), the difference between two kernel functions need not be PSD. Hence FALSE.
αi can be different among the two algorithms, the number of support vectors can differ as well. Hence FALSE again.
A) constant 0 is a kernel, constant 1 is a kernel, too. But 0-1=-1 is not PSD.
Thus false IMHO.
B) Assuming 2D data, where x=0 for Class 1, x=1 for Class 2, and y is uniformly random. Any vector from each class is as good a support vector as the others, yielding the same hyperplane. Visually:
x1 | y1
|
x2 | y2
Which SVM is better, the one using x1 and y1 as support vectors, or the one using x2 and y2?
i have two bezier curves placed at a distance apart in space.
curve 1 has control points A0, A1,A2, A3. A0 and A3 lie on curve and are its end points
Curve 2 has control points C0,C1, C2, C3 . C0 and C3 lie on curve.and are its end points
i want to join the two curves A and C with an intermediate bezier curve B. the intermediate Curve B has control points A3 and C0 which lie on the curve and are its end points. the intermediate control points B1 and B2 are unknown to me. also the joining should be smooth enough. please help as to how to proceed. have read alot about beziers but dont know how to do this.
thanks and regards,
Gauri
B1 will be: B1x = 2 * A3x - A2x; B1y = 2 * A3y - A2y;
B2 will be: B2x = 2 * C0x - C1x; B2y = 2 * C0y - C1y;
This should give you perfectly smooth join.
#Arty
You are correct but this will only assure a "smooth enough" join.
To achieve a better looking join of those 2 curves you must also have 2nd derivative equals at the junction points. I place this here for those that might need this piece of information.