Borrar filtros
Borrar filtros

Remove empty image file in a ImageDatastore

2 visualizaciones (últimos 30 días)
Zzz
Zzz el 6 de Ag. de 2021
Comentada: Drishan Poovaya el 10 de Ag. de 2021
I have a folder containing images, some of which are empty JPEG (Zero byte). How can I create a ImageDatastore and skip the null files?
I have tried using ReadFcn to create a custom read function, see below:
function data=readImages(filename)
try % Fetch dimensions of a JPEG, error returned if it is null
dim = infinfo(filename);
data = imread(filename);
catch error
disp('Null data detected') % Problem: need to define data value for this statement
end
end
  2 comentarios
Zzz
Zzz el 6 de Ag. de 2021
The problem with the above approach is that it doesn't really skip the null files, since I still need to define what 'data' is.
Drishan Poovaya
Drishan Poovaya el 10 de Ag. de 2021
I understand you want to avoid including any empty jpg files. For reference purposes, could you please attach one of these empty jpg files? It would be helpful to come up with a solution

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by