Proceacmiento distributed images with matlab

33 views Asked by At

I'm doing image processing in a cluster, but failed to optimal performance, I have a function that replicate the edges and another to apply the filter or mask, but when the time of execution of MATLAB SPMD used the program are not meeting each while increasing worker as time increases.

enter code here
      p1=parpool('local',4);
      addAttachedFiles(p1,{'Max_Duplicado_pixel.m',
      'funcion_Aplicacion_mascaras.m'});
      tic
      spmd
      d1=codistributor1d(2);
      c = codistributed(imA, d1);  
      som=funcion_Aplicacion_mascaras(
      Max_Duplicado_pixel(getLocalPart(c),sombrero),sombrero);     
      salida=gcat(som);
       end
      imshow(salida{1});
       end
       delete(gcp);   

enter code here

this is the function to apply mascara

enter code here
     x=ceil(R1/2):R-floor(R1/2); 
     y=ceil(R1/2):C-floor(R1/2); 
     for b=-floor(R1/2):floor(R1/2)
         for a=-floor(R1/2):floor(R1/2)
             salida(x,y)=salida(x,y)+single(imagen(x+b,y+a))
            *sombrero(b+ceil(R1/2),a+ceil(R1/2));        
         end

     end
     temp=salida(ceil(R1/2):R-floor(R1/2),ceil(R1/2):C-floor(R1/2));
     image_procesada=uint8(temp);
1

There are 1 answers

6
Daniel On

From what I understand, you are just doing something like spmd,x=somefunction(),end without ever using labindex. This won't accelerate your computation, each worker will do exactly the same stuff, evaluating x=somefunction(). With 5 workers the function will be evaluated 5 times. Take a look at parfor, it's typically the easiest concept to write parallel code.