[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:25:13 +0000

Always make reply to all and include the mailing. Also, avoid top
posting, I moved your reply to the bottom of the e-mail:

On 19 November 2012 23:14,  <address@hidden> wrote:
> Dnia 20 listopada 2012 0:07 Carnë Draug <address@hidden>
> napisał(a):
> 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.
> would you be so kind and could you check whats wrong in this code please?
> A=imread('swiss.jpg');
> im2double(A);
> [mytext,map]=rgb2ind(A);
> mytext=flipud(mytext);
> [x,y,z] = sphere(100);
> graphics_toolkit ("fltk")
> figure(1)
> surface(x,y,z,'CData',mytext,'FaceColor','texturemap','EdgeColor','none');
> colormap(map/255);

Do not divide your map by 255. Next time, say what you were expecting
and what you got instead.

reply via email to

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