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

3 vues (au cours des 30 derniers jours)
Zun Sid
Zun Sid le 25 Juin 2018
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....

Réponses (1)

Nathan Jessurun
Nathan Jessurun le 14 Avr 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.

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by