Finding the disparity to depth matrix using Matlab - matlab

I have the Rotation matrix and the translation vector between the 2 cameras .Is there a way to find out the 4 X 4 disparity-to-depth mapping matrix using Matlab ?
I used this link for finding the R and T parameter values between the two cameras.

You can always compile OpenCv and use it in matlab as external DLL.

Related

Camera Calibration - How To Find The Projection Matrix

There are many questions that explain how to find the projection matrix but they don't apply to my situation. The Matlab function cameraMatrix(cameraParams,rotMatrix,tranVector) can easily find the projection matrix.
I obtained my cameraParams variable by using the camera calibrator app in Matlab by providing checkerboard images in the input. The problem is that in my cameraParams variable, there are 10 rotation matrices and 10 translation vectors for some reason. The app always returns 10 rotation and translation vectors no matter what. The function cameraMatrix() can only accept a single rotation matrix and translation vector as inputs.
Why are there multiple rotation matrices and translation vectors and how do I find the projection matrix?

PCA 3D matrix - Matlab

I'm trying to apply a PCA solution to a 3d matrix (x,y,z)
I have 552 occurences of this matrix to use as my sample.
I'm not trying to reduce the dimensionality, instead I want to be able to predict these matrix using the information that I will extract from the first 3 vectors of the PCA.
I searched online but I couldn't find any clear solution to that problem.
One approach that I thought was to "unwrap" my 3d matrix on a 2d set of information
so, for instance assuming that I have a matrix that is
C D
A 1.5 2.4
B 2 3.4
I could work with the linear combination
(A,C) (A,D) (C,B) (B,D)
1.5 2.4 2 3.4
As my variables
Does it make sense?
Am I missing something?
is there any easier way ?
Looking forward to hear other members !
Cheers,

3D Matrix in Simulink which can be 2D is not supported

I am using SIMULINK and I needed to define a Rotation Matrix 3,3,N where N is the number of Robots which I am trying to simulate. To do that, because I am also using the Simulink Coder I had to define the signal related to this matrix as Variable Size and I had to define the upper-bound in the following way:
The problem is that when I want to use only one robot (I set n_robots to 1) I get the following error.
Cannot initialize dimensions of 'R' of 'test_pos_ctrl_target/rotation matrix to Euler angles' to [3x3x1]. When the number of dimensions of a matrix exceeds 2, the size of the trailing dimension must be greater than 1.
Someone could help me?
thanks a lot.
You can't have the last dimension as 1 because MATLAB treats any matrix of dimension [m,n,1] as [m,n]. See size() returns 1 where matrix dimension should not exist for more details.
Try defining R of size [n_robots,3,3] and then re-arrange the matrix inside your code (I assume you are using a MATLAB Function block).

Making Dataset for 4 Motors Inverse kinematics using ANFIS in MATLAB

This is the link that explain to solve inverse kinematics using ANFIS
http://www.mathworks.com/help/fuzzy/examples/modeling-inverse-kinematics-in-a-robotic-arm.html
But the example is only for 2 DOFs Robot. How to make the data set if the robot using 4 motors?
Because there is always an error that says :"Error using meshgrid. Too many input arguments." when running the code:
a= 0:(1*pi/180):(180*pi/180);
b= 0:(1*pi/180):(180*pi/180);
c= 0:(1*pi/180):(180*pi/180);
d= (25*180/pi):(1*pi/180):(180*pi/180);
[THETA1, THETA2, THETA3, THETA4] = meshgrid(a, b, c, d);
Any Suggestion will be appreciated
Thanks!
meshgrid is specifically for 2D or 3D data. For arbitrary n-dimensional data, the appropriately-named ndgrid is the guy you want.
Note that meshgrid is intended for working intuitively with Cartesian X,Y{,Z} data, so swaps the first two dimensions in the shape of its output to reflect X,Y order rather than row,column. ndgrid, being more general, just gives you standard multidimensional matrix order.

Calculating a rotation matrix using rotate in Matlab

I'm using Matlab 2013a on Windows 7 Pro 64 bit.
In 2010 (using a different version of Matlab), I wrote the following code to calculate a 3x3 rotation matrix
C=rotate (omega, i, w);
R=C*Ro;
where omega, i, and w are rotation angles in radians. On my current system, giving the example input of omega = i = w = 0, C will be a 3x3 identity matrix.
If I copy the code into another directory that I wrote in the past few months, the same code will result in the following error.
Error using rotate
Too many output arguments.
So my question to SO is why the same lines of code on the same computer with the same version of Matlab will work in one directory but not in another directory?
If you had read the help for rotate, you would have seen that this one does not calculate the rotation matrix, but rotates a matlab graph. Some toolboxes eg Phased Array System Toolbox have some functions rotx, roty,... to calculate the rotational matrix.
However, functions for calculating the rotation matrix is not that hard to construct. Looking at http://en.wikipedia.org/wiki/Rotation_matrix the rotational matrices for every axis is given. The general rotation matrix is then a product of the individual rotation matrices. This should be piece of cake.