Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在matlab中根据假定的尺寸选择元件_Matlab_Matrix_Wolfram Mathematica - Fatal编程技术网

如何在matlab中根据假定的尺寸选择元件

如何在matlab中根据假定的尺寸选择元件,matlab,matrix,wolfram-mathematica,Matlab,Matrix,Wolfram Mathematica,mathematica中的SelectComponents函数是否有其他选择 如何将wolfram mathematica代码转换为与matlab等效的代码 (* Connected component selection based on some supposed sizes. *) ccs = SelectComponents[wsthick, "Count", 1000 < # < 3000 || 6000 < # < 10000 &] (*基于某些假定

mathematica中的
SelectComponents
函数是否有其他选择

如何将wolfram mathematica代码转换为与matlab等效的代码

(* Connected component selection based on some supposed sizes. *)
ccs = SelectComponents[wsthick, "Count", 1000 < # < 3000 || 6000 < # < 10000 &]
(*基于某些假定尺寸的连接组件选择。*)
ccs=选择组件[wshick,“Count”,1000<#<3000 | | 6000<#<10000&]
在Matlab中,您可以用来计算图像中标记区域的不同属性

对于你的问题,我会试试看

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;
lb=bwlabel(wsthick,4);%在bw图像中使用4连接区域
s=区域属性(lb,'区域','像素idxlist');%提取区域面积-区域覆盖的像素数
计数=[s(:).Area];%每个区域都有计数的向量
sel=((计数>1000,计数<3000)|(计数>6000,计数<10000);
ccs=假(尺寸(wsthick));
ccs(vertcat(s(sel).PixelIdxList))=true;

可能没有Mathematica中的优雅,但工作原理相同。

SelectComponents到底做了什么?可以提供一个示例(输入数据、输出数据及其解释)?@ThijsW@Suvidha是的,我看到了,但我不太清楚你问题中的代码行应该做什么。如果你提供一个例子,我可以在matlab中试一试,但我不会先安装mathematica来尝试。@ThijsW请参考这个问题,第一个答案是最后一行出现错误使用==>horzcat CAT参数时出错。维度不一致。