[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: image on sphere
From: |
Juan Pablo Carbajal |
Subject: |
Re: image on sphere |
Date: |
Tue, 20 Nov 2012 00:33:41 +0100 |
On Tue, Nov 20, 2012 at 12:25 AM, Carnë Draug <address@hidden> wrote:
> 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
>>> https://savannah.gnu.org/bugs/?37712
>>>
>>> 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.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
I found that you need to divid the map by 255 otherwise you get the error
values must be in [0,1]
and the image is not shown.
With that code, it works for me.
http://agora.octave.org/snippet/rfeB/
- Re: image on sphere, (continued)
- Message not available
- Re: image on sphere, Juan Pablo Carbajal, 2012/11/19
- Re: image on sphere, gregortjw, 2012/11/19
- Re: image on sphere, Juan Pablo Carbajal, 2012/11/19
- Re: image on sphere, gregortjw, 2012/11/19
- Re: image on sphere, Juan Pablo Carbajal, 2012/11/19
- Re: image on sphere, gregortjw, 2012/11/19
- Message not available
- Re: image on sphere, Juan Pablo Carbajal, 2012/11/19
- Re: image on sphere, Carnë Draug, 2012/11/19
- Re: image on sphere, Carnë Draug, 2012/11/19
- Message not available
- Re: image on sphere, Carnë Draug, 2012/11/19
- Re: image on sphere,
Juan Pablo Carbajal <=
- Message not available
- Re: image on sphere, Carnë Draug, 2012/11/19
- Re: image on sphere, Juan Pablo Carbajal, 2012/11/19