Labelling edges in an image
古いコメントを表示
I am trying to do what should be a really basic image processing task, but don't seem to be able to find a particular neat solution so hopefully someone can suggest one.
I simply wish to find the edges between three coloured segments of the image below as single-pixel thick lines with 3 distinct values representing the 3 different boundary possibilities. I don't care what the 3 distinct values are so long as they are distinct.

This is the solution I want (ignore the colourmap, I was just trying to find colours that made it easy to distinguish) - here the 3 values happen to be 3, 4, 5.

My method for achieving it was:
f = @(x) ( x(2) ~= x(1) ) * ( x(2) + x(1) );
edgeRes = nlfilter( wedge, [1 2], f );
i.e. basically just looking at a 1*2 window and adding together the two values in the window if they differ.
I don't like this solution much though as nlfilter throws up a progress bar (plus it feels like there should be a much simpler method).
The input data and the edge result I have should be in the attached .mat file if anyone has any better idea for achieving this seemingly trivial task!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!