I need to construct camera extrinsic parameters matrix in a form like $ C =\begin{bmatrix} r_{11} & r_{12} & r_{13} & t_{1} \\ r_{21} & r_{22} & r_{23} & t_{2} \\ r_{31} & r_{32} & r_{33} & t_{3} \end{bmatrix}$ (where $r$ is rotation matrix and $t$ is a translation vector), so that $C$ could be used to project 3D point $X=\begin{bmatrix} x \\ y \\ z \\1 \end{bmatrix}$ to camera image plane (like $\begin{bmatrix}x_{px}\\y_{px} \\1 \end{bmatrix}= K * dist(normalize(CX))$, with $K$ as camera intrinsics, $dist$ as distortion function).
I would like to do it in a form like OpenGL allows (https://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml), so that I should be able to specify camera center, the point that camera should be "looking at" (this point will be in the center of the image). Unfortunately, the algorithm at https://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml misses formatting, so I'd like a clarification on how to do this, especially in relation to my coordinate system:
The second question is how to construct the "UP" vector. First, I need it to be pointing "up" (the Y axis of the image plane lies along Z world axis). Should this vector always be $\begin{bmatrix}0\\0\\1 \end{bmatrix}$ or it has to be calculated relatively to camera rotation? (suppose the camera is at (10,10,10) and it "looks" at (0,0,0), so it's "optical axis" is under 45 degrees with Z axis - what the vector UP will be in this case?)
Finally, I will have to rotate camera as well from "landscape" to "portrait" orientation (not exactly by 90 degrees, but by some degree around 89-91 deg, to simulate human's inaccuracy), so the Z axis in the world will lie along with X axis of the camera image plane. How this rotation can be achieved?
(I'm sorry for my English as it is not my first language)