0

SelectComponentsMatlab にはmathematicaの関数の代替がありますか?

この wolfram mathematica コードを matlab の同等のコードに変換するにはどうすればよいでしょうか。

(* Connected component selection based on some supposed sizes. *)
ccs = SelectComponents[wsthick, "Count", 1000 < # < 3000 || 6000 < # < 10000 &]
4

1 に答える 1

1

regionpropsMatlabでは、画像内のラベル付けされた領域のさまざまなプロパティを計算するために使用できます。

あなたの質問のために私は試してみます

lb = bwlabel( wsthick, 4 ); % use 4-connect regions in bw image
s = regionprops( lb, 'Area', 'PixelIdxList' );  % extract area of regions - number of pixels they cover
count = [s(:).Area] ; % a vector with count for each region
sel = ( ( count > 1000 & count < 3000 ) | ( count > 6000 & count < 10000 );
ccs = false( size( wsthick ) );
ccs( vertcat( s(sel).PixelIdxList ) ) = true;

Mathematica ほどエレガントではないかもしれませんが、同じように機能します。

于 2013-02-25T08:11:54.200 に答える