フィルターのクリア

The Watershed Transform::separate objects::please help

2 ビュー (過去 30 日間)
mangood UK
mangood UK 2013 年 7 月 18 日
hi
i try to use Watershed Transform to separate touching objects
i read The Watershed Transform: Strategies for Image Segmentation
By Steve Eddins, MathWorks
www.mathworks.com/.../the-watershed-transform-strate...
i follow exact his code as below but no result i get
i think their a basic error in code
------------generate toching object-------
center1 = -10;
center2 = -center1;
dist = sqrt(2*(2*center1)^2);
radius = dist/2 * 1.4;
lims = [floor(center1-1.2*radius) ceil(center2+1.2*radius)];
[x,y] = meshgrid(lims(1):lims(2));
bw1 = sqrt((x-center1).^2 + (y-center1).^2) <= radius;
bw2 = sqrt((x-center2).^2 + (y-center2).^2) <= radius;
bw = bw1 | bw2;
imshow(bw), title('bw');
%----------------separate object------------
D = ~bwdist(~bw);
L=watershed(D);
BW(L == 0) = 0;
imshow(BW);
%-------------------------------------------
title('Distance transform of ~bw')

採用された回答

Iain
Iain 2013 年 7 月 18 日
Should BW be bw?
  3 件のコメント
Jeff E
Jeff E 2013 年 7 月 18 日
You've got a few steps wrong, and are missing a few in the middle.
doc watershed - example 1 has basically the same code and works for me. You should just be able to copy and paste to replicate. If you have an older version of Matlab, you can find it on the web: http://www.mathworks.com/help/images/ref/watershed.html
mangood UK
mangood UK 2013 年 7 月 18 日
編集済み: mangood UK 2013 年 7 月 18 日
thank
it work
but i test it with another image look to the result
why the cycle was separated ??? do this need any processing to solve it

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by