octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54392] rgb2ind issue and images / gif creatio


From: Rick T
Subject: [Octave-bug-tracker] [bug #54392] rgb2ind issue and images / gif creation
Date: Thu, 26 Jul 2018 23:00:14 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?54392>

                 Summary: rgb2ind issue and images / gif creation
                 Project: GNU Octave
            Submitted by: ratulloch
            Submitted on: Fri 27 Jul 2018 03:00:12 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.0
        Operating System: Any

    _______________________________________________________

Details:

I'm trying to create an animated gif using code I found at
https://www.mathworks.com/matlabcentral/answers/94495-how-can-i-create-animated-gif-images-in-matlab

But I get an error
"error: Invalid call to rgb2ind.  Correct usage is:

 -- [X, MAP] = rgb2ind (RGB)
 -- [X, MAP] = rgb2ind (R, G, B)

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at https://www.octave.org and via the address@hidden
mailing list."


The code is below.  Are there any workarounds?

h = figure;
axis tight manual % this ensures that getframe() returns a consistent size
filename = 'testAnimated.gif';
for n = 1:0.5:5
    % Draw plot for y = x.^n
    x = 0:0.01:1;
    y = x.^n;
    plot(x,y)
    drawnow
      % Capture the plot as an image
      frame = getframe(h);
      im = frame2im(frame);
      [imind,cm] = rgb2ind(im,256);
      % Write to the GIF File
      if n == 1
          imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
      else
          imwrite(imind,cm,filename,'gif','WriteMode','append');
      end
  end

Nicholas Jankowski said the function is different from matlab and I should
post a bug.  See he's email he sent below

Looking at the function calling structure on matlab:


https://www.mathworks.com/help/matlab/ref/rgb2ind.html

[X,map] = rgb2ind(RGB,n)
X = rgb2ind(RGB, map)
[X,map] = rgb2ind(RGB, tol)
[___] = rgb2ind(___,dither_option)

and octave:

https://octave.sourceforge.io/octave/function/rgb2ind.html

[x, map] = rgb2ind (rgb)
[x, map] = rgb2ind (R, G, B)


it appears that the current Octave implementation is not fully compatible.
Unless there's already something on the bug tracker that I didn't see in a
quick search, it should probably be logged as one:






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54392>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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