How to scan pixel and fill gaps. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to scan pixel and fill gaps.

sb79sb79 Posts: 6Member
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)


[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


[/code]



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


Comments

  • giuggiug Posts: 217Member
    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.
  • sb79sb79 Posts: 6Member
    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.


  • giuggiug Posts: 217Member
    I'm sorry but I can't understand...

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

    ok!

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

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

    [b]and from there come back towords starting point.[/b]

    in what sense "came back"?

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

    ?

    [b]But we have to do this baed on some threshold values.
    [/b]

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

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

    ok

    Sorry, i think it's only a problem with my english.
  • sb79sb79 Posts: 6Member
    Ok see the attached , it will explain more, i hope so.
  • giuggiug Posts: 217Member
    Well, the question is "how do you find the end point"?
    Then I think (hope) it could be all clear to me.
  • sb79sb79 Posts: 6Member
    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.

    [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



    [/code]
  • giuggiug Posts: 217Member
    Perfect, I understand!

    I think it could be something like this:
    [code]

    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
    [/code]


  • sb79sb79 Posts: 6Member
    Ok thx U,

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

    Thank u so much.


Sign In or Register to comment.