octave-maintainers
[Top][All Lists]
Advanced

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

Re: need a test in matlab to implement imformats in Octave


From: PhilipNienhuis
Subject: Re: need a test in matlab to implement imformats in Octave
Date: Fri, 5 Jul 2013 00:22:46 -0700 (PDT)

Carnë Draug-4 wrote
> Hi
> 
> could someone with matlab run a test for me in. I'm trying to
> understand how the image IO functions work after messing up with
> imformats. The test is the following:
> 
> 1) add the following function somewhere in the path
> 
> function [out] = testreadjpg (filename)
>   persistent im = 1;
>   disp (im)
>   if (im > 3), error ('stuck in a loop\n'); end
>   im++;
>   out = imread (filename);
> end

This contains quite a bit of invalid ML syntax. I rewrote it as:

function [out] = testreadjpg (filename)
  persistent im;
  if (isempty (im)); im = 1; fprintf ('im initialized\n'); end    % This
should work OK
  disp (im)
  if (im > 3), error ('stuck in a loop\n'); end
  im = im + 1;
  out = imread (filename);
end 


> 2) running the following code:
> 
> fmt = imformats ('jpg');
> fmt.read = @testreadjpg;
> imformats ('update', 'jpg', fmt);
> img = imread (PATH_TO_SOME_JPG);
> image (img)
> 
> 3) what gets displayed on the promp

>> edit testreadjpg.m

<fixed up testreadjpg.m>

>> fmt = imformats ('jpg');
>> fmt.read = @testreadjpg;
>> imformats ('update', 'jpg', fmt);
>> img = imread ('H:\Digfotos\IJsberg.jpg');
Error using testreadjpg
Too many output arguments.

Error in imread (line 415)
    [X, map] = feval(fmt_s.read, filename, extraArgs{:});
 
>> 

... so I think testreadjpg.m contains additional errors. It doesn't even get
called as there's no 'im initialized' message.


>  and does the last command displays
> the image?

No.

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/need-a-test-in-matlab-to-implement-imformats-in-Octave-tp4655217p4655226.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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