Simulink-Coder image data representation in C
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello, I have a question related to an image representation out of Matlab Simulink Coder. If I have a Simulink block with an RGB image output size for instance 320x240x3, I get in my generated code an array with the size "img[230400]". My question is now, if I want to write this array to an .ppm-file-format, how do I have to iterate over this array to get a row based rgb order and see the image.
Thanks in advanced.
댓글 수: 0
채택된 답변
Alain Kuchta
2017년 5월 12일
편집: Alain Kuchta
2017년 5월 12일
Assuming img is an I x J x K array, the array element given in MATLAB by:
img(i,j,k)
can accessed in the generated C code at:
img[(k-1)*(J*I) + (j-1)*I + (i-1)];
For a more detailed explanation of how matrices and arrays are stored in generated code, refer to the following documentation:
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!