help with my code

1 次查看(过去 30 天)
Isee You
Isee You 2013-6-23
i write this code so i can search for intesity point in 8 direction like this http://s11.postimg.org/3l4z61wb7/Untitled.jpg and see also http://www.mediafire.com/?y3sy0xs6i7eis58
my code work well but i think it too too too long and take long time 3 minutes can any one help me to make it small and powerful and faster

回答(1 个)

Walter Roberson
Walter Roberson 2013-6-23
编辑:Walter Roberson 2013-6-23
You indicate you are searching for intensity points, but you have not defined the algorithm and you have not defined what you want the output to be. The table in the .docx file does not help as you did not give any interpretation of it.
Your existing code has the appearance of a rats nest. There is no point in us analyzing how it works or what it is intended to do, when it would be much easier for you to describe it and document it (including comments.)
  2 个评论
Isee You
Isee You 2013-6-25
At first Ignore comments sorry , i forget do delete them .
my code create mask of 3X3 matrix that scan the image
z=[z1 z2 z3
z4 z5 z6;
z7 z8 z9];
avgg=mean2(z);
and get Average (avgg) and then
if ( avgg<10 && avgg>300 ||avgg==0 )
break;
end
to avoid zero and other values i do not want .
and then i search in 8 direction
c = {@northest, @north, @northwest,@west, @southwest, @south,@southeset,@eset};
for f=1:8
c{f}(avg,a,x,y,t) ;
end
for any direction i pass image, avg,x ,y , t (t no of cycle) like this example as you can find in .doc file i write the condition and thin i get the value of northeset
%north eset
function northest(avg,a,x,y,t)
while x-1 ~= NaN && y-1 ~= NaN && x-1 > 0 && y-1>0
northeset=avg-a(x-1,y-1);
then
if northeset < 20 && northeset >-20
if t<50
dataxnorthest=[dataxnorthest (x-1)];
dataynorthest=[dataynorthest (y-1)];
elseif t>=50 && t<100
dataxnorthest ,dataynorthest are the point i find . i divide these storage from (dataxnorthest to dataxnorthest12 ) , to speed i got a lot of data , then at last i combine them at one datax and datay .
[~,tt]=size (datay);
[k,m]=size (a);
z = ones(k,m, 'double');
z = logical(z);
for u=1:tt
z(datax(u),datay(u)) = 0;
end
then i use above code to creat array that has same size of image but it array of one and zeroes.
No.one expresses the chosen data then
a=double(a).*z;
to get the final image
figure;imshow(a, []);title('cancer image')
Isee You
Isee You 2013-6-27
Walter Roberson , help

请先登录,再进行评论。

类别

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