Я пытаюсь сделать видео из файлов png, и они должны быть в порядке, в то время как при создании видео оно помещает изображение test_1, следующее test_10, но мне нужно быть test_1, test_2, test_3 ....если я сортирую их по% sort_nat ({images.name});Я получу ошибку позже. Индексирование точек не поддерживается для переменных этого типа.любой комментарий был бы оценен.вот скрипт:
clear all; clc;close all;
path = 'D:/Neda/Pytorch/U-net/plots_U_Net/CineLoop';
filePattern = fullfile(path, '*.png');
imgfileattrib = dir(filePattern); %attributes
images = {imgfileattrib.name}; %list of images
[~, ind] = sort(str2double(regexprep(images,'[^0-99]',''))); %sorted indices
images = images(ind);
writerObj = VideoWriter('YourAVI.avi');
writerObj.FrameRate=1;
open(writerObj);
for frameNumber = 1 : length(images)
baseFileName = images(frameNumber);
fullFileName = fullfile(path, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
thisimage = imread(fullFileName);
imshow(thisimage);
drawnow;
writeVideo(writerObj, thisimage);
end
close(writerObj);