我有使用imread命令由一個具有我想讀從文件夾中一個循環圖像的各種圖像的文件夾,任何建議如何做到這一點的最佳 感謝讀取圖像一個
Q
讀取圖像一個
0
A
回答
0
您必須同步您的圖像名稱才能在循環中讀取。他們必須像image1.jpg
,image2.jpg
,image3.jpg
...你有10個像這樣的圖像。
NumberOfimages=10; %chose the number of images you want to give input
prefix_image='image'; %change the desired input image name here only
fileformat='.jpg'; %change the desired input image format here only
for num=1:NumberOfimages
image = imread(strcat(prefix_image,num2str(num),fileformat));
end
+0
請不要在你的帖子中籤名。請參閱[常見問題#簽名]。 – Gilles 2012-02-18 18:32:54
1
- 您可以使用
dir
函數獲取目錄中的所有文件。這將返回結構的載體,它也包括文件名 - 遍歷所有的結構
- 檢查文件是否是一個圖像(例如檢查擴展)
- 讀取圖像
-1
這可以幫助您!
S = struct2cell(dir('*.jpg'));
FileNames = S(1,:);
lenDb = length(FileNames);
result= struct('img', {});
for j = 1 : lenDb
result(j).img = imread(FileNames{j})
end
所有的圖像都在結構 「result.img」
要訪問只需要調用的結果(NUM).IMG
例:
圖像(結果(1)。 img)
0
以及該功能將幫助您在一次甚至diferent名稱看了很多圖片:
首先把所有的圖片文件夾中,例如:d:/實驗室/
他們必須在本例同樣的格式:TIF
調用的函數,你鍵入:
A=imread_many();
個,所有的圖像將在變量A
,如果你想在第一圖像您鍵入A{1}
如果u希望第二個U型A{2}
...等
function [ A ] = imread_many()
srcFiles = dir('D:\lab\*.tif'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('D:\lab\',srcFiles(i).name);
A{i} = imread(filename);
figure, imshow(A{i});
end
end
0
srcFiles = dir('C:\Users\Omm\Downloads\multicharacterrec\*.png'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('C:\Users\Omm\Downloads\multicharacterrec\',srcFiles(i).name);
I = imread(filename);
figure, imshow(I);
相關問題
- 1. 從管道讀取一個PNG圖像
- 2. 將兩個圖像作爲一個圖像讀取Python
- 3. 使用apache讀取一個幻燈片圖像到一個bufferedImage
- 4. 讀取多個圖像,其中處理一個圖像,並通過模型
- 5. 讀取一批圖像很慢?
- 6. 從同一目錄讀取圖像?
- 7. ImageIO.read()無法讀取一些圖像
- 8. 從一個文件中讀取多個jpg圖像
- 9. Cordova - 讀取大圖像損壞圖像
- 10. C++編程讀取圖像
- 11. 讀取.dat圖像文件
- 12. nodejs讀取圖像數據
- 13. 用gil讀取png圖像
- 14. 笨圖像讀取概率
- 15. TYPO3 FAL圖像讀取
- 16. Magick ++ - 讀取JPEG2000圖像
- 17. 16位(565)圖像讀取
- 18. OpenCV無法讀取圖像!
- 19. 在緩衝區中讀取一個PNG圖像
- 20. 讀取圖像的像素顏色
- 21. 在C++中讀取圖像像素
- 22. 讀取圖像的像素值
- 23. 讀取圖像的像素值
- 24. EXC_BAD_ACCESS試圖讀取一個NSArray
- 25. 從PlayN中的圖像讀取個人像素
- 26. 讀取每個像素的PVRTC圖像顏色信息
- 27. 從pbm中讀取一位(便攜式位圖圖像)
- 28. og:圖像讀取圖像url,但不顯示縮略圖
- 29. 圖像未被讀取,'NoneType沒有屬性讀取'
- 30. 使用WPF成像類 - 獲取圖像尺寸,而不讀取整個文件
告訴我們你已經什麼試過。 – Oli 2012-02-15 20:41:49
可能的重複[在MATLAB中加載多個圖像](http://stackoverflow.com/questions/2408112/loading-multiple-images-in-matlab) – yuk 2012-02-15 20:57:52