How to convert mxarray datatype in simulink
4 ビュー (過去 30 日間)
古いコメントを表示
I have to remove small objects from binary image and Im trying to use bwareaopen in simulink by using following code:
function y = fcn(u)
x = zeros(size(u));
coder.extrinsic('bwareaopen');
x = bwareaopen(u, 50);
y = double(x);
and getting error:
Class mismatch for variable 'bwareaopen'. Expected 'double', Actual 'logical'. Block MATLAB Function (#24) While executing: none
Model is as follows:

%
0 件のコメント
採用された回答
Ryan Livingston
2014 年 4 月 2 日
For allocating logical data use either of the functions true or false:
x = true(size(u));
x = false(size(u));
5 件のコメント
Sayed Rizban Hussain
2016 年 5 月 18 日
編集済み: Sayed Rizban Hussain
2016 年 5 月 18 日
yes bwareaopen is supported in matlab coder as I have used it previously. Now my target machine is raspberry pi. Can you suggest me any function that can replace bwareaopen? As for my application I only need objects of a specific area range.
その他の回答 (1 件)
Kaustubha Govind
2014 年 3 月 20 日
It looks like bwareaopen returns an output of type logical. You need to pre-declare 'x' as follows:
x = zeros(size(u), 'logical');
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Computer Vision with Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
