lua-users home
lua-l archive

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


Hi Gaspard,

I'm using this structure as a wrapper for pointer that I pushing onto
the lua stack, so Lua allocate only sizeof this structure.

template <typename cvtype>
struct luacv_obj
{
  cvtype *data;
  bool dealloc_data;
  int ref;
};

cvtype* data - is a pointer to OpenCV object

bool dealloc_data  - check if garbage collector callback  __gc can
dealloc data or they are shared by another object (to avoid segfault).

int ref - reference on LUA_REGISTRY stack position, I'm using this in
cvRelease* functions when I want to break references(luaL_unref()) to
this object and kill it, thus call __gc method.

As far as I know the reference counting in OpenCV is only for
matrices, or  isn't?

regards,
Jiří Prymus


2011/3/9 Gaspard Bucher <gaspard@teti.ch>:
> Hi Jiří,
> I have scrolled through the code and I do not understand the need for your
> boxed object model (struct luacv_obj). OpenCV has reference counting for the
> data already. Why do you need this extra layer ?
> Gaspard
>
> On Wed, Mar 9, 2011 at 10:28 AM, Jiří Prymus <jiri.prymus@gmail.com> wrote:
>>
>> Thanks Gaspard,
>>
>> your feedback gave me a lot of new powers:). I'm glad  that you are
>> planning use LuaCV in your Lubyk project, but please consider that
>> LuaCV is in early alpha stage. It has functionality, but it  wasn't
>> tested as far as I want. It has up to 16000 lines of code so be sure
>> I've made some mistakes.
>>
>> And about integrating LuaCV to OpenCV source package. It would be
>> awesome, but even if I had a chance I don't do that until I'll be sure
>> that LuaCV is relatively bug free.
>>
>> Btw: I'll take a look on your Lubyk project, it looks promising.
>>
>> regards,
>> Jiří Prymus
>>
>> 2011/3/8 Gaspard Bucher <gaspard@teti.ch>:
>> > Jiří, I love you !
>> > I created a first OpenCV binding against a previous version but could
>> > not
>> > find the time to rework the bindings for 2.2.
>> > Your bindings look very good (much better then mine) and much more
>> > complete.
>> > I will therefore use your work in Lubyk. I'll keep you posted on the
>> > integration of OpenCV there: it might be an interesting environment for
>> > your
>> > projects too (easy access to GUI, live coding, live video, etc).
>> > If possible, please consider pushing your bindings to the OpenCV sources
>> > (I
>> > was given commit access just for this but never considered my work good
>> > enough for the move)...
>> > Your the man !
>> > Gaspard
>
>