Azzera filtri
Azzera filtri

Bwconncomp code conversion in c++ using matlab coder gives error

6 visualizzazioni (ultimi 30 giorni)
Bwconncomp returns a variable with 4 fields. one of them is pixelIdxlist which is of type cell array. For code conversion, We have to allocate the memory to variable beforehand. While allocating memory, Matlab coder gives an error "Code generation does not support cell arrays in structure fields.","This structure does not have a field 'PixelIdxList'." How can I resolve these errors. Here's my code:
n=14456;
A = ones(1,n);
sz = size(A);
p = cell(sz);
field6='PixelIdxList'; value6 ={p};
CC = struct(field3,value3,field4,value4,field5,value5,field6, value6 );
CC = bwconncomp(I3);
A=NaN(9999,1);
for i = 1:size(CC.PixelIdxList,2)
A(i) = size(CC.PixelIdxList{i},1);
end
[Val,Idx] = max(A);
L = zeros(CC.ImageSize);
for k = 1 : CC.NumObjects
L(CC.PixelIdxList{k}) = k;
end
L(find(L~=Idx))=0;
L(find(L==Idx))=1;
%continue....

Risposte (1)

Nathan Jessurun
Nathan Jessurun il 14 Apr 2019
From the bwconncomp help page (here), they make the statement under C++ code generation:
The PixelIdxList field in the CC struct return value is not supported.
So it looks like what you're doing isn't possible yet.

Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by