apply 3D DCT on a 3d matrix

4 次查看(过去 30 天)
konstantina vatavali
回答: Shlok 2025-2-26
Hello,
Is there any way to apply 3d dct on a 3d matrix without using the multidimensional function mirt_dctn?
i.e. working seperately on each dimension of the matrix.
Thank you!

回答(1 个)

Shlok
Shlok 2025-2-26
Hi Konstantina,
Yes, you can apply a 3D Discrete Cosine Transform (DCT) to a 3D matrix without using “mirt_dctn”. This can be done by applying a 1D DCT sequentially along each dimension. To achieve this, use the “dct” function present in Signal Processing Toolbox. Here’s an example of how to apply a 3D DCT manually:
A = rand(4, 4, 4); % Assuming a sample 3D matrix
% Applying 1D DCT along each dimension separately
A_manual = dct(A, [], 1);
A_manual = dct(A_manual, [], 2);
A_manual = dct(A_manual, [], 3);
disp('Manual 3D DCT:');
Manual 3D DCT:
disp(A_manual);
(:,:,1) = 4.0438 -0.2585 0.0015 0.4368 -0.2388 0.0352 0.3830 0.1899 0.2355 -0.0452 -0.2289 0.0318 0.2921 0.0377 0.4991 0.2263 (:,:,2) = -0.1791 -0.1629 -0.3286 0.4020 0.2812 0.1543 0.2249 -0.1348 -0.0387 0.0317 0.1924 -0.0612 0.0865 -0.2584 0.3129 -0.2798 (:,:,3) = 0.2543 -0.3150 -0.0084 0.1145 -0.4315 -0.4029 -0.1167 -0.0776 -0.1673 -0.0063 0.0381 0.2420 0.4992 0.2309 -0.5001 0.1140 (:,:,4) = 0.0050 0.0784 -0.2937 0.1079 0.5732 0.2763 -0.0944 -0.2212 0.1077 0.1326 -0.2218 0.2908 -0.0236 0.2336 0.1926 -0.0552
To know more about “dct”, refer to the following MathWorks documentation link:

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by