What is this code doing exactly?
조회 수: 2 (최근 30일)
이전 댓글 표시
Here's a code that i got from a random source..... Please explain the logic of this above given code.... I am not getting the logic at all.... Please help....
for a=1:20
if a<=9
b=char(a+47);
elseif a>9 && a<20
b=strcat(char(49),char(a-10+48));
else
b=strcat(char(50),char(48));
end
filemane=strcat('D:\my doc\study docs\Project-VP\code\',b,'.tif');
fluent=imread(filemane,'tif');
filename2=strcat('D:\my doc\study docs\Project-VP\code\',b,'.tif');
flowvis=imread(filename2,'tif');
size_fluent=size(fluent);
size_flowvis=size(flowvis);
for k=1:size_fluent(1)
for l=1:size_fluent(2)
for m=1:size_fluent(3)
if l<(260+(4*a)) || l>(948+(4*a))
%l=302, l=988
overlap(k,l,m)=fluent(k,l,m);
else
if k<43 || k>706
overlap(k,l,m)=fluent(k,l,m);
elseif fluent(k,l,1)>=200 && fluent(k,l,2)>=200 && fluent(k,l,3)>=200
overlap(k,l,m)=flowvis(k-42,l-(259+(4*a)),m); %l-301
else
overlap(k,l,m)=fluent(k,l,m);
end
end
end
end
end
filename3=strcat('D:\my doc\study docs\Project-VP\code\frames\output_',b,'.tif');
imwrite(overlap,filename3,'tif','Colorspace','rgb','Compression','none');
disp(strcat('File ',b,' processed'));
end
댓글 수: 2
Jan
2013년 7월 30일
This is a very vague question. Are you asking also, what e.g. "if k<43 k>706" does?
The code is written in a strange way. E.g. b=strcat(char(49),char(a-10+48)); is an obfuscated version of: b = '20'. A clean sprintf command would be much smarter than the first 8 lines.
채택된 답변
Iain
2013년 7월 30일
looks like its opening some pairs of files and overlaying some parts of the second image on the first, and saving the result.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!