Borrar filtros
Borrar filtros

sliding the rectangle using nlfilter

2 visualizaciones (últimos 30 días)
ramya raj
ramya raj el 25 de Ag. de 2011
hai
i am new to matlab and studing about optic disc localization
in that my work is to develop two feature maps namely I horizontal map II vertical map
and then create a rectangle and move over the feature map and calculate the sum of pixels inside the rectangle and move the rectangle all over the image and calculate the sum of pixel values in each point.
my third step is i have to plot the values and draw a graph
now i had generated two feature maps and i have created a rectangle also
i have strucked in making the rectangle to move
please tell me wheather an function is available in matlab for moving the rectangle over the image
i want the rectangle to move automatically and not a dragable rectangle and i have trid with imrectwhicvh is of the form of draggable rectangle
please help me
and the code i have used is
*r=rectangle('position',[10,10,30,560],'linewidth',2.4,'edgecolor','w');
func = @(x) sum(x.cdata(:));
B = nlfilter(final2,r,func);
figure,imshow(B);*
please hep me
thanks
hai jan Simon
as you mentioned a have used nlfilter function but i am getting the result as NAN and the time taken for processing also high s0 i used colfilt function but the answer is not coming
what can i do now please tell me thanks
  2 comentarios
Walter Roberson
Walter Roberson el 25 de Ag. de 2011
duplicates are at http://www.mathworks.com/matlabcentral/answers/13866-move-rectangle-over-te-image and http://www.mathworks.com/matlabcentral/answers/13444-to-make-the-rectangle-move-over-the-image
Jan
Jan el 26 de Ag. de 2011
@kanagapushpavalli: Please post the command you have used, otherwise we cannot guess what's going wrong.

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 25 de Ag. de 2011
I recommend against the approach you have taken. Please see my answer to the 13444 post.

Jan
Jan el 25 de Ag. de 2011
Drawing a rectangle will not help. You want to process rectangular sections of the image data.
Please read the documentation of help nlfilter. There you find: "B = nlfilter(A, [m n], fun)" with m and n are the dimensions of the rectangle and fun is @sum in your case.

Community Treasure Hunt

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

Start Hunting!

Translated by