필터 지우기
필터 지우기

The memory size occupied by an image

조회 수: 7 (최근 30일)
K. Taieb
K. Taieb 2020년 6월 19일
편집: K. Taieb 2020년 6월 23일
I did not understand why when I save a 2D matrix (200 * 200) in an image (imwrite), the memory size occupied by this image is less than the memory occupied by the image created by a matrix (1 * 25000). the number of elements in the first case is greater than in the second.
do you have any explanation?
Thank you

답변 (1개)

Steven Lord
Steven Lord 2020년 6월 19일
Compression, perhaps.
Let me generate a random matrix. What's the most compact way you can think of to write a command to regenerate it? [I'm not going to give you the command I used to generate it.]
A =
1 8 8 -6 -6
3 7 -5 -7 8
0 10 -10 -9 -6
9 -10 5 5 -9
5 -8 1 10 -6
Here's a second matrix, same size. Can you write a shorter command to generate B than you could to generate A?
B =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
Even if I gave you the full command to create A, it would still be longer than the command I used to generate B.
  댓글 수: 1
K. Taieb
K. Taieb 2020년 6월 19일
편집: K. Taieb 2020년 6월 23일
Thank you!
In my case, the matrixes are of type uint16 like B in your example.
I will show you an example:
I have a matrix A with 40000 elements and B with 25000 elements.
A=200*ones(200,200);
B=200*ones(25000,1);
imwrite(A,['image' num2str(1) '.jp2']);
imwrite(B,['image' num2str(2) '.jp2']);
The size of memory :
for B: image 1 = 240 byte.
for A: image 2 = 4,11 kilobyte.
I thought that the memory size occupied by the image 1 is more important because the nomber of elements of A is more then in B.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by