Clear Filters
Clear Filters

Read and edit image frames saved in a fodler

2 views (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 7 Feb 2016
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.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!