help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parallel processing in Octave


From: Thomas Weber
Subject: Re: Parallel processing in Octave
Date: Sun, 22 May 2011 11:30:28 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, May 18, 2011 at 03:41:31PM +0530, Chethan S wrote:
> Hi all,
> 
> The code I am using is fairly simple.I am using it to process satellite 
> images of dimension - 3000X2000 pixels. The code goes as follows:
> 
> 
> function texlayer(subfn)
> clc;
> [fn,pn] = uigetfile({"*.TIF;*.tiff;*.tif;*.TIFF;*.jpg;*.bmp;*.JPG;*.png", 
> "Supported Image Formats"}, ...
>                    'Select an Image', "/home/");
> I = double(imread(fullfile(pn,fn)));
> global ld
> ld = input('Enter the lag distance = '); % prompt for lag distance
> fh = eval(['@' subfn]); % Function handles
> I2 = uint8(nlfilter(I, [7 7], fh))
> imshow(I2);
> imwrite(I2,'i1.tiff');
> 
> % Zero Degree Variogram
> function [gamma] = ewvar(I)
>     c = (size(I)+1)/2; % Finds the central pixel of moving window
> global ld
>     EW = I(c(1),c(2):end); % Determines the values from central pixel to 
> margin of window
>     h = length(EW) - ld; % Number of lags
>     gamma = 1/(2 * h) * sum((EW(1:ld:end-1) - EW(2:ld:end)).^2);
> 
> 
> According to the above code, I call the function as texlayer('ewvar')
> and browse and select the input image and give the lag distance which
> is usually 1. The processing exceeds 45 minutes and I get the output
> image. Is there any scope for improvement in this code or will it be
> possible to implement parallel processing for the code? I have no idea
> about how to implement parallel processing. So any help would be a
> great time-saver for me.

I've looked briefly at the nlfilter() function - it seems that it's
running something along

for i=1:2000
  for j=1:3000
    here be dragons
  endfor
endfor

where 2000 and 3000 are the dimensions of your images. I don't think
there's much you can do from your code - rewriting the time-critical
part of nlfilter as .oct file seems your best way out.

        Thomas


reply via email to

[Prev in Thread] Current Thread [Next in Thread]