The trailer opens by quoting Trinity ( Carrie-Anne Moss) from 1999’s “The Matrix” - “A deja vu is usually a glitch in the Matrix. In the latest trailer for “ The Matrix Resurrections” - the sequel to the first “Matrix” trilogy that concluded 18 years ago with “The Matrix Revolutions” - it’s clear that director Lana Wachowski and her collaborators are going to get meta with what a sequel is. However, from what I see in your post, making the colour map is what you want to do.Sequels, by their nature, are a remix of what’s come before: a new iteration of characters we’ve already met and a story we already know. MATLAB has a bunch of built-in colour maps for you to use if you don't feel like designing your own colour map.
#MATRIX GIF MOVIE#
However, you must make sure you run through each value in a.movie and assign a unique integer to each value to ensure that there are no gaps in your data and every value gets assigned to a new value that goes up from 1 to M in order for the movie to properly access the right colour. Therefore, you can simply just create a jet colour map: map = jet(M) However, the colour map you're looking at is the jet colour map. Movie = immovie(X,map) % map is the colormap you want to use
#MATRIX GIF CODE#
Now, go ahead and use map with the above code to create your movie. Therefore, I'd create your colour map like this: = unique(a.movie) However, this will require that a.movie be redefined to ensure that we can assign a value to a colour. What we can do is figure out how many unique values there are in your matrix, then we can create our colour map that way so we can ensure that each value in your matrix gets assigned to one colour. Therefore, start off with RGB = (0,0,1), then start linearly increasing the red component while linearly decreasing the blue component until the red is 1 and the blue is 0. The blue colour has an exact colour of RGB = (0,0,1) assuming normalized coordinates and similarly, the red represents the exact colour of RGB = (1,0,0). If you want the colours to span between blue and red. Now, I'm assuming that your values in the 3D matrix span from 0 to 100. The way to do this is to use each value in your 3D matrix exactly as it is and use this to access the row of the colour map.
The goal of the colour map is to take each value in your 3D matrix, and figure out which colour that value maps to. Keep in mind that these colours should be normalized between. Therefore, the first column represents the proportion of red you want, the second channel is the proportion of green and the last is the proportion of blue. Basically, the colour map is a M x 3 matrix where row in this matrix corresponds to a unique colour. This maps each value in your 3D matrix to a unique colour. The first and second dimensions represent the rows and columns, and you leave those empty. The job of permute here is to swap the 3rd and 4th dimension - that's why you see the vector in the permute call. Simply put, you can think of your 3D matrix as having a singleton 4D dimension: m x n x k x 1.
Therefore, by permuting, you are artificially creating a 4D matrix from your 3D original matrix. You currently have your 3D matrix set up to be m x n x k. immovie expects a m x n x 1 x k matrix where m and n are the rows and columns of 1 slice from your 3D matrix, and k is the number of slices. The post you linked us to exactly answers that.