MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by aboomnea on 23 Jun 2013

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

Answer by Walter Roberson on 23 Jun 2013

Edited by Walter Roberson on 23 Jun 2013

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.)

aboomnea on 25 Jun 2013

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')

## 0 Comments