while converting my matlab code to hdl code, i got the error' HDL Code generation does not support 2D-matrices as function inputs. Use help codegen for more information on using this command. Error in Manager>wfa_generateCode at 627'

1 view (last 30 days)
clc; clear all; close all; image1=imread('cameraman.tif'); subplot(2,2,1); figure(1); imshow(image1);title('original image'); image2=stdfilt(image1); subplot(2,2,2); imshow(image2,[]); title('standard deviation map'); t2=0.1*max(max(image2)); for i=1:256 for j=1:256 % c1(:,:,i)=cell2mat(C(i)); % p1(:,:,i)=cell2mat(P(i)); % sum1=sum(sum(c1(:,:,i)));
if image2(i,j) < t2
s(i,j)=0;
else
s(i,j)=1;
end
end
end
subplot(2,2,3);
imshow(s);
title('binarized standard deviation map');

Answers (1)

Walter Roberson
Walter Roberson on 28 Dec 2016
Your code cannot be translated to HDL. HDL does not support file operations such as imread(), and does not support any graphics such as imshow()
When you get the needed code isolated, you might need to use https://www.mathworks.com/products/vision-hdl/features.html#full-frame-and-pixel-based-processing frame to pixel conversion.

Community Treasure Hunt

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

Start Hunting!