i am working on image compression and my code gives the error (Dot indexing is not supported for variables of this type). Could anyone help me on the reason why?

1 view (last 30 days)
part of the code can be seen below
% apply DCT on 8x8 blocks of the image, and re-order the coefficients
dct_result = blkproc(image, [8 8], @(block_struct) zigzag(dct2(block_struct.data)));
% for each block, set the last n coefficients to zero
for i = 1:m/8
for j = 1:n/8
start_index = 64 - n + 1;
dct_result(start_index:end, start_index:end, i, j) = 0;
end
end
% apply inverse DCT on each block of coefficients
idct_result = blkproc(dct_result, [8 8], @(block_struct) idct2(izigzag(block_struct.data)));
The erroe also says
Dot indexing is not supported for variables of this type.
Error in dc>@(block_struct)zigzag(dct2(block_struct.data)) (line 17)
dct_result = blkproc(image, [8 8], @(block_struct) zigzag(dct2(block_struct.data)));

Answers (1)

Amit Dhakite
Amit Dhakite on 11 May 2023
Hi Yonta,
As per my understanding, you are trying to block process the images using blkproc function.
It is not recommended to use blkproc, instead you can use blockproc, which will remove the error related to dot indexing.
To know more about blockproc, kindly refer to the following link:

Community Treasure Hunt

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

Start Hunting!