List of builtin demo images

1.533 Ansichten (letzte 30 Tage)
Matt J
Matt J am 21 Nov. 2012
Bearbeitet: DGM am 9 Jan. 2023
Where can one find a list of MATLAB's pre-packaged demo images, like 'camerman', 'coins', etc...?
  7 Kommentare
Image Analyst
Image Analyst am 31 Mär. 2014
praks, that used to be true until R2014a, when they moved the demo images from the imdemos folder to the imdata folder. The robust way to get the folder where the demo images are located is to use my code:
% Prior to R2014a, demo images were in
% C:\Program Files\MATLAB\R2013b\toolbox\images\imdemos
% Starting with R2014a, demo images are now located in
% C:\Program Files\MATLAB\R2014a\toolbox\images\imdata
structVersion = ver; % Get version information.
if strcmp(structVersion(1).Release, '(R2014a)')
folder = fullfile(matlabroot, '\toolbox\images\imdata');
else
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
end
if exist(folder, 'dir')
fprintf('Demo Images Folder is %s.\n', folder);
else
fprintf('Folder %s does not exist.\n', folder);
end
Of course, you can get rid of the comments and fprintf statements when you transfer it to your code if you want.
Matt J
Matt J am 31 Mär. 2014
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt Fig
Matt Fig am 21 Nov. 2012
Bearbeitet: Matt Fig am 22 Nov. 2012
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
  5 Kommentare
Nour
Nour am 9 Jan. 2023
what about RGB? only 'peppers.jpg'?
DGM
DGM am 9 Jan. 2023
Bearbeitet: DGM am 9 Jan. 2023
Those are just the images in the IPT imdata/ directory. There are also a couple images in the base toolbox, specifically, peppers.png
which cameraman.tif -all % in IPT
/MATLAB/toolbox/images/imdata/cameraman.tif
which peppers.png -all % in base
/MATLAB/toolbox/matlab/imagesci/peppers.png /MATLAB/examples/deeplearning_shared/data/peppers.png % Shadowed /MATLAB/examples/rptgen/data/peppers.png % Shadowed
% what else is in imagesci/? not much.
pth = fileparts(which('peppers.png'));
D = dir(pth);
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);
for ii = 1:numel(D)
fprintf('%s\n',D(ii).name)
end
corn.tif peppers.png

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Adam Danz
Adam Danz am 17 Sep. 2021
Bearbeitet: Adam Danz am 27 Sep. 2021
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 Kommentare
Walter Roberson
Walter Roberson am 27 Sep. 2021
On MacOS, none of the example image file extensions are lowercase, at least not in that directory. But filenames are potentially case sensitive on Mac (depending on user configuration) so TIF and PNG might possibly not match anything.
Adam Danz
Adam Danz am 27 Sep. 2021
Bearbeitet: Adam Danz am 27 Sep. 2021
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.

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 21 Nov. 2012
They're in C:\Program Files\MATLAB\R2012b\toolbox\images\imdemos.
  6 Kommentare
Matt J
Matt J am 31 Mär. 2014
Bearbeitet: Matt J am 31 Mär. 2014
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.
Image Analyst
Image Analyst am 31 Mär. 2014
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by