why do i get "Array indices must be positive integers or logical values ?"

1 visualización (últimos 30 días)
% folder in which your images exists
location1 = 'C:\Users\User\Documents\MATLAB\FYP-DCP (jaja)\dataset-hazy\*.png';
location2 = 'C:\Users\User\Documents\MATLAB\FYP-DCP (jaja)\dataset-ori_img\*.png';
imdshazy = imageDatastore(location1);
imgs = readall(imdshazy);
imdsori = imageDatastore(location2);
imgO = readall(imdsori);
[m, n, p, l] = size(imgs{1}); % m=height, n=width
image = zeros(m,n,p,l);
res_im = imresize(imgs{i}, 0.4);
[m, n, p, l] = size(res_im);
image2 = zeros(m,n,p,l);
imagedehaze = zeros(m,n,p,l);
image3 = zeros(m,n,p,l);
for i = 1:1:54
image2(:,:,:,i) = imresize(imgs{i}, 0.4);
imagedehaze(:,:,:,i) = dehaze(image2(:,:,:,i), 0.95, 5);
image3(:,:,:,i) = imresize(imgO{i}, 0.4);
resultpsnr = psnr(imagedehaze(:,:,:,i), image3(:,:,:,i))
end

Respuestas (1)

Voss
Voss el 19 de Mayo de 2022
res_im = imresize(imgs{i}, 0.4);
is before the i loop, so i is not defined, so MATLAB interprets that i as the imaginary unit 1i. Probably you meant imgs{1} there.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by