Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Zun Sid
Zun Sid el 25 de Jun. de 2018
Respondida: Nathan Jessurun el 14 de Abr. de 2019
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....

Respuestas (1)

Nathan Jessurun
Nathan Jessurun el 14 de Abr. de 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.

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by