Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1495
Number of posts: 2175

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to scan pixel and fill gaps. Posted by sb79 on 15 Mar 2009 at 8:24 PM
Hi can any one help me.


I want to scan each pixel in a output image of sobel vertical edge image.


start from top-left, scan once i get a pixel i mark it a start pixel and go forward in same line by shifting the point to a MAX intervell that i give. (Eg : MaxIntervel = 30)

But i want scan back word after shifting the point to max intervel,to fix a end point.

To make it more clear see this.


Row pixel

1(starting point) 25 30(Maxintervel)



function new_image = fill_function(Image, start_row, start_col, interval)
    
    if Image(start_row, start_col) == 1 && Image(start_row, start_col + interval + 1) == 1
        for i = 1:interval
            Image(start_row, start_col + i) = 1;
        end
    end
   new_image = Image;   

  
end       






I want to fix 25 as end point and fill 1 to 25 with a threshold value white pixel...

How to do it can any one help me

Thank You
Manoj


Report
Re: How to scan pixel and fill gaps. Posted by giug on 16 Mar 2009 at 1:12 AM
Perhaps I don't understand you question, in particular I don't understand haw you find the value "25", but:

I suppose that 25 is "MaxInterval-5", you have the starting point, so, why you can't write, for example:

Image(start_row,start_col:start_col+MaxInterval-5)=1

In this way all the values from the starting column to the starting column + the interval -5 (?) are setted to 1.
Report
Re: How to scan pixel and fill gaps. Posted by sb79 on 16 Mar 2009 at 1:29 AM
Thank u for the reply.

Let me explain clearly.

I am doing this on a vertical soble edge image,which has only 0's and 1's. So starting opint is the first 1's fron left and move the point to 30 MaxIntervel. and from there come back towords starting point.

When u find a 1's in the same row again, fix it as end point, and fill the gap.But we have to do this baed on some threshold values.

But for any start and end pixel its intensity must be higher then the threshold value.

So i am not sure how to do it. Did u understood ?

Thank U.


Report
Re: How to scan pixel and fill gaps. Posted by giug on 16 Mar 2009 at 1:41 AM
I'm sorry but I can't understand...

I am doing this on a vertical soble edge image,which has only 0's and 1's.

ok!

So starting opint is the first 1's fron left and move the point to 30 MaxIntervel.


"move the point"? in the sense that it fills all the pixels in the row from the starting point to the starting point + maxinterval?

and from there come back towords starting point.

in what sense "came back"?

When u find a 1's in the same row again, fix it as end point, and fill the gap.


?

But we have to do this baed on some threshold values.


You are working with the black and white sobel image so I think that the threshold is set in the original image...

But for any start and end pixel its intensity must be higher then the threshold value.


ok

Sorry, i think it's only a problem with my english.
Report
Re: How to scan pixel and fill gaps. Posted by sb79 on 16 Mar 2009 at 2:03 AM
Ok see the attached , it will explain more, i hope so.
Attachment: fill.JPG (93853 Bytes | downloaded 102 times)
Report
Re: How to scan pixel and fill gaps. Posted by giug on 16 Mar 2009 at 2:20 AM
Well, the question is "how do you find the end point"?
Then I think (hope) it could be all clear to me.
Report
Re: How to scan pixel and fill gaps. Posted by sb79 on 16 Mar 2009 at 2:33 AM
I will give a threshold value (T), and start and end point intensity must be > T.Than only we take it as start pixel or end pixel.


Some thing like this

if
{
Start_px > T
}

If above is true,Move the index to Maxintervel and scan backword, if a pixel > T mark it as end pixel. then fill the gap with a intensity (C).

I hope now its clear.

I did it in the following code, but i could not do it in full. Check the code.



function new_image = fill_function(Image, start_row, start_col, interval)
    
    if Image(start_row, start_col) == 1 && Image(start_row, start_col + interval + 1) == 1
        for i = 1:interval
            Image(start_row, start_col + i) = 1;
        end
    end
   new_image = Image;   

  
end 




Report
Re: How to scan pixel and fill gaps. Posted by giug on 16 Mar 2009 at 2:58 AM
Perfect, I understand!

I think it could be something like this:

  if OriginalImage(start_row,start_col)> T
    for i=start_col+j:start_col
      if OriginalImage(start_row,i)> T
          end_col=i;
          break
      end
    end
    break
  end
Image(start_row,end_col)=C;

%I don't know if you want to modify the  original image or a new one



Report
Re: How to scan pixel and fill gaps. Posted by sb79 on 16 Mar 2009 at 4:42 AM
Ok thx U,

Let me try this and if i have any doubt let me ask u ,

Thank u so much.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.