It depends on various factors related to the input matrix I. For instance:
- Input Matrix I:
The size of the input matrix I directly impacts the memory consumption. If I is an m×n matrix with elements of type double, it consumes 8×m×n bytes because each double precision floating-point number in MATLAB uses 8 bytes. If I is of type uint8, it consumes m×n bytes, since each uint8 element uses 1 byte.
- Decomposition Result S:
The result S is a sparse matrix indicating the quad tree decomposition. Each entry in S corresponds to the size of the block that the corresponding element of I belongs to. For each block of size k×k, an entry in S is set to k.
The storage for S as a sparse matrix includes space for the non-zero elements and their corresponding row and column indices. If nS is the number of non-zero elements in S: The values (block sizes) in S require 8×nS bytes. The row and column indices each require 4×nS bytes in case it is stored as 32-bit integers (which is normally the case in MATLAB).
- Total Memory Consumption:
Both the memory consumption for storing the matrix I and for the sparse matrix S.
Thus, the total memory consumption can be approximated by the sum of these components.
For an input matrix I of size m×n with type double, the memory consumption would be roughly:
Memory=8×m×n+16×nS
with nS being the number of non-zero elements in the sparse matrix S.
If the input matrix I is of type uint8, the memory consumption would be roughly: Memory=m×n+16×nS
This gives you a basic estimation of the memory usage for the qtdecomp function in MATLAB. Though in my opinion, the exact memory usage may vary based on the sparsity of the decomposition and the internal overheads in MATLAB's memory management.