MATLAB Examples

im2html Examples

Display a table of values for a gray-scale image.

I = imread('pout.tif');
disp(im2html(I(125:134, 104:114)))
112 112 107 97 91 87 86 84 83 84 84
120 126 128 128 114 101 87 87 86 86 87
116 132 138 142 142 132 98 91 89 87 89
110 133 145 150 149 147 121 101 93 93 91
109 133 145 156 159 153 142 130 109 102 99
109 131 143 154 169 171 169 169 154 139 137
108 126 142 151 169 175 186 190 189 180 179
110 121 137 148 158 167 177 187 199 189 185
112 117 136 146 151 159 159 163 189 189 180
114 113 132 142 147 151 156 154 162 184 179

Display a table of values for a gray-scale image using auto-scale syntax.

I = magic(10);
disp(im2html(I,[]))
92 99 1 8 15 67 74 51 58 40
98 80 7 14 16 73 55 57 64 41
4 81 88 20 22 54 56 63 70 47
85 87 19 21 3 60 62 69 71 28
86 93 25 2 9 61 68 75 52 34
17 24 76 83 90 42 49 26 33 65
23 5 82 89 91 48 30 32 39 66
79 6 13 95 97 29 31 38 45 72
10 12 94 96 78 35 37 44 46 53
11 18 100 77 84 36 43 50 27 59

Display a table of values for an RGB image.

rgb = imread('peppers.png');
disp(im2html(rgb(88:97,200:209,:)))
R:80
G:50
B:77
R:78
G:47
B:74
R:76
G:47
B:71
R:95
G:65
B:73
R:158
G:129
B:117
R:193
G:166
B:150
R:203
G:177
B:158
R:213
G:187
B:166
R:217
G:191
B:169
R:221
G:195
B:170
R:76
G:47
B:77
R:75
G:46
B:71
R:91
G:63
B:72
R:158
G:130
B:119
R:192
G:165
B:141
R:204
G:176
B:152
R:215
G:187
B:165
R:219
G:192
B:170
R:224
G:195
B:173
R:228
G:200
B:174
R:77
G:45
B:70
R:82
G:51
B:63
R:148
G:120
B:114
R:192
G:166
B:146
R:203
G:176
B:153
R:211
G:182
B:159
R:221
G:191
B:168
R:225
G:197
B:173
R:225
G:200
B:176
R:230
G:203
B:177
R:75
G:43
B:65
R:126
G: 95
B: 97
R:186
G:160
B:145
R:197
G:173
B:154
R:208
G:180
B:160
R:220
G:192
B:171
R:223
G:194
B:171
R:222
G:195
B:169
R:232
G:206
B:179
R:246
G:220
B:193
R:100
G: 70
B: 72
R:174
G:146
B:135
R:193
G:169
B:151
R:198
G:175
B:158
R:211
G:189
B:170
R:218
G:192
B:168
R:226
G:198
B:172
R:238
G:212
B:184
R:246
G:222
B:195
R:248
G:224
B:201
R:152
G:121
B:112
R:194
G:166
B:150
R:194
G:169
B:151
R:209
G:186
B:163
R:213
G:188
B:161
R:225
G:199
B:170
R:237
G:212
B:186
R:241
G:216
B:193
R:242
G:219
B:196
R:243
G:219
B:194
R:184
G:158
B:145
R:192
G:164
B:147
R:207
G:180
B:158
R:216
G:190
B:166
R:226
G:198
B:175
R:233
G:207
B:186
R:235
G:209
B:188
R:237
G:212
B:189
R:242
G:218
B:192
R:249
G:222
B:196
R:187
G:161
B:140
R:200
G:170
B:146
R:216
G:189
B:162
R:222
G:198
B:173
R:226
G:204
B:183
R:233
G:209
B:187
R:237
G:210
B:187
R:242
G:216
B:192
R:241
G:221
B:196
R:245
G:222
B:197
R:188
G:162
B:136
R:211
G:182
B:153
R:216
G:193
B:163
R:218
G:197
B:169
R:231
G:207
B:182
R:232
G:209
B:185
R:237
G:213
B:187
R:238
G:213
B:188
R:237
G:213
B:188
R:244
G:221
B:194
R:199
G:174
B:146
R:212
G:187
B:160
R:212
G:189
B:164
R:223
G:199
B:176
R:231
G:206
B:183
R:229
G:208
B:182
R:232
G:209
B:183
R:233
G:207
B:181
R:243
G:217
B:190
R:252
G:227
B:199

Display a table of values for an indexed image.

[X,map] = imread('trees.tif');
disp(im2html(X(1:4,1:4),map))
<108>
R:0.61
G:0.78
B:0.74
<116>
R:0.84
G:0.84
B:0.71
<98>
R:0.58
G:0.71
B:0.61
<108>
R:0.61
G:0.78
B:0.74
<112>
R:0.65
G:0.81
B:0.94
<112>
R:0.65
G:0.81
B:0.94
<112>
R:0.65
G:0.81
B:0.94
<105>
R:0.55
G:0.74
B:0.91
<112>
R:0.65
G:0.81
B:0.94
<112>
R:0.65
G:0.81
B:0.94
<105>
R:0.55
G:0.74
B:0.91
<112>
R:0.65
G:0.81
B:0.94
<105>
R:0.55
G:0.74
B:0.91
<105>
R:0.55
G:0.74
B:0.91
<105>
R:0.55
G:0.74
B:0.91
<105>
R:0.55
G:0.74
B:0.91

Suppress the display of pixel values.

I = imread('pout.tif');
disp(im2html(I(125:134, 104:114),'ShowPixelValues','off'))

Steve Eddins