I want to read an image from folder in away that every time i run my code i could choose another image ?
1 次查看(过去 30 天)
显示 更早的评论
i have a barcode progarm and i want to run the code every time with different image so i asked about any tool that make me able to choose an image without need to write the name of it .
0 个评论
回答(1 个)
Thorsten
2015-11-13
Suppose you have jpg images in the current folder. First you read a description of the files
d = dir('*.jpg');
Now each time you need to randomly pick one of the jpg images, use
I = imread(d(randi(numel(d))).name);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!