How to implement dct2 in MATLAB coder?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I'm trying to implement dct2 by using MATLAB coder in https://in.mathworks.com/help/images/ref/dct2.html.
But I've found error message when I invoke dct2 in MATLAB coder.
How do I resolve this problem?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191184/image.jpeg)
4 commentaires
Walter Roberson
le 12 Juin 2018
You write dct2 and idct2 yourself.
You will have problems with the graphics components. There is no one platform-independent standard for graphics -- there are a number of competing graphics standards.
You have to understand that code generation assumes that you might be generating code for an embedded system that might not have any graphics at all, or which might have a 7 segment by 20 characters by 2 rows LCD panel.
Réponses (1)
Walter Roberson
le 13 Juin 2018
I already answered you about dct2: I wrote,
"You write dct2 and idct2 yourself."
Mathworks has chosen not to permit code generation for their dct2 and idct2 routines, or perhaps they have simply not gotten around to implementing it. You did not miss any obscure setting.
To write dct2 yourself:
- pad the input image to a power of 2 in each direction
- call dct() on the input image
- transpose the result
- call dct() on the transposed result;
- transpose the result of that.
To write idct2 yourself:
- call idct() on the array (which must be a power of 2 in each direction
- transpose the result
- call idct() on the transposed result;
- transpose the result of that
- truncate away the part of the result that did not exist in the original image.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!