rgb2ind issue

classic Classic list List threaded Threaded
3 messages Options
RT
Reply | Threaded
Open this post in threaded view
|

rgb2ind issue

RT
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 [hidden email]
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


​Ps I tried with

----------------------------------------------------------------------
GNU Octave Version: 4.4.0 (hg id: d703d8bbc6ae)
GNU Octave License: GNU General Public License
Operating System: Linux 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
     control  |   3.1.0 | /home/rt/octave/control-3.1.0
      signal  |   1.4.0 | /home/rt/octave/signal-1.4.0
>>​

--
--


Reply | Threaded
Open this post in threaded view
|

Re: rgb2ind issue

nrjank
On Thu, Jul 26, 2018 at 4:35 PM, RT <[hidden email]> wrote:
but I get an error
"error: Invalid call to rgb2ind.  Correct usage is:

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


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:



RT
Reply | Threaded
Open this post in threaded view
|

Re: rgb2ind issue

RT
ok I posted it in the bug tracker.

 If anyone knows of a workaround please let me know.

Thanks

On Thu, Jul 26, 2018 at 4:42 PM Nicholas Jankowski <[hidden email]> wrote:
On Thu, Jul 26, 2018 at 4:35 PM, RT <[hidden email]> wrote:
but I get an error
"error: Invalid call to rgb2ind.  Correct usage is:

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


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:



--
--
|======================================================|
|https://stillpointx.wordpress.com/research/modulated-plasma/                          
|======================================================|
"Knowledge may be the Key"
"But wisdom unlocks the door"
"Absolute Power demands absolutely nothing"

As the old maxim has it, you need find only one white crow to disprove the rule that all crows are black

"The bourgeois today burns as heretics and hangs as criminals those to whom he erects monuments tomorrow" ('Steppenwolf')

"There are two modes of being those in bliss and those seeking bliss,
may each step you take and each thought you make be made in a mindful and blissful state."
|======================================================|