Matlab - ¿Que hace este programa?

   
Vista:

¿Que hace este programa?

Publicado por antonio (1 intervención) el 09/01/2013 19:02:53
Hola, tengo que describir que es lo que hace este programa, se que lo primero que hace es asignar a la variable p la imagen y mostrar la imagen escalada para utilizar el mapa de colores completo., ¿pero que hace a partir de hay?, bueno pongo el programa

P=imread('image.png');
imagesc(P);
z=size(P)
pause
d=min(z(1),z(2))
Q=P(:,1:d);
R=Q(1:d,:)
figure, imagesc(R), colormap(gray);
pause
pixels=d^2
k=round(pixels/(2*(2*d+1)))
muestra(R',k);
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de JOSE JEREMIAS CABALLERO

¿Que hace este programa?

Publicado por JOSE JEREMIAS CABALLERO jjcc94@hotmail.com (3835 intervenciones) el 09/01/2013 23:14:01
Cada Comando digita en la ventana de comandos de matlab y podrás leer para q sirve.
por ejemplo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
>> help imread
 imread Read image from graphics file.
    A = imread(FILENAME,FMT) reads a grayscale or color image from the file
    specified by the string FILENAME. If the file is not in the current
    directory, or in a directory on the MATLAB path, specify the full
    pathname.
 
    The text string FMT specifies the format of the file by its standard
    file extension. For example, specify 'gif' for Graphics Interchange
    Format files. To see a list of supported formats, with their file
    extensions, use the IMFORMATS function. If imread cannot find a file
    named FILENAME, it looks for a file named FILENAME.FMT.
 
    The return value A is an array containing the image data. If the file
    contains a grayscale image, A is an M-by-N array. If the file contains
    a truecolor image, A is an M-by-N-by-3 array. For TIFF files containing
    color images that use the CMYK color space, A is an M-by-N-by-4 array.
    See TIFF in the Format-Specific Information section for more
    information.
 
    The class of A depends on the bits-per-sample of the image data,
    rounded to the next byte boundary. For example, imread returns 24-bit
    color data as an array of uint8 data because the sample size for each
    color component is 8 bits. See the Remarks section for a discussion of
    bitdepths, and see the Format-Specific Information section for more
    detail about supported bitdepths and sample sizes for a particular
    format.
 
    [X,MAP] = imread(FILENAME,FMT) reads the indexed image in FILENAME into
    X and its associated colormap into MAP. Colormap values in the image
    file are automatically rescaled into the range [0,1].
 
    [...] = imread(FILENAME) attempts to infer the format of the file
    from its content.
 
    [...] = imread(URL,...) reads the image from an Internet URL.
 
    Remarks
 
    Bitdepth is the number of bits used to represent each image pixel.
    Bitdepth is calculated by multiplying the bits-per-sample with the
    samples-per-pixel. Thus, a format that uses 8-bits for each color
    component (or sample) and three samples per pixel has a bitdepth of 24.
    Sometimes the sample size associated with a bitdepth can be ambiguous:
    does a 48-bit bitdepth represent six 8-bit samples or three 16-bit
    samples? The following format-specific sections provide sample size
    information to avoid this ambiguity.
 
    Format-Specific Information (Listed Alphabetically by Format)
 
    BMP  --  Windows Bitmap
 
    Supported  Compression     Output
    Bitdepths  None    RLE     Class    Notes
    ---------------------------------------------------------
     1-bit      x        -     logical
     4-bit      x        x     uint8
     8-bit      x        x     uint8
    16-bit      x        -     uint8    1 sample/pixel
    24-bit      x        -     uint8    3 samples/pixel
    32-bit      x        -     uint8    3 samples/pixel (1 byte padding)
 
    CUR  -- Cursor File
 
    Supported    Compression      Output
    Bitdepths   None Compressed   Class
    --------------------------------------------------
    1-bit        x      -         logical
    4-bit        x      -         uint8
    8-bit        x      -         uint8
 
    Special syntaxes:
 
    [...] = imread(...,IDX) reads in one image from a multi-image icon or
    cursor file. IDX is an integer value that specifies the order that the
    image appears in the file. For example, if IDX is 3, imread reads the
    third image in the file. If you omit this argument, imread reads the
    first image in the file.
 
    [A,MAP,ALPHA] = imread(...) returns the AND mask for the resource,
    which can be used to determine transparency information.  For cursor
    files, this mask may contain the only useful data.
 
    GIF  --  Graphics Interchange Format
 
    Supported     Compression        Output
    Bitdepths    None  Compressed    Class
    ---------------------------------------------
    1-bit         x        -         logical
    2-to-8 bit    x        -         uint8
 
    Special syntaxes:
 
    [...] = imread(...,IDX) reads in one or more frames from a multiframe
    (i.e., animated) GIF file. IDX must be an integer scalar or vector of
    integer values.  For example, if IDX is 3, imread reads the third image
    in the file.  If IDX is 1:5, only the first five frames are returned.
 
    [...] = imread(...,'Frames',IDX) is the same as the syntax above except
    that IDX can be 'all'.  In this case, all of the frames are read and
    returned in the order that they appear in the file.
 
    Note: Because of the way GIF files are structured, all of the frames
    must be read when a particular frame is requested. Consequently, it is
    much faster to specify a vector of frames or 'all' for IDX than to call
    imread in a loop when reading multiple frames from the same GIF file.
 
    HDF  --  Hierarchical Data Format
 
    Supported   Raster image   Raster image     Output
    Bitdepths   with colormap  without colormap Class    Notes
    ------------------------------------------------------------
     8-bit        x               x             uint8
    24-bit        -               x             uint8   3 samples/pixel
 
    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



luego haces clic con el mouse en doc imread para mayor informacion del comando.


Saludos.
JOSE JEREMIAS CABALLERO
Asesor de Proyectos con Matlab
programador en matlab
Servicios de programación matlab
jjcc94@hotmail.com

http://matlabcaballero.blogspot.com
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar