Read and edit image frames saved in a fodler

2 次查看(过去 30 天)
Below is the code i used but it is only changing one image and i want them all changed and saved in a sepereate folder
thanks
close all; clear all; clc;
dname_open = ('C:frames'); dname_save = ('C:frames_edit');
test = 0;
top_file = [dname_open '001.png']; ls_top_file = ls(top_file); c = cellstr(ls_top_file); cc = c(3:length(c)); S = size(cc); a = 1;
while a <= S(1) close all
imagename = ('file_name');
file2read = [dname_open '/' '001.png'] ;
index = 0;
I = imread(file2read);
for T=188 index=index+1; j=(rgb2gray(I));
k=zeros(size(j));
m=find(j>T);
k(m)=1;
figure(1); subplot(1,1,index);
pcolor(k); shading interp;
set(gca,'YDir','reverse');
saveas (gca, [dname_save '/' 'z_' imagename ], 'png');
end
end

采纳的回答

Image Analyst
Image Analyst 2016-2-7
See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F In the loop, use sprintf() and fullfile() to create both input and output filenames.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by