help-octave
[Top][All Lists]
Advanced

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

Re: new to octave - need help with running user-defined function files


From: Joe Koski
Subject: Re: new to octave - need help with running user-defined function files
Date: Thu, 09 Mar 2006 19:47:45 -0700
User-agent: Microsoft-Entourage/11.2.1.051004

on 3/9/06 6:22 PM, Theresa Bullard at address@hidden wrote:


How do I set up or change my .bash_profile or .bashrc? Where would these files be located? I do not see them in the home directory. What would I change in these files?

You will not see your .bash_profile or .bashrc files in terminal because they are hidden unless you do ls –a to show all files. The only essential lines in my .bash_profile (used by Terminal, as I recall) or .bashrc (used by xterm, as I recall) are

export GNUTERM=aqua
export DISPLAY=:0.0

These set the graphics display to AquaTerm. Change aqua to x11 if you are using X11. It shouldn’t matter which terminal you use because photo type images will open in as .bmp files in the Apple Preview application. To edit the .bash files, I suggest getting TextWrangler or Smultron (free downloads) if you don’t already have one of these. If you’re a UNIX person, you could use vi or emacs.

What I usually do is run a Terminal window with AquaTerm available.  

OK, I can do that. At what point does AquaTerm come into play? Is it called automatically when I use one of the plotting functions?

Yes, through gnuplot, if you have the lines above in your .bash_profile.

First I do a cd into the directory where my .m script resides, and type
octave.  

That helps me run the simple test script, finally, but I’m still having trouble accessing other user-defined function files that are in other directories. The function files I want to use for my task at hand were downloaded from:

P. D. Kovesi.   MATLAB and Octave Functions for Computer Vision and Image Processing.
 School of Computer Science & Software Engineering,  
 The University of Western Australia.   Available from:
 <http://www.csse.uwa.edu.au/~pk/research/matlabfns/>


Do I need to do a batch compile of these functions to get them integrated into Octave? If so, how do I do that here?

If they are all .m scripts, you do not need to compile them. If there are .oct files (which are compiled), then your version of octave is important and must be compatible with the .oct files. To compile files for octave, you use a program called mkoctfile.

You have several options regarding how to locate the image processing files for use. First, as you have discovered below, you can cd into the directory where the image processing files reside, copy your data to the same directory, and everything should work. Octave looks first in the local directory, and then (in your case) in /usr/local for the files to use. Second, you could install the image processing files in a directory in the same directory tree in /usr/local where the octave-forge routines are located. That’s how I have the digital signal processing library from Stearns and David installed. Third, you could create a .octaverc file that adds the image processing directory to your octave load path, as you originally thought. I’m sure people on this list could help you do that.

I am able to use the built-in octave functions, although in attempting to use some of the image functions as a basic step before even trying the computer vision functions from Kovesi, I cannot seem to access the image files. I have cd’ed into the directory the image files are stored in, and they are recognized as being in IMAGEPATH, but then I get the following error trying to use imread

octave:2> file_in_path(IMAGEPATH, 'gray_image.jpg')
ans = /Users/tvb/usr/local/share/octave/2.1.71/imagelib/gray_image.jpg
octave:3> im1 = imread('gray_image.jpg')
error: could not read file: /var/tmp/oct-EHDvjn
error: evaluating if command near line 189, column 4
error: called from `imread' in file `/usr/local/share/octave/2.1.71/site/m/octave-forge/image/imread.m'
error: evaluating assignment _expression_ near line 3, column 5
octave:3>

I’ve tried loadimage(‘gray_image.img’) also, but perhaps my file format is not right even though it seemed like it was what Octave was asking for based on the online manual. I have Graphical Converter, so I tried to convert from .jpg to .img and .ppm which seemed to be the file formats that Octave can work with. My preference would be to just use jpg’s and from seeing some of the other threads, it looks like this should be possible.   

This looks to me like an internal octave-forge error from (perhaps) reading a locally created scratch file. (The .jpg extension should be OK.) You can look at imread.m by copying it from /usr/local/ to an unprotected location like ~ after you find it (In Terminal: find . -name image.m –print). Anyone else got any ideas?

I do know that octave relies on ImageMagick for some image input/output, but I don’t know how much of ImageMagick  is included with the HPC download. My .jpg reading is currently broken because my “build from scratch” octave-forge can’t find my installed ImageMagick library. This problem doesn’t look my my problem (core dump), so I am hopeful that there is an easy solution. If you are running OS X 10.4, there is a binary installer for ImageMagick available (Google for it), but I don’t know if installing it will fix the problem.

You are probably pioneering in this use for your particular version of octave. After you narrow the problem a bit by looking at image.m, maybe someone on the list can help with the /var/tmp file problem. I think that you are close to a solution.

Joe




Further advise and instruction is much appreciated.

Thanks
Theresa



on 3/6/06 6:32 PM, Theresa Bullard at address@hidden wrote:

Dear Octave List,

I am new to Octave and have loaded everything successfully and am able
to run built-in functions and such, but I seem to be having trouble
with getting Octave to see and run any user-defined functions. I've
read the online manual sections dealing with this but am not clear on a
couple points.

1. what is the appropriate syntax to use for changing LOADPATH once
Octave is running?

2. Since I haven't figured out how to add another path for Octave to
search in for function files, I've placed the files in one of the paths
that is already in DEFAULT_LOADPATH
(/usr/local/share/octave/2.1.71/site/m//), and when I use the built in
function 'file_in_loadpath(filename)' it keeps returning empty results
for the all of the new user-defined function files I've downloaded or
that I've created myself. Whereas if I search for octave functions in
the same directory path it will find them. From the manual it seems
like I can add new function or script files even while Octave is
running and as soon as I call the new function from the command line it
should search the directories and then compile it on the fly, if needed
(based on time-stamp). Is this true? If so, why is it not able to see
these new function files or script files I've put into the default
paths? Is there a way to force compile all these functions?

Any clarification or suggestions for getting started here is much
appreciated. I'm running Octave through X-11 in Mac OSX (10.3.9)

Thanks,
Theresa







reply via email to

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