help-octave
[Top][All Lists]
Advanced

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

Re: saving a NxM matrix as a color-mapped image of size NxM


From: James Sherman Jr.
Subject: Re: saving a NxM matrix as a color-mapped image of size NxM
Date: Tue, 11 Dec 2012 16:45:18 -0500

On Tue, Dec 11, 2012 at 4:15 PM,  <address@hidden> wrote:
> On 10/12/12 18:57:43, address@hidden wrote:
>> Hello!
>>
>>
>>  Is  it  possible  to  save  a colour image of what imagesc displays, i.e. a
> matrix
>> whos entries are mapped to the current color‐map? I  don’t  want  a  "screen
> shot"
>>  of the window that pops up when using imagesc (i.e. using print).
>> I used to use saveimage for this but this no longer works. I tried:
>
> Just to clarify what I’m looking for: If I have an NxM matrix in octave it can
> be visualized with imagesc such that each value of the matrix is mapped to the
> current color‐map and displayed as a kind of 2D histogram viewed from top. I’d
> like to save this as an image without any annotation but with the same  color‐
> mapping e.g. as a PNG with NxM pixels.
> Is this still possible in octave 3.x?
>
> Thanks for any hints or help.
> Lynx
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

I think the problem is that your original image (mHist2d) is of type
double, but imwrite expects type uint8, so what happens if you try:

imwrite(uint8(mHist2d), colormap(cmap), "test.png", "png");

Hope this helps.


reply via email to

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