-2
讀取目錄的內容和爲每個JPEG圖像轉換爲灰度轉接目錄包含在RGB圖像爲灰度
srcFiles = dir('R:\...\images - Copy\*.jpeg');
for i = 1 : length(srcFiles)
filename = srcFiles(i).name;
try
I = imread(filename);
catch ME
continue
end
IGrey = rgb2gray(I);
imshow(IGrey);
pathOfNewFile = strcat(pathOfGSFolder,filename,'jpeg');
imwrite(IGrey,pathOfNewFile,'jpeg');
end
此循環由於某種原因沒有執行 – royalWithCheese