help-octave
[Top][All Lists]
Advanced

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

Re: oct files


From: Richard Kirk
Subject: Re: oct files
Date: Wed, 10 Jul 2013 18:02:50 +0100

On 10 Jul 2013, at 17:35, Jordi Gutiérrez Hermoso wrote:

> 
> If the manual doesn't help, then we need more examples for the manual.
> Can you write one? I can incorporate it.

I think the problem with learning how to write oct-files, is that you have to 
learn how to…

- lay out the .cpp file, with the right #includes, and the right syntax
- check the number input arguments
- import parameters from octave, and check the type and size
- import the parameter data (there may be several ways to do this)
- do the calculation (this is the easy bit)
- re-pack up the right number of output values to go back to octave.

…and you have to get the lot right all at once.

Here's a simple test I wrote. You import an image, and it paints one pixel 
white. This was useful to check how the pixels were numbered in octave compared 
to my viewer. It also showed that the fortran_vec() call returned a copy of the 
image data, which you can edit without affecting the original image.

 

Attachment: imageDemo.cpp
Description: Binary data


We could have another, more complicated version where we create a new data 
structure for the output image. Images are good for learning: you make a change 
and you can see something happen.

I have a collection of oct-files I have written. Most of them are pretty light 
on checking the inputs and outputs because I am the only one who uses them. If 
you think this example is helpful, I can perhaps think about writing a small 
set of image processing functions in increasing order. Can't promise anything 
but I can see what I can do.

Cheers.
Richard Kirk

---
FilmLight Ltd, Artists House, 14-15 Manette Street, London W1D 4AP
Tel: +44 (0)20 7292 0400  Fax: +44 (0)20 7292 0401








reply via email to

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