Page 1 of 1

Colormap must be the same for all frames being written. Palette changes are not supported by VideoWriter.

Posted: Thu Feb 09, 2017 3:58 am
by matlab1
Colormap must be the same for all frames being written. Palette changes are not supported by VideoWriter.

Re: Colormap must be the same for all frames being written. Palette changes are not supported by VideoWriter.

Posted: Wed Dec 30, 2020 8:04 am
by matlab1
solution :



A colormap is a matrix of values that define the colors for graphics objects such as surface, image, and patch objects. MATLABĀ® draws the objects by mapping data values to colors in the colormap.

Colormaps can be any length, but must be three columns wide. Each row in the matrix defines one color using an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. Typically, the intensities are double or single values in the range [0, 1]. A value of 0 indicates no color and a value of 1 indicates full intensity. For example, this command creates a colormap that has five colors: black, red, green, blue, and white.

Code: Select all

mymap = [0 0 0
    1 0 0
    0 1 0
    0 0 1
    1 1 1];
To change the color scheme of a visualization, call the colormap function to change the colormap of the containing axes or figure. For example, the following commands create a surface plot and set the colormap of the figure to mymap.

Code: Select all

surf(peaks)
colormap(mymap)

https://de.mathworks.com/help/matlab/ref/colormap.html



When writing to a video file, the field in colormap must be same for all of the frames