[Top][All Lists]

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

Re: octave and image processing

From: John W. Eaton
Subject: Re: octave and image processing
Date: Sat, 21 Dec 2002 12:00:54 -0600

On 21-Dec-2002, Al Niessner <address@hidden> wrote:

| 3) The mutability of the data in an image
|   a) in-place operations allowed via .oct files only
|   b) nominal -- as done normally in octave

| [...]

| Lastly, there
| is (3). This is a little more difficult. It would allow reference to be
| passed within .oct files causing the original data to change. However,
| the user would have to explicitly choose this option and accept all the
| pitfalls that come with it.

Unfortunately(?) you can't do this without some other changes to
Octave.  There are a couple of levels of reference counting.  One is
in the Matrix object itself and the other is in the octave_value
object.  If you look at the octave_scalar object, you will see that it
is just a container for a double (or complex) number.  Neither of
those objects implements reference counting, but Octave does not allow
functions to modify scalar arguments either.  For example, if you do
something like

  function f (x) x = 2; end
  x = 1;
  f (x)

you will find that x still has a value of 1 after the function.  The
reference counting you need to modify is the overall reference
counting scheme for octave_value objects.  You can't change that by
defining a new sub-type like octave_image.

Sorry, but what you want to do will require some fundamental changes
to the way Octave works.  You mentioned before that you didn't want to
do that because it would introduce some maintenance problems for you.
That's only true if you make the modifications and they are not
included in the "standard" Octave sources, but if we can come up with
a reasonable way to introduce "pass-by-reference" semantics for
functions in Octave, I'd be happy to try to implement that (or help
you do it).  The primary problem that I see is that whatever we come
up with will probably not be compatible with whatever the MathWorks
does for Matlab if they choose to implement similar functionality.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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