Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
27
Добавлен:
09.02.2015
Размер:
297.47 Кб
Скачать

Is less than or equal to 256. If the length of newmap is

greater than 256, Y is of class double.

Example

-------

Approximate the indexed image clown by another indexed image

containing only 16 colors.

load clown

[Y, newmap] = imapprox(X, map, 16);

figure, image(Y), colormap(newmap)

axis off

axis image

See also cmunique, dither, rgb2ind.

Reference page in Help browser

doc imapprox

Lighting

<surfl> - 3-D shaded surface with lighting.

SURFL 3-D shaded surface with lighting.

SURFL(...) is the same as SURF(...) except that it draws the surface

with highlights from a light source.

SURFL(Z), SURFL(X,Y,Z), SURFL(Z,S), and SURFL(X,Y,Z,S) are all

legal. S, if specified, is the three vector S = [Sx,Sy,Sz]

that specifies the direction of the light source. S can also be

specified in view coordinates, S = [AZ,EL].

SURFL(...,'light') produces a colored lighted surface using

the LIGHT object. This produces different results than the

default lighting method, SURFL(...,'cdata'), which changes the

color data for the surface to be the reflectance of the surface.

H = SURFL(...) returns a handle to a surface graphics object.

The shading is based on a combination of diffuse, specular and

ambient lighting models.

The default value for S is 45 degrees counterclockwise from

the current view direction. Use CLA, HOLD ON, VIEW(AZ,EL),

SURFL(...), HOLD OFF to plot the lighted surface with view

direction (AZ,EL).

The relative contributions due to ambient light, diffuse

reflection, specular reflection, and the specular spread

coefficient can be set by using five arguments

SURFL(X,Y,Z,S,K) where K=[ka,kd,ks,spread].

Relies on the ordering of points in the X,Y, and Z matrices

to define the inside and outside of parametric surfaces.

Try SURFL(X',Y',Z') if you don't like the results of

this function. Due to the way surface normal vectors are

computed, SURFL requires matrices that are at least 3-by-3.

See also surf, shading.

Reference page in Help browser

doc surfl

<lighting> - Lighting mode.

LIGHTING Lighting mode.

LIGHTING controls the lighting of SURFACE and PATCH objects.

SURFACE and PATCH objects are created by the functions SURF, MESH,

PCOLOR, FILL, and FILL3.

LIGHTING FLAT sets the lighting of the current graph to flat.

LIGHTING GOURAUD sets the lighting to gouraud.

LIGHTING PHONG sets the lighting to phong.

LIGHTING NONE turns off lighting.

LIGHTING(AX,...) uses axes AX instead of the current axes.

See also light, material

Reference page in Help browser

doc lighting

<material> - Material reflectance mode.

MATERIAL Material reflectance mode.

MATERIAL controls the surface reflectance properties of SURFACE

and PATCH objects. SURFACE and PATCH objects are created by

the functions SURF, MESH, PCOLOR, FILL, and FILL3.

MATERIAL SHINY makes the objects shiny.

MATERIAL DULL makes the objects dull.

MATERIAL METAL makes the objects metallic.

MATERIAL([ka kd ks]) sets the ambient/diffuse/specular strength

of the objects.

MATERIAL([ka kd ks n]) sets the ambient/diffuse/specular strength

and specular exponent of the objects.

MATERIAL([ka kd ks n sc]) sets the ambient/diffuse/specular strength,

specular exponent and specular color reflectance of the objects.

MATERIAL DEFAULT sets the ambient/diffuse/specular strength,

specular exponent and specular color reflectance of the objects

to their defaults.

See also light, lighting

Reference page in Help browser

doc material

<specular> - Specular reflectance.

SPECULAR Specular reflectance.

R = SPECULAR(Nx,Ny,Nz,S,V) returns the reflectance of a surface with

normal vector components [Nx,Ny,Nz]. S and V specify the direction

to the light source and to the viewer, respectively. They can be

three vectors [x,y,z] or two vectors [Theta Phi] (in spherical

coordinates).

The specular highlight is strongest when the normal vector is in the

direction of (S+V)/2 where S is the source direction, and V is the

Соседние файлы в папке Библиотеки Matlab