Matlab - Cargar todas las imágenes de un directorio

 
Vista:
sin imagen de perfil

Cargar todas las imágenes de un directorio

Publicado por Tomas (5 intervenciones) el 07/03/2017 20:13:39
Hola a todos.
Necesitó ayuda para modificar el siguiente código de tal forma de que en ves de trabajar con una única imagen, este lo haga con todas las contenidas en un directorio.
Si alguien me pudiese ayudar le agradecería muchísimo.
El código:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%% read the input image
close all,clear all;
I=im2double(imread('ImageData\bird\input2.jpg'));
 
%% get edge map
% Canny edge detector is used here. Other edge detectors can also be used
eth=0.1; % thershold for canny edge detector
edgeMap=edge(rgb2gray(I),'canny',eth,1);
 
%% estimate the defocus map
std=1;
lambda=0.001;
maxBlur=3;
tic; % about 1 mins for a 800x600 image
[sDMap, fDmap] = defocusEstimation(I,edgeMap,std,lambda,maxBlur);
toc;
imshow(fDmap,[0 maxBlur]);
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de David Correa
Val: 497
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Cargar todas las imágenes de un directorio

Publicado por David Correa (1094 intervenciones) el 07/03/2017 22:06:11
Hola Tomas;

A continuación una opción de como podrías leer masivamente las imágenes de un directorio.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
%% read the input image
close all,clear all;
ruta = '../Directorio/';
lst = ls([ruta,'*.jpg']);
 
for n = 1:size(lst,1)
iname = [ruta,lst(n,:)];
I =   im2double(imread(iname);
 
% I=im2double(imread('ImageData\bird\input2.jpg'));
 
%% get edge map
% Canny edge detector is used here. Other edge detectors can also be used
eth=0.1; % thershold for canny edge detector
edgeMap=edge(rgb2gray(I),'canny',eth,1);
 
%% estimate the defocus map
std=1;
lambda=0.001;
maxBlur=3;
tic; % about 1 mins for a 800x600 image
[sDMap, fDmap] = defocusEstimation(I,edgeMap,std,lambda,maxBlur);
toc;
imshow(fDmap,[0 maxBlur]);
 
end

​Espero que sea de alguna ayuda.

Saludos
David Correa
[email protected]
[email protected]
Servicios de Programación Matlab
http://fismatlab.org​​
http://fismatlab.blogspot.com
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

Cargar todas las imágenes de un directorio

Publicado por Tomas Radeljak (5 intervenciones) el 08/03/2017 12:58:30
Muchísimas gracias!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar