Effacer les filtres
Effacer les filtres

What is this code doing exactly?

1 vue (au cours des 30 derniers jours)
Febin Benjamin
Febin Benjamin le 30 Juil 2013
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 commentaires
Jan
Jan le 30 Juil 2013
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.
Febin Benjamin
Febin Benjamin le 30 Juil 2013
Exactly! thats what confused me! The code is completely abstruse! I found it in a pdf file which named this program as compare.m All i cud comprehend was that it is comparing two images.... but on what basis?? this code kept me awake yesterday! :(

Connectez-vous pour commenter.

Réponse acceptée

Iain
Iain le 30 Juil 2013
looks like its opening some pairs of files and overlaying some parts of the second image on the first, and saving the result.
  1 commentaire
Febin Benjamin
Febin Benjamin le 30 Juil 2013
Seems like it!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by