From: andrea on
Hi,

I have a BW image (black=0 white=255).
I want to find the border pixels between black pixels and white pixels.

I wrote this code:

for col = 1:size(img,2)
[r c v] = find(img(:,col)==255, 1, 'first');
....
end

But in the image I have horizontal and vertical edge and, in the case of vertical edge, the output of fuction find is the first pixel of the edge.

How can I do?

Thank you

Andrea
From: Sean on
"andrea " <nacchio1983(a)yahoo.it> wrote in message <i11ubt$ad7$1(a)fred.mathworks.com>...
> Hi,
>
> I have a BW image (black=0 white=255).
> I want to find the border pixels between black pixels and white pixels.
>
> I wrote this code:
>
> for col = 1:size(img,2)
> [r c v] = find(img(:,col)==255, 1, 'first');
> ...
> end
>
> But in the image I have horizontal and vertical edge and, in the case of vertical edge, the output of fuction find is the first pixel of the edge.

It's hard to understand what you're saying without seeing an image. Could you post an image somewhere so we can see it?

If I'm understanding you correctly what you want is every pixel that's neither black or white but touching a black or white object. Is that correct? Or do you just want all non -(black, white) pixels?
From: Image Analyst on
andrea:
Simply use bwboundaries(). See my image processing demo for an example:
http://www.mathworks.com/matlabcentral/fileexchange/25157
-ImageAnalyst
 | 
Pages: 1
Prev: Chebychev distance matrix
Next: nntrain tool