please help : Subscripted assignment dimension mismatch. Error in dct (line 13) imred(:,:,1) = uint8(red);

1 view (last 30 days)
function dct(I) coder.extrinsic('dctmtx');
%dctmtx - Compute discrete cosine transform matrix. T = dctmtx(8); red = double(I(:,:,1)); coder.extrinsic('imred'); imred = zeros(8,8);
imred(:,:,1) = uint8(red);
B = blkproc(imred,[8 8],'410*x*500',T,T'); mask = [16 11 10 16 24 40 51 61; 12 12 14 19 26 58 60 55; 14 13 16 24 40 57 69 56; 14 17 22 29 51 87 80 62; 18 22 37 56 68 109 103 77; 24 35 55 64 81 104 113 92; 49 64 78 87 103 121 120 101; 72 92 95 98 112 100 103 99]; B2 = blkproc(B,[8 8],'410.*x',mask); I2 = blkproc(B2,[8 8],'410*x*500',T',T);
  2 Comments
Rik
Rik on 22 Feb 2017
Edited: Rik on 22 Feb 2017
Have a read here and here.
Right now I can't really see what is going on and what is exactly your question.
jebli med
jebli med on 22 Feb 2017
this is my code i use hdl coder in
matlab to convert my code but i have
this error :"Subscripted assignment dimension
mismatch. Error in dct (line 13) imred(:,:,1) = uint8(red);"
please can you help me
function dct(I)
coder.extrinsic('dctmtx');
%dctmtx - Compute discrete cosine transform matrix.
T = dctmtx(8);
red = zeros(8,8,1);
red = double(I(:,:,1));
coder.extrinsic('imred');
coder.extrinsic('blkproc');
imred(:,:,1) = uint8(red);
B = blkproc(imred,[8 8],'410*x*500',T,T');
mask = [16 11 10 16 24 40 51 61;
12 12 14 19 26 58 60 55;
14 13 16 24 40 57 69 56;
14 17 22 29 51 87 80 62;
18 22 37 56 68 109 103 77;
24 35 55 64 81 104 113 92;
49 64 78 87 103 121 120 101;
72 92 95 98 112 100 103 99];
B2 = blkproc(B,[8 8],'410.*x',mask);
I2 = blkproc(B2,[8 8],'410*x*500',T',T);
%figure, imshow(I4);
image(:,:,1)=I2;
image(:,:,2)=I3;
image(:,:,3)=I4;
figure,
subplot(1,2,1); imshow(I); title('image originale')
subplot(1,2,2); imshow(image); title('image compressée')
end

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!