failed to calculate median images using parfor

37 views Asked by At

I'm trying to calculate the median image of a series of images.
tableau4D corresponds to a time series of images.

tableau4D(pixel_x, pixel_y, value_grayscale, time t)

I have a lot of images and want to use parfor to increase calculation speed.
But I get an error.

my code :

% Calcul mediane serie image
function Io_mediane = median_images(tableau4D)
    %Io_mediane = median(tableau4D, 4);
    % Calcul taille du tableau
    [m,n,c,nombre_images] = size(tableau4D);

    % init temp
    Io_med_temp = zeros(m,n,c,nombre_images);

    parfor i = 1:nombre_images %parfor bug 
        Io_med_temp(:,:,:,i) = medfilt2(tableau4D(:,:,:,i));
    end
    Io_mediane = mean(Io_med_temp,4);
end 

my error :

Starting parallel pool (parpool) using the 'Processes' profile ...
Connected to parallel pool with 20 workers.
Warning: X does not support locale fr_FR.utf8
Error using post>median_images/parfor%supply_3
Out of memory.

Error in post>median_images (line 195)
    parfor i = 1:nombre_images %parfor bug

Error in post (line 33)
Io_mediane = median_images(Io_land);
 
Starting parallel pool (parpool) using the 'Processes' profile ...
Parallel pool using the 'Processes' profile is shutting down.

Do you have any advice? (If I replace parfor by for, It's works)

0

There are 0 answers