How to process images that have been queued in a list?

  • Follow


Hi,

I want to have a list of four images which I can use for testing a block processing algorithm, queued ready for processing, call image 1, process, call image, 2 and process and so on.

Using this code:

close all
clear all
%% prepare file list for processing
I = which('f1.jpg');
filelist = dir([fileparts(I) filesep 'f*.jpg']);
fileNames = {filelist.name}';
%% Load first frame -- works till here --

I = imread(fileNames(1));

Then get error message; 
??? Conversion to logical from cell is not possible.

Error in ==> imread at 329
if (strfind(filename, '://'))

%% 
f1 = rgb2gray(I);
figure, imshow(f1)

Does anyone have any ideas on how I can have the file queue and overcome this error

Regards,

Stewart.
0
Reply Stewart 5/4/2010 6:29:07 PM

On Tue, 04 May 2010 14:29:07 -0400, Stewart   
<tired2409.remove@hotmail.com> wrote:

> Hi,
>
> I want to have a list of four images which I can use for testing a block  
> processing algorithm, queued ready for processing, call image 1,  
> process, call image, 2 and process and so on.
>
> Using this code:
>
> close all
> clear all
> %% prepare file list for processing
> I = which('f1.jpg');
> filelist = dir([fileparts(I) filesep 'f*.jpg']);
> fileNames = {filelist.name}';
> %% Load first frame -- works till here --
>
> I = imread(fileNames(1));
>
> Then get error message; ??? Conversion to logical from cell is not  
> possible.
>
> Error in ==> imread at 329
> if (strfind(filename, '://'))
>
> %% f1 = rgb2gray(I);
> figure, imshow(f1)
>
> Does anyone have any ideas on how I can have the file queue and overcome  
> this error
>
> Regards,
>
> Stewart.

fileNames is a cell array. When you index into a cell array using (), you  
get a cell array back. You need to use {} indexing to get to the string.


use fileNames{1} in your IMREAD function call.
0
Reply Ashish 5/6/2010 12:20:03 PM


"Stewart " <tired2409.remove@hotmail.com> wrote in message <hrpp1j$fbp$1@fred.mathworks.com>...
> Hi,
> 
> I want to have a list of four images which I can use for testing a block processing algorithm, queued ready for processing, call image 1, process, call image, 2 and process and so on.
> 
> Using this code:
> 
> close all
> clear all
> %% prepare file list for processing
> I = which('f1.jpg');
> filelist = dir([fileparts(I) filesep 'f*.jpg']);
> fileNames = {filelist.name}';
> %% Load first frame -- works till here --
> 
> I = imread(fileNames(1));
> 
> Then get error message; 
> ??? Conversion to logical from cell is not possible.
> 
> Error in ==> imread at 329
> if (strfind(filename, '://'))
> 
> %% 
> f1 = rgb2gray(I);
> figure, imshow(f1)
> 
> Does anyone have any ideas on how I can have the file queue and overcome this error
> 
> Regards,
> 
> Stewart.


Thank you I would never have spotted the different brackets.

Stewart.
0
Reply Stewart 5/6/2010 2:19:04 PM

2 Replies
437 Views

(page loaded in 0.037 seconds)

Similiar Articles:













7/23/2012 10:21:09 AM


Reply: