List of builtin demo images
Show older comments
Where can one find a list of MATLAB's pre-packaged demo images, like 'camerman', 'coins', etc...?
7 Comments
Matt Fig
on 21 Nov 2012
I've wondered that myself....
Star Strider
on 21 Nov 2012
I found the list in my installation in the directory and file:
C:\Program Files\MATLAB\R2012b\toolbox\images\imdemos\Contents.m
Andreas Goser
on 22 Nov 2012
Looks like I am bit late in that discussion, but I wonder WHY is that important to know?
Image Analyst
on 22 Nov 2012
Sometimes you want to demonstrate a concept to a questioner and they did not supply an image, or you want to use a standard image so that everyone can try your demo code instead of just the original poster.
praks
on 31 Mar 2014
C:\Program Files\matlab\toolbox\images\imdemos
Image Analyst
on 31 Mar 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
on 31 Mar 2014
Accepted Answer
More Answers (2)
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).
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 Comments
Image Analyst
on 18 Sep 2021
Nice. If the user wants to pick from a listbox, here is some code:
%===============================================================================
% Get the name of the demo image the user wants to use.
% Let's let the user select from a list of all the demo images that ship with the Image Processing Toolbox.
folder = fileparts(which('cameraman.tif')); % Determine where demo folder is (works with all versions).
% Demo images have extensions of TIF, PNG, and JPG. Get a list of all of them.
imageFiles = [dir(fullfile(folder,'*.TIF')); dir(fullfile(folder,'*.PNG')); dir(fullfile(folder,'*.jpg'))];
baseFileNames = {imageFiles.name}';
% Sort the base file names alphabetically.
[baseFileNames, sortOrder] = sort(baseFileNames);
imageFiles = imageFiles(sortOrder);
selection = listdlg('ListString', baseFileNames, 'PromptString', 'Use which demo image?'); % Display all image file names in a popup menu.
% button = menu('Use which gray scale demo image?', ca); % Display all image file names in a popup menu.
% Get the base filename.
baseFileName = imageFiles(selection).name; % Assign the one on the button that they clicked on.
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
Adam Danz
on 18 Sep 2021
That'll be useful.
Walter Roberson
on 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.
Image Analyst
on 21 Nov 2012
1 vote
They're in C:\Program Files\MATLAB\R2012b\toolbox\images\imdemos.
6 Comments
Matt J
on 22 Nov 2012
Matt Fig
on 22 Nov 2012
There are other demo images in the wavelet and mapping toolboxes, for instance.
Image Analyst
on 22 Nov 2012
Edited: Image Analyst
on 22 Nov 2012
Yeah, they can be scattered about. For example there are some more IPT demo images in C:\Program Files\MATLAB\R2012b\toolbox\images\imdemos\html. Some of the images are the same as the other folder, but some are different. I don't know what the rationale is for what images go where. Plus the images are mixed up with m-files, etc. I've let them know that it would be cleaner if they just kept all their images in a folder called C:\Program Files\MATLAB\R2012b\toolbox\images\DemoImages, but they don't seem to want to do that for some reason.
Image Analyst
on 31 Mar 2014
This 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.
Image Analyst
on 31 Mar 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.
Categories
Find more on Display 2-D Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!