What is the simplest way to create my own python function ?

Dear all,

I have some problem of memory size with F7 cam if my python code is too big, not yet with H7, lol

To improve this, and my knowledge, i would like to do and integrate my own python function with openmv github source.

I have so two questions :

  • What is the simplest way to create my own python function ?

  • How get the latest github openmv update all along keeping my own function ?

Thanks for help,

There’s no documentation for this you have to read the code. To keep your changes, you have to know your way around github. If your function is general and useful enough, send a pull request and we’ll merge it in the upstream firmware.

Well thanks, but i dont know if i am sure to do a good and generic code well integrated enough to github it…
I tried to do a manual exposition and gain control (MEC and MGC) in function of a ROI luminance in a gray image.

Um, so there are a lot of Pull Requests that you can look at done by me that show how to add methods. It’s not really hard. See the closed Pull Requests in the OpenMV GitHub. You can see exactly what changes are needed there.

Is it possible to have a template lib for newbie like there are in imlib_config.h ?

What do you mean?

Sorry i was not very explicit, because i proposed a solution and dit not with the idea.
The idea is to have a template python function included in the github for newbie to understand how it works and test it.

I think to do it by myseld, i should

  • create and add in py directory the files : py_file.c and py_file.h
  • create function in py_file like py_file_functioname()
  • modifiy MakeFile of OMV directory by adding py_file.o in FIRM_OBJ and py_file.c in SRCS
  • adding import file in the python code, and use the function by calling with functioname()

It is something close ?
Thanks for help,

Yes, that’s about right. You know, folks keep failing to find the wiki and asking this. I think I’ll move the wiki to the readme file along with adding a note about how to do this.