help-octave
[Top][All Lists]
Advanced

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

Re: Problem with images loading


From: Andy Buckle
Subject: Re: Problem with images loading
Date: Tue, 8 Mar 2011 10:11:20 +0000

On Tue, Mar 8, 2011 at 9:41 AM, olga_kruglova <address@hidden> wrote:
> Hi everybody,
>
> I am very new to octave and programming. So, I need to write a program to
> subtract images from each other. I was reading different advices and wrote
> some routine but it keeps giving me an error and I can't see why it happens.
> If somebody would point out what is wrong and where I should correct I would
> be very grateful. So, here is the routine:
>
> filePaths =dir( 'E:\data\EHD_flow\Particle_1µm6µl\01m_nacl_4v_100hz\*.tif');
> fileNames = {filePaths.name};
> numberOfImageFiles = numel(fileNames);
> rows=2;
> columns=2;
>
> subtractedSequence = zeros(rows, columns, numberOfImageFiles-1, 1);
> for i = 1 : numberOfImageFiles
>        priorImage{i} = imread(fileNames{i});
>        currentImage{i+1} = imread(fileNames(i+1));
>        subtractedSequence(:,:, i-1, :) = currentImage - priorImage;
>        priorImage = currentImage;
>        outputFileName = sprintf('Subtraction.tif',i);
>                           imwrite(subtractedSequence, outputFileName );
>        end
> And here is error I get:
>
>>>>error: imread: cannot find 0000001.tif
> error: called from:
> error:   C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\image\imread.m at
> line
> 53, column 5
> error:   Images.m at line 10, column 17
>  Thank you very much in advance!!!

fileNames contains filenames only, not the whole path with directories.

(I have not tested this)

...
tifDir='E:\data\EHD_flow\Particle_1µm6µl\01m_nacl_4v_100hz\';
filePaths =dir([tifDir '*.tif']);
...
priorImage{i} = imread([tifDir fileNames{i}]);
...

-- 
/* andy buckle */


reply via email to

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