From: Sami Oueslati on 23 Mar 2010 18:59 Thanks to all, I followed your advice and I wrote another file, here is it: function b=Vprofil(a) Vpro=sum(a,2); n=size(Vpro); for j=1:1:n for i=1:1:(size(a,1)) if Vpro(j)>=1 b(i,j)=1; else b(i,j)=0; end end end figure, imshow(b); results are satisfactory except that size of "b" is smaller than of "a" b is 142x142 ans a is 142x154 Where is the error please???
From: Sami Oueslati on 24 Mar 2010 00:12 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <46142f3d-0dc1-4ebb-ac0b-3085b755e6a4(a)g11g2000yqe.googlegroups.com>... > No you don't need regionprops. Just scan the array and find the start > and stop of the white bands and zero out the middle of the band. It's the first thing that comes to my mind even if I know that it's completely wrong.........I feel stupid writing it :P....I'm not used to work with MatLab that's why..... function b=Vmid(a) [row col]=size(a); for x=1:row for y=1:col if a(x,y)=1 w=y; %first white point of a band for y=w:col if a(x,y)=0 z=y-1; %last white point of a band p=(w+z)/2; %position of the middle of a band a(x,p)=0; end end end end end
From: ImageAnalyst on 24 Mar 2010 08:28 Wow, you should get used to MATLAB. Look into the diff function. Then see where it goes positive and negative - these will be where your data changes from black to white or white to black. Then use the positions to set whole columns to black - no need to scan the whole array in x and y like you did since your source data is in vertical strips.
From: Sami Oueslati on 24 Mar 2010 18:41 Thank you Image Analyst for your reply...but I couldn't find a solution...How about using the function "find" and combine it with "diff"??? My salutations Sami.
From: ImageAnalyst on 24 Mar 2010 19:27 On Mar 24, 6:41 pm, "Sami Oueslati" <Samy...(a)yahoo.fr> wrote: > Thank you Image Analyst for your reply...but I couldn't find a solution....How about using the function "find" and combine it with "diff"??? > > My salutations > Sami. ---------------- Are you going to supply us with an image to work with? Post one to http://drop.io
|
Next
|
Last
Pages: 1 2 3 Prev: Using Trapz function Next: plotting equi-distant points given 4 coords points |