[Top][All Lists]

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

Re: image on sphere

From: Carnë Draug
Subject: Re: image on sphere
Date: Mon, 19 Nov 2012 23:07:25 +0000

On 19 November 2012 23:01, Carnë Draug <address@hidden> wrote:
> On 19 November 2012 22:08, Juan Pablo Carbajal <address@hidden> wrote:
>> Yes, that is ok. But when called with two arguments, what it is supposed to 
>> do?
> The current implementation of rgb2ind is incompatible with the one
> from matlab. The behaviour when it has 2 arguments depends if the
> second argument is a colormap or a scalar but Octave currently
> supports none of them. Plus, rgb2ind is completely broken since it
> does not even return a valid colormap (exception made for rgb of class
> double which I find to be very rare). I have submitted some patches
> that will at least fix that last week
> But supporting the other arguments as with matlab will require some
> extra input checking if we don't want to break current code (which may
> try to pass each channel as independent variables).

Oh! But as solution to your problem, don't limit your colormap to 256
colors, just don't give a second argument. The implementation of
rgb2ind in Octave stable does not look for repeated values in the
image so you'll have a colormap 3*number of pixels in your image.

Also the colormap will be the exact intensity values of your image
which is most likely uint8 which is not a valid colormap and will make
everything white. To fix this, you can either use im2double to convert
your image (before calling rgb2ind), or you colormap.

With this two changes your code should keep working in both Matlab and Octave.


reply via email to

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