i'm trying to read a RGB BMP format image and a JPG format image. but it appears that both have same size(bytes) on my work space . is it possible to read the image with their actual disk space?

1 vue (au cours des 30 derniers jours)
reply as soon as possible.

Réponse acceptée

Image Analyst
Image Analyst le 6 Fév 2015
You'd have to use fread(), instead of imread(), to read in the image data byte-for-byte. Of course it does no decompressing that way - it's just pure raw bytes and would look like garbage if you went to display it. Why do you want to do that anyway?
  12 commentaires
Image Analyst
Image Analyst le 7 Fév 2015
That's a completely different question, and one that you asked and accepted an answer to in a completely different discussion, so I won't answer it here.
Pradeep Gowda
Pradeep Gowda le 8 Fév 2015
oh okay . thnkxx for all the information that you gave me. i'm almost done with my project. thnkxx once again :D

Connectez-vous pour commenter.

Plus de réponses (1)

John D'Errico
John D'Errico le 6 Fév 2015
Modifié(e) : John D'Errico le 6 Fév 2015
So all you want to know is how much disk space was taken up by the image, NOT to read it in with the file still in compressed format?
Just use dir. Look at the struct form that dir returns. One of the fields is bytes, i.e., the number of bytes taken up by the file on disk, as it is currently stored.
For example, in my current directory, I have a jpg file stored.
d = dir('untitled.jpg')
d =
name: 'untitled.jpg'
date: '05-Feb-2015 10:59:57'
bytes: 20014
isdir: 0
datenum: 7.36e+05
If your goal is to also know the space required to store the image in an uncompressed form, then you need only to know the size of the image.
  2 commentaires
Pradeep Gowda
Pradeep Gowda le 6 Fév 2015
okay thank you. i have doubt now, is the space required to store the uncompressed image and its disk space are different?

Connectez-vous pour commenter.

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by