octave - xv - image viewer

View: New views
18 Messages — Rating Filter:   Alert me  

octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you for reading my post.

I have installed "octave" and "xv".
Both of them work correctly.

I want to use "xv" as "octave"'s image viewer.

I read one should use a command such as:
image_viewer("xv");

My problem is the following:
where does this command has to be executed?
- At "octave"'s command line?
- In a "~/.octaverc" file?
- ...

And... if it was not too much asking, could you post me your
"~/.octaverc" file because I have none and cannot find any
sample on the Internet .

Thank you for you help in advance ,
all the best,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

søn, 04 10 2009 kl. 04:05 -0700, skrev lmhelp:
> I want to use "xv" as "octave"'s image viewer.
>
> I read one should use a command such as:
> image_viewer("xv");

I believe you should use

  image_viewer ("xv %s");

> My problem is the following:
> where does this command has to be executed?
> - At "octave"'s command line?
> - In a "~/.octaverc" file?

Both options work.

> And... if it was not too much asking, could you post me your
> "~/.octaverc" file because I have none and cannot find any
> sample on the Internet .

Most people do not have such a file as the default settings work quite
well. The '~/.octaverc' is just an Octave script that is evaluated when
Octave is started. This means you can put any commands in this file.

In your case, just create a file with the following contents:

  image_viewer ("xv %s");

and that should be it.

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you for your answer.

So, I created a ".octaverc" in my home folder "/home/lmhelp" containing:
------------------------------------------------------------------------------------
image_viewer("xv %s");
------------------------------------------------------------------------------------
(that's all the file contains).

Now, when I launch "octave", I get the following error message:
------------------------------------------------------------------------------------
error: 'image_viewer' undefined near line 1 column 1
error: near line 1 of file '/home/lmhelp/.octaverc'
------------------------------------------------------------------------------------

It looks like there is something else going wrong...
Can you help me?

Thanks and all the best,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 05:25 -0700, skrev lmhelp:
> Now, when I launch "octave", I get the following error message:
> ------------------------------------------------------------------------------------
> error: 'image_viewer' undefined near line 1 column 1
> error: near line 1 of file '/home/lmhelp/.octaverc'
> ------------------------------------------------------------------------------------
>
> It looks like there is something else going wrong...

What version of Octave are you running?

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

GNU Octave, version 2.1.73

All the best,
--
Lmhelp

Søren Hauberg wrote:
søn, 04 10 2009 kl. 05:25 -0700, skrev lmhelp:
> Now, when I launch "octave", I get the following error message:
> ------------------------------------------------------------------------------------
> error: 'image_viewer' undefined near line 1 column 1
> error: near line 1 of file '/home/lmhelp/.octaverc'
> ------------------------------------------------------------------------------------
>
> It looks like there is something else going wrong...

What version of Octave are you running?

Søren

_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 05:40 -0700, skrev lmhelp:
> GNU Octave, version 2.1.73

There's your problem: you are using a very old version of Octave. The
'image_viewer' function was introduced in Octave 3.0, so you'll need to
upgrade if you want to use this function.

I do believe that Octave 2.1.x uses 'xv' by default to show images, so
I'm not sure you'll actually need the 'image_viewer' function.

But in any case, it is a good idea to upgrade to the 3.2.x series.

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok... snif.
I am going to upgrade to Octave > 3.0.
I'll let you know if it works or not.

"My" Octave doesn't seam to be using "xv" by default...
Where can I check which default image viewer Octave uses?

Thank you for your help and all the best,
--
Lmhelp



Søren Hauberg wrote:
> søn, 04 10 2009 kl. 05:40 -0700, skrev lmhelp:
>> GNU Octave, version 2.1.73
>
> There's your problem: you are using a very old version of Octave. The
> 'image_viewer' function was introduced in Octave 3.0, so you'll need to
> upgrade if you want to use this function.
>
> I do believe that Octave 2.1.x uses 'xv' by default to show images, so
> I'm not sure you'll actually need the 'image_viewer' function.
>
> But in any case, it is a good idea to upgrade to the 3.2.x series.
>
> Søren

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ooops, by the way... my "xv" version is 3.10a
What do you think about that?

Thanks,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 06:05 -0700, skrev lmhelp:
> Ok... snif.
> I am going to upgrade to Octave > 3.0.
> I'll let you know if it works or not.

It comes with a large set of wonderful new features, so you should be
happy to have an excuse to upgrade :-)

> "My" Octave doesn't seam to be using "xv" by default...
> Where can I check which default image viewer Octave uses?

I don't have a version of 2.1.x on my machine, so I'm not sure. I think
you should look at the source for the 'image' function, to see what's
going on. To do this, run

  type image

from the Octave prompt.

> Ooops, by the way... my "xv" version is 3.10a
> What do you think about that?

I haven't used 'xv' in ages, so I don't really know; sorry.

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

I managed to install "Octave version 3.0.1".

It took a little time because I had to upgrade my "Debian box"
from "Etch" to "Lenny" first to be able to do a simple:
# apt-get install octave3.0

The command "image_viewer("xv %s");" launched at "Octave"'s command line
doesn't fail anymore.

Would you help me a bit more?

With "Matlab" I would do:
---------------------------------------------------------------------------
pout = imread('pout.tif');
figure(1);
imshow(pout);
---------------------------------------------------------------------------
Resulting in the display of the image "pout.tif" in a window called
"Figure 1".

Can you tell me how to do the same with "Octave"?

Thank you and all the best,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 09:06 -0700, skrev lmhelp:

> With "Matlab" I would do:
> ---------------------------------------------------------------------------
> pout = imread('pout.tif');
> figure(1);
> imshow(pout);
> ---------------------------------------------------------------------------
> Resulting in the display of the image "pout.tif" in a window called
> "Figure 1".
>
> Can you tell me how to do the same with "Octave"?

Since you are running Octave 3.0.x, you need to install the 'image'
package to get the 'imread' function. In Debian, I think you just have
to apt-get install 'octave-image'.

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you: I installed "octave_image"  just as you said (version 1.0.6-3 by the way).
I could execute properly:
--------------------------------------------------------------------------------------------------
> pout = imread("pout.tif");
> imshow(pout);
--------------------------------------------------------------------------------------------------

The problem is that the image is not opened with "xv".
Even if I launch "image_viewer("xv %s");" first.

Do you know what the problem can be?
Thanks and all the best,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 09:28 -0700, skrev lmhelp:
> I could execute properly:
> --------------------------------------------------------------------------------------------------
> > pout = imread("pout.tif");
> > imshow(pout);
> --------------------------------------------------------------------------------------------------
>
> The problem is that the image is not opened with "xv".
> Even if I launch "image_viewer("xv %s");" first.

Well, what does actually happen? Is the image shown? If so, how is it
displayed? Is an error message printed or something like that?

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, the image is shown in a window (very simple window with no
menus nor anything). In fact, two windows show up (I am using "Ion"
as a window manager):
- one with title "Figure 1" and empty,
- the other one, with title "/tmp/oct-n0ZWKD" showing the image.

I have no error message printed.
I only have a warning after launching "imread":
-----------------------------------------------------------------------------
warning: isstr is obsolete and will be removed from a future version
of Octave, please use ischar instead
-----------------------------------------------------------------------------

Sooner, I saw "xv" error messages but they went away very swiftly
(I couldn't note down the messages) but I cannot reproduce that anymore...

Are you yourself using "xv" as an image viewer?

Thank you and all the best,
--
Lmhelp

Re: octave - xv - image viewer

by Francesco Potortì :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>"My" Octave doesn't seam to be using "xv" by default...
>Where can I check which default image viewer Octave uses?

By looking at the imege function's help for Octave 2.1 I read:

 It first tries to use 'display' from 'ImageMagick' then
 'xv' and then 'xloadimage'

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@...
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Despite the fact that I am not sure "xv" displayed the image (and not
for instance the default Octave image viewer which is [I don't know])...
the image is displayed and, in a certain way, it is what I wanted... :)

If I choose:
---------------------------------------------------------------------------------------
> image_viewer("ImageMagick %s");
or
> image_viewer("xloadimage %s");
or
> image_viewer("toto %s");
---------------------------------------------------------------------------------------
the image is not displayed.
If I choose:
---------------------------------------------------------------------------------------
> image_viewer("xv %s");
---------------------------------------------------------------------------------------
the image is displayed  (the window which title was previously "Figure 1" is
now "Gnuplot").

Thank you very much Søren for your precious help:
you really helped me a lot :)
Thank you too to Francesco Potortì.

All the best,
--
Lmhelp

Re: octave - xv - image viewer

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

søn, 04 10 2009 kl. 10:46 -0700, skrev lmhelp:
> Despite the fact that I am not sure "xv" displayed the image (and not
> for instance the default Octave image viewer which is [I don't know])...
> the image is displayed and, in a certain way, it is what I wanted... :)

By default, Octave 3.0.x and 3.2.x uses Gnuplot to display images. This
has the advantage that you can plot on top of images, e.g.

  imshow (blabla)
  hold on
    plot (1:10, sin (1:10))
  hold off

You cannot do this if you use an external image viewer.

Anyway, it seems that you solved your problem, which was the most
important thing :-)

Søren

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave - xv - image viewer

by lmhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for this remark and for your help :)

All the best to you,
--
Lmhelp


Søren Hauberg wrote:
By default, Octave 3.0.x and 3.2.x uses Gnuplot to display images. This
has the advantage that you can plot on top of images, e.g.

  imshow (blabla)
  hold on
    plot (1:10, sin (1:10))
  hold off

You cannot do this if you use an external image viewer.

Anyway, it seems that you solved your problem, which was the most
important thing :-)

Søren