Instead of read the whole image first and then take part of feature, but only read this feature part of the image from the beginning, how to do it? Using fread function?

1 visualización (últimos 30 días)
How to read the feature part of the image (without white color area)? Izit using fread function?
  2 comentarios
Jan
Jan el 22 de Mayo de 2017
The question is not clear. What is "the feature part" and how is it defined in your code? In which format is the image saved? Whyt is the benefit of reading the image partially? Most likely it will be much faster to perform the cropping when the image is imported into the RAM. So why do you want to apply a very complicated import function?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 15 de Jun. de 2017
No, those are JPEG images. There is no provided way to read only part of a JPEG image.
Looking around, I find a reference that claims that libjpeg supports reading JPEG images line by line. Considering that JPEG are divided into blocks, I suspect that would involve reading and decoding information and throwing out most of it -- either that or perhaps it only supports reading groups of 8 lines at a time. Either way, it certainly does not support reading only irregular parts of an image.
  2 comentarios
Mei Synn Tan
Mei Synn Tan el 16 de Jun. de 2017
Dear Walter Roberson, if the images is in PNG format. Possible to read part of a png image? Thanks
Walter Roberson
Walter Roberson el 16 de Jun. de 2017
No, PNG files have no way of handling this kind of situation.
TIFF files are permitted to be written in "tiles" that can be read separately -- so for example you might happen to know that there are three tiles between the left edge of the image and the left side of the leaves around the stem, below the petals and above the leaves. If you happened to know that, and if it happened that everything aligned just right, then with TIFF images you could skip those tiles as you read the others. This would typically be slower than reading the whole thing in this circumstance, as you would need to be going back and forth between MATLAB and libtiff all the time instead of staying inside libtiff to read the entire image.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by