I want to convert this code into hdl, but blockproc function is not an allowed function in hdl code. Hence, not able to convert it. Is there any other function same as blockproc and accepted by hdl coder. If not, then what else can be done?

I = imread('flower.jpg');
X = rgb2gray(I);
XD = im2double(X);
T = dctmtx(8);
dct = @(block_struct) T * block_struct.data * T';
B = blockproc(XD,[8 8],dct);
mask = [1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0];
B2 = blockproc(B,[8 8],@(block_struct) mask .* block_struct.data);
invdct = @(block_struct) T' * block_struct.data * T;
I2 = blockproc(B2,[8 8],invdct);
imshow(I2);

Answers (1)

Hi,
You can check hdlcoder supported style of MATLAB code in "matlab\toolbox\hdlcoder\hdlcoderdemos\matlabhdlcoderdemos"
Can you please share your code?
kiran.kintali@mathworks.com

This question is closed.

Asked:

on 21 Dec 2018

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!