help-octave
[Top][All Lists]
Advanced

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

Re: Image aspect ratio


From: Ben Abbott
Subject: Re: Image aspect ratio
Date: Sun, 14 Aug 2011 15:04:23 -0400

On Aug 14, 2011, at 4:40 AM, Divakar Ramachandran wrote:

> On Saturday 13 August 2011 08:23 PM, Ben Abbott wrote:
>> On Aug 13, 2011, at 9:00 AM, Divakar Ramachandran wrote:
>> 
>> 
>>> I am using Octave 3.2.4 on Microsoft Windows 7.
>>> 
>>> A = imread("A8.tif");
>>> 
>>> followed by
>>> 
>>> imshow(A) or imagesc(A)
>>> 
>>> results in a Gnuplot window that displays the image stretched along x-axis. 
>>> axis("square") or axis("image") improves the aspect ratio slightly, but not 
>>> to 1:1 that I require.
>>> 
>>> Is there any workaround for this?
>>> 
>>> Thanks in advance,
>>> Divakar
>>> 
>> My initial thought is that your image isn't square. What is its size ?
>> 
>>      size (A)
>> 
>> 
> The image is square, 1024 x 1024 pixels:
> 
>> octave-3.2.4.exe:388>INFO = imfinfo("A8_1.tif")
>> INFO =
>> {
>>   Filename = C:\Users\divakar\Documents\A8_1.tif
>>   FileSize =  1048784
>>   Height =  1024
>>   Width =  1024
>>   BitDepth =  8
> 
> 
>> Another possibility is that your display has a different number of pixels 
>> per inch in the horizontal and vertical directions? (this is rather rare).
>> 
>> If you type the commands below ...
>> 
>>      imshow (A)
>>      axis on
>> 
>> ... and then measure the physical size of the axes box, what does the 
>> following return?
>> 
>>      dpi = [diff(get(gca,"xlim")), diff(get(gca,"ylim"))] ./ 
>> [axis_box_width, axis_box_height]
>> 
>> ... where axis_box_width and axis_box_height are the physical sizes of the 
>> plot.
> 
> This seems true in my case on the Dell Inspiron 580 desktop running Win 7 Pro 
> 64-bit:
> 
>> octave-3.2.4.exe:386>imshow(A)
>> octave-3.2.4.exe:377>axis("square")
>> octave-3.2.4.exe:381>dpi = [diff(get(gca,"xlim")), diff(get(gca,"ylim"))] ./ 
>> [18, 11.2]
>> dpi =
>> 
>>    56.833   91.339
>> 
>> octave-3.2.4.exe:379>
> 
> Is there a workaround for this? Maybe a display property I can set somewhere 
> and invoke through startup.m? I have also tried drawing circles using 
> SmallBasic - these look fine. Somehow, the display geometry is not being 
> sensed in Octave.
> 
> I do not have this problem on Octave 3.2.3 installed on my laptop running 
> Ubuntu 10.04 LTS 64-bit. 

This looks like a bug to me. If you're inclined please file a bug report.

        https://savannah.gnu.org/bugs/?group=octave

As a work around, you can try to modify the dataaspectratio

        set (gca, "dataaspectratio", [56.833   91.339   91.339])

If that doesn't give the result you are looking for, please attach a picture of 
what you see when you try that.

Ben



reply via email to

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