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

In the structure returned from imfinfo function.

'PixelRegion' {ROWS, COLS}. IMREAD returns the sub-image

specified by the boundaries in ROWS and COLS.

ROWS and COLS must both be two-element vectors

that denote the 1-based indices [START STOP]. If

'ReductionLevel' is greater than 0, then ROWS and

COLS are coordinates in the reduced-sized image.

'V79Compatible' A BOOL value. If true, image returned is color

converted to gray-scale or RGB image as consistent

with previous versions of IMREAD (MATLAB 7.9

[R2009b] and earlier). Otherwise raw color

image is returned. Default is false.

PBM -- Portable Bitmap

Supported Raw ASCII (Plain) Output

Bitdepths Binary Encoded Class

--------------------------------------------------

1-bit x x logical

PCX -- Windows Paintbrush

Supported Output

Bitdepths Class Notes

----------------------------------------------

1-bit logical Grayscale only

8-bit uint8 Grayscale or indexed

24-bit uint8 RGB (8-bit samples)

PGM -- Portable Graymap

Supported Raw ASCII (Plain) Output

Bitdepths Binary Encoded Class

-------------------------------------------------------

up to 16-bit x - uint8

Arbitrary - x

PNG -- Portable Network Graphics

Supported Output

Bitdepths Class Notes

-------------------------------------------

1-bit logical Grayscale only

2-bit uint8 Grayscale only

4-bit uint8 Grayscale only

8-bit uint8 Grayscale or Indexed

16-bit uint16 Grayscale or Indexed

24-bit uint8 RGB (Three 8-bit samples/pixel)

48-bit uint16 RGB (Three 16-bit samples/pixel)

Special Syntaxes:

[...] = IMREAD(...,'BackgroundColor',BG) composites any transparent

pixels in the input image against the color specified in BG. If BG is

'none', then no compositing is performed. Otherwise, if the input image

is indexed, BG should be an integer in the range [1,P] where P is the

colormap length. If the input image is grayscale, BG should be an

integer in the range [0,1]. If the input image is RGB, BG should be a

three-element vector whose values are in the range [0,1]. The string

'BackgroundColor' may be abbreviated.

If the ALPHA output argument is used (see below), then BG defaults to

'none' if not specified by the user. Otherwise, if the PNG file

ontains a background color chunk, that color is used as the default

value for BG. If ALPHA is not used and the file does not contain a

background color chunk, then the default value for BG is 1 for indexed

images; 0 for grayscale images; and [0 0 0] for RGB images.

[A,MAP,ALPHA] = IMREAD(...) returns the alpha channel if one is

present; otherwise ALPHA is []. If 'BackgroundColor' is specified by

the user then ALPHA is []. Note that MAP may be empty if the file

contains a grayscale or truecolor image.

PPM -- Portable Pixmap

Supported Raw ASCII (Plain) Output

Bitdepths Binary Encoded Class

--------------------------------------------------------

up to 16-bit x - uint8

Arbitrary - x

RAS -- Sun Raster

Supported Output

Bitdepths Class Notes

----------------------------------------------------

1-bit logical Bitmap

8-bit uint8 Indexed

24-bit uint8 RGB (8-bit samples)

32-bit uint8 RGB with Alpha (8-bit samples)

TIFF -- Tagged Image File Format

Supported Compression Output Bitdepths None Packbits CCITT RGB ICCLAB CIELAB CMYK Class Notes

--------------------------------------------------------------------------------------------------

1-bit x x x - - - - logical

8-bit x x - - - - - uint8

12-bit - - - - - - - uint16 Grayscale

or Indexed

16-bit - - - - - - - uint16 Grayscale

or Indexed

24-bit x x - x x x - uint8 3 samples

32-bit - - - - - - x uint8 4 samples

36-bit - - - x - - - uint16 3 samples

48-bit - - - x x x - uint16 3 samples

64-bit - - - - - - x double 4 samples

NOTE: IMREAD supports 8-bit integral and 32-bit floating point tiled

TIFF images, with any compression and colorspace combination listed

above, and 32-bit IEEE floating point images.

Special Syntaxes:

A = IMREAD(...) returns color data that uses the RGB, CIELAB, ICCLAB,

or CMYK color spaces. If the color image uses the CMYK color space, A

is an M-by-N-by-4 array.

[...] = IMREAD(..., 'Param1', value1, 'Param2', value2, ...) uses

parameter-value pairs to control the read operation. There are three

different parameters you can use:

Parameter name Value

-------------- -----

'Index' A positive integer specifying which image to read in

a multi-image TIFF file. For example, if 'Index' is

3, IMREAD reads the third image in the file.

'Info' A structure array; the output of IMFINFO. When

reading images from a multi-image TIFF file, passing

the output of IMFINFO as the 'Info' parameter helps

IMREAD locate the images in the file more quickly.

'PixelRegion' {ROWS, COLS}. IMREAD returns the sub-image

specified by the boundaries in ROWS and COLS. ROWS

and COLS must be either two- or three-element

vectors. If two elements are provided, they denote

the 1-based indices [START STOP]. If three elements

are provided, the indices [START INCREMENT STOP]

allow image downsampling.

XWD -- X Window Dump

Supported Output

Bitdepths ZPixmaps XYBitmaps XYPixmaps Class

--------------------------------------------------------------------

1-bit x - x logical

8-bit x - - uint8

Please read the file libtiffcopyright.txt for more information.

Example:

imdata = imread('ngc6543a.jpg');

See also imfinfo, imwrite, imformats, fread, image, double, uint8.

Reference page in Help browser

doc imread

<imwrite> - Write image to graphics file

IMWRITE Write image to graphics file.

IMWRITE(A,FILENAME,FMT) writes the image A to the file specified by

FILENAME in the format specified by FMT.

A can be an M-by-N (grayscale image) or M-by-N-by-3 (color image)

array. A cannot be an empty array. If the format specified is TIFF,

IMWRITE can also accept an M-by-N-by-4 array containing color data

that uses the CMYK color space.

FILENAME is a string that specifies the name of the file.

FMT is a string specifying the format of the file. See the reference

page, or the output of the IMFORMATS function, for a list of

supported formats.

IMWRITE(X,MAP,FILENAME,FMT) writes the indexed image in X and its

associated colormap MAP to FILENAME in the format specified by FMT.

If X is of class uint8 or uint16, IMWRITE writes the actual values in

the array to the file. If X is of class double, IMWRITE offsets the

values in the array before writing, using uint8(X-1). MAP must be a

valid MATLAB colormap. Note that most image file formats do not

support colormaps with more than 256 entries.

When writing multiframe GIF images, X should be an 4-dimensional

M-by-N-by-1-by-P array, where P is the number of frames to write.

IMWRITE(...,FILENAME) writes the image to FILENAME, inferring the

format to use from the filename's extension. The extension must be

one of the legal values for FMT.

IMWRITE(...,PARAM1,VAL1,PARAM2,VAL2,...) specifies parameters that

control various characteristics of the output file. Parameters are

currently supported for GIF, HDF, JPEG, TIFF, PNG, PBM, PGM, and PPM

files.

Class Support

-------------

The input array A can be of class logical, uint8, uint16, or double.

Indexed images (X) can be of class uint8, uint16, or double; the

associated colormap, MAP, must be double. Input values must be

full (non-sparse).

The class of the image written to the file depends on the format

specified. For most formats, if the input array is of class uint8,

IMWRITE outputs the data as 8-bit values. If the input array is of

class uint16 and the format supports 16-bit data (JPEG, PNG, and

TIFF), IMWRITE outputs the data as 16-bit values. If the format does

not support 16-bit values, IMWRITE issues an error. Several formats,

such as JPEG and PNG, support a parameter that lets you specify the

bit depth of the output data.

If the input array is of class double, and the image is a grayscale

or RGB color image, IMWRITE assumes the dynamic range is [0,1] and

automatically scales the data by 255 before writing it to the file as

8-bit values.

If the input array is of class double, and the image is an indexed

image, IMWRITE converts the indices to zero-based indices by

subtracting 1 from each element, and then writes the data as uint8.

If the input array is of class logical, IMWRITE assumes the data is a

binary image and writes it to the file with a bit depth of 1, if the

format allows it. BMP, PNG, or TIFF formats accept binary images as

input arrays.

GIF-specific parameters

-----------------------

'WriteMode' One of these strings: 'overwrite' (the default)

or 'append'. In append mode, a single frame is

added to the existing file.

'Comment' A string or cell array of strings containing a

comment to be added to the image. For a cell

array of strings, a carriage return is added

after each row.

'DisposalMethod' One of the following strings, which sets the

disposal method of an animated GIF:

'leaveInPlace', 'restoreBG', 'restorePrevious',

or 'doNotSpecify'.

'DelayTime' A scalar value between 0 and 655 inclusive, which

specifies the delay in seconds before displaying

the next image.

'TransparentColor' A scalar integer. This value specifies which

index in the colormap should be treated as the

transparent color for the image. If X is uint8

or logical, then indexing starts at 0. If X is

double, then indexing starts at 1.

'BackgroundColor' A scalar integer. This value specifies which

index in the colormap should be treated as the

background color for the image and is used for

certain disposal methods in animated GIFs. If X

is uint8 or logical, then indexing starts at 0.

If X is double, then indexing starts at 1.

'LoopCount' A finite integer between 0 and 65535 or the value

Inf (the default) which specifies the number of

times to repeat the animation. By default, the

animation will continuously loop. For a value of

0, the animation will be played once. For a

value of 1, the animation will be played twice,

etc.

'ScreenSize' A two element vector specifying the screen height

and width of the frame. When used with

'Location', this provides a way to write frames

to the image which are smaller than the whole

frame. The remaining values are filled in

according to the 'DisposalMethod'.

'Location' A two element vector specifying the offset of the

top left corner of the screen relative to the top

left corner of the image. The first element is

the offset from the top, and the second element

is the offset from the left.

HDF-specific parameters

-----------------------

'Compression' One of these strings: 'none' (the default),

'rle' (only valid for grayscale and indexed

images), 'jpeg' (only valid for grayscale

and RGB images)

'Quality' A number between 0 and 100; parameter applies

only if 'Compression' is 'jpeg'; higher

numbers mean quality is better (less image

degradation due to compression), but the

resulting file size is larger

'WriteMode' One of these strings: 'overwrite' (the

default) or 'append'

JPEG-specific parameters

------------------------

'Quality' A number between 0 and 100; higher numbers

mean quality is better (less image degradation

due to compression), but the resulting file

size is larger

'Comment' A column vector cell array of strings or a

char matrix. Each row of input is written out

as a comment in the JPEG file.

'Mode' Either 'lossy' (the default) or 'lossless'

'BitDepth' A scalar value indicating desired bitdepth;

for grayscale images this can be 8, 12, or 16;

for truecolor images this can be 8 or 12. Only

lossless mode is supported for 16-bit images.

JPEG2000-specific parameters

----------------------------

'Mode' Either 'lossy' (the default) or 'lossless'.

'CompressionRatio' A real value greater than 1 specifying the target

compression ratio which is defined as the ratio of

input image size to the output compressed size. For

example, a value of 2.0 implies that the output

image size will be half of the input image size or

less. A higher value implies a smaller file size and

reduced image quality. This is valid only with

'lossy' mode. Note that the compression ratio

doesn't take into account the header size, and hence

in some cases the output file size can be larger

than expected.

'ProgressionOrder' A string that is one of 'LRCP', 'RLCP', 'RPCL',

'PCRL' or 'CPRL'. The four character identifiers are

interpreted as L=layer, R=resolution, C=component

and P=position. The first character refers to the

index which progresses most slowly, while the last

refers to the index which progresses most quickly.

The default value is 'LRCP'.

'QualityLayers' A positive integer (not exceeding 20) specifying the

number of quality layers. The default value is 1.

'ReductionLevels' A positive integer (not exceeding 8) specifying the

number of reduction levels or the wavelet

decomposition levels.

'TileSize' A 2-element vector specifying tile height and tile

width. The minimum tile size that can be specified

is [128 128]. The default tile size is same as the

image size.

'Comment' A cell array of strings or a char matrix. Each row

of input is written out as a comment in the JPEG2000

file.

TIFF-specific parameters

------------------------

'Colorspace' One of these strings: 'rgb', 'cielab', or

'icclab'. The default value is 'rgb'. This

parameter is used only when the input array,

A, is M-by-N-by-3. See the reference page

for more details about creating L*a*b* TIFF

files.

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