MATLAB Answers

List of builtin demo images

조회 수: 2,273(최근 30일)
Matt J
Matt J 2012년 11월 21일
편집: Adam Danz 2021년 9월 27일 19:28
Where can one find a list of MATLAB's pre-packaged demo images, like 'camerman', 'coins', etc...?
  댓글 수: 7
Matt J
Matt J 2014년 3월 31일
I think my proposal here is even more robust. It should work no matter where they move the image files, assuming they keep them all together in the same directory, of course. Admittedly, though, I haven't yet tried it in R2014.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt Fig
Matt Fig 2012년 11월 21일
편집: Matt Fig 2012년 11월 22일
UPDATED To printe 2 columns instead of one. Even better for my command window (but not for this forum) is to print 3 columns.
I ran this and the output is shown below (did I miss something?):
wd = pwd;
cd('C:\Program Files\MATLAB\R2011b\toolbox\images\imdemos')
D = dir;
cd(wd)
C = {'.tif';'.jp';'.png';'.bmp'};
idx = false(size(D));
for ii = 1:length(C)
idx = idx | (arrayfun(@(x) any(strfind(x.name,C{ii})),D));
end
D = D(idx);
L = length(D);
for ii = 1:2:numel(D)
fprintf('%25s %25s\n',D(ii:min(ii+1,L)).name)
end
fprintf('\n')
AT3_1m4_01.tif AT3_1m4_02.tif
AT3_1m4_03.tif AT3_1m4_04.tif
AT3_1m4_05.tif AT3_1m4_06.tif
AT3_1m4_07.tif AT3_1m4_08.tif
AT3_1m4_09.tif AT3_1m4_10.tif
autumn.tif bag.png
blobs.png board.tif
cameraman.tif canoe.tif
cell.tif circbw.tif
circles.png circuit.tif
coins.png concordaerial.png
concordorthophoto.png eight.tif
fabric.png football.jpg
forest.tif gantrycrane.png
glass.png greens.jpg
hestain.png kids.tif
liftingbody.png logo.tif
m83.tif mandi.tif
moon.tif mri.tif
office_1.jpg office_2.jpg
office_3.jpg office_4.jpg
office_5.jpg office_6.jpg
onion.png paper1.tif
pears.png peppers.png
pillsetc.png pout.tif
rice.png saturn.png
shadow.tif snowflakes.png
spine.tif tape.png
testpat1.png text.png
tire.tif tissue.png
trees.tif westconcordaerial.png
westconcordorthophoto.png
  댓글 수: 3
Star Strider
Star Strider 2012년 11월 22일
There are actually 140 image files in various formats in that directory, including .dcm and others. That's the reason I suggested the ‘Contents.m’ file.

댓글을 달려면 로그인하십시오.

추가 답변(2개)

Adam Danz
Adam Danz 2021년 9월 17일 23:39
편집: Adam Danz 2021년 9월 27일 18:55
Update: Starting in Matlab R2021b, the documentation contains a list of some built-in images and their descriptions in Matlab Example Data sets.
-------------------------------------------------------------
Using the wisdom shared within the two pre-existing answers to this question, I've developed a function that finds all image files in a directory and plots their thumbnails along with numeric lables. A table is printed to the command window defining the image name for each numeric label. When the function is run without inputs, it searches for files in the \toolbox\images\imdata directory (r2021a).
showImageThumbnails() - available on the file exchange
Sample of output:
Images in directory C:\Program Files\MATLAB\R2021a\toolbox\images\imdata
Ref num. Name Size (KB)
________ _________________________ _________
1 AT3_1m4_01.tif 310.2
2 AT3_1m4_02.tif 310.43
3 AT3_1m4_03.tif 310.31
4 AT3_1m4_04.tif 310.34
5 AT3_1m4_05.tif 310.38
6 AT3_1m4_06.tif 310.34
7 AT3_1m4_07.tif 310.35
8 AT3_1m4_08.tif 310.36
9 AT3_1m4_09.tif 310.27
10 AT3_1m4_10.tif 310.29
11 DistortedImage.png 426.38
12 autumn.tif 214.11
13 baby.jpg 826
14 bag.png 35.582
15 blobs.png 1.094
16 board.tif 573.54
17 cameraman.tif 65.24
18 canoe.tif 71.548
19 car1.jpg 4950.5
20 car2.jpg 4057.4
21 car_1.jpg 45.785
22 car_2.jpg 25.374
23 car_3.jpg 20.081
24 car_4.jpg 7.254
25 cell.tif 31.028
26 circbw.tif 4.122
27 circles.png 0.917
28 circlesBrightDark.png 8.227
29 circuit.tif 76.77
30 coins.png 37.906
31 colorCheckerTestImage.jpg 158.32
32 coloredChips.png 303.78
33 concordorthophoto.png 4685.3
34 eSFRTestImage.jpg 3253.3
35 eight.tif 59.64
36 fabric.png 626.53
37 flamingos.jpg 220.56
38 foggyroad.jpg 341.89
39 foggysf1.jpg 1524.8
40 foggysf2.jpg 565.88
41 foosball.jpg 3200.5
42 football.jpg 27.13
43 forest.tif 128.81
44 gantrycrane.png 133.63
45 glass.png 20.908
46 greens.jpg 74.948
47 hallway.jpg 3135.3
48 hands1-mask.png 1.193
49 hands1.jpg 22.157
50 hands2.jpg 22.133
51 hestain.png 131.63
52 hotcoffee.tif 307.4
53 indiancorn.jpg 209.82
54 kids.tif 97.058
55 kobi.png 2446.8
56 liftingbody.png 125.39
57 lighthouse.png 484.36
58 llama.jpg 135.47
59 logo.tif 1.31
60 lowlight_1.jpg 81.035
61 lowlight_2.jpg 181.56
62 m83.tif 150.39
63 mandi.tif 6100.7
64 micromarket.jpg 4174.8
65 moon.tif 184.39
66 mri.tif 232.37
67 office_1.jpg 60.155
68 office_2.jpg 95.705
69 office_3.jpg 127.73
70 office_4.jpg 141.99
71 office_5.jpg 146.64
72 office_6.jpg 126.53
73 onion.png 44.638
74 paper1.tif 49.458
75 parkavenue.jpg 422.96
76 peacock.jpg 317.1
77 pears.png 554.55
78 pillsetc.png 397.45
79 pout.tif 69.296
80 printedtext.png 583.91
81 rice.png 44.607
82 riceblurred.png 34.526
83 saturn.png 1166.1
84 sevilla.jpg 435.38
85 shadow.tif 70.02
86 sherlock.jpg 47.172
87 snowflakes.png 20.48
88 spine.tif 73.166
89 strawberries.jpg 171.44
90 tape.png 284.4
91 testpat1.png 16.268
92 text.png 1.322
93 threads.png 63.106
94 tire.tif 47.962
95 tissue.png 1037
96 toyobjects.png 2.429
97 toysflash.png 1035.5
98 toysnoflash.png 1133.8
99 trailer.jpg 144.85
100 trees.tif 1778.9
101 wagon.jpg 184.49
102 westconcordaerial.png 298.8
103 westconcordorthophoto.png 104.64
104 yellowlily-segmented.png 21.292
105 yellowlily.jpg 672.46
  댓글 수: 4
Adam Danz
Adam Danz 2021년 9월 27일 19:25
Thanks for the heads up, WR. The showImageThumbnails function ignores case when matching file extension strings. Both the file names and file extensions are forced to lower case before matching.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2012년 11월 21일
They're in C:\Program Files\MATLAB\R2012b\toolbox\images\imdemos.
  댓글 수: 6
Image Analyst
Image Analyst 2014년 3월 31일
Yes, that is more robust. I like how you use which() to find where it lives on the search path. The only way to make it more robust would be to search the entire computer for the file if it's not found (but that would be very slow), or to check for two images in case they ever decided to get rid of cameraman. But those situations are not likely. I'd probably change it to return the folder alone and not the entire list of images in the folder - actually you could make it very general and return both.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by