필터 지우기
필터 지우기

overlapping and coloring pictures in a sequence

조회 수: 1 (최근 30일)
Mohammed Ali
Mohammed Ali 2018년 6월 23일
답변: Gayatri Menon 2018년 6월 28일
I have thi code to colorize pictures in folders and overlapping every two pictures to gether, but I manually change the name of each two files to overlap and also change the name of the written file. Is there is a code could help me to change the name automatically as I have about 1000 files in each folder. this is my code.
if true
a=imread('square 27_filter 4.tif');
b=imread('square 27_filter 5.tif');
% C = imfuse(a,b,'blend','Scaling','joint');
% imwrite(C,'Square_1.png');
% figure;imshow(a)
% figure;imshow(b)
% figure;imshow(C);
blackImage = zeros(size(a), 'uint8');
a_green = cat(3, blackImage, a, blackImage);
%blackImage = zeros(size(b), 'uint8');
b_red = cat(3, b, blackImage, blackImage);
%C_rg = imfuse(a_green,b_red,'blend','Scaling','joint');
imwrite(C_rg,'Square_27_Cycle_1.tif');
end

답변 (1개)

Gayatri Menon
Gayatri Menon 2018년 6월 28일
Hi,
If the name of the images you are trying to read differs only in some number in the name, for example name of images are square 27_filter 1, square 27_filter 2 etc, then you can use a sprintf command in a "for" loop to read the images without manually changing the names.
for i=1:n
name = sprintf('square 27_filter %d.tif', i);
a=imread(name)
blackImage = zeros(size(a), 'uint8');
% rest of your code
end
Hope this helps.
Thanks

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by